# The integral of ln(x+1)/(x^2+1) dx from 0 to 1

Up a level : Integrals
Previous page : The integral of sin(x)/x dx from -infinity to infinity
Next page : The integral of e^(-x^2) from –infinity to infinity This integral was introduced to me by one of my students. It is from some hard maths contest – I could guess from William Lowell Putnam Mathematical Competition. Anyhow, it took me about one and a half hour to figure this one out, and then a number of hours to redo it and verify all steps and so on – about four hours all in all.

Ok, so the integral is $I = \int\limits_0^1 {\frac{{\ln (x + 1)}}{{{x^2} + 1}}dx}$

It seems like no standard methods would work. One way is to use the trick introduced in the first integral in this section, and that is to insert another variable. This to enable us to get rid of the logarithm. Let $I(p) = \int\limits_0^1 {\frac{{\ln (px + 1)}}{{{x^2} + 1}}dx}$

The reason for putting the variable there is that it will enable us to get rid of the logarithm, as we will see.

Differentiate with respect to p

Then we differentiate with respect to p to get $I'(p) = \frac{d}{{dp}}\int\limits_0^1 {\frac{{\ln (px + 1)}}{{{x^2} + 1}}dx} = \int\limits_0^1 {\frac{\partial }{{\partial x}}\frac{{\ln (px + 1)}}{{{x^2} + 1}}dx}$

I.e. $I'(p) = \int\limits_0^1 {\frac{x}{{(px + 1)({x^2} + 1)}}dx}$

Here we have to remember that p is our variable, and that we need to use the chain rule.

Partial fractions

To solve the integral we need to rewrite our integrand using partial fractions

We should find values for A, B and C such that $\frac{x}{{(px + 1)({x^2} + 1)}} = \frac{A}{{px + 1}} + \frac{{Bx + C}}{{{x^2} + 1}}$

The reason for the numerator Bx+C is that, when we multiply away the denominators, the two terms in the right hand side (RHS) should be of the same degree – as we will see is necessary.

Next we multiply both sides with the denominator of the left hand side (LHS) to get $x = A({x^2} + 1) + (Bx + C)(px + 1)$

Now comes a really neat trick – so if you have not worked with partial fractions then listen carefully (as I would have said if this would have been a lesson).

When x varies the constant part of the LHS and the RHS must be the same. The same with the part that varies with x and the part that varies with x2. Each of these parts must vary in unison with each other. We thus get $\begin{gathered} c:\quad 0 = A + C \hfill \\ x:\quad 1 = B + Cp \hfill \\ {x^2}:\;\;0 = A + Bp \hfill \\ \end{gathered}$

Here we just write the coefficient, since we don´t care about any particular value of x.  From the first equation we get that A= –C. This gives us $\begin{gathered} 1 = B + Cp \hfill \\ 0 = - C + Bp \hfill \\ \end{gathered}$

We may now multiply the first equation of this with p to get $\begin{gathered} p = Bp + C{p^2} \hfill \\ 0 = - C + Bp \hfill \\ \end{gathered}$

Next we subtract the second equation of this from the first to get $p = C + C{p^2} = C(1 + {p^2})$

or $C = \frac{p}{{1 + {p^2}}}$

From this, and that A= –C we get $A = - \frac{p}{{1 + {p^2}}}$

Finally, from $0 = - C + Bp$

We get $B = \frac{C}{p} = \frac{1}{{1 + {p^2}}}$

Back to our rational function we thus get $\begin{gathered} \frac{x}{{(px + 1)({x^2} + 1)}} = \frac{A}{{px + 1}} + \frac{{Bx + C}}{{{x^2} + 1}} \hfill \\ \quad \quad \quad \quad \quad \quad \; = \frac{{ - \frac{p}{{1 + {p^2}}}}}{{px + 1}} + \frac{{\frac{1}{{1 + {p^2}}}x + \frac{p}{{1 + {p^2}}}}}{{{x^2} + 1}} \hfill \\ \quad \quad \quad \quad \quad \quad \; = \frac{1}{{{p^2} + 1}}\left( { - \frac{p}{{px + 1}} + \frac{x}{{{x^2} + 1}} + \frac{p}{{{x^2} + 1}}} \right) \hfill \\ \end{gathered}$

