TITLE: Evaluate $\int_0^\infty \frac{(\ln x)^2}{x^2+4} \ dx$ using complex analysis.
QUESTION [11 upvotes]: Evaluate $\int_0^\infty \frac{(\ln x)^2}{x^2+4} \ dx$.  This is the last question in our review for complex analysis.  Hints were available upon request, but being the student I am, I waited until the last minute to do this.  Can anyone give a detailed answer?  It would greatly appreciated.  This is part of our residue theorem review, which is how we were taught to evaluate such integrals.

REPLY [2 votes]: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{0}^{\infty}{\ln^{2}\pars{x} \over x^{2} + 4}\,\dd x:\ {\large ?}}$.

\begin{align}&\color{#c00000}{\int_{0}^{\infty}
{\ln^{2}\pars{x} \over x^{2} + 4}\,\dd x}
=\int_{0}^{\infty}{\ln^{2}\pars{x^{1/2}} \over x + 4}\,\half\,x^{-1/2}\,\dd x
={1 \over 8}\int_{0}^{\infty}{x^{-1/2}\ln^{2}\pars{x} \over x + 4}\,\dd x
\\[3mm]&={1 \over 8}\lim_{\mu \to -1/2}\partiald[2]{}{\mu}
\color{#00f}{\int_{0}^{\infty}{x^{\mu} \over x + 4}\,\dd x}\tag{1}
\end{align}

With the following contour, the integral is easily evaluated:

\begin{align}&\color{#00f}{\int_{0}^{\infty}{x^{\mu} \over x + 4}\,\dd x}
=2\pi\ic\pars{4^{\mu}\expo{\ic\pi\mu}}
-\int_{\infty}^{0}{x^{\mu}\expo{2\pi\ic\mu} \over x + 4}\,\dd x
\end{align}

$$
\color{#00f}{\int_{0}^{\infty}{x^{\mu} \over x + 4}\,\dd x}
=2\pi\ic\,{4^{\mu}\expo{\ic\pi\mu} \over 1 - \expo{2\pi\ic\mu}}
=-\pi\,{4^{\mu} \over \sin\pars{\pi\mu}}
$$

\begin{align}&
\partiald[2]{}{\mu}\color{#00f}{\int_{0}^{\infty}{x^{\mu} \over x + 4}\,\dd x}
\\[3mm]&=-2^{2m}\,\pi\,\csc\pars{\pi \mu}\braces{\vphantom{\LARGE A}
\pi^2\bracks{\vphantom{\Large A}2\csc^{2}\pars{\pi\mu} - 1}
-4\pi\ln\pars{2}\cot\pars{\pi\mu} + 4\ln^{2}\pars{2}}
\end{align}

\begin{align}&\lim_{\mu \to -1/2}
\partiald[2]{}{\mu}\color{#00f}{\int_{0}^{\infty}{x^{\mu} \over x + 4}\,\dd x}
=\half\,\pi^{3} + 2\pi\ln^{2}\pars{2}
\end{align}

Replacing in $\pars{1}$:
$$\color{#66f}{\large\int_{0}^{\infty}
{\ln^{2}\pars{x} \over x^{2} + 4}\,\dd x}
=
\color{#66f}{\large{1 \over 16}\,\pi^{3} + {1 \over 4}\,\pi\ln^{2}\pars{2}}
\approx 2.3152
$$