Find $a_n:a_{n+1}$ if $a_n=\int_0^{\pi/2}\cos^nx.\cos nx.dx$
$\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 $$
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}}. $$