I tried couple of times to compute $\int_{-\pi}^{\pi}\sin(nx)e^{inx}$. According to W.A it should be $-\pi i$, I'm losing my mind trying to understand where I got wrong.
Assuming the whole process that $e^{-in \pi}=\cos(n \pi)-i \sin(n\pi)=(-1)^{n}$, and $[\cos(nx)e^{-inx}]_{-\pi}^{\pi}$=0.
Here is what I did:
$\int_{-\pi}^{\pi}\sin(nx)e^{inx}=[\frac{(-\cos(nx))}{n}e^{-inx}]_{-\pi}^{\pi}-\int_{-\pi}^{\pi}\frac{ine^{-inx}\cos(nx)}{n}=-\frac{1}{n}[\cos(nx)e^{-inx}]_{-\pi}^{\pi}-\int_{-\pi}^{\pi}ie^{-inx}\cos(nx)e^{inx}=0-i[\frac{e^{-inx}}{-in}]_{-\pi}^{\pi}\cos(nx)=0.$
I'd really love to understand what is wrong with that.
Thank you very much.