Obtaining real Fourier Series from complex Fourier series

fourier analysisfourier series

So for the following piece wise function:
The initial $f(x)$ given is:
$$f(x) = \begin{cases}
\sin(x) & 0 \leq x < \pi\\
0 & \pi \leq x < 2\pi
\end{cases}$$

For which I have found the following complex Fourier Series:

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

which I believe is correct. Now I need to 'obtain the regular Fourier Series from the complex Fourier series' for which I'm assuming the question is asking for the real Fourier Series.

I'm currently not sure how to do this. My current guess is to use the Euler formula

$e^{inx} = \cos(nx) + i\sin(nx)$

but even then I'm not sure how to apply this (if it is even the correct approach) to the complex Fourier Series I have found.

Any suggestions, help or guidance will be greatly appreciated!

Best Answer

Let $f(x) = \sum_{n=-\infty}^\infty c_ne^{inx}$, then

$$\begin{align*} c_n &= \frac{1}{2\pi}\int_{2\pi}f(x)\ e^{-inx} dx\\ &= \frac 1{2\pi}\int_0^\pi \sin x \ e^{-inx}dx\\ &= \frac 1{2\pi}\int_0^\pi \frac{e^{ix} - e^{-ix}}{2i}\cdot e^{-inx}dx\\ &= \frac 1{2\pi}\cdot\frac1{2i}\int_0^\pi\left[e^{-i(n-1)x} - e^{-i(n+1)x}\right] dx\\ \end{align*}$$

For $n\ne 1$ and $n\ne -1$, $$\begin{align*} c_n &= \frac 1{2\pi}\cdot\frac1{2i}\left[\frac{e^{-i(n-1)x}}{-i(n-1)} - \frac{e^{-i(n+1)x}}{-i(n+1)}\right]_0^{\pi}\\ &= \frac 1{2\pi}\cdot\frac1{2}\left[e^{-inx}\left(\frac{e^{ix}}{n-1} - \frac{e^{-ix}}{n+1}\right)\right]_0^{\pi}\\ &= \frac 1{2\pi}\cdot\frac1{2}\left[e^{-in\pi}\left(\frac{e^{i\pi}}{n-1} - \frac{e^{-i\pi}}{n+1}\right) - e^{-in0}\left(\frac{e^{i0}}{n-1} - \frac{e^{-i0}}{n+1}\right)\right]\\ &= \frac 1{2\pi}\cdot\frac1{2}\left[(-1)^n\frac{-2}{n^2-1} - \frac2{n^2-1}\right]\\ &= \frac {(-1)^n+1}{2\pi(1-n^2)} \end{align*}$$

Otherwise,

$$\begin{align*} c_1 &= \frac 1{2\pi}\cdot\frac1{2i}\int_0^\pi\left[e^{-i0x} - e^{-i2x}\right] dx\\ &= \frac 1{2\pi}\cdot\frac1{2i}\int_0^\pi\left[1 - e^{-i2x}\right] dx\\ &= \frac 1{2\pi}\cdot\frac1{2i}\left[x - \frac{e^{-i2x}}{-2i}\right]_0^\pi\\ &= \frac{1}{4i}\\ c_{-1} &= \frac 1{2\pi}\cdot\frac1{2i}\int_0^\pi\left[e^{-i(-2)x} - e^{-i0x}\right] dx\\ &= \frac 1{2\pi}\cdot\frac1{2i}\int_0^\pi\left[e^{i2x} - 1\right] dx\\ &= \frac 1{2\pi}\cdot\frac1{2i}\left[\frac{e^{i2x}}{2i}-x\right]_0^\pi\\ &= -\frac{1}{4i} \end{align*}$$

As a summary,

$$c_n = \begin{cases}\dfrac{1}{\pi(1-n^2)} & n\text{ even}\\ \dfrac1{4i}&n=1\\ -\dfrac1{4i} & n = -1\\ 0 & \text{otherwise} \end{cases}$$

Let $n = 2k$, then

$$\begin{align*} f(x) &= \frac{e^{ix}}{4i} - \frac{e^{-ix}}{4i} + \sum_{k=-\infty}^\infty \frac{e^{i2k}}{\pi[1-(2k)^2]}\\ &= \frac{\sin x}{2} + \frac{1}{\pi} + \sum_{k=1}^\infty\frac{2\cos 2k}{\pi[1-(2k)^2]} \end{align*}$$