# How to integrate $\int\frac{\ln x\,dx}{x^2+2x+4}$

$$K=\int\frac{\ln x\,dx}{x^2+2x+4}$$

I did this $x^2+2x+4=(x+\alpha)(x+\beta)$, then used partial fraction, I am then unsure how to integrate $\int\frac{\ln x}{x+c}\,dx$.

I tried Integration by parts also taking first function as both of them which ended nowhere

Also I need help how to evaluate this, with or without(which I think might be easier) using the above:

$$I=\int_0^{\infty}\frac{\ln x\,dx}{x^2+2x+4}$$

I did $x\mapsto 1/x$and then added those to get: $$I=\frac32\int_0^{\infty}\frac{(x^2-1)\ln x \,dx}{(x^2+2x+4)(4x^2+2x+1)}=?$$

You were kinda on the right track. Try the substitution $x = \dfrac{4}{y}$ to get:

$I = \displaystyle\int_{0}^{\infty}\dfrac{\ln x}{x^2+2x+4}\,dx = \displaystyle\int_{-\infty}^{0}\dfrac{\ln \frac{4}{y}}{\frac{16}{y^2}+\frac{8}{y}+4} \cdot \dfrac{-4}{y^2}\,dy$

$= \displaystyle\int_{0}^{\infty}\dfrac{\ln 4 - \ln y}{y^2+2y+4}\,dy = \ln 4 \displaystyle\int_{0}^{\infty}\dfrac{\,dy}{y^2+2y+4} - I$

Thus, $2I = \ln 4 \displaystyle\int_{0}^{\infty}\dfrac{\,dx}{x^2+2x+4}$, which is easy to compute.

• some hints/idea behind the substitution for future reminder or ideas? – RE60K Oct 28 '14 at 2:59
• We want the resulting integral to have the same denominator as the original one. So, I tried to find a substitution in the form $x = \frac{a}{y}$ which resulted in the denominator being $y^2+2y+4$. Turns out the right choice is $a = 4$. – JimmyK4542 Oct 28 '14 at 3:01
• I did the same thing, but i substituted, $x= \frac{2}{y}$ , so that all coeffecients, become equal , and the divided the integral in two parts and then in one , substituted, $y=1/u$. – Shivang jindal Oct 28 '14 at 11:00

One way to attack improper integrals of the form

$$\int_0^{\infty} dx \, f(x)$$

is to use the residue theorem, i.e. contour integration in the complex plane. To do this, one considers the contour integral

$$\oint_C dz \, f(z) \log{z}$$

where $C$ is a keyhole contour about the positive real axis, of inner radius $\epsilon$ and outer radius $R$. We consider the limits as $\epsilon \to 0$ and $R \to \infty$. In most cases, the integrals about the inner and outer circles vanish in these limits (I will not prove here).

In this case, our statement of the residue theorem takes the form

$$\int_0^{\infty} dx \frac{\log^2{x} - (\log{x}+i 2 \pi)^2}{x^2+2 x+4} = i 2 \pi \sum_{k=1}^2\frac{\log^2{z_k}}{2 z_k+2}$$

where $z_{1,2}= -1 \pm i \sqrt{3}$, or, in other words, $z_1 = 2 e^{i 2 \pi/3}$ and $z_2=2 e^{i 4 \pi/3}$. Note that the arguments of the $z_k$ are between $[0,2 \pi]$ necessarily because of how $C$ was defined. Thus,

$$-i 4 \pi \int_0^{\infty} dx \frac{\log{x}}{x^2+2 x+4} + 4 \pi^2 \int_0^{\infty} dx \frac{1}{x^2+2 x+4} = i 2 \pi \left [\frac{(\log{2} + i 2 \pi/3)^2}{i 2 \sqrt{3}} + \frac{(\log{2} + i 4 \pi/3)^2}{-i 2 \sqrt{3}} \right ]$$

Equating real and imaginary parts, we find that

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

• sorry no idea on contour integration(still in high school) – RE60K Oct 28 '14 at 5:29

$$\int \dfrac{\ln(x)\; dx}{x+\alpha} = \ln(x) \ln(1+x/a) + \text{dilog}(1+x/a)$$ But it requires some care to use this for your improper integral.