Logarithmic Differentiation

Solve derivatives of functions like xxx^x where both base and exponent depend on xx using logarithms and implicit differentiation.

y=f(x)g(x)    lny=g(x)lnf(x)y = f(x)^{g(x)} \implies \ln y = g(x)\ln f(x)

Solve a problem with Logarithmic Differentiation

Type the problem. The solver will use Logarithmic Differentiation where Logarithmic Differentiation is the right tool, and tell you when it is not.

Drag one in or paste from the clipboard. JPEG, PNG or WebP. You get the transcription to check before anything is solved.

How to get a better answer
  • Paste the whole problem, including the instruction word — "simplify", "solve for x" and "factor" lead to three different answers.
  • Say what you have already tried. "I got x = 4 and the book says 2" turns a solution into a diagnosis.
  • Set the level in the settings button. A calculus shortcut is not a better answer if you have not met derivatives yet.
  • For a photo, get the whole problem in frame and hold the page flat — you get the transcription to fix before anything is solved.

What each symbol means

What Logarithmic Differentiation takes
ff
gg
xx
yy
Logarithmic Differentiation
SymbolMeaning
ffIn the expression f(x)g(x)f(x)^{g(x)}, ff is the base function of xx; it must be positive everywhere in your domain, because taking logarithms requires lnf(x)\ln f(x) to be defined.
gggg is the exponent function of xx; it can be any differentiable function, and it being variable (not constant) is what makes logarithmic differentiation necessary.
xxxx is the independent variable, the input to both functions ff and gg; confusing it with a parameter or assuming it is constant will break the differentiation.
yyyy represents the output f(x)g(x)f(x)^{g(x)}, the dependent variable we are differentiating; treating it as a constant instead of a function of xx is why we need implicit differentiation.

When to use it

Reach for logarithmic differentiation when you have a function where both the base and exponent depend on the variable.

Level

Usually taught in: Calculus I

Worked examples

1. Differentiate a variable exponent with integer base

Problem

Find dydx\frac{dy}{dx} for y=xxy = x^x where x>0x > 0.
  1. lny=xlnx\ln y = x \ln x

    Take the natural logarithm of both sides to convert the variable exponent into a product.

  2. 1ydydx=lnx+x1x=lnx+1\frac{1}{y}\frac{dy}{dx} = \ln x + x \cdot \frac{1}{x} = \ln x + 1

    Differentiate both sides implicitly: the left side uses the chain rule giving 1ydydx\frac{1}{y}\frac{dy}{dx}, and the right side uses the product rule on xlnxx \ln x to get lnx+1\ln x + 1.

  3. dydx=xx(lnx+1)\frac{dy}{dx} = x^x(\ln x + 1)

    Multiply both sides by y=xxy = x^x to isolate dydx\frac{dy}{dx} and get the answer in terms of xx alone.

Answer: dydx=xx(lnx+1)\frac{dy}{dx} = x^x(\ln x + 1)

Logarithmic differentiation is the natural choice here because the exponent is the variable xx, not a constant. The Power Rule only applies when the exponent is constant, so applying it would yield the incorrect answer xxx1x \cdot x^{x-1}.

2. Differentiate with a linear base and quadratic exponent

Problem

Find dydx\frac{dy}{dx} for y=(2x1)x2y = (2x - 1)^{x^2} where x>1/2x > 1/2.
  1. lny=x2ln(2x1)\ln y = x^2 \ln(2x - 1)

    Take the natural logarithm of both sides to turn the variable exponent into a factor in the product.

  2. 1ydydx=2xln(2x1)+x222x1\frac{1}{y}\frac{dy}{dx} = 2x \ln(2x - 1) + x^2 \cdot \frac{2}{2x - 1}

    Differentiate both sides using the product rule on the right: ddx[x2ln(2x1)]=2xln(2x1)+x222x1\frac{d}{dx}[x^2 \ln(2x-1)] = 2x \ln(2x-1) + x^2 \cdot \frac{2}{2x-1} (the derivative of ln(2x1)\ln(2x-1) is 22x1\frac{2}{2x-1} by the chain rule).

  3. dydx=(2x1)x2(2xln(2x1)+2x22x1)\frac{dy}{dx} = (2x-1)^{x^2}\left(2x\ln(2x-1) + \frac{2x^2}{2x-1}\right)

    Multiply both sides by y=(2x1)x2y = (2x-1)^{x^2} to isolate dydx\frac{dy}{dx}.

