# Obtaining real Fourier Series from complex Fourier 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!

• What is the $n=1$ term in your series for $f(x)$? – kimchi lover May 28 at 10:42
• undefined because of the $1-n^2$ in the denominator right? – lohboys May 28 at 23:48
• That's part of it. Also, don't you want the argument to the exponential function to depend on $n$? Shouldn't it be something like $\exp(-ni\pi x)$? – kimchi lover May 28 at 23:51
• yeah i might have mistyped it... should be $n$ instead of $x$ – lohboys May 29 at 0:04
• $\cos nx$ and $\sin nx$ are related to $e^{-inx}$ by: $$e^{-inx} = \cos nx - i\sin nx$$ Combine with your Euler formula, and express $\cos nx$ and $\sin nx$ in terms of $e^{inx}$ and $e^{-inx}$. – peterwhy May 29 at 0:15

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*}

• how exactly did you extract the real fourier series from the complex fourier series? i assume euler's identity but im not sure of the exact steps – lohboys May 31 at 7:50
• @lohboys The following are from Euler's formula, converting between $(\sin x, \cos x)$ and $(e^{ix}, e^{-ix})$: $$\cases{e^{ix} = \cos x + i\sin x\\ e^{-ix} = \cos x - i\sin x}\\ \cases{\cos x = \dfrac{e^{ix} + e^{-ix}}{2}\\ \sin x = \dfrac{e^{ix} - e^{-ix}}{2i}}$$ – peterwhy May 31 at 9:58