Sum and integral. Swap?

144 Views Asked by At

I have that $$f(x)=\sum_{n=-\infty}^{\infty}\left(\left(\frac{1}{1+n^2}\right)e^{inx}\right)\text{.}$$ Then I have to find $\int_{-\pi}^{\pi}f\,\mathrm{d}x$.

Wolfram Alpha give me $$\int_{-\pi}^{\pi}\frac{e^{inx}}{1+n^2}\,\mathrm{d}x=\frac{2\sin(\pi n)}{n^3+n}\text{.}$$ And if I take the sum of it I get: $$\sum_{n=-\infty}^{\infty}\frac{2\sin(\pi n)}{n^3+n}=2\pi\text{.}$$ So $\int_{-\pi}^{\pi}f\,\mathrm{d}x=2\pi$. Is that correct? I think I can swap the sum and integral? If it is correct how can I formally show it?