Proof of $\int_{0}^{\pi}\cos^n(x)\cos(nx)dx=\frac{\pi}{2^n}$

Although I recognize that this post is relatively old, let me propose another strategy to solving this problem.

Let

$$ I(n) = \int_{0}^{\pi}\cos^{n}(x)\cdot\cos(n\cdot x)\,\text{d}x\text{,}$$

where $n\in\mathbb{N}^{0}$.

Perform integration by parts,

$$ \int u\,\text{d}v=u\cdot v-\int v\,\text{d}u\text{,} $$

where

$$ u = \cos^{n}(x)\Leftrightarrow\text{d}u = -n\cdot\cos^{n-1}(x)\cdot \sin(x)\,\text{d}x\text{,} \\ \text{d}v = \cos(n\cdot x)\,\text{d}x\Leftrightarrow v = 1/n\cdot\sin(n\cdot x)\text{.} $$

Then,

$$ \begin{align} I(n) & = \left.1/n\cdot\cos^{n}(x)\cdot\sin(n\cdot x)\right|_0^{\pi}+\int_{0}^{\pi}\cos^{n-1}(x)\cdot\sin(n\cdot x)\cdot\sin(x)\,\text{d}x \\ & = \int_{0}^{\pi}\cos^{n-1}(x)\cdot\sin(n\cdot x)\cdot\sin(x)\,\text{d}x\text{.} \end{align} $$

Take the sum of both integral forms:

$$ \begin{align} 2\cdot I(n) & = \int_{0}^{\pi}\cos^{n}(x)\cdot\cos(n\cdot x)\,\text{d}x+\int_{0}^{\pi}\cos^{n-1}(x)\cdot\sin(n\cdot x)\cdot\sin(x)\,\text{d}x \\ & = \int_{0}^{\pi}\cos^{n-1}(x)\cdot\left(\cos(n\cdot x)\cdot\cos(x)+\sin(n\cdot x)\cdot\sin(x)\right)\text{d}x\text{.} \end{align} $$

Make use of the angle-difference identity for the cosine function,

$$ \cos(\alpha-\beta) = \cos(\alpha)\cdot\cos(\beta)+\sin(\alpha)\cdot\sin(\beta)\text{.} $$

Then,

$$ 2\cdot I(n) = \int_{0}^{\pi}\cos^{n-1}(x)\cdot\cos\left((n-1)\cdot x\right)\,\text{d}x\text{.} $$

Recognize that

$$ 2\cdot I(n) = I(n-1) $$

Then,

$$ \begin{align} 2\cdot I(n-1) & = I(n-2) \\ 2\cdot I(n-2) & = I(n-3) \\ & \;\;\vdots \\ 2\cdot I(1) & = I(0)\text{.} \end{align} $$

It follows that

$$ 2^{n}\cdot I(n) = I(0)\Rightarrow I(n) = \frac{I(0)}{2^{n}}\text{.} $$

According to the integral form,

$$ I(0) = \int_{0}^{\pi}\cos^{0}(x)\cdot\cos(0\cdot x)\,\text{d}x = \int_{0}^{\pi}\text{d}x = \pi\text{.} $$

Thus,

$$ I(n) = \frac{\pi}{2^{n}}\text{,} $$

where $n\in\mathbb{N}^{0}$.


You may just exploit the binomial theorem. By the parity of $\cos$ we have $$ F(n) = \int_{0}^{\pi}\cos^n(x)\cos(nx)\,dx = \frac{1}{2}\int_{-\pi}^{\pi}\cos^n(x)\cos(nx)\,dx $$ and $\int_{-\pi}^{\pi}e^{nix}e^{-mix}\,dx = 2\pi\delta(m,n)$, so $$ F(n) = \frac{1}{2^{n+2}}\int_{-\pi}^{\pi}(e^{ix}+e^{-ix})^n (e^{nix}+e^{-nix})\,dx=\frac{2\cdot 2\pi}{2^{n+2}}=\frac{\pi}{2^n} $$ since $(e^{ix}+e^{-ix})^n = \sum_{k=0}^{n}\binom{n}{k}e^{(n-2k)ix}$ and the only terms that matters are the ones associated to $k=0$ and $k=n$.