10
$\begingroup$

Consider

$$\int_0^{2\pi}\cos^n(x)\,dx,\qquad n\text{ a positive integer}$$ For $n$ odd, the answer is zero.

Is there a slick way to find a closed form for $n$ even?

$\endgroup$
2
  • 3
    $\begingroup$ Write $\cos(x) = (e^{ix} + e^{-ix})/2$. I am reasonably certain this is a duplicate but I don't know how I'd go about finding the duplicate. For a combinatorial proof see this post: qchu.wordpress.com/2010/03/07/… $\endgroup$ Mar 28 '12 at 20:33
  • $\begingroup$ Should be proportional to $2^{-n}|P_n(0)|$ (or so), where $P_n$ is the $n$th Legendre polynomial! $\endgroup$
    – dohmatob
    Sep 7 '21 at 16:20
10
$\begingroup$

Funny enough, someone just posted a question on the Power-reduction formula two hours ago. Using that, you readily get the result

$$\frac{2\pi}{2^n}\binom{n}{n/2}\;.$$

$\endgroup$
1
  • 1
    $\begingroup$ Fascinating connection! $\endgroup$ Mar 28 '12 at 20:18
8
$\begingroup$

Qiaochu Yuan's hint seems to be the simplest approach: By the binomial theorem for any $n\geq0$ one has $$2^n\cos^n x=(e^{ix}+e^{-ix})^n=\sum_{k=0}^n {n\choose k} (e^{ix})^k\ (e^{-ix})^{n-k}=\sum_{k=0}^n {n\choose k} e^{(2k-n)ix}\ .\qquad(*)$$ Since $$\int_0^{2\pi}e^{i\ell x}\ dx=\cases{2\pi&$\quad(\ell=0)$\cr 0&$\quad(\ell\ne0)$\cr}$$ at most one term on the right of $(*)$ contributes to the integral $J_n:=\int_0^{2\pi}\cos^n x\ dx$. When $n$ is odd then $2k-n\ne0$ for all $k$ in $(*)$, therefore $J_n=0$ in this case. When $n$ is even then $k=n/2$ gives the only contribution to the integral, and we get $$\int_0^{2\pi} \cos^n x\ dx={2\pi\over 2^n}{n\choose n/2}\ .$$

$\endgroup$
7
$\begingroup$

It is also possible with partial integration, though getting the closed formula from the other solution is not as easy to see.

$$ C(n):=\int_0^{2\pi}\!\!\!\cos^n(x)\,dx =\int_0^{2\pi}\!\!\!\cos^{n-1}(x)\cos(x)\,dx $$ partial integration gives

$$ = (n-1)\int_0^{2\pi}\!\!\!\cos^{n-2}(x)\sin^2(x)\,dx$$ $$ =(n-1)\int_0^{2\pi}\!\!\!\cos^{n-2}(x)\left(1-\cos^2(x)\right)\,dx $$ $$ \Rightarrow \int_0^{2\pi}\!\!\!\cos^n(x)\,dx = \frac{n-1}{n}\int_0^{2\pi}\!\!\!\cos^{n-2}(x)\,dx $$

So in short: $C(0)=2\pi$, $C(1)=0$ and $$C(n)=\frac{n-1}{n}C(n-2) = \frac{(n-1)!!}{n!!} 2\pi\quad \text{for }n\text{ even} .$$

$\endgroup$
2
  • $\begingroup$ You got a factor of $2$ wrong; it's $nC(n)=(n-1)C(n-2)$ and thus $C(n)=(n-1)/n C(n)$, and that agrees with my answer. $\endgroup$
    – joriki
    Mar 28 '12 at 20:42
  • $\begingroup$ @joriki thank you. already fixed it. Took me a while to see the 2 or 3 mistakes I did (the factor of two was the last one ;) ). $\endgroup$
    – example
    Mar 28 '12 at 20:45
2
$\begingroup$

It's possible to do this integral in a couples of lines using the residue theorem from complex analysis.

Details: The usual trick to do definite integrals going from $0$ to $2\pi$ is to let $\cos x = \dfrac {z^2 + 1} {2z}$ where $z = {\rm e} ^{{\rm i} x}$. This substitution also implies that ${\rm d} x = \dfrac {{\rm d} z} {{\rm i} z}$. Then this is reduced to the contour integral of $\left( \dfrac {z^2 + 1} {2z} \right) ^n \dfrac {{\rm d} z} {{\rm i} z}$ where the contour is the unit circle in the complex plane. Then you can expand this using the binomial theorem and get the coefficient of $\dfrac 1 z$ and apply the residue theorem to get the answer.

$\endgroup$
3
  • 2
    $\begingroup$ Without more details, this should be a comment and not an answer. $\endgroup$ Jul 12 '12 at 7:24
  • 3
    $\begingroup$ Sorry, here are some details. The usual trick to do definite integrals going from 0 to 2pi is to let cos(x) = (z^2 + 1)/2z where z = e^ix. This substitution also implies that dx = dz/iz. Then this is reduced to the contour integral of ((z^2 + 1)/2z)^n*dz/iz where the contour is the unit circle in the complex plane. Then you can expand this using the binomial theorem and get the coefficient of 1/z and apply the residue theorem to get the answer. $\endgroup$
    – dayar
    Jul 13 '12 at 8:53
  • 2
    $\begingroup$ You should edit your answer instead of posting that as a comment. $\endgroup$ Jul 13 '12 at 8:56
1
$\begingroup$

Let $X$ be a standard normal random variable. Then, your integral $I$ can be computed as

$$ I = 2\pi\cdot \mathbb E[X^n] = \begin{cases}2\pi\cdot (n-1)!! = \frac{2\pi}{2^n}{n\choose n/2},&\mbox{ if }n\text{ is even},\\ 0,&\mbox{ else.} \end{cases} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.