# Complex Fourier Series Coefficients

I am a bit confused by the complex Fourier Series in general, but I am working with complex Fourier Series on the form: $$\sum_{n=-\infty}^{\infty} c_ne^{inx}$$

Where the Fourier coefficient $c_n$ is defined as: $$c_n = \frac{1}{2\pi} \int_{-\pi}^{\pi}f(y)e^{-iny}dy$$

I am then find the $c_0$ and the $c_n$ coefficient of the function on the interval $]-\pi, \pi]$ defined by:

$$f(x) := \begin{cases} 0, & \text{for -\pi<x<0} \\ sin(x), & \text{for 0\le x\le \pi } \end{cases}$$

This is what I have done so far:

Note that $sin(x) = \frac{e^{ix} - e^-{ix}}{2i}$, so we have that

$$c_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}f(x)e^{-inx}dx=\frac{1}{2\pi}\int_{-\pi}^{0}0(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})e^{-inx}dx$$

What am I supposed to do here in order to find $c_0$ and $c_n$ ?

For $c_0$, you can simply do $$c_0=\frac{1}{2\pi}\int_{0}^{\pi}\sin(x)dx.$$And $$c_n=\frac{1}{2\pi}\int_{0}^{\pi}(\frac{e^{ix} - e^{-ix}}{2i})e^{-inx}dx=\frac{1}{4\pi i}\int_{0}^{\pi}e^{ix(1-n)} - e^{-ix(1+n)}dx\\=\frac{1}{4\pi i}\left[\int_{0}^{\pi}e^{ix(1-n)}dx -\int_{0}^{\pi} e^{-ix(1+n)}dx\right]$$ and integrating by parts.

The above evaluates to $$c_n=\frac{1+e^{-i\pi n}}{2\pi(1-n^2)}.$$

EDIT: Something important missing so I add some more lines.

Bare in mind that the function is periodic on $\Large (-\pi,\pi]$, $$f(x)=\sum_{n=-\infty}^{\infty} c_ne^{inx}$$where $$c_n=\begin{cases} \frac{i}{4}&n=-1\\ -\frac{i}{4}&n=1\\ \frac{1}{\pi(1-n^2)}&n=2k\,\,\text{for some integer}\,k;k\ne1,-1\\ 0&\text{otherwise} \end{cases}$$ Since $$\frac{1}{4\pi i}\left[\int_{0}^{\pi}e^{ix(1-1)}dx -\int_{0}^{\pi} e^{-ix(1+1)}dx\right]=\frac{1}{4\pi i}\left[\pi -0\right]=\frac{-i}{4}.$$

• So for $c_0$ I have that $\frac{1}{2 \pi} \left[\int_0^\pi sin(x)dx \right] = \frac{1}{2\pi} \left[-cos(x) \right]_{0}^{\pi} = \frac{1}{2\pi} \cdot 2= \frac{1}{\pi}$ To find the $c_n$ coefficient you have $$\frac{1}{4\pi i}\left[\int_{0}^{\pi}e^{ix(1-n)}dx -\int_{0}^{\pi} e^{-ix(1+n)}dx\right]$$ you simply integrate by parts and then we have the $c_n$ coefficient? – Martin Winther Jun 6 '18 at 14:54
• Correct. Of course you'll have to simplify the expression at the end. Also you have to separate odd cases of $n$, including $n=1,-1$ in your final answer. They're all zero. – poyea Jun 6 '18 at 14:59
• Okay thank you for you answer! One last question, if you were to calculate $c_1$ would you calculate it by just changing $n=1$ and calculate it the same way as for $c_0$ and $c_n$? – Martin Winther Jun 6 '18 at 15:10
• @MartinWinther Yes in general. But in this question $c_i=0\,\forall \,\text{odd}\,i$. – poyea Jun 6 '18 at 15:16
• Hmmm I tried to calculate $c_1$ and I get that: $c_1 = -\frac{i}{4}$ and for $c_{-1} = \frac{i}{4}$ – Martin Winther Jun 6 '18 at 18:06

I suggest that you use the fact that a primitive of $e^{i(1-n)x}$ is $\frac{e^{i(n-1)x}}{i(1-n)}$ (unless $n=1$) and that a primitive of $e^{-i(n+1)x}$ is $-\frac{e^{-i(n+1)x}}{i(n+1)}$ (unless $n=-1$).

• I am not so familiar with that the that use, however, can I use the fact that $e^{i\pi n} = (-1)^n$? – Martin Winther Jun 6 '18 at 14:09
• Since it is true, of course you can use it. – José Carlos Santos Jun 6 '18 at 14:10