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

interval $-\pi:\pi$ split into M equal intervals.

midpoints are $y_K$

but i dont understand how to show

$$ \frac{1}{M}\sum_{j=1}^{M}\cos(mx_{j})=\begin{cases} 1, & \ m \equiv 0\pmod{M}\\ 0, & \text{else} \end{cases}$$

thank you very much

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

It is convenient to push the interval forward by $\pi$. Since we are working over a full period of the cosine function, the sum does not change.

Now use the fact that $$\cos x=\frac{e^{ix}+e^{-ix}}{2}.$$ Then our sum turns out to be the sum of two finite geometric series. The case $m\equiv 0\pmod{M}$ corresponds to the trivial geometric series of all $1$'s.

Some detail: After the shift, the midpoints $x'_k$ at which we evaluate $\cos(mx)$ are $x'_k=\frac{2\pi(2k+1)}{2M}$, where $k$ ranges from $0$ to $M-1$. So one of the geometric series that we calculate the sum of is $$\sum_{k=0}^{M-1}\exp\left(\frac{2\pi i(2k+1)m}{2M}\right).\tag{$1$}$$ The other is the conjugate, obtained by replacing $i$ by $-i$.

For the sum $(1)$, by taking out the obvious common factor, we can see that all we need is $\sum_{k=0}^{M-1} \exp(2\pi i m k/M)$. This reduces to finding $\sum_{k=0}^{M-1} t^k$, where $t=2\pi i m/M$. If $1-t\ne 0$, then by the usual formula for the sum of a finite geometric series, the sum is $$\frac{1-t^M}{1-t}.$$ This sum (if $1-t\ne 0$) is $0$, since $t^M=1$. The only situation in which $1-t=0$ is when $m/M$ is an integer, meaning that $m \equiv 0\pmod M$.

Remark: If we do not push forward by $\pi$, again we obtain a geometric series, with somewhat nicer symmetries. We went to the interval $[0,2\pi]$ mainly because it is more familiar.

The relevant facts can be also proved without appealing to complex numbers. What we need then is a formula for the sum of the cosines of numbers in arithmetic progression. Please see Wikipedia for the relevant formula. The formula can be proved by a telescoping series argument.

share|cite|improve this answer
is this the general method to whcih you said uses complex numbers?thank you again very much! also, how about if we use original interval? thank you! – nanme Jun 18 '12 at 17:07
@nanme: Yes, for sines and cosines or mixtures, the complex exponential is the a very useful approach, and ultimately connects with Fourier series. I could have written the answer in terms of the original interval. In $(1)$ replace $\exp\left(\frac{2\pi i(2k+1)m}{2M}\right)$ by $\exp\left(\frac{2\pi i(2k+1)m}{2M}-\pi i\right)$. The same argument then pushes through. The transformation to $[0,2\pi]$ was made mainly for the sake of tradition! – André Nicolas Jun 18 '12 at 18:33

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.