How do I use residue theorem to evaluate this improper integral to get a good looking solution?

The problem is $\int_{0}^{\infty} \frac{\sqrt{x}}{x^2+2x+5}dx$ I replace x with z, and did some algebra, but the solution was rather nasty. it contains exponential and arctan such and such. However, the solution given was $\frac{\pi}{2\sqrt{2}}{\sqrt{\sqrt{5}-1}}$. It was pretty neat and I have no idea how I could convert my solution to that form.

• What contour did you consider? – science Apr 9 '15 at 4:41
• The first step is to get rid of the square root, by making the substitution $x = y^2$. Next step is to extend the integration to $(-inf, +inf)$. Third step is to identify the poles (singularities) in the denominator. Fourth step is to apply contour integration in the complex plane, and use the residue theorem. – M. Wind Apr 9 '15 at 4:41
• I considered a "keyhole" contour and let $\epsilon$ tend to 0 and R tend to infinity – metricspace Apr 9 '15 at 5:11

Notice first that $$\int_0^\infty\frac{\sqrt{x}}{x^2+2x+5}\,dx\stackrel{x=u^2}{=}\int_0^\infty\frac{2u^2}{u^4+2u^2+5}\,du=\int_{-\infty}^\infty f(x)\,dx$$ where $$f(z)=\frac{z^2}{z^4+2z^2+5}.$$ The function $f$ has 4 simple poles at $a,-a,\bar{a}$, and $-\bar{a}$, with $$a=\sqrt{\frac{\sqrt{5}-1}{2}}+i\sqrt{\frac{\sqrt{5}+1}{2}}$$ Given $R>|a|$, we denote by $\Delta(R)$ the bounded region of $\mathbb{C}$ whose boundary consists of the segment $[-R,R]$ and the upper half circle $C_R:=\{Re^{it}:\, 0\le t\le \pi\}$.

Since $a,-\bar{a}\in \Delta(R)$, thanks to the Residue Theorem we have: \begin{eqnarray} \int_{\Delta(R)}f(z)\,dz&=&2\pi i\left(\mathrm{Res}(f,a)+\mathrm{Res}(f,-\bar{a})\right)\\ &=&2\pi i\left[\frac{a^2}{2a(a-\bar{a})(a+\bar{a})}+\frac{\bar{a}^2}{2\bar{a}(a+\bar{a})(a-\bar{a})}\right]\\ &=&\pi i\left[\frac{a}{(a-\bar{a})(a+\bar{a})}+\frac{\bar{a}}{(a+\bar{a})(a-\bar{a})}\right]\\ &=&\frac{\pi i}{a-\bar{a}}=\frac{\pi i}{2i\Im a}=\frac{\pi }{\sqrt{2(\sqrt{5}+1)}}=\pi\frac{\sqrt{\sqrt{5}-1}}{2\sqrt{2}}. \end{eqnarray} It follows that $$\pi\frac{\sqrt{\sqrt{5}-1}}{2\sqrt{2}}=\int_{-R}^R f(x)\,dx+\int_0^\pi \frac{iR^3e^{i3t}}{R^4e^{4it}+2R^2e^{2it}+5}\,dt \quad \forall R>|a|.$$ For every $R>\max\{|a|,\sqrt{+1\sqrt{6}}\}$ we have $$\left|\int_0^\pi \frac{iR^3e^{i3t}}{R^4e^{4it}+2R^2e^{2it}+5}\,dt \right|\le \int_0^\pi \frac{R^3}{R^4-2R^2-5}\,dt= \frac{\pi R^3}{R^4-2R^2-5} \to 0 \mbox{ as } R\to \infty,$$ and we deduce that \begin{eqnarray} \int_0^\infty\frac{\sqrt{x}}{x^2+2x+5}\,dx&=&\int_{-\infty}^\infty f(x)\,dx=\lim_{R\to\infty}\int_{-R}^Rf(x)\,dx\\ &=&\lim_{R\to\infty}\left[\pi\frac{\sqrt{\sqrt{5}-1}}{2\sqrt{2}}-\int_0^\pi \frac{iR^3e^{i3t}}{R^4e^{4it}+2R^2e^{2it}+5}\,dt \right]\\ &=&\pi\frac{\sqrt{\sqrt{5}-1}}{2\sqrt{2}}. \end{eqnarray}

Suppose we seek to evaluate $$J = \int_0^\infty \frac{\sqrt{x}}{x^2+2x+5} dx$$

using a keyhole contour and the function $$f(z) = \frac{\exp(1/2\log(z))}{z^2+2z+5}$$

with the branch cut of the logarithm on the positive real axis and the argument from $0$ to $2\pi.$

We obtain that $$J (1- e^{\pi i}) = 2\pi i \left(\mathrm{Res}_{z=\rho_1} f(z) + \mathrm{Res}_{z=\rho_2} f(z)\right)$$

where $\rho_{1,2} = -1\pm 2i.$

The two residues are

$$\frac{\exp(1/2\log(\rho_{1,2}))}{2\rho_{1,2} + 2}.$$

Let $\rho_1 = \sqrt{5} \exp(i\theta)$ with $0\lt\theta\lt \pi$ so that $\rho_2 = \sqrt{5} \exp(2\pi i - i\theta)$ with the chosen branch of the logarithm.

This gives $$\mathrm{Res}_{z=\rho_1} f(z) = \frac{5^{1/4} \exp(1/2 i\theta)}{2\rho_1+2} = \frac{5^{1/4} \exp(1/2 i\theta)}{4i}$$ and $$\mathrm{Res}_{z=\rho_2} f(z) = - \frac{5^{1/4} \exp(-1/2 i\theta)}{2\rho_2+2} = \frac{5^{1/4} \exp(-1/2 i\theta)}{4i}.$$

Collecting everything we obtain $$\pi i \times \frac{5^{1/4}}{2i} \cos(1/2\theta) = \pi \frac{5^{1/4}}{2} \cos(1/2\theta).$$

This is $$\pi \frac{5^{1/4}}{2} \sqrt{\frac{1+\cos\theta}{2}} = \pi \frac{5^{1/4}}{2} \sqrt{\frac{1-1/\sqrt{5}}{2}} = \frac{\pi}{2} \sqrt{\frac{\sqrt{5}-1}{2}}.$$