# Evaluating $\int_{-\infty}^{\infty}\frac{\sin ax-a \sin x}{x^3(x^2+1)} \ dx$ using contour integration

How would you compute the integral $$\int_{-\infty}^\infty \frac{\sin ax-a\sin x}{x^3(x^2+1)} \ dx ?$$ We will integrate along two circular contours and a striaghtline section between them.(Half donut shape) In the solution my professor give, it stated consider the function $$g(z)=\frac{-1+a+e^{iaz}-ae^{iz}}{z^3(z^2+1)}$$ instead of $$f(z)=\frac{e^{iaz}-ae^{iz}}{z^3(z^2+1)}$$ because $g$ has simple poles at the real lines. However, the result when we calculate the residue at $i$ is different. I checked the answer using Wolfram, the calculation using $g$ is the correct answer. Can someone explain why?

• So which one should you use to compute the integral $g$? but that is not the same function as our original integral. – amathnerd Jan 5 '15 at 3:44
• What I stated previously was not correct. I was looking at just a particular value of $a$. In the first case, $\lim_{r \to 0} \int_{\pi}^{0} g(re^{it}) \ ir e^{it} dt = -\pi i \ \text{Res}[g(z),0]$ since $g(z)$ has a simple pole at the origin. But it can also be shown by expanding $f(z)$ in a Laurent series at the origin and integrating termwise that $\lim_{r \to 0} \int_{\pi}^{0} f(re^{it}) \ ir e^{it} dt = - \pi i \ \text{Res} [f(z),0]$ even though $f(z)$ has a pole of order $3$ at the origin. And $$\text{Im} \ g(x) = \text{Im} \ f(x) = \frac{\sin (ax) - a \sin(x)}{x^{3}(x^{2}+1)}.$$ – Random Variable Jan 5 '15 at 14:48

I'm going to expand on my comment about why we can consider the function $$f(z) = \frac{e^{iaz}-ae^{iz}}{z^3(z^2+1)} \ , \ a >0$$ and that half-donut-shaped contour even though $f(z)$ has a pole of order $3$ at the origin.

Assume that a function $h(z)$ has a Laurent expansion at $z=z_{0}$ of the form $$\sum_{k=-n}^{-1} a_{2k+1} (z-z_{0})^{2k+1} + \sum_{k=0}^{\infty} a_{k}(z-z_{0})^{k}.$$

And let $C_{r}$ be a semicircle centered at $z=z_{0}$ of radius $r$.

Then $$\lim_{r \to 0} \int_{C_{r}}h(z) \ dz = - i \pi \ \text{Res}[f(z),z_{0}]$$ if $C_{r}$ is traversed clockwise.

For a proof see this question, particularly Daniel Fischer's first comment.

Now if we expand $\displaystyle f(z)=\frac{e^{iaz}-ae^{iz}}{z^3(z^2+1)}$ in a Laurent series at the origin (as M.N.C.E. did in the other answer) we get $$f(z) = \frac{1-a}{z^{3}} + \frac{-a^{2}+3a-2}{2z} + \mathcal{O}(1).$$

So the above lemma is applicable.

Then integrating around that half-donut-shaped contour and applying both the above lemma and Jordan's lemma,

\begin{align} \text{PV} \int_{-\infty}^{\infty} \frac{e^{iax}-ae^{ix}}{x^{3}(1+x^{2})} \ dx - i \pi \left(\frac{-a^{2}+3a-2}{2} \right) &= 2 \pi i \ \text{Res}[f(z), i] \\ &= 2 \pi i \ \lim_{z \to i} \frac{e^{iaz} - a e^{iz}}{z^{3}(z+i)} \\ &= \pi i \left(e^{-a}-ae^{-1} \right). \end{align}

And equating the imaginary parts on both sides of the equation,

$$\int_{-\infty}^{\infty} \frac{\sin(ax)-a \sin(x)}{x^{3}(1+x^{2})} \ dx = \pi \left(e^{-a}-ae^{-1} - \frac{a^{2}-3a+2}{2} \right)$$

