What has flipping a coin to do with $\int_0^{2 \pi}\sin^{2n}(x)\,dx$?

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.


This is still not a combinatorial proof, purely, but it avoids complex numbers, at least, and is phrased in terms of probability.

First note that your integral is the same as $\int_{0}^{2\pi}\cos^{2n}x\,dx$.

Now we use the property that $\cos^2 x =\frac{1+\cos 2x}{2}.$ If $X$ is a uniform random variable in $[0,2\pi]$, then the random variables $U=\cos X$ and $V=\cos 2X$ have the same distribution, so it means that $$E\left[U^{2n}\right]=\frac{1}{2^n}E\left[(1+V)^n\right]=\frac{1}{2^n}E\left[(1+U)^n\right]$$ and thus you get an inductive formula. Since $E\left[U^k\right]=0$ when $k$ is odd, you get:

$$E\left[U^{2n}\right]=\frac{1}{2^n}\sum_{k=0}^{\lfloor n/2\rfloor}\binom{n}{2k}E\left[U^{2k}\right]$$

We want to prove $$E\left[U^{2n}\right]=\frac{1}{4^n}\binom{2n}{n}.$$

When $n=0$ we get $E[U^0]=1=\frac1{2^0}\binom{0}{0}.$

Inductively, then, we need to show:

$$\frac{1}{4^n}\binom{2n}{n}=\frac{1}{2^n}\sum_{k=0}^{\lfloor n/2\rfloor}\binom{n}{2k}\frac{1}{2^{2k}}\binom{2k}{k}$$

which is equivalent to:

$$\binom{2n}{n}=\sum_{k=0}^{\lfloor n/2\rfloor}2^{n-2k}\binom{n}{n-2k}\binom{2k}{k}\tag{1}$$

which can be proved combinatorially.

If we think of $\binom{2n}{n}$ as the number of ways of picking an $n$-subset of $\{1,\dots,n\}\times\{1,2\}$ then $k$ is the number of elements $m\in\{1,\dots,n\}$ such that $(m,1)$ and $(m,2)$ are both in the $n$-subset. That means we need to pick an $n-2k$-subset $P$ of $\{1,\dots,n\}$, then for each $p\in P$, choose either $(p,1)$ or $(p,2)$, and then choose $k$ elements of the $2k$ elements not in $P$, and add $(q,1)$ and $(q,2)$ to our subset.

The interesting thing about this proof of $(1)$ is that the meaning of the $\binom{2n}{n}$ on the left side is kind-of different from the meaning of $\binom{2k}{k}$ on the right side.


A power series approach. Even less combinatorial than the first approach.

Consider for $|x|<1$ the function $f(x,t)=\frac{1}{1-x\cos t}=\sum_{k=0}^{\infty} x^k\cos^kt$

The integral $$F(x)=\frac1{2\pi}\int_{-\pi}^{\pi} f(x,t)\,dt$$

can be found by using the Weierstrass substitution. This gives that:

$$\begin{align}F(x)&=\frac{1}{\sqrt{1-x^2}} \end{align}$$

So if $T$ is a uniform random variable in $[0,2\pi]$ you get:

$$\sum_{k=0}^{\infty} x^kE\left[\cos^k T\right]=E[f(x,T)]=F(x)=\frac{1}{\sqrt{1-x^2}}=\sum_{k=0}^{\infty}\frac{1}{4^k}\binom{2k}{k}x^k$$

That last step requires you to know the generating function for the central binomial coefficients, $\binom{2k}{k}$. (Alternatively, if you prove the equality elsewhere, you can use this to prove the central binomial coefficients generating function.)


Finally, maybe the underlying reason is due to the characteristic function for a random variable. Unfortunately, this is essentially an encoding of the proof that starts with $\cos(x)=\frac{1}{2}\left(e^{ix}+e^{-ix}\right).$

Given a random variable, $X$, we have the characteristic function:

$$G_X(t)=E\left[e^{itX}\right]$$

If $X$ is a random integer variable, and $T$ is a uniform random variable in $[0,2\pi]$ then we have a fundamental result:

$$E\left[G_X(T)\right]=P(X=0).$$

Now if $X_1,\dots,X_{n}$ are independent coin tosses returning values $-1$ and $1$, then $G_{X_i}(t)=\cos t$ and $$G_{X_1+\cdots+X_n}=G_{X_1}G_{X_2}\cdots G_{X_n}$$

So if $X=X_1+\cdots+X_n$, then $G_X(t)=\cos^n(t)$ and $$P(X=0)=E[G_X[T]]=\frac{1}{2\pi}\int_{0}^{2\pi} \cos^n t\,dt$$

That's just really fundamentally hiding the usual approach of writing $\cos x= \frac{1}{2}(e^{ix}+e^{-ix})$ and using the algebraic property of the characteristic function.


Well, if you write $$ \sin^{2n} x = \left(\frac{e^{ix}-e^{-ix}}{2i}\right)^{2n} , $$ expand using the binomial theorem, and integrate term by term, everything will be zero except the contribution from the middle (constant) term, $$ \int_0^{2\pi} \binom{2n}{n} (e^{ix})^n (-e^{-ix})^n \,\left(\frac{1}{2i}\right)^{2n} \, dx = 2 \pi \, \binom{2n}{n} \left(\frac{1}{2}\right)^{2n} , $$ which is a bit similar to how the coefficients in the binomial expansion of $(p+q)^{2n}$ tell you the probabilities of getting $k$ heads and $2n-k$ tails when flipping a coin with probability $p$ and $q$ for head and tail.

But whether you would count this as an “explanation”, I don't know...