TITLE: How to evaluate $\int_0^\pi \cos(x) \cos(2x) \cos(3x) \cos(4x)\, dx$
QUESTION [7 upvotes]: 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.

REPLY [2 votes]: 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$