I am trying to solve the integral $\int_0^{2\pi} \cos^{2n}\theta d\theta$ using residues. I get the wrong answer so could you please say what I am doing wrong?
We start with the substitution $z = e^{i\theta}$. Then $d\theta = \frac{dz}{iz}$ and $\cos \theta = (z + z^{-1})/2$. So our integral now looks like
$\frac{1}{i2^{2n}}\int_{|z|=1} \frac{(z+z^{-1})^{2n}}{z}dz$. The inner part of the integral has a singularity at $z = 0$. So we expand it as a Laurent series around the origin.
$\frac{(z+z^{-1})^{2n}}{z} = \frac{1}{z}\sum_{t=0}^{2n}\binom{2n}{t}z^{2n-t}z^{-t} = \sum_{t=0}^{2n}\binom{2n}{t}z^{2n-2t-1}$. The residue of that beast is the coefficient of $1/z$, that is $\binom{2n}{n}$. Therefore the integral is equal to $\frac{2\pi i}{i2^{2n}}\binom{2n}{n} = \frac{\pi}{2^{2n-1}}\binom{2n}{n}$. But this is the wrong answer! Please help me!
I know that this can be solved using partial integration but I don't want that!
Best Answer
We have
$$\begin{align}\int_0^{2\pi}\cos^{2n}(\theta)\,d\theta&=4\int_0^{\pi/2}\cos^{2n}(\theta)\,d\theta\\\\ &=2B\left(1/2,n-1/2\right)\\\\ &=2\frac{\Gamma(1/2)\Gamma(n+1/2)}{\Gamma(n+1)}\\\\ &=2\frac{\sqrt\pi \left(\sqrt\pi (2n-1)!!\right)}{2^nn!}\\\\ &=\frac{2\pi}{2^n\,n!}\frac{(2n)!}{2^n\,n!}\\\\ &=\frac{\pi}{2^{2n-1}}\binom{2n}{n} \end{align}$$
as was to be shown!