\begin{align} &\int^\infty_{-\infty}\frac{\sin(ax)-a\sin{x}}{x^3(1+x^2)}dx\\ =& \, \, \frac{1}{2i}\lim_{\epsilon\to 0}\left(\int^\infty_{-\infty}\frac{e^{iax}-ae^{ix}}{(x-i\epsilon)^3(1+x^2)}dx-\int^\infty_{-\infty}\frac{e^{-iax}-ae^{-ix}}{(x-i\epsilon)^3(1+x^2)}dx\right)\tag1\\ =& \, \,\pi\lim_{\epsilon\to0}\left(\operatorname*{Res}_{z=i\epsilon}\frac{e^{iaz}-ae^{iz}}{(z-i\epsilon)^3(1+z^2)}+\operatorname*{Res}_{z=i}\frac{e^{iaz}-ae^{iz}}{(z-i\epsilon)^3(1+z^2)}\color{red}{+}\operatorname*{Res}_{z=-i}\frac{e^{-iaz}-ae^{-iz}}{(z-i\epsilon)^3(1+z^2)}\right)\tag2\\ =& \, \,\pi\left(-\frac{a^2-3a+2}{2}+\frac{e^{-a}-ae^{-1}}{2}+\frac{e^{-a}-ae^{-1}}{2}\right)\tag3\\ =& \, \,\pi\left(e^{-a}-ae^{-1}-\frac{a^2-3a+2}{2}\right) \end{align}

Explanation:

$(1)$: Moved the pole into the upper half plane and expanded $\sin$ in terms of complex exponentials.
$(2)$: Applied the residue theorem. For the first integral in $(1)$, close the contour along the upper half of $|z|=R$, hence picking up the residues at $z=i\epsilon$ and $z=i$. For the second integral in $(1)$, close the contour along the lower half of $|z|=R$, hence picking up the residue at $z=-i$. By Jordan's lemma, the integral along both arcs vanishes.
$(3)$: Applied the limit and computed the residues. To evaluate the residue at $z=0$, \begin{align} \operatorname*{Res}_{z=0}\frac{e^{iaz}-ae^{iz}}{z^3(1+z^2)} &=[z^2]\frac{e^{iaz}-ae^{iz}}{1+z^2}\\ &=[z^2]\left(1-a-\frac{1}{2}(a^2-a)z^2+\mathcal{O}(z^3)\right)\left(1-z^2+\mathcal{O}(z^4)\right)\\ &=a-1-\frac{1}{2}(a^2-a)\\ &=-\frac{a^2-3a+2}{2} \end{align}

