Value of this definite integral $\int_{0}^{\infty} \frac{ \ln(x)}{x^2+2x+4} dx $ So I came across this question on brilliant.org and didn't know how to go about it:
$$\int_{0}^{\infty} \frac{ \ln(x)}{x^2+2x+4} dx $$
I tried to complete the squares in the denominator and then use a trigonometric substitution (with tan) but I didn't get anything beyond that. 
How do I do it? Do we need to differentiate under the integral sign here?
 A: As mentioned above, use a keyhole contour in the complex plane, which we'll call $C$.  Here though you should consider the contour integral
$$\oint_C dx \frac{\log^2{z}}{z^2+2 z+4} $$
I will leave it to the reader to show that the integral vanishes over the circular portions of $C$; we are thus left with the contour integral equaling
$$\int_0^{\infty} dx \frac{\log^2{x}-(\log{x}+i 2 \pi)^2}{x^2+2 x+4} = -i 4 \pi \int_0^{\infty} dx\frac{\log{x}}{x^2+2 x+4} + 4 \pi^2 \int_0^{\infty} \frac{dx}{x^2+2 x+4}$$
Now, the integral on the right we need to know as well.  We may evaluate that any way we wish, but let's stick to this formalism.  This integral may be evaluated using the same contour and the residue theorem.  Let
$$R_n = \sum_k \operatorname*{Res}_{z=z_k} \frac{\log^{n+1}{z}}{z^2+2 z+4}$$
for $n=0,1$.  That is,
$$\oint_C dz \frac{\log^{n+1}{z}}{z^2+2 z+4} = i 2 \pi R_n$$
Then from the above, you may show that
$$\int_0^{\infty} dx\frac{\log{x}}{x^2+2 x+4} = i \pi R_0 - \frac12 R_1$$
Note that the poles of the integrands are at $z_1=2 e^{i 2 \pi/3}$ and $z_2 = 2 e^{i 4 \pi/3}$.  Note that we must use these arguments because of how we defined the contour.
We mat deduce that
$$R_0 = \frac{\log{2}+i 2 \pi/3}{i 2 \sqrt{3}} + \frac{\log{2}+i 4 \pi/3}{-i 2 \sqrt{3}} = -\frac{\pi}{3 \sqrt{3}}$$
$$R_1 = \frac{(\log{2}+i 2 \pi/3)^2}{i 2 \sqrt{3}} + \frac{(\log{2}+i 4 \pi/3)^2}{-i 2 \sqrt{3}} = -\frac{2 \pi \log{2}}{3 \sqrt{3}} - i \frac{2 \pi^2}{3 \sqrt{3}}$$
Putting it all together, the imaginary pieces cancel and we get
$$\int_0^{\infty} dx\frac{\log{x}}{x^2+2 x+4} = \frac{\pi \log{2}}{3 \sqrt{3}}$$
A: \begin{align}I=\int_{0}^{\infty} \frac{\ln(x)}{x^2+2x+4} dx\end{align}
Perform the change of variable $x=2t$,
\begin{align}I&=\frac{1}{2}\int_{0}^{\infty} \frac{\ln\left(2t\right)}{t^2+t+1}\,dt\\ 
&=\frac{1}{2}\int_{0}^{\infty} \frac{\ln t}{t^2+t+1}\,dt+\frac{\ln 2}{2}\int_{0}^{\infty} \frac{1}{t^2+t+1}\,dt
\end{align}
The first integral is $0$ (perform the change of variable $y=\dfrac{1}{t}$)
\begin{align}I&=\frac{\ln 2}{2}\int_{0}^{\infty} \frac{1}{t^2+t+1}\,dt\\
&=\frac{\ln 2}{2}\int_{0}^{\infty} \frac{1}{\left(t+\frac{1}{2}\right)^2+\frac{3}{4}}\,dt\\
&=\frac{2\ln 2}{3}\int_{0}^{\infty} \frac{1}{\left(\frac{2t+1}{\sqrt{3}}\right)^2+1}\,dt\\
\end{align}
Perform the change of variable $u=\dfrac{2t+1}{\sqrt{3}}$
\begin{align}I&=\frac{2\ln 2}{3}\times \frac{\sqrt{3}}{2}\int_{\frac{1}{\sqrt{3}}}^{\infty} \frac{1}{1+u^2}\,du\\
&=\frac{\ln 2}{\sqrt{3}}\left(\arctan(\infty)-\arctan\left(\frac{1}{\sqrt{3}}\right)\right)\\
&=\frac{\ln 2}{\sqrt{3}}\left(\frac{\pi}{2}-\frac{\pi}{6}\right)\\
&=\frac{\pi\ln 2}{3\sqrt{3}}
\end{align}
A: This CAN be done with real variables and no, you do not need to differentiate with respect to a parameter. Here's how:
$$I=\int_{0}^{\infty} \frac{\ln(x)}{x^2+2x+4} dx $$
$$I=\int_{0}^{\infty} \frac{\ln(x)}{{(x+1)}^2+3}dx $$
$$I=\frac{1}{3} \int_{0}^{\infty} \frac{\ln(x)}{ ({ \frac{x+1}{\sqrt{3}} })^2 + 1} dx $$
Now, set 
$$\frac{x+1}{\sqrt{3}} = \tan(t)$$
Thus $t$ is between $\frac{\pi}{6}$ and $\frac{\pi}{2}$.
We now have
$$I=\frac{1}{\sqrt{3}} \int_{\frac{\pi}{6}}^{\frac{\pi}{2}} \ln{ (\sqrt{3} \tan(t) - 1 )} dt $$
Now, use this property:
$$\int_{a}^{b} f(x) dx = \int_{a}^{b} f(a+b-x) dx$$
So, we have:
$$I= \frac{1}{\sqrt{3}} \int_{\frac{\pi}{6}}^{\frac{\pi}{2}} \ln{ \left( \sqrt{3} \frac{ \sqrt{3} + \tan(t) }{\sqrt{3} \tan(t) - 1} - 1\right) }dt $$
On simplifying,
$$I=\frac{1}{\sqrt{3}} \int_{\frac{\pi}{6}}^{\frac{\pi}{2}} \ln{\left( \frac{4}{\sqrt{3} \tan(t) - 1}\right)} dt $$
Thus,
$$I=\frac{1}{\sqrt{3}} \int_{\frac{\pi}{6}}^{\frac{\pi}{2}} \ln{(4)} dt - I$$
$$I= \frac{\pi}{3 \sqrt{3} } \ln{2} $$
and we are done.
