[Math] How to convert a complex Fourier series into a purely real one

fourier series

I have a question that gives me a periodic function $f(x)$ and asks me to find the complex Fourier series (which I think I have done correctly) and then asks me to obtain from that the regular Fourier series. I assume by 'regular' it just means real. I have no idea how to turn this complex series into a real series. I worked out what the real series should be by using Euler's formulae but that isn't obtaining it using the complex series (like the question asks).

The initial $f(x)$ given is:
$$f(x) = \begin{cases}
0 & -\pi < x \leq 0\\
x & 0 < x < \pi
\end{cases}$$

The complex Fourier series I found is:

$$f(x) = \frac{\pi}{4} + \sum_{n = -\infty}^{\infty}\frac{1}{2\pi n^2}\left(1-\frac{n\pi}{i} – e^{inx}\right)$$

The 'regular' series I found is:

$$f(x) = \frac{\pi}{4} +\sum_{n=1}^{\infty}\frac{1}{\pi n^2}((-1)^{n}-1)\cos(nx)-\frac{1}{n}(-1)^n\sin(nx)$$

How do I get from the complex Fourier series to the regular series?

(Sorry I couldn't get nice formatting done above)

Best Answer

Just use: $$e^{ikx} = \cos(kx) + i\sin(kx)$$ Generally, if the fourier transform is real, you'll have terms like $e^{ikx}+e^{-ikx}$ that cancel out the imaginary part. In your case, divide the infinite series into three parts: $$\sum_{k=-\infty}^{\infty} =\sum_{k=-\infty}^{-1} + \sum_{k=1}^{\infty} + \sum_{k=0}^{0}$$

Notice how you now get terms like $e^{ikx}+e^{-ikx}=2\cos(kx)$, or $e^{ikx}-e^{-ikx}=2i\sin(kx)$.