Answer: dydx=(2x1)x2(2xln(2x1)+2x22x1)\frac{dy}{dx} = (2x-1)^{x^2}\left(2x\ln(2x-1) + \frac{2x^2}{2x-1}\right)

Both the base and exponent depend on xx in complicated ways, making logarithmic differentiation far simpler than any other approach. Trying to use the Power Rule, Exponential Rule, or even the Chain Rule directly would lead to an unmanageable expression.

3. Solve a word problem: cookie production rate

Problem

A bakery tests a new automated mixer. When the mixer runs for nn cycles, the number of cookies produced follows C(n)=(n+2)nC(n) = (n+2)^n. Find the rate at which cookies are produced (with respect to the number of cycles) when n=3n = 3.
  1. lnC=nln(n+2)\ln C = n \ln(n+2)

    Take the natural logarithm of both sides to convert the variable exponent nn into a multiplicative factor.

  2. 1CdCdn=ln(n+2)+n1n+2\frac{1}{C}\frac{dC}{dn} = \ln(n+2) + n \cdot \frac{1}{n+2}

    Differentiate both sides implicitly with respect to nn: apply the product rule to nln(n+2)n \ln(n+2) to get ln(n+2)+nn+2\ln(n+2) + \frac{n}{n+2}.

  3. dCdn=(n+2)n(ln(n+2)+nn+2)\frac{dC}{dn} = (n+2)^n\left(\ln(n+2) + \frac{n}{n+2}\right)

    Multiply both sides by C=(n+2)nC = (n+2)^n to isolate dCdn\frac{dC}{dn}.

  4. dCdnn=3=53(ln5+35)=125(1.609+0.6)276 cookies per cycle\frac{dC}{dn}\bigg|_{n=3} = 5^3\left(\ln 5 + \frac{3}{5}\right) = 125(1.609 + 0.6) \approx 276 \text{ cookies per cycle}

    Substitute n=3n = 3: we get 53=1255^3 = 125, ln51.609\ln 5 \approx 1.609, and 35=0.6\frac{3}{5} = 0.6, giving approximately 276276 additional cookies per additional cycle.

Answer: dCdnn=3276 cookies per cycle\frac{dC}{dn}\bigg|_{n=3} \approx 276 \text{ cookies per cycle}

Logarithmic differentiation is necessary because the cookie production follows a base-and-exponent pattern that would be extremely difficult to handle with standard rules. This real-world scenario shows why the technique is valuable for modeling production rates and growth phenomena.

Common mistakes

