# Sum of Cosine/Exponential

I try to simplify to get rid of sum $$\sum_{k=0}^{n-1}\cos(2 \pi fk)$$

I discover I shall use euler equation to form:

$$\sum_{k=0}^{n-1}\frac{1}{2}(e^{2 \pi fki}+e^{-2 \pi fki})$$

but how to sum exponentials?

-
Is it the product of $f$ and $k$, where $f$ is constant? Then the second expression is just the sum of two geometric progressions. – André Nicolas Jun 11 '12 at 21:58
hint: $e^{2\pi f k i}=\left(e^{2\pi f i}\right)^k$ : think geometric! – Raymond Manzoni Jun 11 '12 at 21:59
I don't understand why do you want to delete the main body of the question. – user2468 Jun 18 '12 at 19:21
@nname: By removing the equations from your question, you made it impossible to understand. That constitutes vandalism. If you do something like that again, you may be suspended. – Zev Chonoles Jun 18 '12 at 22:42

## 3 Answers

You could proceed using the fact that $\cos(k \theta) = \dfrac{\exp(i k \theta) + \exp(-i k \theta)}{2}$, where $\theta = 2 \pi f$, as others have suggested.

Here is another method. Let $I_n = \displaystyle \sum_{k=0}^{n-1} \cos(k \theta)$. Now multiply by $\sin \left( \dfrac{\theta}{2}\right)$. Hence, \begin{align} \sin \left( \dfrac{\theta}{2}\right) I_n & = \sin \left( \dfrac{\theta}{2}\right) \displaystyle \sum_{k=0}^{n-1} \cos(k \theta) = \displaystyle \sum_{k=0}^{n-1} \cos(k \theta) \sin \left( \dfrac{\theta}{2}\right)\\ & = \dfrac12 \left(\displaystyle \sum_{k=0}^{n-1} \left( \sin \left( \left(k+\dfrac12 \right) \theta \right) - \sin \left( \left(k- \dfrac12 \right) \theta \right) \right) \right) \end{align} Now telescopic cancellation gives us $$\sin \left( \dfrac{\theta}{2}\right) I_n = \dfrac12 \left( \sin \left( \left( n - \dfrac12\right) \theta \right) + \sin \left( \dfrac{\theta}{2}\right)\right) = \sin \left( \left(\dfrac{n}{2} \right) \theta \right) \cos \left( \left(\dfrac{n-1}{2} \right)\theta\right)$$ Hence, $$I_n = \dfrac{\sin \left( \left(\dfrac{n}{2} \right) \theta \right) \cos \left( \left(\dfrac{n-1}{2} \right)\theta\right)}{\sin \left( \dfrac{\theta}{2}\right)}$$

The same idea works for $J_n = \displaystyle \sum_{k=0}^{n-1} \sin(k \theta)$ as well. Multiply by $\sin \left( \dfrac{\theta}{2}\right)$ and write each term as a difference of cosines to get $$J_n = \dfrac{\sin \left( \left(\dfrac{n}{2} \right) \theta \right) \sin \left( \left(\dfrac{n-1}{2} \right)\theta\right)}{\sin \left( \dfrac{\theta}{2}\right)}$$

-

It's just the sum of two geometric sequences $\frac{1}{2}\sum_{k=0}^{n-1} (e^{2\pi fi})^k$ and $\frac{1}{2}\sum_{k=0}^{n-1} (e^{-2\pi f i})^k$.

Evaluate it using the identity $\sum_{k=0}^{n-1} x^k = \frac{x^n-1}{x-1}$.

-
but is it $$\frac{1-exp(2 \pi fi)^{t}}{1-exp(2 \pi fi)}+\frac{1-exp(-2 \pi fi)^{t}}{1-exp(-2 \pi fi)}$$ – nanme Jun 11 '12 at 22:01
With a $1/2$ in front and $n$ instead of $t$. – André Nicolas Jun 11 '12 at 22:39
$\exp(2 \pi fi)^{n} = \exp(2 n \pi fi)$ – Santosh Linkha Jun 11 '12 at 22:45
@nanme : Please: write $\exp 2$, not $exp2$. – Michael Hardy Jun 12 '12 at 0:05

Since $\cos(2\pi fk)+i\sin(2\pi fk)=e^{2\pi ifk}$, we get \begin{align} \sum_{k=0}^{n-1}\cos(2\pi fk)+i\sin(2\pi fk) &=\sum_{k=0}^{n-1}e^{2\pi ifk}\\ &=\frac{e^{2\pi ifn}-1}{e^{2\pi if}-1}\\ &=e^{\pi if(n-1)}\frac{e^{\pi ifn}-e^{-\pi ifn}}{e^{\pi if}-e^{-\pi if}}\\ &=(\cos(\pi f(n-1))+i\sin(\pi f(n-1)))\frac{\sin(\pi fn)}{\sin(\pi f)} \end{align} Equating real and imaginary parts we get $$\sum_{k=0}^{n-1}\cos(2\pi fk)=\frac{\cos(\pi f(n-1))\sin(\pi fn)}{\sin(\pi f)}$$ and $$\sum_{k=0}^{n-1}\sin(2\pi fk)=\frac{\sin(\pi f(n-1))\sin(\pi fn)}{\sin(\pi f)}$$

-