I'm a little stuck with this one. I've found the singularities to be at $\pm 2i$ and $0$ (branch point). So far, using a branch cut at $2\pi$ I've found that $$\int_{0}^{\infty}\frac{\ln(2r)}{4+r^2}dr+\int_{0}^{\infty}\frac{\ln(2r)+2\pi i}{4+r^2}dr = 2I+\int_{0}^{\infty}\frac{2\pi i}{4+r^2}dr$$ And $$\int_{0}^{\infty}\frac{2\pi i}{4+r^2}dr = \text{Res}(r=2i) \\ = -2\pi^2\lim_{r\to2i}\frac{r-2i}{(r-2i)(r+2i)} = \frac{i}{2}\pi^2$$ My problem is that the answer I found is completely imaginary, and I'm not sure how that's possible given that the original function is real. Any help is appreciated.

  • $\begingroup$ The original integral does not make sense (as a real integral) because $2x$ does not have a real logarithm when $x\le0$. Should the integral be from $0$ to $\infty$? $\endgroup$
    – David
    Mar 10 '17 at 2:18
  • $\begingroup$ You're right! I accidentally wrote down the integral wrong here, it's changed to the right bounds now $\endgroup$
    – John Page
    Mar 10 '17 at 2:29
  • 1
    $\begingroup$ If you are integrating around a key-hole contour then the first and second integrals should cancel. $\endgroup$ Mar 10 '17 at 2:31
  • $\begingroup$ Not entirely sure what you mean here. You say "the answer I found is completely imaginary", do you mean the answer $i\pi^2/2$? As far as I can tell from your working, that's the answer to a different integral and therefore no problem. $\endgroup$
    – David
    Mar 10 '17 at 2:33
  • $\begingroup$ My problem is I don't know how to get the final answer from here, or whether this answer is correct. $\endgroup$
    – John Page
    Mar 10 '17 at 2:34


$$f(z) = \frac{\log(2z)}{z^2+4}$$

By using a key-hole integral with branch-cut on positive axis we should get

$$\int^\infty_0 \frac{\log(|2x|)}{x^2+4}\,dx + \int_{\infty}^{0} \frac{\log(|2x|)+2\pi i}{x^2+4}\,dx =2\pi i \sum \mathrm{Res}(f,z_0)$$

We see that the first and second integrals will cancel. Now to avoid that consider

$$f(z) = \frac{\log(2z)^2}{z^2+4}$$

By using a key-hole integral with branch-cut on positive axis we should get

$$\int^\infty_0 \frac{\log^2(|2x|)}{x^2+4}\,dx + \int^0_{\infty} \frac{(\log(|2x|)+2\pi i)^2}{x^2+4}\,dx =2\pi i \sum \mathrm{Res}(f,z_0)$$

$$\int^\infty_0 \frac{\log^2(|2x|)}{x^2+4}\,dx - \int_0^{\infty} \frac{(\log(|2x|)+2\pi i)^2}{x^2+4}\,dx =2\pi i \sum \mathrm{Res}(f,z_0)$$

Now you can see that $\log^2(2x)$ will be cancelled and we are left out with $\log(2x)$.

Another approach

Integrate around a big half-circle indented at 0 where the branch cut is chosen on the imaginary axis then for

$$f(z) = \frac{\log(2z)}{z^2+4}$$

we have only one pole at $z = 2i$

$$\int_{-\infty}^0 \frac{\log|2x|+\pi i}{x^2+4}\,dx +\int^{\infty}_0 \frac{\log|2x|}{x^2+4}\,dx = 2\pi i \,\mathrm{Res}(f,2i)$$

$$2\int^\infty_0 \frac{\log(2x)}{x^2+4}\,dx + \pi i\int^\infty_0\frac{1}{x^2+4}\,dx = 2\pi i \,\mathrm{Res}(f,2i) $$

Note that

