Showing $\int_{0}^{2\pi}\cos(x)\cos(2x)\cos(3x)\,dx = \frac\pi2$

An integral from MIT Integration Bee:

Show that $$I = \int_{0}^{2\pi}\cos(x)\cos(2x) \cos(3x)\,dx = \frac\pi2$$

This integral appeared in the 2019 paper. Below is my own solution:

$$\begin{align} I &= \int_{0}^{2\pi}\cos(x)\cos(2x)(\cos x\cos2x-\sin x\sin2x)\,dx \\[6pt] &= \int_{0}^{2\pi}\cos^2(x)\cos^2(2x) \,dx -\int_{0}^{2\pi}\cos(x)\cos(2x)\sin(x)\sin(2x)\, dx \end{align}$$

Replacing $\cos^2(x)= \frac{1+\cos(2x)}{2}$ for the first integral and $\sin(x)\cos(x)= \sin(2x)/2 $ for the second, we get

$$\begin{align} &\int_{0}^{2\pi}\frac{1+\cos(2x)}{2}\cos^2(2x) dx-\frac{1}{2}\int_{0}^{2\pi}\cos(2x)\sin^2(2x) dx \\[6pt] =\; &\frac{1}{2}\left(\int_{0}^{2\pi}\cos^2(2x)dx \, + \int_{0}^{2\pi}\cos(2x)\cos(4x)dx \right) \\[6pt] =\; &\frac{1}{2} \left( \pi + 0\right) \qquad \text{$\because$ the orthogonality of $\cos(mx)$} \\[6pt] =\; &\frac\pi2 \end{align}$$

This solution is rather awkward, and I'm sure there's a better and faster approach to this integral. Could anyone provide a more elegant solution(or a sketch of it)? Thanks.


By symmetry $$\displaystyle I = 4\int_0^{\pi/2} \cos x \cos 2x \cos 3x \, \mathrm dx.$$ Let $\displaystyle x \mapsto \frac{\pi}{2}-x$ then

$$\displaystyle I = 4\int_0^{\pi/2} \sin x \cos 2x \sin 3x \, \mathrm dx$$ So that if we add the two

$$\displaystyle 2I = 4\int_0^{\pi/2} \cos^2{2x} \, \mathrm dx = \pi. $$

Therefore $$I = \frac{\pi}{2}.$$


Using the fact that $\cos(x)=(e^{ix}+e^{-ix})/2$, and temporarily setting $\omega=e^{ix}$, we have that we are integrating $(\omega+1/\omega)(\omega^2+1/\omega^2)(\omega^3+1/\omega^3)/8$. Integrating any power of $\omega$ from $0$ to $2\pi$ will give $0$ except for $\omega^0$, and so it suffices to expand this expression out and find the constant term, which will be the only thing which contributes to the integral. Instead of actually multiplying out, we can turn this into a combinatorics problem: The constant term (ignoring the multiplicative factor of 1/8) will be the number of ways to get $0$ from $\pm 1\pm 2 \pm 3$. There are only two ways: 1+2-3 and -1-2+3. So our constant term will be 2/8=1/4, the integral will simplify down to $\int_0^{2\pi} (1/4) dx = 2\pi/4=\pi/2$.

It is perhaps worth noting that this technique gives simple ways to do other integrals too. For example, combining it with the binomial theorem immediately gives that $\int_0^{2\pi}\cos^{100}(x)dx=\frac{\binom{100}{50}}{2^{100}}(2\pi)$. It gives the orthogonality relations for Fourier series without needing any trig identities. It is a useful thing to add to your bag of tricks.


A different approach would be repeated use of the identity: $$\cos(A+B)+\cos(A-B)=2\cos A \cos B$$ Then, $$I=\frac 12 \int_{0}^{2\pi} \cos 2x(\cos 4x+\cos 2x)\ dx$$ Multiplying out and using the same identity again, $$I=\frac 14\int_{0}^{2\pi} (\cos 6x +\cos 2x)+(\cos 4x+1)\ dx=\frac 14 (0+0+0+ 2\pi)$$ So, $I=\frac {\pi}{2}$.


$$ \cos(a)\cos(b)\cos(c) = \frac{\cos(a+b+c)+\cos(a+b-c)+\cos(a-b+c)+\cos(-a+b+c)}{4} $$ In this case, we get $$ \cos(x)\cos(2x)\cos(3x) = \frac{\cos(6x)+\cos(0)+\cos(2x)+\cos(4x)}{4} $$ Integrate $\int_0^{2\pi}$ yields: $$ \frac{0+2\pi+0+0}{4} = \frac{\pi}{2} $$


You can observe that \begin{align} (t+t^{-1})(t^2+t^{-2})(t^3+t^{-3}) &=(t^3+t+t^{-1}+t^{-3})(t^3+t^{-3})\\ &=t^6+t^4+t^{2}+1+1+t^{-2}+t^{-4}+t^{-6}\\ &=(t^6+t^{-6})+(t^4+t^{-4})+(t^2+t^{-2})+2 \end{align} With $t=e^{ix}$ you have $$ 8\cos x\cos2x\cos3x=2\cos6x+2\cos4x+2\cos2x+2 $$ and so your integral is $$ \frac{1}{4}\int_0^{2\pi}(\cos6x+\cos4x+\cos2x+1)\,dx =\dfrac{2\pi}{4} =\frac{\pi}{2} $$ because the terms $\cos(nx)$ contribute $0$.