Fourier series of function $f(x)=0$ if $-\pi<x<0$ and $f(x)=\sin(x)$ if $0<x<\pi$

The $\sin$ term comes form $n=1$ you can't devide by zero.

mh I calculated again, your $\cos(x)$ terms are right, there shouldn't be a $-$ in the denominator

For $$\int_0^\pi \sin(x) e^{inx}\, \mathrm{d} x = \frac{1+ e^{i \pi n}}{1-n^2}$$ we have to check the case $n=1$ seperate as we can't devide by zero.

The case $n=1$ give $$\int_0^\pi \sin(x) \exp(x)\, \mathrm{d}x=\frac{i \pi }{2}$$