Tutorials › Calculus II › Integrating The Logarithm Of A Quadratic

Integration by Parts I · Tutorial 37 of 998

Integrating The Logarithm Of A Quadratic

Evaluate ∫ ln(1+x²) dx by parts, reduce the leftover rational function by division, and check the answer with the product and chain rules.

Intermediate 10 min read

What You'll Learn

  • Apply integration by parts with u = ln(1+x²) and dv = dx.
  • Use division to rewrite 2x²/(1+x²) as a constant plus a fraction.
  • Recognize the inverse tangent term that appears from 1/(1+x²).
  • Evaluate definite integrals, using symmetry when the limits are symmetric.
  • Avoid the chain-rule omission when differentiating ln(1+x²).

A Logarithm of a Quadratic

The function \(\ln(1+x^2)\) is defined and smooth for every real \(x\), because \(1+x^2\ge1\) is always positive. Unlike \(\ln x\), it needs no domain restriction and no absolute value. Its antiderivative is not a simple composition, so integration by parts is the natural method, exactly as for \(\ln x\). The new feature is that the derivative of the logarithm is a genuine rational function, and its integral brings in an inverse tangent.

Result: For all real \(x\), \(\displaystyle\int\ln(1+x^2)\,dx=x\ln(1+x^2)-2x+2\arctan x+C.\)

Deriving the Antiderivative

Take \(u=\ln(1+x^2)\) and \(dv=dx\). By the chain rule, \(du=\frac{2x}{1+x^2}\,dx\), and \(v=x\). The parts formula gives

$$ \int\ln(1+x^2)\,dx=x\ln(1+x^2)-\int\frac{2x^2}{1+x^2}\,dx. $$

The leftover integrand has numerator and denominator of the same degree, so divide first. Since \(2x^2=2(1+x^2)-2\), we have

$$ \frac{2x^2}{1+x^2}=2-\frac{2}{1+x^2}. $$

The integral of \(2\) is \(2x\), and the integral of \(\frac{2}{1+x^2}\) is \(2\arctan x\). Substituting back,

$$ \int\ln(1+x^2)\,dx=x\ln(1+x^2)-\bigl(2x-2\arctan x\bigr)+C=x\ln(1+x^2)-2x+2\arctan x+C. $$

Notice how the pieces fit together. The logarithm term is the boundary term \(uv\). The linear term and the inverse tangent term both come from the single division step. If the division is skipped and the fraction is integrated directly, the problem looks like a logarithm or an arctangent integral but is neither, which is a common source of confusion.

Checking by Differentiation

Differentiate each term of the answer. The product rule on \(x\ln(1+x^2)\) gives \(\ln(1+x^2)+x\cdot\frac{2x}{1+x^2}\). The derivative of \(-2x\) is \(-2\), and the derivative of \(2\arctan x\) is \(\frac{2}{1+x^2}\). Adding them:

$$ \ln(1+x^2)+\frac{2x^2}{1+x^2}-2+\frac{2}{1+x^2}=\ln(1+x^2)+\frac{2x^2+2}{1+x^2}-2=\ln(1+x^2). $$

The three non-logarithmic terms add to \(2-2=0\), leaving the integrand. This check is quick enough to do on every problem.

Worked Examples

Worked Example: A Definite Integral from 0 to 1

Evaluate \(\int_0^1\ln(1+x^2)\,dx\).

Use \(F(x)=x\ln(1+x^2)-2x+2\arctan x\). At \(x=1\), \(F(1)=\ln2-2+2\cdot\frac\pi4=\ln2-2+\frac\pi2\). At \(x=0\), \(F(0)=0\). Therefore

$$ \int_0^1\ln(1+x^2)\,dx=\ln2-2+\frac{\pi}{2}\approx0.264. $$

The integrand rises from \(0\) to \(\ln2\approx0.693\), and behaves like \(x^2\) near zero, so the area should be smaller than the triangle value \(\frac{0.693}{2}\approx0.35\). The result \(0.264\) agrees.

Worked Example: A Scaled Argument

