TITLE: What has flipping a coin to do with $\int_0^{2 \pi}\sin^{2n}(x)\,dx$?
QUESTION [23 upvotes]: If you toss a coin $2n$ times the chance of getting heads $n$ times is
$$\frac{1}{4^n} \binom{2n}{n} $$ (simple combinatorics problem).
Now I've made a seemingly obscure observation:
$$\int_0^{2 \pi}\sin^{2n}(x)\,dx = \frac{2 \pi}{4^n} \binom{2n}{n} $$
The identities only differ by a factor of $2 \pi$. Is there an explanation for this phenomenon or just a cool coincidence?
UPDATE:
As Aloizio Macedo pointed out, a fairly related question has been answered with a combinatorial proof by Qiaochu Yuan here.

REPLY [6 votes]: I thought I had a real approach to this question, but after working a bit, I realized that I needed some Fourier analysis at least.
In a generating function approach, the number of ways to get exactly $k$ heads and $2n-k$ tails would be $\left[x^k\right](1+x)^{2n}$ where each choice of an $x$ represents a head and each choice of a $1$ a tail. Since
$$
\frac1{2\pi}\int_0^{2\pi}e^{ikx}\,\mathrm{d}x=\left\{\begin{array}{}1&\text{if }k=0\\0&\text{if }k\ne0\end{array}\right.
$$
$\left[x^n\right](1+x)^{2n}$ is simply
$$
\begin{align}
\frac1{2\pi}\int_0^{2\pi}\left(1+e^{ix}\right)^{2n}e^{-inx}\,\mathrm{d}x
&=\frac1{2\pi}\int_0^{2\pi}\left(e^{-ix/2}+e^{ix/2}\right)^{2n}\,\mathrm{d}x\tag1\\
&=\frac{4^n}{2\pi}\int_0^{2\pi}\cos^{2n}(x/2)\,\mathrm{d}x\tag2\\
&=\frac{4^n}{\pi}\int_0^{\pi}\cos^{2n}(x)\,\mathrm{d}x\tag3\\
&=\frac{4^n}{2\pi}\int_0^{2\pi}\cos^{2n}(x)\,\mathrm{d}x\tag4\\
&=\frac{4^n}{2\pi}\int_0^{2\pi}\sin^{2n}(x)\,\mathrm{d}x\tag5
\end{align}
$$
Explanation:
$(1)$: distributive property
$(2)$: $2\cos(x/2)=e^{ix/2}+e^{-ix/2}$
$(3)$: substitute $x\mapsto2x$
$(4)$: $\cos^{2n}(x)=\cos^{2n}(x+\pi)$
$(5)$: $\cos^{2n}(x)=\sin^{2n}(x+\pi/2)$  
Since there are $2^{2n}=4^n$ possible outcomes, we get the probability of exactly $n$ heads to be
$$
\frac1{2\pi}\int_0^{2\pi}\sin^{2n}(x)\,\mathrm{d}x
$$