Find $a_n:a_{n+1}$ if $a_n=\int_0^{\pi/2}\cos^nx.\cos nx.dx$ 
Find $a_n:a_{n+1}$ if $a_n=\int_0^{\pi/2}\cos^nx.\cos nx.dx$

Attempt 1
$$
a_{n+1}=\int_0^{\pi/2}\cos^{n+1}x.\cos(n+1)x.dx=\frac{\sin (n+1)x}{n+1}.\cos^{n+1}x-(n+1)\int\cos^{n}x.\frac{\sin (n+1)x}{(n+1)}.dx\\
=\frac{\sin (n+1)x}{n+1}.\cos^{n+1}x-\int\cos^{n}x.{\sin (n+1)x}.dx\\
=\frac{\sin (n+1)x}{n+1}.\cos^{n+1}x-\bigg[\frac{-\cos(n+1)x}{n+1}.\cos^nx-n\int\cos^{n-1}x.\frac{-\cos(n+1)x}{n+1}.dx\bigg]\\
=\frac{\sin (n+1)x}{n+1}.\cos^{n+1}x+\frac{\cos(n+1)x}{n+1}.\cos^nx+\frac{n}{n+1}\int\cos^{n-1}x.\big[\cos nx.\cos x-\sin nx\sin x\big]dx\\
=\frac{\sin (n+1)x}{n+1}.\cos^{n+1}x+\frac{\cos(n+1)x}{n+1}.\cos^nx+\frac{n}{n+1}\bigg[\color{red}{\int\cos^nx\cos nxdx}+\int\cos^{n-1}x.\sin x.\sin nx.dx\bigg]\\
=\frac{\sin (n+1)x}{n+1}.\cos^{n+1}x+\frac{\cos(n+1)x}{n+1}.\cos^nx+\frac{n}{n+1}\bigg[\color{red}{a_n}+\int\cos^{n-1}x.\sin x.\sin nx.dx\bigg]
$$
I don't think it is leading anywhere, is there any trickier way to see the solution ?
Note: The solution given in my reference is $2:1$ and I understand that $$
\int_0^{\pi/2}\sin^nx.dx=\int_0^{\pi/2}\cos^nx.dx=\begin{cases}
\dfrac{(n-1)(n-3)....2}{n(n-2)....1}\quad\text{if $n$ is odd}\\
\dfrac{(n-1)(n-3)....1}{n(n-2)....2}\quad\text{if $n$ is even}
\end{cases}
$$
Thanx @Math1000,
Attempt 2
$$
a_n = \int_0^{\frac\pi2}\cos^n x\cos nx\ \mathsf dx = \frac{1}{2.2^n} \int_0^{\frac{\pi }{2}} \left(e^{i x}+e^{-i x}\right)^n \left(e^{i n x}+e^{-i n x}\right) \, dx\\
I_1=\int_0^{\frac{\pi }{2}} \left(e^{i x}+e^{-i x}\right)^n e^{i n x}.dx=\bigg[(e^{i x}+e^{-i x})^n\frac{e^{inx}}{in}\bigg]_0^{\pi/2}-n\int(e^{i x}+e^{-i x})^{n-1}\frac{e^{i n x}}{in}.dx\\
=\frac{1}{in}-n\int(e^{i x}+e^{-i x})^{n-1}\frac{e^{i n x}}{in}.dx\\
$$
$$
I_2=\int_0^{\frac{\pi }{2}} \left(e^{i x}+e^{-i x}\right)^n e^{-i n x}.dx=\bigg[(e^{i x}+e^{-i x})^n\frac{e^{-inx}}{-in}\bigg]_0^{\pi/2}-n\int(e^{i x}+e^{-i x})^{n-1}\frac{e^{-i n x}}{-inx}.dx\\
=\frac{-1}{in}+n\int(e^{i x}+e^{-i x})^{n-1}\frac{e^{-i n x}}{in}.dx\\
a_n=\frac{i}{4}\bigg(\int_0^{\pi/2}(e^{i x}+e^{-i x})^{n-1}e^{i n x}.dx-\int_0^{\pi/2}(e^{i x}+e^{-i x})^{n-1}e^{-i n x}.dx\bigg)\\
=\frac{i}{2^{n+1}}\int_0^{\pi/2}(e^{i x}+e^{-i x})^{n-1}\Big(e^{i n x}-e^{-i n x}\Big).dx
$$
 A: $\newcommand{\d}[1]{\, \mathrm{d}#1}$
It's easier to start by expanding $\cos{(n+1)x}$.
\begin{align*}
a_{n+1} &= \int_0^\frac{\pi}{2} \cos^{n+1}{x}\cos{(n+1)x} \d{x} \\
&= \int_0^\frac{\pi}{2} \cos^{n+1}{x}(\cos{nx}\cos{x} - \sin{nx}\sin{x}) \d{x} \\
&= \int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} - \int_0^\frac{\pi}{2} \sin{x}\cos^{n+1}{x}\sin{nx} \d{x}
\end{align*}
Let's first look at the second term. Integrating by parts yields:
\begin{align*}
\int_0^\frac{\pi}{2} \sin{x}\cos^{n+1}{x}\sin{nx} \d{x} &= \left[-\frac{1}{n+2}\cos^{n+2}{x}\sin{nx}\right]_{x = 0}^{x = \frac{\pi}{2}} + \frac{n}{n+2}\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} \\
&= \frac{n}{n+2}\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x}
\end{align*}
Back to $a_{n+1}$:
\begin{align*}
a_{n+1} &= \int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} - \frac{n}{n+2}\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} \\
&= \frac{2}{n+2}\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x}
\end{align*}
We now examine the term in RHS. Integrating by parts again:
\begin{align*}
\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} &= \left[\frac{1}{n}\cos^{n+2}{x}\sin{nx}\right]_{x = 0}^{x = \frac{\pi}{2}} + \frac{n+2}{n}\int_0^\frac{\pi}{2}\sin{x}\cos^{n+1}{x}\sin{nx} \d{x} \\
&= \frac{n+2}{n}\int_0^\frac{\pi}{2}\sin{x}\cos^{n+1}{x}\sin{nx} \d{x} \\
&= \frac{n+2}{n}\left[-\frac{1}{n}\sin{x}\cos^{n+1}{x}\cos{nx}\right]_{x = 0}^{x = \frac{\pi}{2}} + \frac{n+2}{n^2}\int_0^\frac{\pi}{2} (\cos^{n+2}{x} - (n+1)\sin^2{x}\cos^n{x})\cos{nx} \d{x} \\
&= \frac{n+2}{n^2}\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} - \frac{(n+1)(n+2)}{n^2}\int_0^\frac{\pi}{2} \sin^2{x}\cos^n{x}\cos{nx} \d{x} \\
&= \frac{n+2}{n^2}\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} - \frac{(n+1)(n+2)}{n^2}\int_0^\frac{\pi}{2} (1 - \cos^2{x})\cos^n{x}\cos{nx} \d{x} \\
&= \left(\frac{n+2}{n}\right)^2\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} - \frac{(n+1)(n+2)}{n^2}\color{red}{\int_0^\frac{\pi}{2} \cos^n{x}\cos{nx} \d{x}}
\end{align*}
Therefore:
\begin{align*}
&\left(1 - \left(\frac{n+2}{n}\right)^2\right)\int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} = -\frac{(n+1)(n+2)}{n^2}a_n \\
&\implies \int_0^\frac{\pi}{2} \cos^{n+2}{x}\cos{nx} \d{x} = \frac{n+2}{4}a_n
\end{align*}
Substituting back finally yields the desired result:
$$
a_{n+1} = \frac{1}{2}a_n
$$
A: There is a closed form for $a_n$:
$$
a_n = \int_0^{\frac\pi2}\cos^n x\cos nx\ \mathsf dx = \frac{1}{2^{n+1}} \int_0^{\frac{\pi }{2}} \left(e^{i x}+e^{-i x}\right)^n \left(e^{i n x}+e^{-i n x}\right) \, dx = \frac\pi{2^{n+1}}.
$$
