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.
 A: Using Werner's formula with $a\ge b>0$ so that $a\pm b$ are integers
$$\int_0^\pi\cos ax\cos bx\ dx=\dfrac12\int_0^\pi\{\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$
A: 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.

Fiddling around with generalizations of this result and consulting OEIS I stumbled 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 theory which is pretty awesome
A: 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.
A: 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$.
