# Does this residue trick work?

When I have to evaluate an integral by means of residues I sometimes find this shortcut useful. Let's say I need to integrate $$I = \int_{-\infty}^{+\infty} \frac{x^2}{x^4+6x^2+13}dx$$ I would normally go with the starndard procedure of taking the limit of the integral on the semincircle $[-R,R] \cup \{Re^{it} : t \in [0,\pi)\}$ in the upper plane and evaluate it with residues. Though if I make the substituition $y = x^2$ I get $$I = \frac{1}{2}\int_{-\infty}^{+\infty} \frac{\sqrt y}{y^2+6y+13}dy$$ which is far easier to compute by the same procedure with residues. The integrand though is not a rational function anymore, so the question is: am I allowed to compute the second integral with the semicircle path as as I would do for the first one? I'd say it's legitimate, the integrand on the arc $Re^{it}$ tends to zero as R tends to intinity and the poles are just determined by the denominator, which is still a polinomial. By the way using this method I get $I = \pi \sqrt{-3+2i}/8$

The new function is not analytic. It is not even differentiable at $0$. So, you cannot use the residue theorem.

• A superficial problem, easily fixed by also using a semicircle about the origin. – Hurkyl Jun 29 '17 at 17:49
• As @Hurkyl notes, this is a solvable problem, yes, although to overlook the issue and its resolution might lead to fatal errors, depending. In fact, the well-known key-hole contour trick (in another answer) exactly exploits this seeming hazard. – paul garrett Jun 29 '17 at 19:06

Your final answer of $\pi\sqrt{-3+2i}/8$ answers your question. The integral is clearly a positive real number, but $\pi\sqrt{-3+2i}/8$ isn't real.

$$\int_{0}^{+\infty} \frac{x^2}{x^4+6x^2+13}dx = \frac{1}{2}\int_{0}^{+\infty} \frac{\sqrt y}{y^2+6y+13}dy$$

$$\int_{-\infty}^{0} \frac{x^2}{x^4+6x^2+13}dx = \frac{1}{2}\int_{+\infty}^{0} \frac{-\sqrt y}{y^2+6y+13}dy = \frac{1}{2}\int_{0}^{+\infty} \frac{\sqrt y}{y^2+6y+13}dy$$

As others have already mentioned, the substitution in the OP is invalid. Instead, we exploit the evenness of the integrand and write

\begin{align} I&=2\int_0^\infty \frac{x^2}{x^4+6x^2+13}\,dx\\\\ &=\int_0^\infty \frac{\sqrt{x}}{x^2+6x+13}\,dx\tag1 \end{align}

We can evaluate the integral on the right-hand side of $(1)$ using complex analysis.

Let $f(z)=\frac{\sqrt z}{z^2+6z+13}$ for $z\in \mathbb{C}\setminus [0,\infty)$ with $0<\arg(z)\le 2\pi$ (i.e., We have cut the complex plane along the positive real axis).

Let $C$ be the classical "keyhole" contour where the keyhole coincides with the branch cut.

Then, we have

\begin{align} \int_0^\infty \frac{\sqrt{x}}{x^2+6x+13}\,dx&=i\pi \,\text{Res}\left(\frac{\sqrt z}{z^2+6z+13}, z=-3\pm i4\right)\\\\ &=i\pi\,\left(\frac{\sqrt {13}e^{\frac i2\text{atan2}(2,-3)}}{4i}-\frac{\sqrt {13}e^{\frac i2\left(2\pi+\text{atan2}(-2,-3)\right)}}{4i}\right)\\\\ &=\frac{\sqrt {13}\pi}{2}\cos\left(\frac12 \text{atan2}(2,-3)\right)\\\\ &=\frac{\pi}{2}\sqrt{\frac{\sqrt{13}-3}{2}} \end{align}

• Please let me know how I can improve my answer. I really want to give you the best answer I can. – Mark Viola Jun 30 '17 at 22:14

You can split the integral in partial fractions $$\frac{\frac{1}{2}+\frac{3 i}{4}}{x^2+(3-2 i)}+\frac{\frac{1}{2}-\frac{3 i}{4}}{x^2+(3+2 i)}$$ Then compute the residues for each part $$\frac{\frac{1}{2}+\frac{3 i}{4}}{2 \sqrt{-3+2 i}};\quad \frac{-\left(\frac{1}{2}-\frac{3 i}{4}\right)}{2 \sqrt{-3-2 i}}$$ and get $$2 \pi i \left(\frac{\frac{1}{4}+\frac{3 i}{8}}{\sqrt{-3+2 i}}-\frac{\frac{1}{4}-\frac{3 i}{8}}{\sqrt{-3-2 i}}\right)$$ which simplifies to $$\frac{1}{2}\, \pi \sqrt{\frac{1}{2} \left(\sqrt{13}-3\right)}$$