Tutorials › Calculus II › Integrating Logarithms Of Affine Expressions

Integration by Parts I · Tutorial 36 of 998

Integrating Logarithms Of Affine Expressions

Find ∫ ln(ax+b) dx by taking the logarithm as u and dv = dx, then express the answer using the original affine expression.

Intermediate 10 min read

What You'll Learn

  • Set up integration by parts with u = ln(ax+b) and dv = dx.
  • Reduce the leftover rational integral by splitting off a constant.
  • Express the antiderivative in terms of ax + b and check it by differentiation.
  • Identify the interval on which ax + b is positive.
  • Compare the parts method with the substitution u = ax + b.

Integrating a Logarithm with an Affine Argument

The natural logarithm of a linear expression, \(\ln(ax+b)\), appears constantly in applications. The integral \(\int \ln x\,dx\) is already a classic use of integration by parts, because \(\ln x\) alone has no obvious antiderivative. The affine version adds one extra step: the derivative of the inside function contributes a factor \(a\). In this tutorial \(a\ne0\) and \(b\) are constants, and the integral is considered on an interval where \(ax+b>0\), since the logarithm requires a positive argument.

Result: On an interval where \(ax+b>0\) and \(a\ne0\), \(\displaystyle\int\ln(ax+b)\,dx=\frac{ax+b}{a}\ln(ax+b)-x+C.\)

Derivation by Parts

Let \(u=\ln(ax+b)\) and \(dv=dx\). The chain rule gives \(du=\frac{a}{ax+b}\,dx\), and \(v=x\). Then

$$ \int\ln(ax+b)\,dx=x\ln(ax+b)-\int \frac{ax}{ax+b}\,dx. $$

The new integral is a rational function whose numerator and denominator have the same degree. Rewrite the numerator by adding and subtracting \(b\): \(ax=(ax+b)-b\). Then

$$ \frac{ax}{ax+b}=\frac{(ax+b)-b}{ax+b}=1-\frac{b}{ax+b}. $$

Integrating term by term, \(\int 1\,dx=x\) and \(\int\frac{b}{ax+b}\,dx=\frac{b}{a}\ln(ax+b)\), the latter because the argument is positive and the derivative of \(ax+b\) is \(a\). So \(\int\frac{ax}{ax+b}\,dx=x-\frac{b}{a}\ln(ax+b)\), and

$$ \int\ln(ax+b)\,dx=x\ln(ax+b)-x+\frac{b}{a}\ln(ax+b)+C=\frac{ax+b}{a}\ln(ax+b)-x+C. $$

The two logarithmic terms combine because \(x+\frac ba=\frac{ax+b}{a}\). Notice the pleasant form of the answer: the factor in front of the logarithm is the original affine expression divided by \(a\), exactly as in the basic result \(\int\ln x\,dx=x\ln x-x\).

A Shortcut by Substitution

The same result follows from a substitution. Let \(w=ax+b\), so \(dw=a\,dx\). Then \(\int\ln(ax+b)\,dx=\frac1a\int\ln w\,dw=\frac1a\bigl(w\ln w-w\bigr)+C=\frac{ax+b}{a}\ln(ax+b)-\frac{ax+b}{a}+C\). The last term equals \(-x-\frac ba\), and the constant \(-\frac ba\) can be absorbed into \(C\). The two answers differ only by a constant, which is exactly what two correct antiderivatives may do. This agreement is a useful consistency check on both methods.

Worked Examples

Worked Example: A Positive Slope

Find \(\int\ln(2x+3)\,dx\) on the interval \(x>-\tfrac32\).

Here \(a=2\) and \(b=3\). The formula gives

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

Check: \(\frac{d}{dx}\left[\frac{2x+3}{2}\ln(2x+3)\right]=\ln(2x+3)+\frac{2x+3}{2}\cdot\frac{2}{2x+3}=\ln(2x+3)+1\). Subtracting the derivative of \(x\) leaves \(\ln(2x+3)\).

Worked Example: A Negative Slope

Find \(\int\ln(5-x)\,dx\) for \(x<5\).

Now \(a=-1\) and \(b=5\), and the argument \(5-x\) is positive when \(x<5\). The formula gives

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

