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$ ? 
 A: 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$).
A: 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}.$$
