# How to evaluate $\int_0^\pi \cos(x) \cos(2x) \cos(3x) \cos(4x)\, dx$

Is there an easy way to evaluate the integral $\int_0^\pi \cos(x) \cos(2x) \cos(3x) \cos(4x)\, dx$?

I know that I can plugin the $e$-function and use the linearity of the integral. However this would lead to 16 summands which I really dont want to calculate separately.

• – lab bhattacharjee Jan 27 '17 at 17:04
• The easiest way to approach integrals like this is with Euler's formulas for the trig functions. – Vik78 Jan 27 '17 at 17:06
• plugging in $exp(ix)=:z$ is indeed a good idea - it seems you get many terms, but only those with $z^0$ contribute, and that comes only from $z^0=z^4z^1z^{-3}z^{-2}$ and $z^0=z^{-4}z^{-1}z^{3}z^{2}$ – user8268 Jan 27 '17 at 17:10
• @Moo, Plane Trigonometry : Sidney Luxton Loney OR A treatise on plane trigonometry : Hobson, Ernest .. – lab bhattacharjee Jan 27 '17 at 18:20

Because i like it, i will add a tricky approach ($C$ denotes the unit circle):

$$I=\frac{1}{2}\int_{-\pi}^{\pi}dx\prod_{n=1}^4\cos(nx)\underbrace{=}_{z=e^{ix}}\frac{1}{32i}\oint_C\frac{1}{z^{11}}\prod_{n=1}^4(z^{2n}+1)$$

now since $\oint_Cz^{n}=0$ for $n\in \mathbb{Z}$ and $n\neq-1$ only the terms of the product with total power of $10$ will contribute. There are exactly two of them $2+8=4+6=10$ so

$$I=\frac{1}{32i}\oint_C\frac{2}{z}=\frac{\pi}8$$

where the last equality results from the residue theorem

Fiddeling around with generalizations of this result and consulting OEIS i stumbeled over this interesting set of slides: http://www.dorinandrica.ro/files/presentation-INTEGERS-2013.pdf So integrals of this kind have a deep connection to problems in number theroy which is pretty awesome

• What a beautiful solution (+1)! – Moo Jan 27 '17 at 18:10
• Thank you very much, this is the kind of answer i was hoping for – user410669 Jan 27 '17 at 18:14
• you are mssing a minus sign, $\oint_Cz^{n}=0$ for $n\in \mathbb{Z}$ and $n\neq -1$ – klirk Jan 27 '17 at 18:20
• those anonymus downvoters seem to have a misarable life... – tired Jan 28 '17 at 10:58
• No one expected this solution and the linked PDF out of this simple integral!!! +1 – Paramanand Singh Feb 10 '17 at 16:45

HINT: We have the following identities

$\cos(A+ B) = \cos A \cos B - \sin A \sin B$ and

$\cos(A-B) = \cos A \cos B + \sin A \sin B$

$2\cos A \cos B = \cos(A+B) + \cos (A-B)$

$\cos A \cos B = \dfrac{\cos(A+B) + \cos(A-B)}{2}$

Take $\cos x$ and $\cos 4x$ together and $\cos 2x$ and $\cos 3x$ together.

Then $\cos(x) \cos(2x) \cos(3x) \cos(4x) =\\ \frac18[1 + \cos(10x) + \cos(8x)+ \cos(6x)+2\cos(4x)+2\cos(2x)+\cos(x) ]$.

Now you can do with your usual integration formula.

• nice $\,(+1)\,$ – tired Jan 27 '17 at 17:44
• shouldnt i get quadratic terms if i do this? – user410669 Jan 27 '17 at 17:47

There is a well-known identity which says

$$\cos A + \cos B = 2\cos\left(\frac{A-B}{2}\right)\cos\left(\frac{A+B}{2}\right)$$

If we put $\frac{A-B}{2} = x$ and $\frac{A+B}{2}=2x$ then we get $A=3x$ and $B=x$, so $$\cos x \cos 2x \equiv \frac{1}{2}(\cos x+\cos 3x)$$

We can repeat this for $\cos 3x$ and $\cos 4x$. Solving $\frac{A-B}{2} = 3x$ and $\frac{A+B}{2}=4x$ gives $$\cos 3x \cos 4x \equiv \frac{1}{2}(\cos x + \cos 7x)$$ Putting this together gives $$\cos x \cos 2x \cos 3x \cos 4x \equiv \frac{1}{4}(\cos x+\cos 3x)(\cos x+\cos 7x)$$

Now, you need to expand these brackets and follow the same procedure to simplify $\cos x \cos x$, $\cos x \cos 7x$, $\cos 3x \cos x$ and $\cos 3x \cos 7x$.

Using Werner's formula with $a\ge b>0$ so that $a\pm b$ are integers

$$\int\cos ax\cos bx\ dx=\dfrac12\int\{\cos(a+b)x+\cos(a-b)x\} dx=\cdots=\begin{cases}0&\mbox{if } a\ne b\\ \dfrac\pi2 & \mbox{if } a=b\end{cases}$$

Now, $(2\cos x\cos4x)(2\cos2x\cos3x)=(\cos3x+\cos5x)(\cos x+\cos5x)$

$=\cos3x\cos x+\cos x\cos5x+\cos3x\cos5x+\cos5x\cdot\cos5x$

So, $\displaystyle4\int_0^\pi\cos x\cos2x\cos3x\cos4x\ dx=\dfrac\pi2$ for $a=b=5$