Logarithmic differentiation

Try to differentiate y=xxy = x^x with the rules you already know and you hit a wall: the power rule needs a constant exponent, and the exponential rule needs a constant base — here neither is constant, both are xx. Logarithmic differentiation breaks the deadlock by taking ln⁡\ln of both sides first. A logarithm turns multiplication into addition and exponents into multipliers, so a tangled product of powers becomes a simple sum that ordinary chain-rule differentiation can handle term by term. The one extra cost is that yy is now hidden inside ln⁡y\ln y, so the left side must be differentiated implicitly, producing the factor 1ydydx\frac1y\frac{dy}{dx}. This short article expands the Class 12 method into a full working toolkit — the algebraic reason it works, a clean derivation for y=[f(x)]g(x)y=[f(x)]^{g(x)}, and two board-style worked examples covering both classic use cases.

The core insight

Taking ln⁡\ln of both sides converts a variable-base-to-variable-power or a long product/quotient into a sum of logarithms, which can be differentiated term by term and then multiplied back by yy to recover dydx\dfrac{dy}{dx}.

The core idea

Logarithmic differentiation exists for exactly two situations that no single standard rule covers.

Case 1 — variable base, variable exponent. For y=[f(x)]g(x)y=[f(x)]^{g(x)}, both the base and the power depend on xx, so neither the power rule (ddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1}, constant nn) nor the exponential rule (ddxax=axln⁡a\frac{d}{dx}a^x = a^x\ln a, constant aa) applies directly.

Case 2 — long products, quotients and powers. For an expression like y=f(x)m g(x)nh(x)py = \dfrac{f(x)^m\,g(x)^n}{h(x)^p}, differentiating directly means chaining the product and quotient rules across every factor — slow and error-prone. Taking logs first turns the whole right side into a sum, so each factor is differentiated separately and simply. Both cases use the same three-move sequence:

ln⁡y=g(x)ln⁡[f(x)](or the expanded sum of logs for Case 2)\ln y = g(x)\ln[f(x)] \qquad \text{(or the expanded sum of logs for Case 2)}

where: yy is the original function, ln⁡y\ln y is its natural logarithm, and the right side is rewritten using the log laws ln⁡(ab)=ln⁡a+ln⁡b\ln(ab)=\ln a+\ln b, ln⁡(a/b)=ln⁡a−ln⁡b\ln(a/b)=\ln a-\ln b, and ln⁡(an)=nln⁡a\ln(a^n)=n\ln a before anything is differentiated. The reason this helps is purely structural: ln⁡\ln is the one function that turns a product/power structure into an additive one, and sums differentiate term by term without any product or quotient rule at all. The picture below shows the same transformation as a flow — a hard, tangled expression on the left becomes an easy sum on the right, at the cost of one implicit-differentiation step to get back to dydx\dfrac{dy}{dx}.

Figure
A flow diagram showing a hard product of powers on the left turning into an easy sum of logarithms on the right after taking the natural log, then multiplying back by y to recover dy by dx
Why take the log first y = f(x)^g(x) hard product / power no direct rule applies take ln ln y = g(x) ln f(x) easy sum / product-of-two chain rule handles each term diff. (1/y)y' implicit multiply by y, sub y back — dy/dx found
Derivation Aof the log-differentiation formula

The goal is to derive, from the definition of implicit differentiation and the log law ln⁡(ab)=bln⁡a\ln(a^b)=b\ln a, a general working formula for dydx\dfrac{dy}{dx} when y=[f(x)]g(x)y=[f(x)]^{g(x)}, so that from here on the process is mechanical rather than something re-derived each time.

Step 1. Take the natural log of both sides of y=[f(x)]g(x)y=[f(x)]^{g(x)}. Using ln⁡(ab)=bln⁡a\ln(a^b)=b\ln a, the right side simplifies from a power to a product: ln⁡y=g(x)⋅ln⁡[f(x)]\ln y = g(x)\cdot\ln[f(x)]. This step is only valid for f(x)>0f(x)>0, which is why such problems always specify a domain where the base stays positive.

