The question is to find the complex Fourier series expansion of
$$ f(x) = x , -\pi < x < \pi $$ I solved for $C_n$ and got:
$$ C_n = \frac{1}{n}(-1)^n - \frac{1}{\pi n^2 } \sin(n \pi ) $$
But I saw a solution online and saw that they got:
$$ C_n = \frac{i}{n}(-1)^n - \frac{i}{\pi n^2 } \sin(n \pi ) $$
$$ f(x) = \sum_{n = -\infty}^{\infty} \left( \frac{i}{n}(-1)^n - \frac{i}{\pi n^2 } \sin(n \pi )\right)e^{inx} $$
Can someone tell me why the numerator has an i? And also since $\sin(n \pi ) = 0$, would the answer then be:
$$ f(x) = \sum_{n = -\infty}^{\infty} \left( \frac{i}{n}(-1)^n \right)e^{inx} $$
$$c_{n}=\frac{1}{2\pi}\int_{-\pi}^{\pi}xe^{-inx}dx=\Big[\frac{i}{2n\pi}xe^{-inx}\Big]_{-\pi}^{\pi}-\frac{i}{2n\pi}\int_{-\pi}^{\pi}e^{-inx}dx=$$ $$=\frac{i}{n}\cos(\pi{n})+\frac{1}{2\pi{n}^{2}}\Big[e^{-inx}\Big]_{-\pi}^{\pi}=$$ $$=\frac{i}{n}\cos(\pi{n})-\frac{i}{\pi{n}^{2}}\sin(\pi{n})=\frac{i}{n}(-1)^{n}$$