$$\mathrm{Res}(f,2i) = \lim_{z \to 2i} (z-2i) \frac{\log(2z)}{(z-2i)(z+2i)} = \frac{\log(4i)}{4i} = \frac{\log(4)+(\pi i)/2}{4i}$$

$$2\int^\infty_0 \frac{\log(2x)}{x^2+4}\,dx + \pi i\int^\infty_0\frac{1}{x^2+4}\,dx = \pi \frac{\log(4)+(\pi i)/2}{2} $$

By comparison we have

$$\int^\infty_0 \frac{\log(2x)}{x^2+4}\,dx = \frac{\pi}{2} \log(2)$$



As already established in the answer left by @ZaidAlyafeai, the classical approach begins by analyzing the contour integral

$$I=\oint_C \frac{\log^2(2z)}{z^2+4}\,dz$$

where $C$ is the "keyhole" contour with the keyhole taken along the positive real axis. In that case $0\le \arg(z)<2\pi$. Then, we have

$$\begin{align} \color{blue}{\int_0^\infty \frac{\log^2(2x)}{x^2+4}\,dx-\int_0^\infty\frac{(\log(2x)+i2\pi)^2}{x^2+4}\,dx}&=\color{red}{2\pi i \text{Res}\left(\frac{\log^2(2z)}{z^2+4}, z=\pm i2\right)}\\\\ &=\color{red}{2\pi i\left(\frac{\log^2(4i)}{4i}+\frac{\log^2(-4i)}{-4i}\right)}\\\\ &=\color{red}{\frac{\pi}{2}\left((\log(4)+i\pi/2)^2-(\log(4)+i3\pi/2)^2\right)}\\\\ \color{blue}{4\pi^2\int_0^\infty\frac{1}{x^2+4}\,dx-i4\pi\int_0^\infty\frac{\log(2x)}{x^2+4}\,dx}&=\color{red}{\frac{\pi}{2}\left(2\pi^2-i2\pi\log(4)\right)}\tag 1 \end{align}$$

where we find by setting real and imaginary parts of $(1)$ equal

$$\int_0^\infty \frac{1}{x^2+4}\,dx=\frac{\pi}{4}$$


$$\bbox[5px,border:2px solid #C0A000]{\int_0^\infty\frac{\log(2x)}{x^2+4}\,dx=\frac{\pi\log(2)}{2}} \tag 2$$


I thought it might be instructive to present an approach that relies on real analysis only.

To proceed, we begin by enforcing the substitution $x\to 4/x$. Then, we have

$$\begin{align} \int_0^\infty \frac{\log(2x)}{x^2+4}\,dx&=\int_0^\infty \frac{\log(8/x)}{(4/x)^2+4}\,\frac{4}{x^2}\,dx\\\\ &=4\log(2)\int_0^\infty\frac{1}{x^2+4}\,dx-\int_0^\infty \frac{\log(2x)}{x^2+4}\\\\ 2\int_0^\infty \frac{\log(2x)}{x^2+4}\,dx&=4\log(2)\int_0^\infty\frac{1}{x^2+4}\,dx\\\\ \int_0^\infty \frac{\log(2x)}{x^2+4}\,dx&=2\log(2)\int_0^\infty\frac{1}{x^2+4}\,dx\\\\ &=\frac{\pi\log(2)}{2} \end{align}$$

agreeing with the result in $(2)$ as expected!

  • $\begingroup$ @ZaidAlyafeai Thank you my friend! And yours was a very well-written solution! (+1) also. -Mark $\endgroup$
    – Mark Viola
    Mar 10 '17 at 6:50
  • $\begingroup$ Without doubt you are one of the best here on posting instructive, well-written and formatted answers. keep it up. $\endgroup$ Mar 10 '17 at 6:52
  • $\begingroup$ @ZaidAlyafeai Thank you Zaid! $\endgroup$
    – Mark Viola
    Mar 10 '17 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.