Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We are given $I_m = \int_0^{2\pi} \cos(x) \cos(2x) \dots \cos(mx)dx$; i.e.,

$$I_m=\int_0^{2\pi}\prod_{k=1}^m\cos{k x}\,dx.$$

Task is to find such $m \in [1\dots 10]$, so $I_m \neq 0$.

I have computed all these integrals with the use of MATLAB and found out that $I_m \neq 0$ holds for $m \in \{3,4,7,8\}$. Those are cases, when expression after integration contains some other term, but $sin(x)$, something like: $\frac {x}{C}$, C - constant.

But this task is supposed to be solvable in a pure analytical approach. Maybe it is even possible to find the right $m$ values without computing all integrals, since it looks like it is nearly possible to do this just by hand.

share|cite|improve this question
up vote 13 down vote accepted

$$ \begin{align} &2^{-m}\int_0^{2\pi}(e^{ix}+e^{-ix})(e^{2ix}+e^{-2ix})\cdots(e^{mix}+e^{-2mix})\,\mathrm{d}x\ne0\\ &=2^{-m}\int_0^{2\pi}e^{-i\frac{m(m+1)}{2}x}(e^{2ix}+1)(e^{4ix}+1)\cdots(e^{2mix}+1)\,\mathrm{d}x\ne0 \end{align} $$ precisely when there is a term with exponent $0$ and that only happens when $\frac{m(m+1)}{2}$ can be written as the sum of even integers. That is when $m(m+1)$ is divisible by $4$. Therefore, the integral is non-zero precisely when $m\equiv0\pmod{4}$ or $m\equiv3\pmod{4}$.

share|cite|improve this answer
Ahhh. I saw this formula $\cos(x)=\frac 1 2 (e^{ix}+e^{-ix})$ but I didn't tried it. – wf34 Apr 5 '14 at 6:48
Thank you for answer, I'm going to accept it. But I got some questions: how factoring out $e^{-i \frac{m(m+1)}{2}x}$ enables us to get 1 in all brackets? – wf34 Apr 5 '14 at 6:57
@wf34: factoring $e^{-ix}$ out of the first term, $e^{-2ix}$ out of the second term, and so on until factoring $e^{-mix}$ out of the $m^\text{th}$ term, accumulates $e^{-i\frac{m(m+1)}{2}x}$ outside and leaves $(e^{2ix}+1)$ in the first term, $(e^{4ix}+1)$ in the second term, and so on until $(e^{2mix}+1)$ in the $m^\text{th}$ term. This is because $1+2+\dots+m=\frac{m(m+1)}{2}$. – robjohn Apr 5 '14 at 7:03
Thanks, I see it now. I'm a bit ashamed to ask again, but why divisibility of $m(m+1)$ by 4 turn expression $-i\frac{m(m+1)}{2}x$ into 0? – wf34 Apr 5 '14 at 7:14
@wf34: in order to get a term with a $0$ in the exponent, $\frac{m(m+1)}{2}$ must be gotten as the sum of some subset of $\{0,2,4,\dots,2m\}$. The sums of all the subsets span all the even numbers from $0$ to $m(m+1)$. – robjohn Apr 5 '14 at 7:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.