# Recursional Formula for Integration

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.

• Try using a trig identity on $\cos(x+ (n-1)x)$ – Matthew Towers Apr 26 at 17:18

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}}$$

• Would the cowardly downvoter care to comment? – Mark Viola May 27 at 21:23

(Using Mathew Towers' hint $$\cos((n+1)x-x) = \cos((n+1)x)\cos x + \sin((n+1)x)\sin x$$)

$$I(n)=\int_0^{\pi/2}\cos^nx\cos(nx)dx$$

$$= \int_0^{\pi/2}\cos^{n}x\ \left[\cos((n+1)x)\cos x + \sin((n+1)x)\sin x\right]dx$$ $$= I(n+1) + \int_0^{\pi/2}(\cos^nx\sin x)\sin((n+1)x)dx$$ $$= I(n+1) - \left.\frac{\cos^{n+1}x}{n+1}\sin((n+1)x)\right|_0^{\pi/2} + \int_0^{\pi/2}\frac{\cos^{n+1}x}{n+1}(n+1)\cos((n+1)x)dx$$ $$= I(n+1) - \left.\frac{\cos^{n+1}x}{n+1}\sin((n+1)x)\right|_0^{\pi/2} + I(n+1)$$ $$= 2I(n+1) - 0$$

$$\implies I(n) = 2I(n+1) = 4I(n+2)\dots$$

Also, $$I(1) = \int_0^{\pi/2}\left(\frac{1+\cos(2x)}{2}\right)dx = \frac{\pi}{4}$$

Hence $$I(n) = \frac{1}{2^{n-1}}I(1) = \boxed{\frac{\pi}{2^{n+1}}}$$