TITLE: For which integers $1\leq{m}\leq{10}$ is it true that $\int_0^\pi{(\cos{x})(\cos{2x})\cdots(\cos{mx})}\,dx = 0$?
QUESTION [9 upvotes]: I could only solve this problem via brute force, trying every value from $m = 1$ to $10$... 
What is the more efficient and proper method of approach? 
(Note: my method involved repeated usage of the product-to-sum trig identity to achieve a simplified result of the integrand; but is there a way to generalize this simplified result for all $m \in [1,10]$?)
Thanks

REPLY [4 votes]: Let
$$I_{m}=\int_{0}^{\pi}\prod_{k=1}^{m}\left(\dfrac{e^{ikx}+e^{-ikx}}{2}\right)dx=2^{-m}\sum_{\xi=\pm 1}\int_{0}^{\pi}e^{i(\xi_{1}+2\xi_{2}+\cdots+m\xi_{m})x}dx$$
since
$$\int_{0}^{\pi}e^{itx}dx=\begin{cases}\pi&t=0\\
0&\textbf{otherwise}
\end{cases}$$
then $I_{m}\neq 0$, if and only if $0$ can written as
$$\xi_{1}+2\xi_{2}+\cdots+m\xi_{m},\xi_{i}\in\{-1,1\},i=1,2,\cdots,m$$
It is to easy to find when 
$$m\equiv 3,4\pmod 4$$ because
$$0=\xi_{1}+2\xi_{2}+\cdots+m\xi_{m}=1+2+\cdots+m=\dfrac{m(m+1)}{2}\pmod 2$$
so
$$\Longrightarrow m(m+1)\equiv 0\pmod 4\Longrightarrow m\equiv 3,4\pmod 4$$then satisfying this condition except are $3,4,7,8$,
so if
$$I_{m}=0\Longrightarrow m=1,2,5,6,9,10$$