# 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.

• For what it's worth I like your approach, it may not be the most elegant but it makes a lot of sense Commented Jul 5, 2021 at 3:55
• You can use Euler formulas, but it's not "elegant". Commented Jul 5, 2021 at 3:55

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}.$$

• Wow, embarrassingly elegant. Could you elaborate on the symmetry argument by which you inferred that $I = 4\int_0^{\pi/2} \cdots$ ? Commented Jul 5, 2021 at 4:51
• @user2661923 By plugging in $x + \pi$ you should be able to verify that the integrand is periodic with period $\pi.$ Because of the properties of integrals of periodic functions, we then have $\int_0^{2\pi} \cos(x)\cos(2x)\cos(3x) dx = 2\int_{-\frac{\pi}2}^{\frac{\pi}2} \cos(x)\cos(2x)\cos(3x) dx.$ (I can expand on this more if you'd like but it's a bit much for one comment) Then you can use the fact that the integrand is even. (also yeah love this solution, very nice) Commented Jul 5, 2021 at 5:55
• @StephenDonovan Got it - very smooth. Commented Jul 5, 2021 at 6:11
• Very elegant indeed. +1 from me! Commented Jul 5, 2021 at 12:08
• +1 I must say, you've written some truly spectacular answers! Commented Aug 2, 2021 at 19:43

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.

• Very interesting argument, I like it Commented Jul 5, 2021 at 5:59

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}$$.

• +1: Very elegant. Commented Jul 5, 2021 at 6:58

$$\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$$.

Required formulas from handbook:

$$\cos(2x) = 2\cos^2(x) - 1.$$
$$\cos(3x) = 4\cos^3(x) - 3\cos(x).$$

$$\cos^2(x) = \frac{1}{2}[\cos(2x) + 1].$$
$$\cos^4(x) = \frac{1}{8}[\cos(4x) + 4\cos(2x) + 3).$$
$$\cos^6(x) = \frac{1}{32}[\cos(6x) + 6\cos(4x) + 15\cos(2x) + 10].$$

The first thing to notice is that when integrating $$\cos^2(x), \cos^4(x),$$ or $$\cos^6(x)$$, the indefinite integral will look like $$A\sin(6x) + B\sin(4x) + C\sin(2x) + D.$$

Since the integral is being taken from $$(0)$$ to $$(2\pi)$$, all but the constant term can be ignored. That is, for example, at $$(x = 2\pi), \sin(6x) = 0.$$

Therefore

$$\cos(x) \cos(2x) \cos(3x) = [2\cos^3(x) - \cos(x)] [4\cos^3(x) - 3\cos(x)]$$

$$= 8\cos^6(x) - 10\cos^4(x) + 3\cos^2(x).$$

Therefore
$$\displaystyle I = \int_0^{2\pi} \left[\frac{8}{32}(10) - \frac{10}{8}(3) + \frac{3}{2}(1)\right] dx.$$

This equals
$$\displaystyle (2\pi) \times \left[\frac{10}{4} - \frac{15}{4} + \frac{6}{4}\right] = (2\pi) \times \frac{1}{4} = \frac{\pi}{2}.$$

Another method: $$I=\int_0^{2\pi} \cos x\cos 2x(\cos 3x+\cos x-\cos x)\, dx=\\ \int_0^{2\pi} \cos x \cos 2x (2\cos 2x\cos x-\cos x)\, dx=\\ \int_0^{2\pi} \cos^2x\cos 2x(2\cos2x-1)\,dx=\\ \int_0^{2\pi} 2\cdot \frac{1+\cos 2x}{2}\cdot \frac{1+\cos 4x}{2}\,dx- \frac{1+\cos 2x}{2}\cdot \cos 2x\,dx=\\ \int_0^{2\pi} \frac12+\frac12\cos 4x+\frac12\cos 2x\cos 4x-\frac12\cdot \frac{1+\cos 4x}{2}\,dx=\\ \pi+0+0-\frac{\pi}{2}-0=\frac{\pi}{2}.$$