Find \(\int\ln(1+4x^2)\,dx\).

Substitute \(t=2x\), so \(dx=\frac{dt}{2}\) and \(1+4x^2=1+t^2\). Then the integral is \(\frac12\int\ln(1+t^2)\,dt=\frac12\bigl[t\ln(1+t^2)-2t+2\arctan t\bigr]+C\). Returning to \(x\):

$$ \int\ln(1+4x^2)\,dx=x\ln(1+4x^2)-2x+\arctan(2x)+C. $$

Check: \(\frac{d}{dx}\bigl[x\ln(1+4x^2)\bigr]=\ln(1+4x^2)+\frac{8x^2}{1+4x^2}\), and \(\frac{d}{dx}\arctan(2x)=\frac{2}{1+4x^2}\). The sum of the last two with \(-2\) is \(\frac{8x^2+2}{1+4x^2}-2=0\).

Worked Example: Symmetric Limits

Evaluate \(\int_{-1}^{1}\ln(1+x^2)\,dx\).

The integrand \(\ln(1+x^2)\) is an even function, so the integral over \([-1,1]\) is twice the integral over \([0,1]\):

$$ \int_{-1}^{1}\ln(1+x^2)\,dx=2\left(\ln2-2+\frac\pi2\right)=2\ln2-4+\pi\approx0.528. $$

Using evenness avoids evaluating the antiderivative at \(x=-1\). If you do evaluate it directly, you will find \(F(-1)=-F(1)\), because \(F\) is an odd function, and the same result follows.

A Reliable Procedure

1
Set up the parts.
Let \(u=\ln(1+x^2)\), \(dv=dx\), so \(v=x\).
2
Differentiate with the chain rule.
Compute \(du=\frac{2x}{1+x^2}\,dx\). Do not forget the inner derivative \(2x\).
3
Divide the leftover fraction.
Rewrite \(\frac{2x^2}{1+x^2}\) as \(2-\frac{2}{1+x^2}\).
4
Integrate term by term.
Obtain \(2x-2\arctan x\) and subtract it from the boundary term.
5
Verify.
Differentiate the final answer and confirm that the constants and fractions cancel.

Common Mistake: Omitting the Chain-Rule Factor

The most frequent error is to differentiate \(\ln(1+x^2)\) as \(\frac{1}{1+x^2}\). That omits the inner derivative \(2x\), and the leftover integral becomes \(\int\frac{x}{1+x^2}\,dx\), which equals \(\frac12\ln(1+x^2)\). The resulting answer \(x\ln(1+x^2)-\frac12\ln(1+x^2)\) contains no inverse tangent at all and fails the derivative check. Whenever the logarithm's argument is not a bare variable, remind yourself to apply the chain rule.

A second pitfall is to leave \(\frac{2x^2}{1+x^2}\) unreduced and guess an antiderivative such as \(2\arctan x\). The numerator has the same degree as the denominator, so division is required before integrating. The correct reduction produces two simple pieces, a constant and a multiple of \(\frac{1}{1+x^2}\).

Quick Reference

IntegrandAntiderivativeValid where
\(\ln x\)\(x\ln x-x\)\(x>0\)
\(\ln(1+x^2)\)\(x\ln(1+x^2)-2x+2\arctan x\)all real \(x\)
\(\ln(1+4x^2)\)\(x\ln(1+4x^2)-2x+\arctan(2x)\)all real \(x\)
\(\ln(a^2+x^2)\)\(x\ln(a^2+x^2)-2x+2a\arctan(x/a)\)all real \(x\), \(a>0\)
Takeaway: Integrating \(\ln(1+x^2)\) takes one parts step and one division. The answer \(x\ln(1+x^2)-2x+2\arctan x\) is valid for every real \(x\).

Worked Example: A General Constant a

Find \(\int\ln(9+x^2)\,dx\).

Factor the argument as \(9+x^2=9\bigl(1+(x/3)^2\bigr)\), so that \(\ln(9+x^2)=\ln9+\ln\bigl(1+(x/3)^2\bigr)\). Integrate each part. The constant term gives \(x\ln9\). For the second term, substitute \(t=x/3\), so \(dx=3\,dt\):

