Logarithmic Differentiation: How to Differentiate x^x and More
Logarithmic differentiation: take ln of both sides, differentiate, multiply by y. Steps and examples for x^x, variable powers and messy products.
Derivative rules Updated 3 min read
At a glance
- Applies to
- Variable bases with variable exponents like x^x, and long products or quotients of powers
- In words
- Take \ln of both sides, simplify with log rules, differentiate, then multiply by y
- Key fact
- \frac{d}{dx}\ln y = \frac{1}{y}\,\frac{dy}{dx} by the chain rule
- Log rules used
- \ln(ab) = \ln a + \ln b, \ln\frac{a}{b} = \ln a - \ln b, \ln a^k = k \ln a
- Classic result
- \frac{d}{dx}\,x^x = x^x(\ln x + 1)
Logarithmic differentiation is a technique for functions that are awkward to differentiate directly. You take the natural log of both sides, use log rules to turn products, quotients and powers into sums and multiples, differentiate, and then solve for \frac{dy}{dx}. It is the only standard way to differentiate a function like x^x.
The method
Starting from y = f(x) with f(x) > 0:
- Take the natural log of both sides: \ln y = \ln f(x).
- Simplify the right side with log rules.
- Differentiate both sides with respect to x. The left side becomes \frac{1}{y}\,\frac{dy}{dx} by the chain rule.
- Multiply both sides by y, then substitute y = f(x) back in.
In one line:
If f can be negative, use \ln|y| instead. The derivative of \ln|y| is still \frac{1}{y}\,\frac{dy}{dx}, so the final formula does not change.
Which rule for which power?
| Form | Example | Rule | Derivative |
|---|---|---|---|
| constant to a constant | 2^3 | Constant rule | 0 |
| variable to a constant | x^3 | Power rule | 3x^2 |
| constant to a variable | 3^x | Exponential rule | 3^x\ln 3 |
| variable to a variable | x^x | Logarithmic differentiation | x^x(\ln x + 1) |
Worked examples
Example 1: y = x^x (for x > 0). Take logs and bring the exponent down:
Differentiate, using the product rule on the right:
Multiply by y:
Example 2: y = x^{\sin x} (for x > 0). Then \ln y = \sin x \ln x, and
Example 3: a messy quotient. For y = \frac{(x+1)^3\sqrt{x^2 + 4}}{(2x - 1)^5}, logs split everything apart:
Differentiate each term with the chain rule:
So
The quotient and product rules would get the same answer, but with far more algebra.
Example 4: proving the power rule. For y = x^n with any real n and x > 0: \ln y = n\ln x, so \frac{y'}{y} = \frac{n}{x} and y' = x^n \cdot \frac{n}{x} = n\,x^{n-1}. This is how the power rule is extended to every real exponent.
Common mistakes
- Using the power rule on x^x. x \cdot x^{x-1} = x^x is wrong. The exponent is not constant.
- Using the exponential rule on x^x. x^x\ln x is also wrong. The base is not constant. Notice that the correct answer x^x\ln x + x^x is the sum of these two wrong answers.
- Forgetting to multiply by y. Differentiating \ln y gives \frac{y'}{y}. Solve for y' at the end.
- Leaving y in the answer. Replace y with the original function so the derivative is in terms of x only.
The method relies on implicit differentiation and the derivative of \ln x. For background on exponential and log derivatives, read the guide to derivatives of exponential and logarithmic functions.
Practice it now
Exponentials and logarithms
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