Where Logarithmic Differentiation usually goes wrong
Answer came out wrong
When you get 1ydydx=lnx+1\frac{1}{y}\frac{dy}{dx} = \ln x + 1 for y=xxy = x^x, writing dydx=lnx+1\frac{dy}{dx} = \ln x + 1.
Always multiply both sides by yy first: dydx=y(lnx+1)\frac{dy}{dx} = y(\ln x + 1), then substitute y=xxy = x^x to get dydx=xx(lnx+1)\frac{dy}{dx} = x^x(\ln x + 1).
When differentiating lny=xln(2x+1)\ln y = x \ln(2x+1), writing 1ydydx=ln(2x+1)+x2x+1\frac{1}{y}\frac{dy}{dx} = \ln(2x+1) + \frac{x}{2x+1}.
Apply the product rule correctly: ddn[xln(2x+1)]=1ln(2x+1)+x22x+1\frac{d}{dn}[x \ln(2x+1)] = 1 \cdot \ln(2x+1) + x \cdot \frac{2}{2x+1}, which gives 2x2x+1\frac{2x}{2x+1}, not x2x+1\frac{x}{2x+1}.
Trying to use logarithmic differentiation for y=(x)2y = (-x)^2 by writing lny=2ln(x)\ln y = 2 \ln(-x).
First recognize that y=(x)2=x2y = (-x)^2 = x^2, then use the Power Rule: dydx=2x\frac{dy}{dx} = 2x. Alternatively, restrict to a domain where x>0-x > 0 (i.e., x<0x < 0) before applying logarithmic differentiation.
The mistakeWhy it is wrongThe fix
When you get 1ydydx=lnx+1\frac{1}{y}\frac{dy}{dx} = \ln x + 1 for y=xxy = x^x, writing dydx=lnx+1\frac{dy}{dx} = \ln x + 1.You must multiply both sides by yy to isolate dydx\frac{dy}{dx}; otherwise your answer still contains yy, not a final expression in terms of xx.Always multiply both sides by yy first: dydx=y(lnx+1)\frac{dy}{dx} = y(\ln x + 1), then substitute y=xxy = x^x to get dydx=xx(lnx+1)\frac{dy}{dx} = x^x(\ln x + 1).
When differentiating lny=xln(2x+1)\ln y = x \ln(2x+1), writing 1ydydx=ln(2x+1)+x2x+1\frac{1}{y}\frac{dy}{dx} = \ln(2x+1) + \frac{x}{2x+1}.The derivative of ln(2x+1)\ln(2x+1) is 22x+1\frac{2}{2x+1} (by the chain rule), not 12x+1\frac{1}{2x+1}; the product rule requires the full derivative of the second factor.Apply the product rule correctly: ddn[xln(2x+1)]=1ln(2x+1)+x22x+1\frac{d}{dn}[x \ln(2x+1)] = 1 \cdot \ln(2x+1) + x \cdot \frac{2}{2x+1}, which gives 2x2x+1\frac{2x}{2x+1}, not x2x+1\frac{x}{2x+1}.
Trying to use logarithmic differentiation for y=(x)2y = (-x)^2 by writing lny=2ln(x)\ln y = 2 \ln(-x).You cannot take the natural logarithm of a negative number in the real numbers; logarithmic differentiation requires f(x)>0f(x) > 0 everywhere in your domain.First recognize that y=(x)2=x2y = (-x)^2 = x^2, then use the Power Rule: dydx=2x\frac{dy}{dx} = 2x. Alternatively, restrict to a domain where x>0-x > 0 (i.e., x<0x < 0) before applying logarithmic differentiation.

Tips and when to use something else

  • Logarithmic differentiation only works when f(x)>0f(x) > 0; if the base can be negative or zero, you must use a different approach.
  • If only the exponent is constant, like y=x3y = x^3, use the Power Rule instead—it is much faster and avoids logarithms.
  • If only the base varies and the exponent is constant, like y=2xy = 2^x, use the Exponential Rule: (ax)=axlna(a^x)' = a^x \ln a rather than logarithmic differentiation.
  • Always check your domain: logarithmic differentiation restricts you to where f(x)>0f(x) > 0, which may be narrower than the domain of the original function.

Frequently asked questions

Why can't I use the Power Rule for y=xxy = x^x?
The Power Rule ddx[xn]=nxn1\frac{d}{dx}[x^n] = nx^{n-1} only works when the exponent nn is a constant; in y=xxy = x^x, the exponent is the variable xx itself, so it changes as xx changes. Blindly applying the Power Rule would give y=xxx1y' = x \cdot x^{x-1}, which is wrong because the rule's derivation assumes the exponent does not depend on xx.
What if the base or exponent involves a chain, like y=(2x+3)sinxy = (2x+3)^{\sin x}?
Logarithmic differentiation still works perfectly. Take ln\ln of both sides to get lny=sinxln(2x+3)\ln y = \sin x \cdot \ln(2x+3), then differentiate using the product rule (and applying chain rules as needed to each factor). The additional complexity from the chain rules simply becomes part of the product rule's derivative step.
Can I use logarithmic differentiation for y=5xy = 5^x?
You could, but the Exponential Rule is much faster: the derivative is simply y=5xln5y' = 5^x \ln 5. Logarithmic differentiation is overkill when only the exponent varies and the base is a constant, because you would be adding unnecessary steps without gaining any advantage.
Why do I need implicit differentiation if I've already isolated dydx\frac{dy}{dx}?
Implicit differentiation (differentiating both sides) is how we handle the fact that yy is a function of xx. When we differentiate lny\ln y with respect to xx, we must use the chain rule to get ddxlny=1ydydx\frac{d}{dx}\ln y = \frac{1}{y}\frac{dy}{dx}. This step is not solving for dydx\frac{dy}{dx}—it is setting up the equation that allows us to isolate it afterward.

Need a different method?

The full solver is not scoped to one formula — type any problem and it will pick the method.

Open the math solver

Reviewed 2026-09-18