Check: \(\frac{d}{dx}\bigl[(x-5)\ln(5-x)\bigr]=\ln(5-x)+(x-5)\cdot\frac{-1}{5-x}=\ln(5-x)+1\). Subtracting \(1\) gives back \(\ln(5-x)\). The negative slope changes signs inside the formula but not the structure.

Worked Example: A Definite Integral

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

With \(a=3\), \(b=1\), the antiderivative is \(F(x)=\frac{3x+1}{3}\ln(3x+1)-x\). At \(x=2\), \(F(2)=\frac73\ln7-2\). At \(x=0\), \(F(0)=\frac13\ln1-0=0\). Therefore

$$ \int_0^2\ln(3x+1)\,dx=\frac73\ln7-2\approx2.54. $$

This is plausible: the integrand rises from \(0\) to \(\ln7\approx1.95\), so the area over an interval of length \(2\) should be between \(0\) and \(3.9\), and a concave curve puts it above half the maximum rectangle.

Common Mistake: Dropping the Factor from the Chain Rule

A frequent error is to differentiate \(\ln(ax+b)\) as \(\frac{1}{ax+b}\), forgetting the inner derivative \(a\). That produces \(du=\frac{1}{ax+b}\,dx\) and the incorrect leftover integral \(\int\frac{x}{ax+b}\,dx\). The resulting antiderivative differs from the correct one by a factor of \(a\) in the second term. A derivative check detects the problem: the proposed answer will not differentiate back to \(\ln(ax+b)\) unless the chain-rule factor is present.

A second common slip is to treat the negative-slope case carelessly. With \(a=-1\), the fraction \(\frac{ax+b}{a}\) becomes \(-(ax+b)\), and forgetting that minus sign changes the answer. Writing the result in terms of the original expression, as above, makes the sign easy to track.

Domain and Interpretation

The antiderivative is valid only where \(ax+b>0\). If an interval contains the point \(x=-b/a\), where the argument is zero, the integrand has a vertical asymptote there. The integral is improper at that point and converges, because \(\ln\) is integrable near zero. If the argument is negative, one must use \(\ln|ax+b|\), and the antiderivative takes the same form with absolute values: \(\frac{ax+b}{a}\ln|ax+b|-x+C\).

A Reliable Procedure

A fixed sequence of steps makes these problems routine, regardless of the signs of \(a\) and \(b\).

1
Find the valid interval.
Solve \(ax+b>0\). If \(a>0\), this means \(x>-b/a\); if \(a<0\), it means \(x<-b/a\).
2
Choose the parts.
Take \(u=\ln(ax+b)\) and \(dv=dx\), so \(v=x\) and \(du=\frac{a}{ax+b}\,dx\).
3
Reduce the rational integral.
Write \(\frac{ax}{ax+b}=1-\frac{b}{ax+b}\) and integrate each term.
4
Combine the logarithm terms.
Collect the coefficient of \(\ln(ax+b)\) as \(x+\frac ba=\frac{ax+b}{a}\).
5
Check.
Differentiate the result. The two \(+1\) and \(-1\) terms must cancel, leaving \(\ln(ax+b)\).

Worked Example: A Shift That Changes the Lower Limit

Evaluate \(\int_1^4\ln(x+2)\,dx\).

With \(a=1\) and \(b=2\), the antiderivative is \(F(x)=(x+2)\ln(x+2)-x\). Then \(F(4)=6\ln6-4\) and \(F(1)=3\ln3-1\). Hence

$$ \int_1^4\ln(x+2)\,dx=6\ln6-4-3\ln3+1=6\ln6-3\ln3-3\approx2.46. $$

A quick numerical check: the integrand ranges from \(\ln3\approx1.10\) at \(x=1\) to \(\ln6\approx1.79\) at \(x=4\) over an interval of length \(3\). Its average is about \(0.82\) per unit length times three, roughly \(2.5\), matching the computed value.

Relation to the Basic Logarithm Integral

Setting \(a=1\) and \(b=0\) in the formula gives \(\int\ln x\,dx=x\ln x-x+C\), the basic result for the logarithm. Every affine version is a stretched and shifted copy of this one. The shift \(b\) moves the point where the logarithm vanishes, while the slope \(a\) both stretches the horizontal scale and divides the antiderivative by \(a\), because \(\int f(ax+b)\,dx=\frac1aF(ax+b)\) whenever \(F'=f\). Recognizing this scaling rule lets you write the answer without any parts at all once the basic integral is known.

This is also why the answer is naturally written in terms of the affine expression. The form \(\frac{ax+b}{a}\ln(ax+b)-x\) displays the same structure as \(w\ln w-w\), with \(w=ax+b\), up to a constant. When you are asked to express the result using the original argument, keep \(ax+b\) intact rather than expanding it.

Takeaway: On an interval where \(ax+b>0\), \(\int\ln(ax+b)\,dx=\frac{ax+b}{a}\ln(ax+b)-x+C\). Use parts with \(dv=dx\), rewrite the rational leftover, and confirm by differentiating.

Quick Reference

IntegrandAntiderivativeValid where
\(\ln x\)\(x\ln x-x\)\(x>0\)
\(\ln(x+b)\)\((x+b)\ln(x+b)-x\)\(x+b>0\)
\(\ln(ax+b)\)\(\frac{ax+b}{a}\ln(ax+b)-x\)\(ax+b>0,\ a\ne0\)
\(\ln|ax+b|\)\(\frac{ax+b}{a}\ln|ax+b|-x\)\(ax+b\ne0\)

Worked Example: A Scaled Logarithm with a Decreasing Argument

Find \(\int 5\ln(1-2x)\,dx\) for \(x<\tfrac12\).

Here \(a=-2\) and \(b=1\), and the factor \(5\) comes out of the integral. Applying the formula,

$$ \int 5\ln(1-2x)\,dx=5\left(\frac{1-2x}{-2}\ln(1-2x)-x\right)+C=-\frac52(1-2x)\ln(1-2x)-5x+C. $$

Differentiate to check: \(\frac{d}{dx}\left[-\tfrac52(1-2x)\ln(1-2x)\right]=-\tfrac52\bigl[-2\ln(1-2x)+(1-2x)\cdot\tfrac{-2}{1-2x}\bigr]=5\ln(1-2x)+5\). The term \(-5x\) contributes \(-5\), so the total derivative is \(5\ln(1-2x)\).

An Improper Endpoint

The antiderivative behaves well at the point where the argument vanishes. Since \(w\ln w\to0\) as \(w\to0^+\), the limit of \(\frac{ax+b}{a}\ln(ax+b)\) at \(x=-b/a\) is zero, so the improper integral converges. For example,

$$ \int_{-1}^{0}\ln(x+1)\,dx=\Bigl[(x+1)\ln(x+1)-x\Bigr]_{-1^+}^{0}=0-(0+1)=-1. $$

The value is negative because \(\ln(x+1)<0\) on \((-1,0)\), where the argument lies between \(0\) and \(1\). The integrand has a vertical asymptote at \(x=-1\), yet the area is finite. This is a common surprise: logarithmic singularities are integrable, in contrast with a pole such as \(1/(x+1)\).

A Final Habit: Check the Domain First

Before integrating \(\ln(ax+b)\), confirm that \(ax+b>0\) on the whole interval. If the interval contains the point \(x=-\frac ba\), the integrand is undefined there and the integral cannot be evaluated by a simple substitution of endpoints. This check takes a few seconds, and it prevents the most common error with logarithms of affine expressions: using the antiderivative on an interval where the integrand does not exist.

Where This Fits in the Course

This tutorial belongs to the module “Integration by Parts I”. The tutorial just before it is “Power-Weighted Logarithm Integrals,” and the one that follows is “Integrating The Logarithm Of A Quadratic.” Here the logarithm's argument is a general linear expression, so the chain rule contributes an extra factor.

Check Your Understanding

Use the formula and derivation above to answer these questions.

  1. Find \(\int\ln(4x-1)\,dx\) and state the interval on which your answer is valid.
  2. Why does the rational integral after parts require the rewrite \(ax=(ax+b)-b\)?
  3. Evaluate \(\int_1^3\ln(2x)\,dx\) using the formula with \(b=0\).
  4. Show that the substitution \(w=ax+b\) and the parts method give antiderivatives that differ by a constant.
  5. What changes if the argument is negative on the interval of integration?

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