Logarithmic Differentiation and When It Saves Work
Take logarithms before differentiating to tame variable exponents and long products, and learn when it is not worth it.
Key takeaways
- Write ln y, simplify with logarithm laws, differentiate to get y′/y, then multiply by y.
- It is the natural method for functions of the form u^v where both u and v depend on x.
- For long products and quotients of powers, it replaces repeated product and quotient rules with a simple sum.
- ln y requires y > 0; using ln |y| extends the method to negative values, but not to points where y = 0.
- It does not help with sums, because there is no logarithm law that splits ln(a + b).
Logarithmic differentiation means taking the natural logarithm of a function before you differentiate it. The logarithm turns products into sums, quotients into differences and exponents into multipliers, so the differentiation becomes much shorter. At the end you multiply by the original function to recover its derivative.
It is the standard tool when both the base and the exponent contain the variable, as in xˣ, and a labor saver when a function is a long chain of factors and powers.
The idea in four steps
The method rests on one derivative. If y is a positive differentiable function of x, the chain rule gives:
d/dx ln y = y′/y That follows from the fact that ln has derivative 1/y with respect to y, as shown in derivatives of exponential and logarithmic functions. To use it:
- Take the natural logarithm of both sides of y = f(x).
- Expand the right side using ln(ab) = ln a + ln b, ln(a/b) = ln a − ln b and ln(a^r) = r ln a, for positive a and b.
- Differentiate both sides. The left side becomes y′/y.
- Multiply by y and replace y with the original expression.
The third step is implicit differentiation: ln y is a function of y, which in turn depends on x.
The classic case of x to the x
Consider y = xˣ for x > 0. The power rule does not apply, because the exponent varies. The exponential rule does not apply either, because the base varies.
ln y = x ln x
y′/y = 1 · ln x + x · (1/x) product rule on the right
y′/y = ln x + 1
y′ = xˣ (ln x + 1) The derivative is zero when ln x = −1, that is, at x = 1/e. It is negative before that point and positive after, so xˣ has its minimum there. The minimum value is (1/e)^(1/e), about 0.692. At x = 1 the slope is 1, and by x = 3 it is 27 · (ln 3 + 1), roughly 56.7. Few simple-looking functions climb so quickly.
A long product made short
Now let y = (x² + 1)³ · √(2x + 1) / (x + 4)⁵ for x > −1/2. Using the product and quotient rules directly would produce a sprawling expression. The logarithm splits it cleanly:
ln y = 3 ln(x² + 1) + (1/2) ln(2x + 1) − 5 ln(x + 4)
y′/y = 6x/(x² + 1) + 1/(2x + 1) − 5/(x + 4)
y′ = y · [6x/(x² + 1) + 1/(2x + 1) − 5/(x + 4)] Each factor of the original contributes exactly one term. If you only need the slope at a point, the final form is ideal. At x = 0, the function is 1 · 1/4⁵ = 1/1024. The bracket is 0 + 1 − 5/4 = −1/4. So y′(0) = −1/4096.
You can leave y in the answer while working, but a final answer should normally express everything in x.
A general formula for variable base and exponent
Suppose y = u^v, where u > 0 and both u and v are differentiable functions of x. Then ln y = v ln u, and:
y′/y = v′ ln u + v · u′/u
y′ = u^v · v′ ln u + v · u^(v−1) · u′ The second line is worth a look. The first term is what you would get by treating u as a constant base, using the exponential rule. The second is what you would get by treating v as a constant exponent, using the power rule. The true derivative is the sum of both.
An example: y = (sin x)ˣ for 0 < x < π, where sin x is positive. Here ln y = x ln(sin x), so y′/y = ln(sin x) + x cos x / sin x. Therefore y′ = (sin x)ˣ [ln(sin x) + x cot x]. At x = π/2, sin x = 1 and cot x = 0, so the slope is zero.
An equivalent route skips ln y altogether: rewrite u^v as e^(v ln u) and apply the chain rule. Many people find this safer, since the function never moves to the left side of an equation.
When it saves work and when it does not
| Form of the function | Good choice |
|---|---|
| x⁷, or any variable base with constant exponent | power rule |
| 7ˣ, or constant base with variable exponent | exponential rule |
| xˣ, (cos x)^x, (1 + 1/x)^x | logarithmic differentiation |
| product of two simple factors | product rule |
| many factors raised to various powers | logarithmic differentiation |
| a sum such as x³ + sin x | term by term; logarithms do not help |
The boundary is a matter of taste for medium cases. A quotient of two simple functions is quicker with the quotient rule. Once you reach three or four factors with exponents, the logarithm usually wins and produces fewer algebra errors.
A sum that contains a variable exponent, such as xˣ + x², should be split first. Differentiate xˣ by logarithms and x² by the power rule, then add.
Handling negative values
The logarithm of a negative number is not defined among the real numbers. For products and quotients, you can take absolute values first, because |ab| = |a| |b|. The key fact is that d/dx ln |y| = y′/y wherever y ≠ 0.
Take y = (x − 1)³ (x + 2)² / x. Then:
ln |y| = 3 ln |x − 1| + 2 ln |x + 2| − ln |x|
y′/y = 3/(x − 1) + 2/(x + 2) − 1/x This holds for every x other than 1, −2 and 0. At x = 0 the function is undefined anyway. At x = 1 and x = −2 the function equals zero and its logarithm does not exist, although the function is perfectly differentiable there. Use the ordinary rules, or check that multiplying out the formula for y′ gives an expression that extends continuously to those points.
For variable exponents the situation is stricter. An expression such as xˣ is not defined as a real number for most negative x, so you restrict to a positive base.
Relative rates in the real world
The quantity y′/y has its own name, the logarithmic derivative. It is the relative rate of change: growth per unit time as a fraction of the current size.
Because logarithms turn products into sums, relative rates of a product add. Say revenue R equals price p times quantity q, all changing over time. Then R′/R = p′/p + q′/q. If at some moment price is rising at a relative rate of 3 percent per year and quantity is falling at 1 percent per year, revenue is rising at about 2 percent per year at that moment.
For a quotient the rates subtract, and for a power the rate is multiplied by the exponent. If the radius of a sphere grows at a relative rate of 1 percent per minute, its volume, which is proportional to r³, grows at 3 percent per minute. This is a quick way to estimate how measurement errors spread through a formula.
Proving the familiar rules again
The technique also gives tidy derivations. For y = x^r with x > 0 and any real constant r, ln y = r ln x, so y′/y = r/x and y′ = r x^(r−1). This covers irrational exponents such as √2, which the usual argument for the power rule with whole numbers does not reach.
For y = fg with positive factors, ln y = ln f + ln g, so y′/y = f′/f + g′/g. Multiply by fg to get f′g + fg′, the product rule.
Two more variable exponents
The expression y = (1 + 1/x)^x, for x > 0, appears in discussions of compound growth and approaches e as x becomes large. Does it get there by climbing steadily? Take logarithms:
ln y = x ln(1 + 1/x)
y′/y = ln(1 + 1/x) + x · (−1/x²)/(1 + 1/x)
= ln(1 + 1/x) − 1/(x + 1) At x = 1 the function equals 2, the relative rate is ln 2 − 1/2 ≈ 0.193, and so y′ ≈ 0.386. The relative rate is in fact positive for every x > 0, because ln(1 + t) is greater than t/(1 + t) whenever t > 0 (put t = 1/x). So the function always increases on its way toward e.
Next, y = x^(1/x) for x > 0. Here ln y = (ln x)/x, and the quotient rule gives:
y′/y = (1 − ln x)/x² The sign depends only on 1 − ln x, so the function rises until x = e and falls afterward. Its largest value is e^(1/e), about 1.445. A consequence for whole numbers is that the cube root of 3 is larger than the square root of 2, and larger than every other nth root of n.
In both examples, the logarithmic derivative alone answered the question about increase and decrease. Since y is positive, y′ and y′/y always share a sign, so you do not even need to multiply back unless the slope itself is requested.
Mistakes to watch for
- Stopping at y′/y and forgetting to multiply by y.
- Writing ln(a + b) as ln a + ln b.
- Dropping inner derivatives, such as the 2 from ln(2x + 1).
- Confusing ln(u^v), which equals v ln u, with (ln u)^v.
- Ignoring the domain on which each logarithm is defined.
To verify an answer, compare it with a numerical slope. For xˣ at x = 2 the formula predicts 4(ln 2 + 1) ≈ 6.77, and computing (2.001^2.001 − 1.999^1.999)/0.002 on a calculator should agree to several digits.