Step 2. Differentiate both sides with respect to xx. The left side is ln⁡y\ln y, a function of xx only through yy, so the chain rule gives ddx(ln⁡y)=1ydydx\dfrac{d}{dx}(\ln y) = \dfrac{1}{y}\dfrac{dy}{dx}. The right side is a product of g(x)g(x) and ln⁡[f(x)]\ln[f(x)], so the product rule applies, and ln⁡[f(x)]\ln[f(x)] itself needs one more chain-rule pass:

ddx(g(x)ln⁡[f(x)])=g′(x)ln⁡[f(x)]+g(x)⋅f′(x)f(x)\frac{d}{dx}\Big(g(x)\ln[f(x)]\Big) = g'(x)\ln[f(x)] + g(x)\cdot\frac{f'(x)}{f(x)}

Step 3. Equate the two sides and isolate dydx\dfrac{dy}{dx} by multiplying through by yy:

1ydydx=g′(x)ln⁡[f(x)]+g(x)f′(x)f(x)⟹dydx=[f(x)]g(x)[g′(x)ln⁡[f(x)]+g(x)f′(x)f(x)]\frac{1}{y}\frac{dy}{dx} = g'(x)\ln[f(x)] + \frac{g(x)f'(x)}{f(x)} \quad\Longrightarrow\quad \frac{dy}{dx} = [f(x)]^{g(x)}\left[g'(x)\ln[f(x)] + \frac{g(x)f'(x)}{f(x)}\right]

Step 4. Substituting back y=[f(x)]g(x)y=[f(x)]^{g(x)} is not optional — leaving the answer as 1ydydx=…\frac1y\frac{dy}{dx}=\dots is an incomplete derivative. This general result specialises instantly to y=xxy=x^x: with f(x)=xf(x)=x and g(x)=xg(x)=x, so f′(x)=g′(x)=1f'(x)=g'(x)=1, it gives dydx=xx[1⋅ln⁡x+x⋅1x]=xx(ln⁡x+1)\dfrac{dy}{dx}=x^x[1\cdot\ln x + x\cdot\frac1x] = x^x(\ln x+1), matching the direct computation.

Worked example

Differentiate y=x21−x(x+2)3y = \dfrac{x^2\sqrt{1-x}}{(x+2)^3} using logarithmic differentiation, then evaluate dydx\dfrac{dy}{dx} at x=0x=0.

Step 1. Take the natural log of both sides and expand with log laws: ln⁡y=ln⁡(x2)+ln⁡1−x−ln⁡[(x+2)3]=2ln⁡x+12ln⁡(1−x)−3ln⁡(x+2)\ln y = \ln(x^2) + \ln\sqrt{1-x} - \ln[(x+2)^3] = 2\ln x + \tfrac12\ln(1-x) - 3\ln(x+2). Each power in the original expression became a multiplying coefficient in front of a log term.

Step 2. Differentiate term by term, each needing the chain rule since every argument is a function of xx:

1ydydx=2x−12(1−x)−3x+2\frac{1}{y}\frac{dy}{dx} = \frac{2}{x} - \frac{1}{2(1-x)} - \frac{3}{x+2}

Step 3. Multiply both sides by yy and substitute the original expression back in for yy:

dydx=x21−x(x+2)3[2x−12(1−x)−3x+2]\frac{dy}{dx} = \frac{x^2\sqrt{1-x}}{(x+2)^3}\left[\frac{2}{x} - \frac{1}{2(1-x)} - \frac{3}{x+2}\right]

This bracketed form is the standard, fully acceptable board answer — there is no requirement to expand it further, and doing so usually makes the answer harder to check, not easier.

Competitive stretch — evaluate at a point

The bracket in Step 3 blows up as x→0x\to 0 because of the 2/x2/x term, so x=0x=0 cannot be substituted directly into y=x21−x/(x+2)3y=x^2\sqrt{1-x}/(x+2)^3 and differentiated there in one shot without care — but the original yy is perfectly finite at x=0x=0: y(0)=0y(0) = 0, since the numerator carries a factor x2x^2. So dydx∣x=0=y(0)×[bracket]=0×[… ]\dfrac{dy}{dx}\Big|_{x=0} = y(0)\times[\text{bracket}] = 0\times[\dots] , and since the bracket's problematic 2/x2/x term is multiplied by a yy that itself contains x2x^2, the product is 00 in the limit. The derivative at x=0x=0 is 00 — a useful check that logarithmic differentiation's bracket form must always be read together with the yy multiplying it, not evaluated piece by piece.

Common traps

  • Applying the ordinary power rule to xxx^x. The power rule needs a constant exponent; here the exponent is xx itself, so ddxxn=nxn−1\frac{d}{dx}x^n=nx^{n-1} does not apply and logarithmic differentiation is mandatory.
  • Dropping the 1y\frac1y factor when differentiating ln⁡y\ln y implicitly — writing ddx(ln⁡y)=dydx\frac{d}{dx}(\ln y)=\frac{dy}{dx} instead of the correct 1ydydx\frac1y\frac{dy}{dx}.
  • Misusing log laws, especially assuming ln⁡(a−b)=ln⁡a−ln⁡b\ln(a-b)=\ln a-\ln b; only ln⁡(a/b)=ln⁡a−ln⁡b\ln(a/b)=\ln a-\ln b is valid, and only division (not subtraction) becomes a log difference.
  • Stopping at 1ydydx=…\frac1y\frac{dy}{dx}=\dots without multiplying by yy and substituting the original function back in — this leaves an incomplete derivative, not a final answer.
  • Forgetting the domain restriction. ln⁡y\ln y requires y>0y>0, so logarithmic differentiation as shown assumes f(x)>0f(x)>0 on the interval of interest; if yy can be negative, students instead take ln⁡∣y∣\ln|y| and note that ddxln⁡∣y∣=1ydydx\frac{d}{dx}\ln|y|=\frac1y\frac{dy}{dx} still holds, so the working formula is unchanged.

Ask the tutor: if you want, I can walk through one more logarithmic-differentiation problem with you line by line, picking the exponent-form or the product-form case — just say which.

Why can we take the log of both sides at all — doesn't that change the equation?

It does not change the equation, because ln⁡\ln is a strictly increasing, one-to-one function on positive numbers: if two quantities are equal, their logs are equal, and vice versa. Since yy (a positive power like xxx^x for x>0x>0) is positive, ln⁡y\ln y is well-defined, and ln⁡y=ln⁡[original expression]\ln y=\ln[\text{original expression}] is exactly as true as the original equation. Differentiating both sides of a true equation gives another true equation, which is all logarithmic differentiation relies on.

Do I always need logarithmic differentiation for products, or can I use the product rule instead?

For two factors, the ordinary product rule is usually faster and logarithmic differentiation is not required. The technique earns its keep once you have three or more factors, or factors raised to fractional or negative powers, or roots — situations where repeated product and quotient rules become long and error-prone. As a rule of thumb, reach for logs when you would otherwise need to nest the product rule inside the quotient rule, or when an exponent itself depends on xx.

In the worked example, why doesn't the 2/x term cause a problem at x=0 in the final answer?

Because the final derivative is the product of yy (which contains the factor x2x^2 and equals 00 at x=0x=0) and the bracket (which does blow up as 2/x2/x near x=0x=0). The bracket alone is undefined at x=0x=0, but it is never the final answer by itself — it is always multiplied by yy. Here y∼x2y\sim x^2 near 00 while the troublesome term in the bracket is ∼2/x\sim 2/x, so their product behaves like x2⋅(2/x)=2x→0x^2\cdot(2/x)=2x\to 0. The lesson is to always keep the yy factor attached when reasoning about the derivative's behaviour, not to evaluate the bracket in isolation.

Before this

Where this leads