One can check that this is correct by adding the fractions (find a common denominator) and then by expanding and simplification.

Back to the integral

We now have $\begin{gathered} I'(p) = \int\limits_0^1 {\frac{x}{{(px + 1)({x^2} + 1)}}dx} \hfill \\ \quad \quad \; = \int\limits_0^1 {\frac{1}{{{p^2} + 1}}\left( { - \frac{p}{{px + 1}} + \frac{x}{{{x^2} + 1}} + \frac{p}{{{x^2} + 1}}} \right)} dx \hfill \\ \quad \quad \; = \frac{1}{{{p^2} + 1}}\int\limits_0^1 {\left( { - \frac{p}{{px + 1}} + \frac{x}{{{x^2} + 1}} + \frac{p}{{{x^2} + 1}}} \right)} dx \hfill \\ \end{gathered}$

Solving the three integrals

For the first integral we get $\begin{gathered} \int\limits_0^1 {\frac{p}{{px + 1}}} dx = \left[ {p\frac{{\ln (px + 1)}}{p}} \right]_0^1 = \left[ {\ln (px + 1)} \right]_0^1 \hfill \\ \quad \quad \quad \quad \; = \ln (p + 1) - \ln (1) = \ln (p + 1) \hfill \\ \end{gathered}$

The second one is $\int\limits_0^1 {\frac{x}{{{x^2} + 1}}} dx$

To solve this we can do the substitutions $\left| {u = {x^2} + 1,\quad du = 2xdx,\quad \frac{{du}}{2} = xdx} \right.$

to get $\begin{gathered} \int\limits_0^1 {\frac{x}{{{x^2} + 1}}} dx = \int\limits_{x = 0}^1 {\frac{{du}}{{2u}}} = \left[ {\frac{1}{2}\ln (u)} \right]_{x = 0}^1 \hfill \\ \quad \quad \quad \quad = \left[ {\frac{1}{2}\ln ({x^2} + 1)} \right]_0^1 = \frac{1}{2}\ln (2) - \frac{1}{2}\ln (1) = \frac{1}{2}\ln (2) \hfill \\ \end{gathered}$

The third one gives us $\begin{gathered} \int\limits_0^1 {\frac{p}{{{x^2} + 1}}} dx = \left[ {p{{\tan }^{ - 1}}(x)} \right]_0^1 = p{\tan ^{ - 1}}(1) - p{\tan ^{ - 1}}(0) \hfill \\ \quad \quad \quad \quad = p\frac{\pi }{4} \hfill \\ \end{gathered}$

Combining this we get $\begin{gathered} I'(p) = \frac{1}{{{p^2} + 1}}\int\limits_0^1 {\left( { - \frac{p}{{px + 1}} + \frac{x}{{{x^2} + 1}} + \frac{p}{{{x^2} + 1}}} \right)} dx \hfill \\ \quad \quad \;\; = \frac{1}{{{p^2} + 1}}( - ln(p + 1) + \frac{1}{2}\ln (2) + p\frac{\pi }{4}) \hfill \\ \quad \quad \;\; = - \frac{{ln(p + 1)}}{{{p^2} + 1}} + \frac{1}{2}\frac{{\ln (2)}}{{{p^2} + 1}} + \frac{\pi }{4}\frac{p}{{{p^2} + 1}} \hfill \\ \end{gathered}$

Undoing the Differentiation with respect to p

