I tried to calculate the complex Fourier series of $f(x)=e^{-x}~~(-1<x≤1),~~f(x+2)=f(x)$ but there's a point that I don't understand.
I calculated $C_n$ and formed like this $$C_n=\frac{1}{2}\int_{-1}^1e^{-(1+in\pi)x}dx\\=\frac{1}{2}(\frac{e^{1+in\pi}}{1+in\pi}-\frac{e^{-(1+in\pi)}}{1+in\pi})$$ but the answer is $f(x)\sim \frac{e^2-1}{2e}\sum_{n=-\infty}^{\infty}\frac{(-1)^n}{1+in\pi}e^{in\pi x}$ I know I should apply $\cos(z)=\frac{e^{iz}+e^{-iz}}{2}$ but how should I apply this and transform like this answer? I'm confused. Can someone tell me how to do that? Thank you in advance.
You got the Fourier coefficient $$ C_n=\frac{1}{2}\left(\frac{e^{1+in\pi}}{1+in\pi}-\frac{e^{-(1+in\pi)}}{1+in\pi}\right). $$ Now $e^{\pm in\pi}=(e^{\pm i\pi})^n=(-1)^n$ and in general $e^{a+b}=e^ae^b$, so in fact $$ C_n = \frac{1}{2}(-1)^n\frac{e-e^{-1}}{1+in\pi} = \frac{e^2-1}{2e}(-1)^n\frac{1}{1+in\pi} . $$ If you sum these up, you get exactly the formula you quote.