practicecalculus
Derivative rules

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

\frac{dy}{dx} = y \cdot \frac{d}{dx}\big[\ln y\big]
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)
On this page
  1. The method
  2. Which rule for which power?
  3. Worked examples
  4. Common mistakes

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:

  1. Take the natural log of both sides: \ln y = \ln f(x).
  2. Simplify the right side with log rules.
  3. Differentiate both sides with respect to x. The left side becomes \frac{1}{y}\,\frac{dy}{dx} by the chain rule.
  4. Multiply both sides by y, then substitute y = f(x) back in.

In one line:

\frac{dy}{dx} = y \cdot \frac{d}{dx}\big[\ln y\big]

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:

\ln y = x\ln x

Differentiate, using the product rule on the right:

\frac{1}{y}\,\frac{dy}{dx} = \ln x + x \cdot \frac{1}{x} = \ln x + 1

Multiply by y:

\frac{dy}{dx} = x^x(\ln x + 1)
Graph of y = xˣ and its derivative xˣ(ln x + 1)
The derivative is zero when \ln x = -1, at x = \frac{1}{e} \approx 0.37, where x^x reaches its minimum.

Example 2: y = x^{\sin x} (for x > 0). Then \ln y = \sin x \ln x, and

\frac{1}{y}\,\frac{dy}{dx} = \cos x \ln x + \frac{\sin x}{x} \quad\Rightarrow\quad \frac{dy}{dx} = x^{\sin x}\left(\cos x\ln x + \frac{\sin x}{x}\right)

Example 3: a messy quotient. For y = \frac{(x+1)^3\sqrt{x^2 + 4}}{(2x - 1)^5}, logs split everything apart:

\ln y = 3\ln(x + 1) + \frac{1}{2}\ln(x^2 + 4) - 5\ln(2x - 1)

Differentiate each term with the chain rule:

\frac{1}{y}\,\frac{dy}{dx} = \frac{3}{x + 1} + \frac{x}{x^2 + 4} - \frac{10}{2x - 1}

So

\frac{dy}{dx} = \frac{(x+1)^3\sqrt{x^2 + 4}}{(2x - 1)^5}\left(\frac{3}{x + 1} + \frac{x}{x^2 + 4} - \frac{10}{2x - 1}\right)

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

  1. Using the power rule on x^x. x \cdot x^{x-1} = x^x is wrong. The exponent is not constant.
  2. 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.
  3. Forgetting to multiply by y. Differentiating \ln y gives \frac{y'}{y}. Solve for y' at the end.
  4. 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

Frequently asked questions

What is logarithmic differentiation?

It is a technique where you take the natural log of both sides of y = f(x), simplify with log rules, differentiate implicitly, and solve for \frac{dy}{dx} by multiplying by y.

What is the derivative of x^x?

Let y = x^x, so \ln y = x\ln x. Differentiating gives \frac{y'}{y} = \ln x + 1, so \frac{d}{dx}\,x^x = x^x(\ln x + 1) for x > 0.

When should you use logarithmic differentiation?

Use it for a variable raised to a variable power, and as a shortcut for long products and quotients of powers that would need several product and quotient rule steps.

Why can't you use the power rule on x^x?

The power rule needs a constant exponent and the exponential rule needs a constant base. In x^x both are variable, so neither rule applies.

Written by the PracticeCalculus team

We build interactive calculus lessons and write every page to be clear and correct. Spotted something off? Tell us and we will fix it.