Integrate $$\int_{0}^{\infty} \frac{x^{a}}{1+x^{2}} \mathrm{d}x$$

How to evaluate this integral was a question at Mathematics Stack Exchange. The first method we present was already answered at MSE but here we fill in the missing steps.

Method 1

Let $$z=x^2$$
\begin{align}
\int\limits_{0}^{\infty} \frac{x^{a}}{1+x^{2}} \mathrm{d}x
&= \frac{1}{2} \int\limits_{0}^{\infty} z^{(a-1)/2} \frac{\mathrm{d}z}{1+z} \\
\tag{a}
&= \frac{1}{2} \mathrm{B}\left(\frac{a+1}{2}, 1-\frac{a+1}{2} \right) \\
\tag{b}
& = \frac{1}{2} \Gamma\left(\frac{a+1}{2}\right) \Gamma\left(1-\frac{a+1}{2}\right) \\
\tag{c}
&= \frac{\pi}{2\sin(\pi(a+1)/2)}
\end{align}
a. We used the following definition of the beta function

\mathrm{B}(a.b)=\int\limits_{0}^{\infty} \frac{z^{a-1}}{1+z^{a+b}} \mathrm{d}z

b. $$\mathrm{B}(a.b)=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}$$
c. $$\Gamma(1-z)\Gamma(z)=\frac{\pi}{\sin(\pi z)}$$

Method 2

Let

f(z) = \frac{z^{a}}{1+z^{2}}

Using the keyhole contour, we have first order poles at $$\pm i$$, so the residues are

\mathrm{Res}[f(z),i] = \frac{i^{a}}{i2} = \mathrm{e}^{ia\pi/2} \frac{1}{i2}

\mathrm{Res}[f(z),-i] = \frac{(-i)^{a}}{-i2} = -\mathrm{e}^{ia\pi} \mathrm{e}^{ia\pi/2} \frac{1}{i2}

\begin{align}
\oint\limits_{C} f(z) \mathrm{d}z
&= \pi \mathrm{e}^{ia\pi/2} \left(1 – \mathrm{e}^{ia\pi} \right) \\
&= \lim_{\epsilon,R \to 0,\infty} \int\limits_{\epsilon}^{R} f(x) \mathrm{d}x
+ \int\limits_{\Gamma} f(z)\mathrm{d}z
+ \int\limits_{R}^{\epsilon} f(x) \mathrm{d}x
+ \int\limits_{\gamma} f(z)\mathrm{d}z \\
&= \int\limits_{0}^{\infty} \frac{x^{a}}{1+x^{2}} \mathrm{d}x
\,- \int\limits_{0}^{\infty} \mathrm{e}^{ia2\pi} \frac{x^{a}}{1+x^{2}} \mathrm{d}x \\
&= \left(1 – \mathrm{e}^{ia2\pi} \right) \int\limits_{0}^{\infty} \frac{x^{a}}{1+x^{2}} \mathrm{d}x
\end{align}

Thus we have
\begin{align}
\int\limits_{0}^{\infty} \frac{x^{a}}{1+x^{2}} \mathrm{d}x
&= \pi \mathrm{e}^{ia\pi/2} \left(1 – \mathrm{e}^{ia\pi} \right) \frac{1}{\left(1 – \mathrm{e}^{ia2\pi} \right)} \\
&= \frac{\pi \sin(a\pi/2)}{\sin(a\pi)} \\
&= \frac{\pi}{2\cos(a\pi/2)}
\end{align}

Notes:
1. R is the radius of the large circle $$\Gamma$$.
2. $$\epsilon$$ is the radius of the small circle $$\gamma$$.

Integrate $$\int_{0}^{\infty} \frac{\mathrm{ln}(x^{2}+a^{2})}{x^{2}+b^{2}} \mathrm{d} x$$

For $$a,b > 0$$,

\int\limits_{0}^{\infty} \frac{\mathrm{ln}(x^{2}+a^{2})}{x^{2}+b^{2}} \mathrm{d} x = \frac{\pi}{b} \mathrm{ln}(a+b)
\label{eq:160806a1}
\tag{1}

appeared on page 52 of Rediscovery of Malmsten’s integrals, their evaluation by contour integration methods and some related results by Iaroslav V. Blagouchine. This is a fascinating paper with many interesting results. In future blog posts, I will present some of Blagouchine’s results and solve some of the exercise problems that he proposed. For now, I will do this integral mainly to highlight a common trick used to evaluate contour integrals with logarithms of binomials.

The trick is to begin with a different integrand

f(z) = \frac{\mathrm{ln}(z+ia)}{z^{2}+b^{2}} = \frac{\mathrm{ln}(z+ia)}{(z-ib)(z+ib)}
\label{eq:160806a2}
\tag{2}

Using the following contour

we note that a first order pole at $$z=ib$$ is inside of the contour so we have

Res_{z=ib}[f(z)] = \frac{\mathrm{ln}(ib+ia)}{i2b} = \frac{\mathrm{ln}(i)+\mathrm{ln}(a+b)}{i2b} = \frac{i\frac{\pi}{2}+\mathrm{ln}(a+b)}{i2b}
\label{eq:160806a3}
\tag{3}

\begin{align}
\oint\limits_{C} f(z) \mathrm{d} z & = i2\pi Res_{z=ib}[f(z)] = \frac{i\pi^{2}}{2b} + \frac{\pi}{b}\mathrm{ln}(a+b) \\
& = \lim_{R \to \infty} \int\limits_{-R}^{R} f(x) \mathrm{d} x + \int\limits_{C_{1}} f(z) \mathrm{d} z
\label{eq:160806a4}
\tag{4}
\end{align}

The second integral goes to 0 via the ML estimate. The first integral will be broken in half and we use the substitution $$y=-x$$ to obtain

\int\limits_{-\infty}^{0} \frac{\mathrm{ln}(x+ia)}{x^{2}+b^{2}} \mathrm{d} x = \int\limits_{0}^{\infty} \frac{\mathrm{ln}(-y+ia)}{y^{2}+b^{2}} \mathrm{d} y
\label{eq:160806a5}
\tag{5}

Adding the two halves of the integral together, we have the following in the numerator

\mathrm{ln}(-x+ia) + \mathrm{ln}(x+ia) = i\pi + \mathrm{ln}(x-ia) + \mathrm{ln}(x+ia) = \mathrm{ln}(x^{2}+a^{2})

Now we have

\oint\limits_{C} f(z) \mathrm{d} z = \int\limits_{0}^{\infty} \frac{\mathrm{ln}(x^{2}+a^{2})}{x^{2}+b^{2}} \mathrm{d} x +
i\pi \int\limits_{0}^{\infty} \frac{1}{x^{2}+b^{2}} \mathrm{d} x
\label{eq:160806a6}
\tag{6}

Equating real and imaginary parts of equations \eqref{eq:160806a6} and \eqref{eq:160806a4} yields our original result plus a bonus integral
\int\limits_{0}^{\infty} \frac{1}{x^{2}+b^{2}} \mathrm{d} x = \frac{\pi}{2b}

which we could have obtained via the inverse tangent function.

Note that the trick allowed the limits of the integral to work out with the semi circular contour and we recovered the original integrand. This is a standard trick but surprisingly I have read some complex analysis texts that do not cover it.