The reason why $g$ gives the correct answer is that \begin{align} \sin(ax)-a\sin(x)&=\frac1{2i}\left(\vphantom{\frac1{2i}}\left[e^{iax}-e^{-iax}\right]-\left[ae^{ix}-ae^{-ix}\right]\right)\\ &=\frac1{2i}\left(\vphantom{\frac1{2i}}\left[e^{iax}-ae^{ix}\right]-\left[e^{-iax}-ae^{-ix}\right]\right)\\ &=\frac1{2i}\left(\vphantom{\frac1{2i}}\left[\color{#0000FF}{-1+a}+e^{iax}-ae^{ix}\right]-\left[\color{#0000FF}{-1+a}+e^{-iax}-ae^{-ix}\right]\right)\\ \end{align} In fact, we cannot perform the integral using $f$ and the half-doughnut contour without showing that the $\frac1{z^2}$ term of $f(z)$ is $0$. Expanding, we get $$\frac{e^{iaz}-ae^{iz}}{z^3(z^2+1)}\sim\frac{1-a}{z^3}-\frac{a^2-3z+2}{2z}-i\frac{a^3-a}6+O(z)$$ Furthermore, we need to show that for the small semi-circle $\gamma=re^{i[0,\pi]}$, \begin{align} \int_\gamma\frac{\mathrm{d}z}{z^3} &=\left[-\frac1{2z^2}\right]_{+r}^{-r}\\ &=0 \end{align} Thus, as RandomVariable has noted previously, we can do the integral either with or without the addition of $-1+a$, but with the $-1+a$, we only have to deal with simple poles.

Regarding the change in the residues at $i$ and $-i$, those changes are cancelled by the change in the residue at $0$. In fact, \begin{align} \operatorname*{Res}_{z=0}\frac{-1+a}{z^3(z^2+1)}&=(1-a)\\ \operatorname*{Res}_{z=i}\frac{-1+a}{z^3(z^2+1)}&=-\frac{1-a}2\\ \operatorname*{Res}_{z=-i}\frac{-1+a}{z^3(z^2+1)}&=-\frac{1-a}2 \end{align}

However, by moving the contour away from the singularities things become simpler.

Since $\dfrac{\sin(az)-a\sin(z)}{z^3(z^2+1)}$ is bounded in the rectangle $$[-R,R]\cup R+[0,i/2]\cup[R,-R]+i/2\cup-R+[i/2,0]$$ we get that all singularities are removable. Therefore, $$\int_{-\infty}^\infty\frac{\sin(ax)-a\sin(x)}{x^3(x^2+1)}\,\mathrm{d}x =\int_{-\infty+i/2}^{\infty+i/2}\frac{\sin(az)-a\sin(z)}{z^3(z^2+1)}\,\mathrm{d}z$$ Using the contours \begin{align} \gamma_+&=[-R,R]+i/2\cup Re^{i[0,\pi]}+i/2\\ \gamma_-&=[-R,R]+i/2\cup Re^{-i[0,\pi]}+i/2 \end{align} where $\gamma_+$ circles the singularity at $i$ counterclockwise and $\gamma_-$ circles the singularities at $0$ and $-i$ clockwise, we get \begin{align} \int_{-\infty}^\infty\frac{\sin(ax)-a\sin(x)}{x^3(x^2+1)}\,\mathrm{d}x &=\frac1{2i}\int_{\gamma_+}\frac{e^{iaz}-ae^{iz}}{z^3(z^2+1)}\,\mathrm{d}z -\frac1{2i}\int_{\gamma_-}\frac{e^{-iaz}-ae^{-iz}}{z^3(z^2+1)}\,\mathrm{d}z\\ &=\pi\operatorname*{Res}_{z=i}\left[\frac{e^{iaz}-ae^{iz}}{z^3(z^2+1)}\right]\\ &+\pi\operatorname*{Res}_{z=0}\left[\frac{e^{-iaz}-ae^{-iz}}{z^3(z^2+1)}\right] +\pi\operatorname*{Res}_{z=-i}\left[\frac{e^{-iaz}-ae^{-iz}}{z^3(z^2+1)}\right]\\ &=\pi\left[\frac{e^{-a}-ae^{-1}}2\right]\\ &+\pi\left[-\frac{a^2-3a+2}2\right]+\pi\left[\frac{e^{-a}-ae^{-1}}2\right]\\ &=\pi\left[e^{-a}-ae^{-1}-\frac{a^2-3a+2}2\right] \end{align}

• I'm almost certain that the integral using $f(z)$ does not blow up along the small semicircle about the origin as the semicircle shrinks. It would if the Laurent expansion of $f(z)$ at the origin had $\frac{1}{z^{2n}}$ terms, but it doesn't. For geometrical reasons the integral remains finite. That was the point of my answer. Furthermore, $\text{PV} \int_{-\infty}^{\infty} \frac{1}{x^{3}} \ dx = 0$. But your statement implies that the Cauchy principal value of that integral is not finite. – Random Variable Jan 11 '15 at 15:01
• @RandomVariable: the principal value is indeed $0$, but by very precarious cancellation. My point was that the size of the integrand is not balanced by the size of the contour as it is in the case of $1/z$. – robjohn Jan 11 '15 at 15:45
• But why is that relevant here? We're dealing with a specific function and a specific contour that satisfy certain conditions. That was the point of my answer, namely to explain that those conditions were satisfied and because of that changing the function unnecessary. Your answer states explicitly that we cannot consider $f(z)$ and that doughnut contour because the integral along the small semicircle about the origin blows up as the semicircle shrinks. But that's not true. – Random Variable Jan 11 '15 at 17:01
• @RandomVariable: I am not saying that your answer is wrong. I just wanted to warn that on small contours, powers of $z$ less than $-1$ blow up faster than the size of the contour shrinks. This is what the addition of $-1+a$ suggested for the problem removes. In the special case of a semicircle centered on $0$, the integral of $z^{-3}$ is cancelled, but still care must be taken. I have made my caveat a bit more precise. – robjohn Jan 11 '15 at 18:36
• I knew the reason for introducing the $-1+a$. I evaluated an integral on here doing something similar. I just wanted to show that you actually didn't need to change the function in this particular case to use that contour. My only gripe now is that the second half of the first section of your answer is now basically just a restatement of the first part of my answer (which was posted 7 hours earlier). I linked to a question in which I prove the lemma I stated. And Daniel Fischer proves it in the comment section of that question as well. – Random Variable Jan 11 '15 at 19:05