Ok, to get back to I(p) we need to take the anti-derivative of I’(p). $\begin{gathered} I(p)\; = \int ( - \frac{{ln(p + 1)}}{{{p^2} + 1}} + \frac{1}{2}\frac{{\ln (2)}}{{{p^2} + 1}} + \frac{\pi }{4}\frac{p}{{{p^2} + 1}})dp \hfill \\ \quad \quad = - \int {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp + \int {\frac{1}{2}\frac{{\ln (2)}}{{{p^2} + 1}}dp + \int {\frac{\pi }{4}\frac{p}{{{p^2} + 1}}} dp} } \hfill \\ \end{gathered}$

The second term gives is basically the same as the third one above, so we get $\int {\frac{1}{2}\frac{{\ln (2)}}{{{p^2} + 1}}dp} = \frac{1}{2}\ln (2){\tan ^{ - 1}}(p)$

(We wait with the constant of integration.)

The third term is like the second one above, and we have $\int {\frac{\pi }{4}\frac{p}{{{p^2} + 1}}} dp = \frac{\pi }{4}\frac{1}{2}\ln ({p^2} + 1) = \frac{\pi }{8}\ln ({p^2} + 1)$

The third integral may be the most difficult to figure out, but if we remember that $\int\limits_a^x {f(x)dx = } \left[ {F(x)} \right]_a^x = F(x) - F(a) = F(x) + C$

then  we can rewrite the integral as $- \int {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp = } - \int\limits_1^p {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp}$

Putting it all together

This gives us, after adding the constant of integration we get from the indefinite integrals $\begin{gathered} \int\limits_0^1 {\frac{{\ln (px + 1)}}{{{x^2} + 1}}dx} \hfill \\ \quad = - \int\limits_0^p {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp} + \frac{1}{2}\ln (2){\tan ^{ - 1}}(p) + \frac{\pi }{8}\ln ({p^2} + 1) + C \hfill \\ \end{gathered}$

Solving this for a value of p that we can solve it for, namely p=0 we get $\begin{gathered} \int\limits_0^1 {\frac{{\ln (0x + 1)}}{{{0^2} + 1}}} dx \hfill \\ \quad = - \int\limits_0^0 {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp} + \frac{1}{2}\ln (2){\tan ^{ - 1}}(0) + \frac{\pi }{8}\ln ({0^2} + 1) + C \hfill \\ \end{gathered}$

or $\int\limits_0^1 {0\;} dx = - 0 + 0 + 0 + C$

So C=0.

Now we can let p=1 to get back to our original integral $\begin{gathered} \int\limits_0^1 {\frac{{\ln (x + 1)}}{{{x^2} + 1}}dx} \hfill \\ \quad = - \int\limits_0^1 {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp} + \frac{1}{2}\ln (2){\tan ^{ - 1}}(1) + \frac{\pi }{8}\ln ({1^2} + 1) \hfill \\ \end{gathered}$

or $\int\limits_0^1 {\frac{{\ln (x + 1)}}{{{x^2} + 1}}dx} = - \int\limits_0^1 {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp} + \frac{1}{2}\ln (2)\frac{\pi }{4} + \frac{\pi }{8}\ln (2)$

It is rather fascinating to see that the two last terms turned out to be the same. That gives us $\int\limits_0^1 {\frac{{\ln (x + 1)}}{{{x^2} + 1}}dx} = - \int\limits_0^1 {\frac{{ln(p + 1)}}{{{p^2} + 1}}dp} + \frac{\pi }{4}\ln (2)$

We have thus basically been able to turn the integral to itself – but happily enough with a minus sign in front of it. We thus have $I = - I + \frac{\pi }{4}\ln (2)$

or $2I = \frac{\pi }{4}\ln (2)$

This finally gives us $I = \frac{\pi }{8}\ln (2)$

Phew. That was a tough one. Up a level : Integrals
Previous page : The integral of sin(x)/x dx from -infinity to infinity
Next page : The integral of e^(-x^2) from –infinity to infinity Last modified: Feb 21, 2022 @ 19:04