# Residue Theorem for odd function?

I am trying to find a way to compute:

$$\int_0^{\infty} \frac{x \sin(x) \, dx}{(x^2+1)^2}$$

I thought that I need to use residue theorem but $$\sin(x)$$ is an odd function and I do not know what to do about it.

I computed the residue for $$z=i$$ because it is the one above real axis. From my computations it is: $$(i/8) [\frac{1}{e} + e].$$

How to apply the residue theorem for that example?

• @Jean-ClaudeArbaut: it does help greatly. $\int_0^\infty\frac{\sin(x)}{\left(x^2+1\right)^2}\,\mathrm{d}x$ would be more difficult. – robjohn Feb 17 at 12:25

Let for $$t>0$$ $$I(t)= \frac{1}{t}\int\limits_0^{+\infty} \frac{x\sin tx}{(x^2+1)^2}\mathrm dx.$$ Thus, $$\left(tI(t)\right)'=\int\limits_0^{+\infty} \frac{x^2\cos tx}{(x^2+1)^2}\mathrm dx=\int\limits_0^{+\infty} \frac{(x^2+1-1)\cos tx}{(x^2+1)^2}\mathrm dx=$$ $$=\int\limits_0^{+\infty} \frac{\cos tx}{x^2+1}\mathrm dx-\int\limits_0^{+\infty} \frac{\cos tx}{(x^2+1)^2}\mathrm dx=$$ $$=\frac{\sin{tx}}{t(1+x^2)}|_0^{+\infty}+\int\limits_0^{+\infty}\frac{2x\sin{tx}}{t(x^2+1)^2}-\int\limits_0^{+\infty} \frac{\cos tx}{(x^2+1)^2}\mathrm dx=$$ $$=2I(t)-\int\limits_0^{+\infty} \frac{\cos tx}{(x^2+1)^2}\mathrm dx.$$ Thus, $$(tI(t))''=2I'(t)+\int\limits_0^{+\infty} \frac{x\sin tx}{(x^2+1)^2}\mathrm dx$$ or $$tI''(t)+2I'(t)=2I'(t)+tI(t)$$ or $$I''(t)=I(t),$$ which gives $$I(t)=C_1e^t+C_2e^{-t}.$$ Now, $$\lim_{t\rightarrow0^+}I(t)=\int\limits_0^{+\infty}\frac{x^2}{(1+x^2)^2}dx=\int\limits_0^{+\infty}\frac{x^2+1-1}{(1+x^2)^2}dx=$$ $$=\frac{\pi}{2}-\int\limits_0^{\frac{\pi}{2}}\cos^2udu=\frac{\pi}{2}-\frac{1}{2}\int\limits_0^{\frac{\pi}{2}}(1+\cos2u)du=\frac{\pi}{2}-\frac{\pi}{4}=\frac{\pi}{4}.$$ Also, $$\lim_{t\rightarrow+\infty}I(t)=0,$$ which gives $$C_1=0$$, $$C_2=\frac{\pi}{4}$$ and $$I(t)=\frac{\pi}{4e^t}.$$ Id est, $$\int\limits_0^{+\infty} \frac{x\sin x}{(x^2+1)^2}\mathrm dx=I(1)=\frac{\pi}{4e}.$$

First note that since the numerator is the product of an odd and an odd function, it is even. Which means that

$$\int_0^\infty \frac{x\sin x}{(1+x^2)^2}\:dx= \frac{1}{2}\int_{-\infty}^\infty \frac{x\sin x}{(1+x^2)^2}\:dx$$

Furthermore we have by similar reasoning that

$$\int_{-\infty}^\infty \frac{x\cos x}{(1+x^2)^2}\:dx = 0 \implies \frac{1}{2}\int_{-\infty}^\infty \frac{x\sin x}{(1+x^2)^2}\:dx = \frac{1}{2i}\int_{-\infty}^\infty \frac{xe^{ix}}{(1+x^2)^2}\:dx$$

From this set the contour to be a large semicircle in the upper half plane. The even/odd function shenanigans were important because otherwise if we had used a quarter circle, our poles would have been on the contour.

The integral on the circular contour vanishes by dominated convergence, etc, so all we need to find are the residues and multiply by $$2\pi i$$. We have a pole of order $$2$$ located at $$z=i$$:

$$\frac{d}{dz}\left(\frac{ze^{iz}}{(z+i)^2}\right)\Biggr|_{z=i}=\frac{(2i)^2(e^{-1}-e^{-1})-2ie^{-1}(2i)}{(2i)^4}=\frac{1}{4e}$$

The original integral then is

$$\pi\left(\frac{1}{2\pi i}\int_{-\infty}^\infty \frac{xe^{ix}}{(1+x^2)^2}\:dx\right) = \frac{\pi}{4e}$$

It helps to use Euler's formula: For $$z\in \mathbb C\setminus\{\pm i\}$$, let $$f(z)=\frac{z e^{i z}}{(z^2+1)^2}.$$ Then $$\frac{x \sin x}{(x^2+1)^2}=\Im(f(z))$$, where $$\Im$$ denotes the imaginary part. Also, it should be noted that your function is even because $$(1+x^2)^2$$ is even and $$x \sin x$$ is even.

So $$\int_0^\infty\frac{x \sin x \,\mathrm dx}{(x^2+1)^2}=\frac12\int_{-\infty}^\infty\frac{x \sin x \,\mathrm dx}{(x^2+1)^2}=\Im\left(\int_{-\infty}^\infty f(z)\,\mathrm dz\right).$$

Now we can use a standard semi-circular contour $$\Gamma_R$$ with radius $$R$$, consisting of $$[-R,R]$$ and the semi-circular part $$C_R$$. Now notice that by Jordan's lemma we have $$\int_{C_r} f(z)\,\mathrm dz\le \pi M_R$$, where $$M_R=\max_{\theta\in[0,\pi]} \left\lvert \frac{Re^{i\theta}}{(1+(1+Re^{i\theta})^2)^2}\right\rvert$$ which goes to $$0$$ very rapidly as $$R$$ goes to $$\infty$$. So it follows from the residue Theorem that $$\int_{-\infty}^\infty f(z)\,\mathrm dz=\lim_{R\to\infty} \int_{\Gamma_R} f(z)\,\mathrm dz=2\pi i \operatorname{Res}_{z=i} f(z)=\frac{2\pi i}{4e},$$ where I have used $$\operatorname{Res}_{z=i} f(z)=\lim_{z\to i} \frac{\mathrm d}{\mathrm dz}[f(z)\cdot (z-i)^2]=\lim_{z\to i} \frac{i e^{i z} \left(z^2+2 i z+1\right)}{(z+i)^3}=\frac1{4e}$$

Your integral is equal to$$\frac12\operatorname{Im}\left(\int_{-\infty}^\infty\frac{xe^{ix}}{(x^2+1)^2}\,\mathrm dx\right).$$The integral$$\int_{-\infty}^\infty\frac{xe^{ix}}{(x^2+1)^2}\,\mathrm dx$$can be computed through the residue theorem and the standard methdo of computing the integral from $$-R$$ to $$R$$ ($$R>1$$) followed by the integral from $$R$$ to $$-R$$ along a half-circle through the upper half-plane. Use the fact that$$\operatorname{res}_{z=i}\frac{ze^{iz}}{(z^2+1)^2}=\frac1{4e}.$$