Integral of 1/x: Formula, Derivation and Examples
The integral of 1/x is ln|x| + C. See why the power rule fails here, where the absolute value comes from, and how to handle 1/(ax + b) and f'/f.
Powers, roots and rational functions Updated 3 min read
At a glance
- Antiderivative
- \ln\lvert x\rvert + C
- Valid for
- x \ne 0
- Linear form
- \int \dfrac{1}{ax + b}\,dx = \dfrac{1}{a}\ln\lvert ax + b\rvert + C
- Log form
- \int \dfrac{f'(x)}{f(x)}\,dx = \ln\lvert f(x)\rvert + C
- Area from 1 to e
- 1
On this page
The integral of \dfrac{1}{x} is \ln\lvert x\rvert + C. It is the one power of x that the reverse power rule cannot handle, and the natural log fills the gap.
Graph of 1/x and its antiderivative
On the right, \frac{1}{x} > 0 and \ln x increases. On the left, \frac{1}{x} < 0 and \ln\lvert x\rvert decreases as you move right. The slopes match the heights in both cases.
Why the power rule fails
The reverse power rule says \int x^n\,dx = \frac{x^{n+1}}{n+1} + C. For \frac{1}{x} = x^{-1} that would give \frac{x^0}{0}, which is undefined. No power of x has derivative x^{-1}, because the derivative of x^0 = 1 is 0.
The function that does have derivative \frac{1}{x} is the natural log. The derivative of ln x page proves that \frac{d}{dx}\ln x = \frac{1}{x} for x > 0.
Where the absolute value comes from
For x < 0, \ln x is undefined, but \ln(-x) is fine. Differentiate it with the chain rule:
So \ln x works for x > 0 and \ln(-x) works for x < 0. Together they are \ln\lvert x\rvert.
Check by differentiating
For x > 0: \frac{d}{dx}\ln x = \frac{1}{x}. For x < 0: \frac{d}{dx}\ln(-x) = \frac{1}{x}. Both give \frac{1}{x}, so \frac{d}{dx}\ln\lvert x\rvert = \frac{1}{x} for all x \ne 0.
Substitution variants
With u = ax + b:
More generally, whenever the numerator is the derivative of the denominator, the answer is a log:
This one pattern gives the integral of tan x, the integral of cot x and the integral of x/(x² + 1).
Worked examples
Example 1. \int \frac{5}{x}\,dx = 5\ln\lvert x\rvert + C.
Example 2. \int \frac{1}{3x - 2}\,dx = \frac{1}{3}\ln\lvert 3x - 2\rvert + C.
Example 3. \int \frac{2x + 3}{x^2 + 3x}\,dx = \ln\lvert x^2 + 3x\rvert + C, since the numerator is the derivative of the denominator.
Example 4: definite, positive side. \int_1^2 \frac{1}{x}\,dx = \ln 2 - \ln 1 = \ln 2 \approx 0.693.
Example 5: definite, negative side. \int_{-3}^{-1} \frac{1}{x}\,dx = \ln\lvert -1\rvert - \ln\lvert -3\rvert = -\ln 3. The answer is negative because the curve is below the axis there.
Common mistakes
- Using the power rule. \frac{x^0}{0} is meaningless. Use \ln\lvert x\rvert.
- Dropping the absolute value when x can be negative.
- Integrating across 0. \int_{-1}^{1}\frac{1}{x}\,dx is not \ln 1 - \ln 1 = 0. The integral diverges.
- Confusing it with \frac{1}{x^2}. \int \frac{1}{x^2}\,dx = -\frac{1}{x} + C, not a log. See the integral of 1/x².
- Forgetting the \frac{1}{a} in \int \frac{1}{ax + b}\,dx.
For a log-based integral that runs the other way, see the integral of ln x.
Practice it now
Sine, cosine, eˣ and 1/x
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson