In my exam i have got a problem with Lebesgue integration of $$\int_0^\pi \sum_{k=0}^\infty \frac{(-1)^k}{x+k\pi}\sin\ (x)\ dx$$
The hint i got is saying me that i should calculate this as a limit: $$\lim_{a \to 0}\int_0^\pi \sum_{k=0}^\infty \frac{(-1)^k}{x+k\pi} e^{-a(x+k\pi)}\sin\ (x)\ dx$$ I don't really know which sum and integral would be good to interchange and where to start. I would appreciate any of your help, thanks.
Let us consider $$I=\int_{0}^{\pi}\sum_{k\geq0}\frac{\left(-1\right)^{k}}{x+k\pi}e^{-a\left(x+k\pi\right)}\sin\left(x\right)dx,\, a>0. $$ Since the series converges absolutely, we have $$I=\sum_{k\geq0}\int_{0}^{\pi}\frac{\left(-1\right)^{k}e^{-a\left(x+k\pi\right)}\sin\left(x\right)}{x+k\pi}dx\sup\stackrel{u=x+k\pi}{=}\sum_{k\geq0}\int_{k\pi}^{\left(k+1\right)\pi}\frac{\left(-1\right)^{k}e^{-au}\sin\left(u-k\pi\right)}{u}dx $$ and now since $\sin\left(u-k\pi\right)=\left(-1\right)^{k}\sin\left(u\right) $ we have$$ I=\int_{0}^{\infty}\frac{e^{-au}\sin\left(u\right)}{u}du. $$ Now let us consider the integral $$\int_{0}^{\infty}e^{-au}\sin\left(u\right)du=\textrm{Im}\left(\int_{0}^{\infty}e^{u(i-a)}du\right)=\textrm{Im}\left(\frac{1}{i-a}\right)=\frac{1}{a^{2}+1} $$ hence $$\int_{0}^{\infty}\frac{e^{-au}\sin\left(u\right)}{u}du=\int_{a}^{\infty}\int_{0}^{\infty}e^{-au}\sin\left(u\right)duda=\frac{\pi}{2}-\arctan\left(a\right) $$ so $$\int_{0}^{\pi}\sum_{k\geq0}\frac{\left(-1\right)^{k}}{x+k\pi}\sin\left(x\right)dx=\lim_{a\rightarrow0^{+}}\int_{0}^{\pi}\sum_{k\geq0}\frac{\left(-1\right)^{k}}{x+k\pi}e^{-a\left(x+k\pi\right)}\sin\left(x\right)dx=\color{red}{\frac{\pi}{2}}. $$