[Math] Is the complex form of the Fourier series of a real function supposed to be real

complex numbersfourier series

The question said to plot the $2\pi$ periodic extension of $f(x)=e^{-x/3}$, and find the complex form of the Fourier series for $f$.
My work: $$a_n=\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{-x/3}e^{-inx}dx=\frac{1}{2\pi}\int_{-\pi}^{\pi}e^{-x(1/3+in)}dx$$
$$=\frac{e^{\pi(\frac{1}{3}+in)} – e^{-\pi(\frac{1}{3}+in)}}{2\pi(\frac{1}{3}+in)}=\frac{1}{\pi(\frac{1}{3}+in)}\sinh(\pi(\frac{1}{3}+in))$$
$$\therefore F(x)=\frac{3\sinh(\pi/3)}{\pi}+\sum_{n=-\infty}^{\infty}\frac{3\sinh(\pi/3+in\pi)}{\pi+3in\pi}\cos(nx)$$
But, this is not always real-valued. Is it possible for the complex Fourier series of a real-valued function to have imaginary coefficients, or is my algebra just wrong?

Best Answer

You are using the formula for the complex fourier coefficients which are usually denoted by $c_n$. These are usually complex, and they lead to the representation:

$f_f(x) = \sum_{n=-\infty}^\infty c_n e^{inx}$

This is still (more or less) the original function and is therefore real.

There is also a transformation into the sinus-cosinus representation:

$f_f(x) = a_0 + \sum_{n=1}^\infty a_n \cos(nx) + b_n \sin(nx)$

Where the $a_n$ and $b_n$ are real if the original function was real.

You can even go back and forth between the 'real' and the 'complex' coefficients. This comes from the fact that you can express the sinus as well as the cosinus as

$\sin(x) = \frac{1}{2i}(e^{ix}-e^{-ix})$ and

$\cos(x) = \frac{1}{2}(e^{ix}+e^{-ix})$.

Or the other way around which might be more familiar:

$e^{ix} = \cos(x)+i\sin(x)$

You can find all of this including the formulas for converting the real coefficients $a_n,b_n$ to the complex ones $c_n$ and vice versa here: http://mathworld.wolfram.com/FourierSeries.html