$$ \int\ln\bigl(1+(x/3)^2\bigr)\,dx=3\int\ln(1+t^2)\,dt=3\bigl[t\ln(1+t^2)-2t+2\arctan t\bigr]+C. $$

Replace \(t\) by \(x/3\) and combine with \(x\ln9\). Because \(\ln9+\ln\bigl(1+x^2/9\bigr)=\ln(9+x^2)\), the logarithmic terms merge:

$$ \int\ln(9+x^2)\,dx=x\ln(9+x^2)-2x+6\arctan\left(\frac x3\right)+C. $$

The coefficient \(6\) is \(2a\) with \(a=3\), which is the pattern in the last row of the table. Differentiating confirms the result: the product rule gives \(\ln(9+x^2)+\frac{2x^2}{9+x^2}\), the next term gives \(-2\), and \(6\cdot\frac{1/3}{1+x^2/9}=\frac{18}{9+x^2}\), so the three rational pieces add to \(\frac{2x^2+18}{9+x^2}-2=0\).

Geometry and Growth of the Antiderivative

The antiderivative \(F(x)=x\ln(1+x^2)-2x+2\arctan x\) is an odd function of \(x\), because each of its three terms is odd. This matches the fact that \(\ln(1+x^2)\) is even, and it explains why the integral over a symmetric interval can be computed from one side. For large \(x\), \(\ln(1+x^2)\approx2\ln x\), so the integral grows roughly like \(2x\ln x-2x\), while the arctangent term levels off at \(\pm\pi\). The area function is therefore dominated by the first two terms for large arguments, and the inverse tangent mainly corrects the behavior near the origin.

Why the Division Step Cannot Be Skipped

After integration by parts, students sometimes try to treat \(\int\frac{2x^2}{1+x^2}\,dx\) as an arctangent integral because the denominator is \(1+x^2\), or as a logarithmic integral because the numerator resembles a derivative. Neither shortcut is available: the numerator \(2x^2\) is not the derivative of \(1+x^2\), which is \(2x\), and an arctangent requires a constant numerator. The only safe move is to divide so that the fraction part has a numerator of lower degree than the denominator. That is the same principle used later in partial fractions, where improper rational functions are always divided before they are decomposed.

Relation to Probability and Applications

Integrals of \(\ln(1+x^2)\) turn up when working with the Cauchy distribution and with log-likelihood functions that have heavy tails. In those settings one often needs the total area of the log-density between two points, and the closed form above lets you evaluate it exactly rather than numerically. The inverse tangent term is the same one that appears in the Cauchy cumulative distribution function, which is a reminder that these integrals are not isolated exercises. Keeping the antiderivative at hand also gives an immediate sanity check for numerical integration routines.

When you apply the formula on a computer-algebra system, you may see the answer written with a complex logarithm or with different constants. Any such form differs from the one here by a constant, so differentiate it, or compare values at two points, to confirm agreement.

Where This Fits in the Course

This tutorial belongs to the module “Integration by Parts I”. The tutorial just before it is “Integrating Logarithms Of Affine Expressions,” and the one that follows is “Definite Logarithmic Integrals With Positive Endpoints.” The previous tutorial uses the same method for the logarithm of a linear expression; here the chain rule introduces a rational function.

Check Your Understanding

Use the derivation and examples above to answer these questions.

  1. Why does \(\ln(1+x^2)\) need no absolute value or domain restriction?
  2. Rewrite \(\frac{2x^2}{1+x^2}\) as a constant plus a fraction.
  3. Evaluate \(\int_0^{\sqrt3}\ln(1+x^2)\,dx\).
  4. Use symmetry to evaluate \(\int_{-2}^{2}\ln(1+x^2)\,dx\) in terms of the antiderivative at \(x=2\).
  5. Which term in the answer comes from the boundary term, and which come from the division step?

Test yourself: Calculus II final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon