Integrals

Integral of 1/x: Why It’s ln|x| + C (Not x⁰/0)

Integral of 1/x: Why It’s ln|x| + C (Not x⁰/0) — CalculusCalc cover image

Quick answer:

$$\int\frac{1}{x}\,dx = \ln|x| + C$$

The integral of 1/x is the one gap in the power rule, and filling that gap is how the natural logarithm enters calculus. Below you’ll find why the power rule fails, a short proof, the picture that makes logs feel natural, seven worked examples, the mistakes to avoid, and practice problems with answers.

Why the power rule breaks here

The integral power rule is \( \int x^n\,dx = \frac{x^{n+1}}{n+1} + C \). With \( n = -1 \) it would give \( \frac{x^0}{0} \): division by zero. So \( \frac1x = x^{-1} \) is the one power that needs a different answer, and that answer is the natural logarithm, because the derivative of ln x is \( \frac1x \).

The power rule doesn’t fail gracefully, either. The powers \( x^{n+1} \) for other values of \( n \) are all polynomials or roots, and none of them has derivative \( x^{-1} \). A genuinely new function is needed.

Why it works: the area under a hyperbola

Here’s a picture that makes the log feel inevitable. Look at the area under \( y = \frac1x \) from 1 to some number \( a \). Now stretch that region horizontally by a factor \( b \) and squash it vertically by the same factor. The area doesn’t change, and the squashed curve is still exactly \( y = \frac1x \), now running from \( b \) to \( ab \).

So the area from 1 to \( a \) equals the area from \( b \) to \( ab \). Adding the area from 1 to \( b \) to both sides, the area from 1 to \( ab \) is the area to \( a \) plus the area to \( b \). A function that turns products into sums is a logarithm. For example, the area from 2 to 8 equals the area from 1 to 4, and both are \( \ln 4 \).

Proof with the Fundamental Theorem

Define \( F(x) \) as the area under \( \frac1t \) from 1 to \( x \), for \( x > 0 \). By the Fundamental Theorem of Calculus, \( F'(x) = \frac1x \). The function \( \ln x \) has the same derivative, so the two differ by a constant. Both equal 0 at \( x = 1 \), so the constant is 0 and \( F(x) = \ln x \). For negative \( x \), the next section handles the sign.

There’s also a neat limit connection. For \( n \neq -1 \), the area under \( t^n \) from 1 to \( x \) is \( \frac{x^{n+1} - 1}{n+1} \). As \( n \) approaches \( -1 \), this expression approaches \( \ln x \). So the log isn’t a random patch; it’s the limit of the power rule itself. (Try it at \( x = 2 \): the expression \( \frac{2^h - 1}{h} \) tends to \( \ln 2 \) as \( h \to 0 \).)

Why the absolute value?

\( \frac1x \) is defined for negative \( x \), but \( \ln x \) is not. For \( x < 0 \), \( \ln(-x) \) works:

$$\frac{d}{dx}\ln(-x) = \frac{-1}{-x} = \frac1x$$

Writing \( \ln|x| \) covers both cases at once. Strictly speaking, since the domain has two separate pieces, the constant can be different on each side of zero.

Definite integrals

  • \( \int_1^e\frac{dx}{x} = \ln e - \ln 1 = 1 \). (This is actually one way to define \( e \): the number where the area under \( \frac1x \) from 1 reaches exactly 1.)
  • \( \int_1^2\frac{dx}{x} = \ln 2 \approx 0.6931 \)
  • \( \int_{-3}^{-1}\frac{dx}{x} = \ln 1 - \ln 3 = -\ln 3 \): negative, because the curve is below the axis.

Warning: \( \int_{-1}^{1}\frac{dx}{x} \) is not zero. The integrand blows up at \( x = 0 \), so this is a divergent improper integral.

Close relatives

Linear inside: \( \int\frac{dx}{ax + b} = \frac1a\ln|ax + b| + C \). Example:

$$\int\frac{dx}{3x+2} = \frac13\ln|3x + 2| + C$$

Derivative on top: whenever the numerator is the derivative of the denominator, the answer is a log (u-substitution):

$$\int\frac{f'(x)}{f(x)}\,dx = \ln|f(x)| + C$$

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

This same pattern is behind the integral of tan x, where the numerator \( \sin x \) is minus the derivative of \( \cos x \).

Constant multiple: \( \int\frac5x\,dx = 5\ln|x| + C \).

Worked examples

Example 1 (split the fraction). For \( \int\frac{x^2 + 1}{x}\,dx \), divide each term by \( x \) first. That gives \( x + \frac1x \), and each piece is basic:

$$\int\frac{x^2+1}{x}\,dx = \frac{x^2}{2} + \ln|x| + C$$

Example 2 (log inside a log). For \( \int\frac{dx}{x\ln x} \), notice that \( \frac1x \) is the derivative of \( \ln x \). Let \( u = \ln x \), so \( du = \frac{dx}{x} \), and the integral becomes \( \int\frac{du}{u} \):

$$\int\frac{dx}{x\ln x} = \ln|\ln x| + C$$

Over \( [e, e^2] \) this gives \( \ln 2 - \ln 1 = \ln 2 \).

Example 3 (exponential on top). For \( \int\frac{e^x}{e^x + 3}\,dx \), the numerator is the derivative of the denominator. So the answer is \( \ln(e^x + 3) + C \). No absolute value is needed because \( e^x + 3 \) is always positive.

Example 4 (partial fractions). For \( \int\frac{dx}{x(x+1)} \), split the fraction as \( \frac1x - \frac{1}{x+1} \) using partial fractions. Each piece is a log:

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

Example 5 (scaling). Evaluate from \( e \) to \( e^3 \). The antiderivative gives \( \ln e^3 - \ln e = 3 - 1 = 2 \). Notice that the ratio of the endpoints, \( e^2 \), is all that matters.

Example 6 (a look-alike). \( \int\frac{dx}{x^2 + 1} \) is not a log, because the top isn’t the derivative of the bottom. It’s \( \arctan x + C \). Always check the numerator before reaching for ln.

Example 7 (negative side). From \( -3 \) to \( -1 \), the answer \( -\ln 3 \approx -1.0986 \) is negative, because the curve lies below the axis there. The absolute value inside the log is what makes this calculation valid.

You can check each of these with the integral calculator.

How to spot a log answer

Before integrating any fraction, run through three quick questions:

  1. Is the denominator a single power of \( x \)? If the power is 1, the answer is a log. Any other power uses the ordinary power rule.
  2. Is the numerator the derivative of the denominator, up to a constant? Then substitute \( u = \) denominator, and the answer is a constant times \( \ln|u| \).
  3. Is the numerator’s degree at least the denominator’s? Divide first, as in Example 1, then look again at the leftover fraction.

If none of these apply, the fraction probably needs partial fractions, an arctangent, or trig substitution instead. This checklist takes a few seconds and prevents the most common wrong answer: a log that doesn’t belong.

Common mistakes

  1. Using the power rule anyway. \( \frac{x^0}{0} \) is undefined. The exponent \( -1 \) is the exception.
  2. Dropping the absolute value. \( \ln x \) only covers \( x > 0 \). The general answer is \( \ln|x| + C \).
  3. Forgetting the \( \frac1a \). The integral of \( \frac{1}{3x+2} \) is \( \frac13\ln|3x + 2| + C \), not \( \ln|3x + 2| + C \).
  4. Canceling through zero. \( \int_{-1}^1\frac{dx}{x} \) is not 0 by symmetry. The integral diverges on each side of 0.
  5. Seeing a log where there isn’t one. \( \frac{1}{x^2} \) integrates to \( -\frac1x \), and \( \frac{1}{x^2 + 1} \) to \( \arctan x \). Only a numerator that matches the derivative of the denominator gives a log.

Where it’s used

Separating variables in growth and decay problems always produces this integral. From \( \frac{dy}{dt} = ky \), you get \( \int\frac{dy}{y} = \int k\,dt \), so \( \ln|y| = kt + C \), and exponentials follow. The same integral computes the work done by a gas expanding at constant temperature, where pressure is proportional to \( \frac1V \). The antiderivative of ln itself, the integral of ln x, is the next step in the story.

The area never stops growing

\( \ln x \to \infty \) as \( x \to \infty \), so \( \int_1^{\infty}\frac{dx}{x} \) diverges, even though \( \frac1x \to 0 \). Compare \( \int_1^{\infty}\frac{dx}{x^2} = 1 \), which converges. This is the integral-test reason the harmonic series diverges while \( \sum\frac1{n^2} \) converges (see the ratio test article for more on series).

Try it yourself

Step-by-step solverExact symbolic engine

Interactive Calculus Problem Solver

Derivatives, antiderivatives, definite and improper integrals, and limits. Every answer comes with the rules used, and antiderivatives are verified by differentiating them back.

Try:
Input syntax
  • Powers x^2, roots sqrt(x), cbrt(x), absolute value |x|
  • Implicit multiplication works: 3x sin(2x)
  • sin cos tan sec csc cot, asin acos atan, sinh cosh tanh
  • e^x or exp(x); ln(x) and log(x) are both the natural log
  • Constants pi and e; bounds accept inf and -inf
Enter a function and press Solve to see a full worked solution.

Practice problems

Try these before checking the answers.

  1. \( \int\frac{3}{x}\,dx \)
  2. \( \int\frac{dx}{5 - 2x} \)
  3. \( \int_2^{8}\frac{dx}{x} \)
  4. \( \int\frac{x + 1}{x}\,dx \)
  5. \( \int\frac{e^x}{e^x + 3}\,dx \)
  6. \( \int_e^{e^3}\frac{dx}{x} \)

Answers: (1) \( 3\ln|x| + C \); (2) \( -\frac12\ln|5 - 2x| + C \); (3) \( \ln 4 \); (4) \( x + \ln|x| + C \); (5) \( \ln(e^x + 3) + C \); (6) \( 2 \).

FAQ

Is the integral of 1/x equal to ln(x)?

For \( x > 0 \), yes. The general answer, valid for any \( x \neq 0 \), is \( \ln|x| + C \).

What is the integral of 1/x²?

Here the power rule works: \( \int x^{-2}\,dx = -x^{-1} + C = -\frac1x + C \).

What is the integral of 1/x from 1 to infinity?

It diverges. The area up to \( b \) is \( \ln b \), which grows without bound as \( b \) grows.

What is the integral of 1/(ax + b)?

It’s \( \frac1a\ln|ax + b| + C \). Substitute \( u = ax + b \), so \( dx = \frac{du}{a} \).

Is the integral of 1/x from −1 to 1 equal to zero?

No. The function has an infinite discontinuity at 0, and each half of the integral diverges, so the whole integral diverges.

Further reading

Calculators for this topic

Leave a comment

Your email address will not be published. Required fields are marked *