Worked example · Derivatives

The derivative of ln x

The slope of the natural logarithm at x is 1/x. Drag the secant on its graph and watch the slope settle there, then see why it must.

5 min read · 2 interactive figures

Drag Q toward P on y = ln x. At x = 1 the slope settles on 1; drag P to 2 and it settles on 0.5. Below, the traced slopes draw y = 1/x.

The derivative of ln x is 1/x, for every x > 0. At x = 1 the logarithm climbs with slope 1, at x = 2 with slope 1/2, at x = 10 with slope 1/10: it keeps rising forever, but ever more slowly.

ddx ln x = 1x, x > 0(1)
Question 1 Predict, then check with the calculator below.#
Figure 1 Type any function of x (ln(5x), ln(x^2+1), log10(x), x ln(x)) and a point. The calculator draws the tangent and reports the derivative with an honest error estimate; open “Show the work” to see the difference quotients behind it. At x = 0 it refuses ln x: the function is not defined there.#

That is the rule as it appears in every derivative table[1]. Below are two reasons it is true, one from the definition of the derivative and one from the exponential function, followed by the variations that turn up in homework: ln(kx), ln of a function, ln|x| and logarithms to other bases. If the derivative itself is new to you, start with the chapter on the derivative, where the secant-to-tangent picture in the figure above is explained from the beginning.

What the graph says

Look at the figure before any algebra. The curve y = ln x passes through (1, 0), rises steeply near 0 and flattens to the right. Its slope is always positive, so the derivative must be positive. Near 0 the curve dives toward −∞, so the derivative must grow large there. Far to the right the curve is nearly flat, so the derivative must shrink toward 0. The function 1/x does all three. Sweep P across the figure with h at zero and the traced slopes draw exactly the hyperbola y = 1/x.

Proof 1: from the limit definition

The derivative is the limit of the secant slope. For ln x, the log rules turn that slope into something recognisable:

ln(x + h) − ln xh = 1h ln(1 + hx) = 1x · ln(1 + u)u, u = h/x(2)

As h → 0, u → 0 too, and everything hinges on one limit: ln(1 + u)/u → 1. That limit is the statement that the logarithm has slope 1 at 1, and it is equivalent to the definition of e as the limit of (1 + u)1/u, since ln(1 + u)/u = ln[(1 + u)1/u] → ln e = 1. You can watch it happen in the limit calculator at the end of the Limits section with (1+x)^(1/x) at 0, which settles on 2.718281828…. Equation (2) then gives the answer 1/x · 1 = 1/x.

There is an important structural point in equation (2): the slope at x is the slope at 1, divided by x. The logarithm turns multiplication into addition, so stretching the input by a factor of x stretches the horizontal scale of the graph by x and divides every slope by x. That is the geometric reason the answer is a reciprocal.

Proof 2: from ex

The logarithm undoes the exponential: y = ln x means ey = x. Differentiate both sides with respect to x, using the chain rule on the left and the fact that ey is its own derivative[1]:

ey · dydx = 1 ⟹ dydx = 1ey = 1x(3)

Geometrically, the graph of ln x is the graph of ex reflected in the line y = x. Reflection swaps rise and run, so it turns every slope m into 1/m. The exponential's slope at height x is x, so the logarithm's slope at x is 1/x. Several rigorous treatments run the logic the other way: they define ln x as the area under 1/t from 1 to x, so that (1) is the fundamental theorem and needs no proof at all, and then build ex as its inverse[2][3].

The cases you will meet

Each of these follows from equation (1) and the chain rule (d/dx ln g(x) = g′(x)/g(x)):

functionderivativewhy
ln(kx), k > 01/xln(kx) = ln k + ln x; the constant has slope 0
ln(x² + 1)2x/(x² + 1)chain rule: inner derivative 2x over the inner function
ln|x|, x ≠ 01/xfor x < 0 it is ln(−x), whose derivative is (−1)/(−x)
logb x1/(x ln b)logb x = ln x / ln b, a constant multiple
x ln xln x + 1product rule

Numbers to check against the calculator: the derivative of ln(x² + 1) at 1 is 2/2 = 1; of log10 x at 2 it is 1/(2 ln 10) ≈ 0.2171; of ln(5x) at 2 it is 0.5. The ln|x| row matters in integration, where it gives ∫ dx/x = ln|x| + C on either side of 0.

Two common mistakes

The first is writing d/dx ln(g(x)) = 1/g(x) and forgetting the inner derivative. The slope of ln(x² + 1) at 1 is 1, not 1/2; drag the calculator to x = 1 and type both versions. The second is applying the rule outside the domain. ln x exists only for x > 0, so "the derivative of ln x at −2 is −1/2" is meaningless, while the derivative of ln|x| at −2 really is −1/2. The graph of ln|x| is the logarithm and its mirror image, and the mirror image falls where the original rises.

The neighbouring rules work the same way: see the Derivative of tan x page for tan x and the Derivatives of the inverse trig functions page for arcsin, arccos and arctan, which also come from differentiating an inverse function.