Consider the following integral,
$$I(n)=\int_0^{\pi/2}\cos^nx\cos(nx)dx $$
I tried taking one $\cos x$ out and then integrating by parts. I also tried integrating by parts using $\cos(nx)$ as the other function but didn't get any relation between $I(n)$ and $I(n-1)$.
In both the ways, $\cos(nx)$ was creating a problem as it wasn't getting converted to $\cos[(n-1)x]$ which was required for getting a term of $I(n-1)$.
Any hint/partial solution would be appreciated.
Let $I(n)$ be given by
$$\begin{align} I(n)&=\int_0^{\pi/2}\cos^n(x)\cos(nx)\,dx\tag1\\\\ &=\frac12\int_0^{\pi/2}\cos^{n-1}(x)\left(\cos((n-1)x)+\cos((n+1)x) \right)\,dx\tag2 \end{align}$$
Now, integrating by parts the integral on the right-hand side of $(1)$ with $u=\cos^n(x)$ and $v=\frac{\sin(nx)}{n}$ reveals
$$\begin{align} I(n)&=\int_0^{\pi/2} \cos^{n-1}(x)\sin(x)\sin(nx)\,dx\\\\ &=\frac12\int_0^{\pi/2}\cos^{n-1}(x) \left(\cos((n-1)x)-\cos((n+1)x) \right)\,dx\tag3 \end{align}$$
Adding $(2)$ and $(3)$ and dividing by $2$ yields
$$I(n)=\frac12 I(n-1)\tag4$$
From the recurrence formula $(4)$, along with $I(1)=\frac\pi4$, we find
$$I(n)=\frac{\pi}{2^{n+1}}$$