In short
Logarithmic differentiation is a technique where you take the natural logarithm of both sides of y = f(x), simplify using log properties, then differentiate implicitly to find dy/dx. It is essential for functions of the form f(x)^{g(x)} (variable base and variable exponent), and makes life dramatically easier for products and quotients with many factors.
Differentiate f(x) = x^x for x > 0.
Stop and think about which rule you would use. The power rule? That requires a constant exponent — but here the exponent is x, which varies. The exponential rule? That requires a constant base — but here the base is x, which also varies. Neither rule fits. Both the base and the exponent depend on x, and no formula you have learned so far handles this directly.
This is the problem that logarithmic differentiation was invented to solve. The idea is disarmingly simple: take \ln of both sides, use the properties of logarithms to pull the exponent down, and then differentiate. The logarithm turns a function that defies every known rule into one that yields to techniques you already have.
Why the logarithm helps
The power of logarithmic differentiation comes from three properties of \ln that you already know from the logarithmic functions article:
- \ln(A \cdot B) = \ln A + \ln B — products become sums.
- \ln(A / B) = \ln A - \ln B — quotients become differences.
- \ln(A^n) = n \ln A — exponents become coefficients.
Differentiation is easy on sums and differences (the sum rule). It is hard on products and quotients (the product and quotient rules generate multiple terms). And it is sometimes impossible when the exponent varies (no standard rule applies). The logarithm transforms the hard structures into easy ones before you differentiate, so you never have to fight with them.
The cost is small: after differentiating, you have \frac{1}{y}\frac{dy}{dx} on the left side instead of \frac{dy}{dx}, so you multiply by y at the end. Since y is the function you started with, you always know what it is.
The technique in three steps
Here is the method, stated in full generality. Given y = f(x) where f(x) > 0:
Step 1. Take the natural logarithm of both sides: \ln y = \ln f(x).
Step 2. Simplify the right side using logarithm properties — \ln(AB) = \ln A + \ln B, \ln(A/B) = \ln A - \ln B, \ln(A^n) = n \ln A.
Step 3. Differentiate both sides with respect to x. On the left side, \frac{d}{dx}[\ln y] = \frac{1}{y} \cdot \frac{dy}{dx} by the chain rule (since y is a function of x). On the right side, differentiate whatever you got after simplifying. Then solve for \frac{dy}{dx} by multiplying both sides by y.
The result always takes the form:
Since you know y — it is the function you started with — you substitute it back in at the end.
The case that demands it: f(x)^{g(x)}
Start with the problem from the opening. Differentiate y = x^x for x > 0.
Step 1. Take \ln of both sides:
The logarithm property \ln(a^b) = b \ln a pulls the exponent x down to become a coefficient. What was an impossible exponent is now a simple product.
Step 2. Differentiate both sides with respect to x.
Left side: \frac{d}{dx}[\ln y] = \frac{1}{y} \cdot \frac{dy}{dx}.
Right side: \frac{d}{dx}[x \ln x]. This is a product, so use the product rule:
So:
Step 3. Multiply both sides by y = x^x:
That's the answer. The derivative of x^x is x^x(\ln x + 1). At x = 1, this gives 1^1(0 + 1) = 1. At x = 2, this gives 4(\ln 2 + 1) \approx 4(1.693) \approx 6.77. The function x^x grows very fast, and the derivative captures that: it contains the original function as a factor, multiplied by a quantity that is itself increasing.
Notice that \frac{dy}{dx} = 0 when \ln x + 1 = 0, which gives \ln x = -1, so x = e^{-1} = 1/e \approx 0.368. At this point, the function x^x reaches its minimum value of (1/e)^{1/e} \approx 0.6922. For x < 1/e the derivative is negative (the function is decreasing), and for x > 1/e it is positive (the function is increasing).
The general formula for [f(x)]^{g(x)}
The same technique handles any function of the form y = [f(x)]^{g(x)} where f(x) > 0. Take \ln:
Differentiate both sides:
Multiply by y:
You do not need to memorise this formula. The three-step technique — take \ln, differentiate, multiply by y — produces it every time. The formula is just what happens when you apply the technique to the general case.
Another example: y = (\sin x)^x for 0 < x < \pi
Take \ln: \ln y = x \ln(\sin x).
Differentiate: \frac{1}{y}\frac{dy}{dx} = \ln(\sin x) + x \cdot \frac{\cos x}{\sin x} = \ln(\sin x) + x\cot x.
Multiply by y: \frac{dy}{dx} = (\sin x)^x\left[\ln(\sin x) + x\cot x\right].
The structure is identical to x^x: two terms arise from the product rule, one involving the derivative of the exponent and one involving the derivative of the base.
A third type: y = x^{1/x}
This is another f(x)^{g(x)} form, with f(x) = x and g(x) = 1/x. Take \ln:
Differentiate (using the quotient rule on \ln x / x):
Multiply by y:
The derivative is zero when 1 - \ln x = 0, i.e., x = e. At x = e, the function x^{1/x} reaches its maximum value e^{1/e} \approx 1.4447. For x > e the derivative is negative, so x^{1/x} decreases. This means that among all the nth roots of n (for positive integers n), \sqrt[3]{3} \approx 1.442 is the largest — it is the integer closest to e.
When products and quotients have many factors
Logarithmic differentiation is not only for variable-exponent functions. It is also the best tool whenever you need to differentiate a product or quotient of many factors.
Consider
You could differentiate this with the product rule and quotient rule. The product rule on the numerator alone would require differentiating x^3 (2x+1)^4, which is itself a product. The quotient rule then adds another layer. The computation is correct but painful — many terms, many places to make algebraic errors.
Logarithmic differentiation cuts through all of it. Take \ln of both sides:
The product became a sum, the quotient became a subtraction, and the exponents became coefficients. Now differentiate:
And multiply by y:
Done. No product rule, no quotient rule, no expanding, no simplifying intermediate expressions. The logarithm converted multiplication into addition, which is always easier to differentiate.
Here is the count: the logarithmic method required differentiating three terms, each of the form c \ln(u), producing three simple fractions. The direct method would have required the quotient rule on a fraction whose numerator is itself a product (requiring the product rule), generating at least six terms before simplification. The logarithmic method wins by a wide margin, and the margin grows with every additional factor.
Another worked product: y = \sqrt[5]{\dfrac{(x-1)(x+3)^2}{(x+5)^3}} for x > 1
Take \ln:
Differentiate:
Multiply by y:
Notice how the fifth root, which would have required converting to a 1/5 exponent and then using the chain rule on a complicated inside, is absorbed effortlessly by the logarithm. The outer 1/5 simply becomes a constant multiplier.
An alternative route: the exponential rewrite
There is a second way to handle f(x)^{g(x)} that avoids the implicit-differentiation flavour. Rewrite the function using e:
Now this is a standard exponential e^u where u = g(x) \ln f(x), and you can differentiate it with the chain rule:
Since e^{g(x) \ln f(x)} = [f(x)]^{g(x)} = y, this gives the same answer as the logarithmic method. Some students prefer this route because it stays entirely within the chain rule framework and avoids the "\frac{1}{y}\frac{dy}{dx}" step. Both methods produce the same result; use whichever feels more natural to you.
For example, to differentiate x^x: rewrite as e^{x \ln x}, then \frac{d}{dx}[e^{x \ln x}] = e^{x \ln x} \cdot (\ln x + 1) = x^x(\ln x + 1).
When to use logarithmic differentiation
The following diagram summarises the decision:
Here is the decision rule:
- Always use it when the base and exponent are both functions of x: f(x)^{g(x)}. No other technique works.
- Strongly prefer it when you have a product or quotient of three or more factors, especially if those factors have exponents. The logarithm turns the messy expression into a clean sum.
- Consider it when you have a function like y = \sqrt[5]{\frac{(x-1)(x+3)^2}{(x+5)^3}}. The fractional exponent 1/5 and the nested factors are cleanly handled by \ln.
- Skip it when the function is a simple product of two factors, or a basic exponential/logarithm. The standard rules are faster in those cases.
Computing one from start to finish
Example 1: Differentiate $y = x^{\sin x}$ for $x > 0$
Step 1. Take the natural logarithm of both sides.
Why: \ln(a^b) = b \ln a. The exponent \sin x comes down as a coefficient, turning an impossible differentiation into a tractable product.
Step 2. Differentiate both sides with respect to x. The left side gives \frac{1}{y}\frac{dy}{dx}. The right side is a product of \sin x and \ln x, so apply the product rule.
Why: product rule. The derivative of \sin x is \cos x; the derivative of \ln x is 1/x.
Step 3. Multiply both sides by y = x^{\sin x}.
Why: solving for dy/dx means clearing the 1/y on the left, which is the same as multiplying by y.
Step 4. Check at a specific point. At x = \pi/2: y = (\pi/2)^{\sin(\pi/2)} = (\pi/2)^1 = \pi/2 \approx 1.571. The derivative is (\pi/2)^1\left(\cos(\pi/2) \cdot \ln(\pi/2) + \frac{\sin(\pi/2)}{\pi/2}\right) = (\pi/2)\left(0 + \frac{2}{\pi}\right) = 1.
Why: at x = \pi/2, \cos(\pi/2) = 0 kills the first term, and \sin(\pi/2) = 1 simplifies the second. The tangent slope of 1 means the curve is rising at a 45-degree angle at this point.
Result: \dfrac{dy}{dx} = x^{\sin x}\!\left(\cos x \cdot \ln x + \dfrac{\sin x}{x}\right).
Notice how the curve dips toward 1 near x = \pi (where \sin x \approx 0, so x^{\sin x} \approx x^0 = 1) and rises near x = \pi/2 (where \sin x = 1, so x^{\sin x} = x). The oscillation of the exponent \sin x creates a gently undulating growth pattern.
Example 2: Differentiate $y = \dfrac{(x+1)^3(x-2)^4}{(x+3)^5}$ for $x > 2$
Step 1. Take the natural logarithm.
Why: logarithm properties convert the product in the numerator into a sum, the quotient into a subtraction, and the exponents into coefficients. Three rules, one line — this is why logarithmic differentiation exists.
Step 2. Differentiate both sides.
Why: each term differentiates by the chain rule. For instance, \frac{d}{dx}[3\ln(x+1)] = 3 \cdot \frac{1}{x+1} \cdot 1. The inner derivative is 1 each time, so it does not produce any visible extra factor.
Step 3. Combine the right side over a common denominator.
Expand each numerator term:
- 3(x-2)(x+3) = 3(x^2 + x - 6) = 3x^2 + 3x - 18
- 4(x+1)(x+3) = 4(x^2 + 4x + 3) = 4x^2 + 16x + 12
- 5(x+1)(x-2) = 5(x^2 - x - 2) = 5x^2 - 5x - 10
Sum: (3x^2 + 3x - 18) + (4x^2 + 16x + 12) - (5x^2 - 5x - 10) = 2x^2 + 24x + 4.
Why: combining into a single fraction gives the cleanest final form. You could also leave the answer as three separate fractions — that is correct too, but less tidy.
Step 4. Multiply by y.
Why: factor 2 from 2x^2 + 24x + 4 = 2(x^2 + 12x + 2), then cancel common factors between the original y and the denominator.
Result: \dfrac{dy}{dx} = \dfrac{2(x^2 + 12x + 2)(x+1)^2(x-2)^3}{(x+3)^6}.
Try differentiating this same function using the quotient rule and product rule directly — just planning the computation takes longer than the logarithmic method takes to finish. Logarithmic differentiation reduced the problem to differentiating a sum of three terms, each of which is almost trivial.
Common confusions
-
"You can use logarithmic differentiation only for f(x)^{g(x)}." It works for any positive function. The technique is most necessary for f(x)^{g(x)}, but it is most useful for complicated products and quotients. Do not restrict yourself to the variable-exponent case.
-
Forgetting to multiply by y at the end. After differentiating \ln y, you get \frac{1}{y}\frac{dy}{dx} on the left — not \frac{dy}{dx}. If you forget to multiply both sides by y, your answer will be off by a factor of y. This is the most common mechanical error.
-
Taking \ln of a function that can be negative. Logarithmic differentiation requires y > 0 (or at least y \neq 0, if you use \ln|y|). If the function can be negative on part of its domain, you need to be more careful: use \ln|y| instead of \ln y, and restrict attention to intervals where y does not change sign.
-
"Logarithmic differentiation gives a different answer than the product rule." It gives the same answer, just in a different form. If you differentiate y = x^2 e^x logarithmically, you get x^2 e^x(2/x + 1) = e^x(2x + x^2), which is e^x \cdot x(x+2) — identical to what the product rule gives.
-
Confusing \frac{d}{dx}[\ln y] with \frac{1}{y}. The derivative of \ln y with respect to x is \frac{1}{y} \cdot \frac{dy}{dx} — not just \frac{1}{y}. The chain rule is essential here: y is a function of x, so differentiating \ln y with respect to x requires multiplying by dy/dx.
Going deeper
If you came here to learn the technique and when to use it, you have the complete picture — you can stop here. The rest of this section explores the logarithmic derivative as a concept in its own right and connects it to percentage rates of change.
The logarithmic derivative as a concept
The quantity \frac{1}{y}\frac{dy}{dx}, which appears naturally on the left side of every logarithmic differentiation, has its own name: the logarithmic derivative of y. It is also written \frac{d}{dx}[\ln y] or (\ln y)'.
The logarithmic derivative measures the relative rate of change — the rate of change as a fraction of the current value. If y = 1000 and dy/dx = 50, the ordinary derivative says "growing at 50 units per unit of x." The logarithmic derivative says 50/1000 = 0.05, or "growing at 5% per unit of x." This is why logarithmic scales are used in economics and biology: percentage growth rates are often more informative than absolute ones.
For an exponential function y = Ce^{kx}, the logarithmic derivative is simply k — a constant. This confirms the intuition that exponential growth has a constant percentage rate of change, even as the absolute rate of change accelerates.
Products, quotients, and the additive property
The deepest reason logarithmic differentiation simplifies products and quotients is that the logarithmic derivative converts multiplication into addition:
The logarithmic derivative of a product is the sum of the logarithmic derivatives. Similarly, the logarithmic derivative of a quotient is a difference. This additive property is why the technique handles many-factor products so cleanly: each factor contributes one simple term, regardless of how complicated the other factors are.
Compare this with the product rule for three factors: \frac{d}{dx}[fgh] = f'gh + fg'h + fgh'. As the number of factors grows, the product rule generates more and more terms, each containing all the other factors. The logarithmic method always gives exactly one term per factor.
Connection to elasticity
In economics, the quantity \frac{x}{y}\frac{dy}{dx} = \frac{d(\ln y)}{d(\ln x)} is called the elasticity of y with respect to x. It measures the percentage change in y per percentage change in x. For a power function y = x^n, the elasticity is exactly n — a constant. This is the economic counterpart of the mathematical fact that \frac{d}{dx}[\ln(x^n)] = n/x.
Verifying x^x with the product rule decomposition
Here is a useful cross-check that deepens understanding. The function x^x can be thought of as simultaneously having a varying base and a varying exponent. Suppose you "freeze" each one in turn:
- Freeze the exponent at x, vary the base. Think of x^x as (x)^n where n happens to equal x. The power rule contribution would be x \cdot x^{x-1} = x^x.
- Freeze the base at x, vary the exponent. Think of x^x as a^x where a happens to equal x. The exponential rule contribution would be x^x \ln x.
Add them: x^x + x^x \ln x = x^x(1 + \ln x).
This is exactly the answer logarithmic differentiation gives. The coincidence is not an accident — it is a consequence of the general formula for [f(x)]^{g(x)}. The two terms in the general formula, g'(x) \ln f(x) and g(x) \cdot \frac{f'(x)}{f(x)}, correspond precisely to "vary the exponent, freeze the base" and "vary the base, freeze the exponent." The logarithmic derivative of a function of the form f^g is the sum of its logarithmic derivatives with respect to each piece — a kind of "total derivative" principle.
This decomposition also explains why neither the power rule alone nor the exponential rule alone gives the right answer for x^x: each captures only half of the total rate of change.
Logarithmic differentiation and limits
Logarithmic differentiation also helps evaluate certain limits. Consider \lim_{x \to 0^+} x^x. This is an indeterminate form of type 0^0. Take \ln: \ln(x^x) = x \ln x. As x \to 0^+, x \to 0 and \ln x \to -\infty, giving the form 0 \cdot (-\infty). Rewrite as \frac{\ln x}{1/x}, which is \frac{-\infty}{\infty}, and apply L'Hopital's rule: \frac{1/x}{-1/x^2} = \frac{-x^2}{x} = -x \to 0.
So \ln(x^x) \to 0, which means x^x \to e^0 = 1. The function x^x approaches 1 as x \to 0^+, even though both the base and the exponent are going to zero. The logarithmic rewrite x^x = e^{x \ln x} is what makes this tractable.
Where this leads next
Logarithmic differentiation is a technique, not a concept — but it opens doors to ideas that are genuinely conceptual:
- Implicit Differentiation — the same "differentiate both sides" approach, applied to equations that define y as a function of x implicitly rather than explicitly.
- Derivatives of Exponential and Logarithmic Functions — the foundational formulas that logarithmic differentiation relies on.
- L'Hôpital's Rule — a technique that frequently requires you to rewrite f(x)^{g(x)} as e^{g(x) \ln f(x)} before applying limits.
- Tangent and Normal — once you have dy/dx from logarithmic differentiation, you can find the equation of the tangent line at any point.