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?
Solution 1:
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)$$
which agrees with M.N.C.E.'s answer.
Solution 2:
\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}
Solution 3:
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} $$