# Choosing correct contour for $\int_{-\infty}^{\infty}\frac{x-\sin x}{x^3}\,dx$ [duplicate]

This question already has an answer here:

I am trying to compute the integral$$\int_{-\infty}^{\infty}\frac{x-\sin x}{x^3}\,dx$$

Let $f(z)=\dfrac{z-\sin z}{z^3}$. I tried to integrate this along a semi-circular contour in the upper half plane, taking the radius to $\infty$, but the $\sin z$ term explodes along the circular arc. I then thought about a rectangular contour, but then the vertical contours on the sides do not give a very nice expression.

(By the way, $f(z)$ has no singularities.)

What contour should I choose? How can you decide this will work when approaching the problem to start with?

## marked as duplicate by John Doe, Community♦Jan 29 '18 at 19:04

• You may just apply integration by parts twice to end with the classical integral $\int_{\mathbb{R}}\frac{\sin x}{x}\,dx = \pi$. – Jack D'Aurizio Jan 28 '18 at 18:42
• the result should be $$\frac{\pi}{2}$$ – Dr. Sonnhard Graubner Jan 28 '18 at 18:44
• The problem with the contour in the upper (or lower) half plane is that $\sin(x)$ diverges in both imaginary directions so the integral along the semicircle doesn't go to zero. – spaceisdarkgreen Jan 28 '18 at 18:55
• Use a small semicircle to avoid the origin. Then write $\sin z = \frac{1}{2i}\bigl(e^{iz} - e^{-iz}\bigr)$, and for the $e^{iz}$ term use a large semicircle in the upper half-plane, for $e^{-iz}$ use a large semicircle in the lower half-plane. It doesn't matter where you put the $z$ from the numerator, either part works, or if you wish you can split it. – Daniel Fischer Jan 28 '18 at 19:14
• Here it is: math.stackexchange.com/questions/2395247/… – DaveNine Jan 29 '18 at 18:54

I have put this answer together from the hint by @DanielFischer:

First consider $$I_1=\oint_{\gamma} \frac{z-\frac1{2i}e^{iz}}{z^3}\,dz$$ where $\gamma$ is a closed contour in the upper half plane, with $4$ pieces:

• $\gamma_+$ along the real line $z\in(\epsilon,R)$;
• $\gamma_R$ a semi-circular arc of radius $R$, $z=Re^{i\theta}$ for $\theta\in(0,\pi)$;
• $\gamma_-$ one along the negative real line, $z\in(-R,-\epsilon)$;
• $\gamma_\epsilon$ a semi-circular arc of radius epsilon, $z=\epsilon e^{i\theta}$ for $\theta\in(0,\pi)$.

The function in the integrand has a pole of order $3$ at $z=0$. The residue here is \begin{align}\mathop{\text{res}}_{z=0}(f(z))&=\frac1{2!}\frac{d^2}{dz^2}\left(z-\frac1{2i}e^{iz}\right)|_{z=0}\\&=\frac1{4i}\end{align}Then $$\int_{\gamma_\epsilon}\frac{z-\frac1{2i}e^{iz}}{z^3}\,dz=-i\pi\cdot\mathop{\text{res}}_{z=0}\left(\frac{z-\frac1{2i}e^{iz}}{z^3}\right)=-\frac\pi4$$ Here, the minus sign comes since $\gamma_\epsilon$ is clockwise. It can be shown that $\int_{\gamma_R} \frac{z-\frac1{2i}e^{iz}}{z^3}\,dz\to0$ as $R\to\infty$.

Next consider $$I_2=\oint_{\gamma} \frac{e^{-iz}}{2iz^3}\,dz$$ where this time, $\gamma$ is a closed contour in the lower half plane with $4$ pieces as above (but reflected in the $\Re$-axis). This also has a pole of order $3$ at $0$. It can be shown in a similar way to above that the residue here is $-\frac1{4i}$. Again, we get that along the radius-$\epsilon$ contour, this integral evaluates to $-\frac1{4i}$, since the residue changes sign, and the orientation of the contour changes to anticlockwise. Also, the integral along the radius-$R$ contour goes to $0$ too.

Putting this all together, $$I_1+I_2=0\\\int_{-\infty}^\infty \frac{x-\frac1{2i}e^{ix}}{x^3}\,dx-\frac\pi4+\int_{-\infty}^\infty \frac{e^{-ix}}{2ix^3}\,dx-\frac\pi4=0\\\implies\int_{-\infty}^{\infty}\frac{x-\sin x}{x^3}\,dx=\frac\pi2$$which agrees with @JackD'Aurizio and @Dr.SonnhardGraubner 's results.