# Solve $\int \cos^{2n}\theta d\theta$

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!

-
How do you get $\cos^{2n}=\frac{(z+z^{-1})^{2n}}{2^{2n}z}dz$? –  Bombyx mori Sep 14 '12 at 1:35
I get that $cos^{2n}\theta = \frac{(z+z^{-1})^{2n}}{2^{2n}}$. The $z$ in the denominator comes from $d\theta = \frac{dz}{iz}$ –  Trey Sep 14 '12 at 1:46
$z=ie^{i\theta}\rightarrow dz = ie^{i\theta}d\theta$, but $e^{i\theta} = z$, then $dz = iz d\theta\rightarrow \frac{dz}{iz}=d\theta$. –  Integral Sep 14 '12 at 1:56
Your answer is correct. What makes you think it is wrong? –  Robert Miller Sep 14 '12 at 2:41
I think this is correct. I also did some numerical computation using Wolfram alpha which agree with your result. –  Bombyx mori Sep 14 '12 at 4:03