# Fourier Series: going from $a_n$ and $b_n$ to $c_n$

I sort of understand the principle of the Fourier series, but when I watch the wiki page I don't understand how to get from:

${a_0 \over 2} + \sum_{n=1}^N[a_n cos({2\pi n x \over P}) + b_n sin({2\pi n x \over P})]$

to

$\sum_{n=-N}^N c_n e^{i{2\pi n x \over P}}$

To be clear what I don't understand is the transition from using the coefficients $a_n$ and $b_n$ to $c_n$. I am familiar with the Euler's formula. I noticed that the sum goes from -N to N in the second equation. In the article they write:

\begin{align} a_n & = c_n + c_{-n} \\[12pt] b_n & = i(c_n - c_{-n}) \\[12pt] c_n & = \begin{cases} \frac{1}{2}(a_n - i b_n) & \text{for } n \ne 0, \\[12pt] \frac{1}{2}a_0 & \text{for }n = 0. \end{cases} \end{align}

So to get an intuition I tried to take a simple example in which N = 4 for example. I assume if I was taking n=-1 and n=1 for example, summing the terms using the above relationships, etc. I would get back to $a_1 cos(...) + b_1 sin(...)$. But I didn't succeed. I realise it probably takes quite some time to show how to get from one to another, but I would be grateful if someone could show me or at least put me on the right track.

Thank you.

-

We need consider only one $n > 0$ (the case $n = 0$ is easily verified). In the exponential form, we consider the two terms with indices $n$ and $-n$,

\begin{align} c_n e^{2\pi inx/P} + c_{-n} e^{-2\pi inx/P} &= c_n (\cos (2\pi nx/P) + i\sin (2\pi nx/P)) + c_{-n}(\cos (2\pi nx/P) - i \sin (2\pi nx/P))\\ &= (c_n + c_{-n})\cos (2\pi nx/P) + i(c_n - c_{-n})\sin (2\pi nx/P), \end{align}

so $a_n = c_n + c_{-n}$, and $b_n = i(c_n - c_{-n})$. In the trigonometric form, we consider

\begin{align} a_n \cos (2\pi nx/P) + b_n\sin (2\pi nx/P) &= \frac{a_n}{2}\left(e^{2\pi inx/P} + e^{-2\pi inx/P}\right) + \frac{b_n}{2i}\left(e^{2\pi inx/P} - e^{-2\pi inx/P}\right)\\ &= \frac{a_n - ib_n}{2}e^{2\pi inx/P} + \frac{a_n + ib_n}{2}e^{-2\pi inx/P} \end{align},

so we get $c_n = \frac{a_n-ib_n}{2}$ and $c_{-n} = \frac{a_n + ib_n}{2}$.

-
Fantastic, thank you so much for this quick and very precise (straight to the point) answer. I still have a small question: your wrote $c_{-n}e^{ix}$ as $c_{-n}(cos(x) - i \: sin(x)$. Why? Or is there a small typo on the left inside. Should it actually be $c_{-n}e^{-ix}$? Thank you. – Marc Ourens Oct 5 '13 at 13:00
That was a typo I didn't see. The coefficient $c_{-n}$ of course belongs to the exponential $e^{-2\pi inx/P}$, not $e^{2\pi inx/P}$. Sorry. – Daniel Fischer Oct 5 '13 at 13:02
That's all good. It at least shows I made an effort to make sense of what you wrote. Thank you again. – Marc Ourens Oct 5 '13 at 13:03