$\renewcommand{\Re}{\operatorname{Re}}

\renewcommand{\Im}{\operatorname{Im}}$

Calculate an improper integral

$$

I=\int_0^\infty \frac{\ln^2(x)\,dx}{(x^2+1)}.

$$

**Hint: ** **(a)** Calculate

$$

J_{R,\varepsilon} = \int_{\Gamma_{R,\varepsilon}} f(z)\,dz, \qquad f(z):=\frac{\log^2(z)}{(z^2+1)}

$$

where we have chosen the branch of $\log(z)$ such that they are analytic on the upper half-plane $\{z\colon \Im z>0\}$ and is real-valued for $z=x>0$. $\Gamma_{R,\varepsilon}$ is the contour on the figure below:

**(b)** Prove that $\int_{\gamma_R} f(z)\,dz\to 0$ as $R\to \infty$ and $\int_{\gamma_\varepsilon} f(z)\,dz\to 0$ as $\varepsilon\to 0^+0$ where $\gamma_R$ and $\gamma_\varepsilon$ are large and small semi-circles on the picture. This will give you a value of

\begin{equation}

\int_{-\infty}^0 f(z)\,dz + \int_0^{\infty} f(z)\,dz.

\label{4-1}

\end{equation}

**(c)** Express both integrals using $I$.