How to integrate $\int_0^\infty \left( \frac{\sin az}{z^2+1}\right)^2 dz$ I have to evaluate the following integral for $a>0$:
$$\int_0^\infty \left( \frac{\sin az}{z^2+1}\right)^2 dz$$
I don't exactly know how to do this kind of integral. But I think I need to use the residue theorem. Maybe I could use the trick $\cos(2a) = 1 - \sin^2(a)$, but that makes the integral much more difficult I think.
 A: The integral can be worked out without the residual theorem. Note
\begin{align}
& I(a)=\int_0^\infty \left( \frac{\sin az}{z^2+1}\right)^2 dz\\
& I’(a)=\int_0^\infty \frac{z\sin(2az)}{(z^2+1)^2}dz
\overset{IBP}= \int_0^\infty \frac{a\cos(2az)}{z^2+1}dz
\end{align}
Next, let $J(b) = \int_0^\infty \frac{\sin(bz)}{z(z^2+1)}dz $ and
$$J’’(b) = \int_0^\infty \frac{\sin(bz)}{z(z^2+1)}dz - \int_0^\infty \frac{\sin(bz)}zdz =J(b) - \frac\pi2
$$
Solve to get $J(b) = \frac\pi2(1-e^{-b})$ and
$I’(a) = a J’(b)|_{b=2a}=\frac\pi2a e^{-2a}$. Then
$$I(a)= \int_0^a I’(s)ds = \frac\pi2 \int_0^a se^{-2s}ds= \frac\pi8-\frac\pi8(1+2a)e^{-2a}
$$
A: Since$$\sin(az)=\frac{e^{iaz}-e^{-iaz}}{2i},$$and since you are integrating an even function, your integral is equal to\begin{multline}-\frac18\int_{-\infty}^\infty\frac{e^{2iaz}+e^{-2iaz}-2}{(z^2+1)^2}\,\mathrm dz=\\=-\frac18\left(\int_{-\infty}^\infty\frac{e^{2iaz}}{(z^2+1)^2}\,\mathrm dz+\int_{-\infty}^\infty\frac{e^{-2iaz}}{(z^2+1)^2}\,\mathrm dz-\int_{-\infty}^\infty\frac2{(z^2+1)^2}\,\mathrm dz\right).\end{multline}Now, let us see how to compute these integrals. First of all, since $a>0$,\begin{align}\int_{-\infty}^\infty\frac{e^{2iaz}}{(z^2+1)^2}\,\mathrm dz&=2\pi i\operatorname{res}\left(i,\frac{e^{2iaz}}{(z^2+1)^2}\right)\\&=2\pi i\left(-\frac14i(2a+1)e^{2a}\right)\\&=\frac12\pi(2a+1)e^{-2a}.\end{align}It is a real number. Since the second integral is the conjugate of the first one, it is equal to the same number. Finally\begin{align}\int_{-\infty}^\infty\frac2{(z^2+1)^2}\,\mathrm dz&=2\pi i\operatorname{res}\left(i,\frac2{(x^2+1)^2}\right)\\&=2\pi i\left(-\frac i2\right)\\&=\pi.\end{align}And so\begin{align}\int_0^\infty\frac{\sin^2(ax)}{(x^2+1)^2}\,\mathrm dx&=-\frac18\left(2\times\frac12\pi(2a+1)e^{-2a}-\pi\right)\\&=\frac18\pi\left(1-(2a+1)e^{-2a}\right).\end{align}
A: Consider the integral
$I=\frac{1}{2}\oint_C \frac{1-e^{i2az}}{(z^2+1)^2}dz$\
where $C=C_R\cup (-R,R)$ and $R$ is large enough to enclose all the singularities of the integrand lying in upper half plane.
Then,
$I=\int_{C_R}f(z)dz+ \int_{-R}^{R}f(x)dx$
$\implies 2\pi i\times Res(f(z);z=i)=\int_{C_R} +\int_{-R}^R$
The first integral on RHS vanishes as $R\rightarrow \infty$ by Jordan's lemma.
$2\pi i.Res(f(z);z=i)=\int_{-\infty}^\infty \frac{1-e^{i2ax}}{(x^2+1)^2}dx$
Equate real parts on both sides to get the required integral.
