Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to calculate the trigonometric sum : $$\sum\limits_{k=1}^{n}\cos(k x)$$

This is what I've tried so far : $$\renewcommand\Re{\operatorname{Re}} \begin{align*} \sum\limits_{k=1}^{n}\cos(k x) &= \Re\left(\sum\limits_{k=1}^{n}e^{i k x}\right)\\ &= \Re\left(e^{i x}\frac{1 - e^{inx}}{1 - e^{ix}}\right) \end{align*}$$

How can I go on ?

share|improve this question

marked as duplicate by Martin Sleziak, Sami Ben Romdhane, mau, 5xum, heropup Feb 21 at 9:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
What is $k$? What is $x$? –  Chris Eagle May 31 '12 at 11:14
    
It was a mistake in the question, the sum is on k and x is a variable. I edited it. –  Skydreamer May 31 '12 at 11:16
2  
Alternative approach - just use $\cos kx=(1/2)(e^{ikx}+e^{-ikx})$. –  Gerry Myerson May 31 '12 at 11:37
    
Have a look at Wikipedia article on trigonometric identities. You find some formulas for $\sum_{k=0}^n \sin(\varphi+k\alpha)$ and $\sum_{k=0}^n \cos(\varphi+k\alpha)$ there. –  Martin Sleziak May 31 '12 at 12:55
add comment

2 Answers

up vote 4 down vote accepted

Expressing in terms of complex exponentials is a good start. You used $$\cos(kx)=\frac{e^{ikx}+e^{-ikx}}{2}.$$ Now $\sum_{k=1}^n e^{ikx}$ is the sum of a finite geometric series, as is the sum of the other terms. So our sum is equal to $$\frac{1}{2}\left(\frac{e^{ix}(1-e^{inx})}{1-e^{ix}}+\frac{e^{-ix}(1-e^{-inx})}{1-e^{-ix}}\right).$$ You are probably expected to express things in terms of real functions. So bring to a common denominator. At the bottom we get $(1-e^{ix})(1-e^{-ix})$. If you multiply this out and recognize that $e^{ix}+e^{-ix}=2\cos x$, you end up with $2-2\cos x$. If you feel like it, this can be in a sense simplified by using the identity $\cos 2\theta=2\cos^2\theta-1$.

After you bring things to a common denominator, expand the messy top that you get. It is easy, but with ample opportunities for error. The terms you get combine nicely in pairs into (twice) cosines, apart from a couple of terms that are each simply $-1$.

The above calculation works when $1-e^{ix}\ne 0$ ($\cos x\ne 1$). For completeness, we need to deal with the case $\cos x=1$. In that case the sum is $n$.

share|improve this answer
    
I get $\frac{\cos{x}-\cos{(n+1)x}+\cos{nx}-2}{2-2\cos{x}}$. It may be false though... –  Skydreamer May 31 '12 at 12:44
    
You have a minor typo, on top it is $-1$, you forgot to divide that one by $2$. The rest looks fine. I added a little thing to the answer to deal with the case $\cos x=1$, where the above formula breaks down, division by $0$. –  André Nicolas May 31 '12 at 12:53
    
Thank you for your answer ! –  Skydreamer May 31 '12 at 13:08
add comment

Here's a slightly different approach than André's one, you may find it easier and less error prone (it doesn't involve common denominators or long expansions). There's also a useful trick in it, so it's not completely uninteresting.

$$\begin{align} \sum_{k=1}^n \cos(kx) & = \Re\left(\sum_{k=1}^n e^{ikx}\right)\\ & = \Re\left(e^{ix} {e^{inx}-1 \over e^{ix}-1}\right) \\ & = \Re\left({e^{ix} e^{inx \over 2} \over e^{ix \over 2}} {e^{inx \over 2} - e^{-inx \over 2} \over e^{ix \over 2} - e^{-ix\over2}}\right)\\ & = \Re\left( e^{i(n+1)x \over 2} {\sin{nx\over2} \over \sin{x \over 2}}\right)\\ & = {\sin{nx\over2} \over \sin{x \over 2}} \cos\left({(n+1)x\over2}\right) \end{align}$$

The trick is between lines 2 and 3, where you factor by the "half-angle" exponential to make a sine appear. As in André's proof you need to distinguish the case $e^{ix} = 1$.

share|improve this answer
    
It was what I was looking for to go on. Thank you ! –  Skydreamer May 31 '12 at 19:10
add comment

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