Antiderivative of 1/x: Why It Is ln|x| + C

Quick answer

The antiderivative of \(\frac{1}{x}\) is \(\ln|x| + C\). The absolute value matters: it makes the answer work for negative \(x\) too. Check: \(\frac{d}{dx}\ln|x| = \frac{1}{x}\) for every \(x \ne 0\).

\(\frac{1}{x}\) is the one power of \(x\) that breaks the usual rule, so it gets its own page. Here are the questions students ask most about it, answered one at a time, with examples you can check yourself.

Why doesn’t the power rule work for 1/x?

The power rule says \(\int x^n\,dx = \frac{x^{n+1}}{n+1} + C\). Write \(\frac1x\) as \(x^{-1}\), so \(n = -1\):

\[\int x^{-1}\,dx = \frac{x^{0}}{0} + C \quad\longleftarrow\ \text{dividing by zero!}\]

The formula breaks, so we need a different function. That function is the natural logarithm.

Where does ln x come from?

The natural logarithm has a special derivative: \(\frac{d}{dx}\ln x = \frac{1}{x}\) for \(x > 0\). Read backward, that says \(\ln x\) is an antiderivative of \(\frac1x\). In fact, mathematicians often define \(\ln x\) as the area under \(\frac1t\) from 1 to \(x\):

Definition of ln x\[\ln x = \int_1^x \frac{1}{t}\,dt, \qquad x > 0\]

Why is there an absolute value in ln|x|?

\(\frac1x\) exists for negative numbers, like \(x = -2\), but \(\ln x\) does not. The absolute value fixes this. For \(x < 0\), \(\ln|x| = \ln(-x)\), and the chain rule gives

\[\frac{d}{dx}\ln(-x) = \frac{1}{-x}\cdot(-1) = \frac{1}{x}.\]

So \(\ln|x|\) has derivative \(\frac1x\) on both sides of zero. That is why the complete answer is \(\int \frac{1}{x}\,dx = \ln|x| + C\).

What is the antiderivative of 1/x²?

This one is different, because \(\frac{1}{x^2} = x^{-2}\) and \(n = -2\) is allowed in the power rule:

\[\int x^{-2}\,dx = \frac{x^{-1}}{-1} + C = -\frac{1}{x} + C.\]

Students often mix the two up, so here they are side by side:

FunctionAntiderivativeWhy
\(\frac{1}{x}\)\(\ln|x| + C\)Special case, \(n = -1\)
\(\frac{1}{x^2}\)\(-\frac{1}{x} + C\)Power rule, \(n = -2\)
\(\frac{1}{x^3}\)\(-\frac{1}{2x^2} + C\)Power rule, \(n = -3\)
\(\frac{1}{\sqrt{x}}\)\(2\sqrt{x} + C\)Power rule, \(n = -\frac12\)

What about 1/(ax + b) and other variations?

IntegralAnswer
\(\int x^{-1}\,dx\) (same as \(\frac1x\))\(\ln|x| + C\)
\(\int \frac{2}{x}\,dx\)\(2\ln|x| + C\)
\(\int \frac{5}{x}\,dx\)\(5\ln|x| + C\)
\(\int \frac{1}{2x}\,dx\)\(\frac12\ln|x| + C\)
\(\int -\frac{1}{x}\,dx\)\(-\ln|x| + C\)
\(\int \left(x + \frac1x\right)dx\)\(\frac{x^2}{2} + \ln|x| + C\)
\(\int \frac{1}{x+1}\,dx\)\(\ln|x+1| + C\)
\(\int \frac{1}{x+4}\,dx\)\(\ln|x+4| + C\)
\(\int \frac{1}{3x-2}\,dx\)\(\frac13\ln|3x-2| + C\)
\(\int \frac{2x}{x^2+1}\,dx\)\(\ln\left(x^2+1\right) + C\)
\(\int \frac{1}{x\ln x}\,dx\)\(\ln\left|\ln x\right| + C\)

The pattern behind all of these is \(\int \frac{f'(x)}{f(x)}\,dx = \ln|f(x)| + C\): when the top is the derivative of the bottom, the answer is the log of the bottom. That is a special case of u-substitution.

Worked example: \(\int \frac{1}{3x-2}\,dx\)

Let \(u = 3x – 2\). Then \(du = 3\,dx\), so \(dx = \frac13\,du\):

\[\int \frac{1}{3x-2}\,dx = \frac13\int\frac{du}{u} = \frac13\ln|3x-2| + C.\]

Look-alikes that do NOT give ln

Only a first power of \(x\) (or of a linear expression) in the bottom gives a logarithm. These look similar but need other rules:

IntegralAnswerWhy
\(\int \frac{1}{x^2}\,dx\)\(-\frac1x + C\)Power rule with \(n = -2\)
\(\int \frac{1}{\sqrt{x}}\,dx\)\(2\sqrt{x} + C\)Power rule with \(n = -\frac12\)
\(\int \frac{1}{1+x^2}\,dx\)\(\arctan x + C\)Inverse tangent formula
\(\int \frac{1}{\ln x}\,dx\)No elementary formulaIts antiderivative is a special function, \(\operatorname{li}(x)\)

For the power-rule cases, see the power rule for antiderivatives.

What does the answer mean as an area?

Because of the definition above, areas under \(\frac1x\) are logarithms:

  • \(\int_1^2 \frac1x\,dx = \ln 2 \approx 0.693\)
  • \(\int_1^{e} \frac1x\,dx = \ln e = 1\). This is one way to define the number \(e \approx 2.718\): it is where the area under \(\frac1x\) reaches exactly 1.
  • \(\int_1^{\infty} \frac1x\,dx\) is infinite. The curve gets low, but not fast enough. Compare it with \(\int_1^{\infty} \frac{1}{x^2}\,dx = 1\) in the improper integral calculator.

Do not integrate across zero. \(\int_{-1}^{1}\frac1x\,dx\) is not \(\ln 1 – \ln 1 = 0\). The function blows up at \(x = 0\), so this integral is improper and does not have a finite value.

How do I check my answer?

Differentiate it. For \(\frac13\ln|3x-2|\), the chain rule gives \(\frac13\cdot\frac{3}{3x-2} = \frac{1}{3x-2}\). ✓ You can also type the problem into the antiderivative calculator, which shows this check automatically.

Calculators for This Topic

Practice what you just read. Each tool shows full steps and checks its own answer.

Frequently Asked Questions

What is the antiderivative of 1/x?

It is \(\ln|x| + C\). For positive \(x\) only, \(\ln x + C\) is also correct.

Why is the antiderivative of 1/x not x⁰/0?

The power rule needs to divide by \(n + 1\). For \(\frac1x = x^{-1}\), that is \(-1 + 1 = 0\), and you cannot divide by zero. The natural logarithm fills this gap.

What is the antiderivative of 1/x²?

It is \(-\frac{1}{x} + C\). Here the power rule works because the exponent is \(-2\), not \(-1\).

What is the antiderivative of 1/(2x)?

Pull out the constant: \(\int \frac{1}{2x}\,dx = \frac12\ln|x| + C\). The answer \(\frac12\ln|2x| + C\) is also correct, because it differs from the first one by a constant.

Is ln|x| + C the most general antiderivative?

Strictly speaking, you may use a different constant on each side of zero, because the graph is in two separate pieces. For almost all homework, \(\ln|x| + C\) is the expected answer.

Related Guides

1 thought on “Antiderivative of 1/x: Why It Is ln|x| + C”

Leave a Comment