Logarithmic differentiation and differentiation of one function w.r.t. another

Try to differentiate y=xxy = x^x with the rules you already know and you get stuck: the power rule needs a fixed exponent, the exponential rule needs a fixed base, and xxx^x has neither. The fix is to take logarithms first — ln⁡y=xln⁡x\ln y = x\ln x — which turns the unruly power into a product you can differentiate directly. This trick, logarithmic differentiation, is the standard tool whenever both the base and the exponent of a function carry the variable xx, and it doubles as a shortcut for messy products and quotients of many factors. A second, related idea in this section asks a different question: not "differentiate with respect to xx" but "differentiate uu with respect to vv," where both uu and vv are themselves functions of xx. The answer turns out to need nothing new — just the ratio of two ordinary derivatives. Both ideas sit at the end of the Continuity, Differentiability, Differentiation unit, resting on the chain and product rules you have already built.

The core insight

Take logarithms before differentiating whenever the exponent itself varies, and to compare two functions' rates of change use dudv=du/dxdv/dx\dfrac{du}{dv}=\dfrac{du/dx}{dv/dx}.

The core idea

Why direct rules fail for y=[f(x)]g(x)y=[f(x)]^{g(x)}. The power rule ddx(xn)=nxn−1\frac{d}{dx}(x^n)=nx^{n-1} assumes the exponent nn is a constant; the exponential rule ddx(ax)=axln⁡a\frac{d}{dx}(a^x)=a^x\ln a assumes the base aa is a constant. When a function has a variable base and a variable exponent — such as y=xxxy=x^{x^x} or y=(sin⁡x)cos⁡xy=(\sin x)^{\cos x} — neither rule applies, and something new is needed.

The logarithmic differentiation method. Take ln⁡\ln of both sides of y=[f(x)]g(x)y=[f(x)]^{g(x)} so the exponent drops down as a multiplier: ln⁡y=g(x)ln⁡f(x)\ln y = g(x)\ln f(x). Differentiate both sides with respect to xx — the chain rule on the left (since y=y(x)y=y(x)), the product rule on the right — then multiply back by yy to isolate dydx\dfrac{dy}{dx}:

1ydydx=g′(x)ln⁡f(x)+g(x)⋅f′(x)f(x)\frac{1}{y}\frac{dy}{dx} = g'(x)\ln f(x) + g(x)\cdot\frac{f'(x)}{f(x)}

where: y=[f(x)]g(x)y=[f(x)]^{g(x)} is the original function, f(x)f(x) is the (positive) base function, g(x)g(x) is the exponent function, and f′(x), g′(x)f'(x),\,g'(x) are their ordinary derivatives. The left side, 1ydydx\dfrac1y\dfrac{dy}{dx}, is only the derivative of ln⁡y\ln y — you must multiply through by yy and substitute y=[f(x)]g(x)y=[f(x)]^{g(x)} back in to get the actual answer. Logarithmic differentiation is also a labour-saving device beyond variable-exponent cases. Because ln⁡(product)\ln(\text{product}) is a sum of logs and ln⁡(quotient)\ln(\text{quotient}) is a difference of logs, a gnarly expression like y=(x−1)(x−2)2x+3y=\dfrac{(x-1)(x-2)^2}{\sqrt{x+3}} turns, after taking logs, into a sum and difference of simple terms — far easier to differentiate term by term than fighting through the product and quotient rules directly on the original expression.

Differentiation of one function w.r.t. another. Sometimes a problem asks for dudv\dfrac{du}{dv}, where both uu and vv are given as functions of xx — not the rate of change of uu against xx, but against vv. Since both are functions of the same underlying variable xx, the chain rule gives the ratio directly:

dudv=du/dxdv/dx\frac{du}{dv} = \frac{du/dx}{dv/dx}

where: u=u(x)u=u(x) and v=v(x)v=v(x) are the two given functions, and du/dxdu/dx, dv/dxdv/dx are their ordinary derivatives with respect to xx. In practice: differentiate uu with respect to xx, differentiate vv with respect to xx, then divide. This is exactly the same idea used for parametric differentiation (dydx=dy/dtdx/dt\dfrac{dy}{dx}=\dfrac{dy/dt}{dx/dt}), except here the shared variable is xx itself rather than an external parameter tt. Notice, too, that "differentiate uu w.r.t. xx" is just the special case v=xv=x: since dv/dx=1dv/dx=1, the formula collapses to dudv=dudx\dfrac{du}{dv}=\dfrac{du}{dx}. So the ordinary derivative is not a different concept — it is "derivative with respect to xx" chosen as the default, and this technique simply lets you choose a different reference variable.

Figure
Two paths for a derivative problem, one route substitutes logs to remove a variable exponent, the other route takes a ratio of two derivatives to change the reference variable
Two related techniques, one shared engine: the chain rule y = [f(x)]^g(x) take ln, differentiate, multiply back by y u(x) and v(x) given du/dv = (du/dx) / (dv/dx) ratio of two derivatives both rest on the chain rule for d(...)/dx
Derivation ALogarithmic differentiation of y equals x to the power x

Differentiate y=xxy=x^x (for x>0x>0) with respect to xx, showing every algebraic step from taking logarithms through to substituting back the original function, so the general formula above is seen worked in full on the syllabus's own headline example.

Step 1. Take ln⁡\ln of both sides of y=xxy=x^x. Since ln⁡(ab)=bln⁡a\ln(a^b)=b\ln a, the exponent drops down as a coefficient: ln⁡y=xln⁡x\ln y = x\ln x.

Step 2. Differentiate both sides with respect to xx. The left side needs the chain rule (because y=y(x)y=y(x)): ddx(ln⁡y)=1ydydx\dfrac{d}{dx}(\ln y)=\dfrac1y\dfrac{dy}{dx}. The right side is a product of xx and ln⁡x\ln x, so the product rule gives ddx(xln⁡x)=1⋅ln⁡x+x⋅1x=ln⁡x+1\dfrac{d}{dx}(x\ln x) = 1\cdot\ln x + x\cdot\dfrac1x = \ln x + 1. Equating the two sides: 1ydydx=ln⁡x+1\dfrac{1}{y}\dfrac{dy}{dx} = \ln x + 1.

Step 3. Solve for dydx\dfrac{dy}{dx} by multiplying both sides by yy: dydx=y(ln⁡x+1)\dfrac{dy}{dx} = y(\ln x + 1).

Step 4. Substitute back y=xxy=x^x, since the answer must be expressed purely in terms of xx, not yy:

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

Result: dydx=xx(1+ln⁡x)\dfrac{dy}{dx}=x^x(1+\ln x), confirming that the power rule alone (which would wrongly give x⋅xx−1x\cdot x^{x-1}) cannot handle a variable exponent.

Worked example

Differentiate sin⁡(x3)\sin(x^3) with respect to x3x^3 — an instance of "one function w.r.t. another," reusing the syllabus's own headline example.

Step 1. Name the two functions. Let u=sin⁡(x3)u=\sin(x^3) be the function to differentiate, and v=x3v=x^3 be the function to differentiate with respect to.

Step 2. Differentiate uu with respect to xx, using the chain rule (outer derivative cos⁡\cos, times inner derivative 3x23x^2):

dudx=cos⁡(x3)⋅3x2\frac{du}{dx} = \cos(x^3)\cdot 3x^2

Step 3. Differentiate vv with respect to xx:

dvdx=3x2\frac{dv}{dx} = 3x^2

Step 4. Form the ratio and simplify by cancelling the common factor 3x23x^2 (valid for x≠0x\ne0):

dudv=du/dxdv/dx=3x2cos⁡(x3)3x2=cos⁡(x3)\frac{du}{dv} = \frac{du/dx}{dv/dx} = \frac{3x^2\cos(x^3)}{3x^2} = \cos(x^3)

The derivative of sin⁡(x3)\sin(x^3) with respect to x3x^3 is cos⁡(x3)\boxed{\cos(x^3)}. This mirrors the familiar rule "the derivative of sin⁡θ\sin\theta with respect to θ\theta is cos⁡θ\cos\theta," with θ=x3\theta=x^3 playing the role of the reference variable — the messy 3x23x^2 factors from the chain rule cancel out precisely because uu and vv share the same underlying variable xx.

Common traps

  • Applying the ordinary power rule to xxx^x-type expressions, writing ddx(xx)=x⋅xx−1\frac{d}{dx}(x^x)=x\cdot x^{x-1} — wrong whenever the exponent itself depends on xx.
  • Forgetting to multiply back by yy at the end of logarithmic differentiation, leaving the answer as 1ydydx=…\dfrac1y\dfrac{dy}{dx}=\dots instead of solving for dydx\dfrac{dy}{dx} and substituting yy back in.
  • In "one function w.r.t. another" problems, computing du/dxdu/dx and dv/dxdv/dx correctly but failing to cancel the common factor, leaving an unnecessarily messy final ratio.
  • Reaching for logarithmic differentiation on expressions like x5x^5 or 5x5^x, where the base or exponent is already constant and a direct rule suffices — it is unnecessary extra work there.
  • Losing track of the domain requirement f(x)>0f(x)>0 that ln⁡f(x)\ln f(x) imposes; the modulus form ln⁡∣f(x)∣\ln|f(x)| extends the method safely where the base function can be negative.

Ask the tutor: want to try logarithmic differentiation on the full triple-tower example y=xxxy=x^{x^x}, layer by layer?

Why can't I just use the power rule directly on something like y equals x to the x?

The power rule ddx(xn)=nxn−1\frac{d}{dx}(x^n)=nx^{n-1} is only valid when the exponent nn is a fixed constant, and the exponential rule ddx(ax)=axln⁡a\frac{d}{dx}(a^x)=a^x\ln a only when the base aa is fixed. In y=xxy=x^x both the base and the exponent are the variable xx, so neither assumption holds and both rules give wrong answers. Taking logarithms first converts the troublesome exponent into an ordinary multiplicative factor, ln⁡y=xln⁡x\ln y = x\ln x, which the product rule can handle cleanly — that is exactly why the method exists.

Do I always have to multiply back by y at the end of logarithmic differentiation?

Yes. Differentiating ln⁡y\ln y with respect to xx only ever produces 1ydydx\dfrac1y\dfrac{dy}{dx} on the left side, never dydx\dfrac{dy}{dx} on its own, because of the chain rule. To finish the problem you must multiply both sides by yy and then substitute the original expression for yy back in, since an answer left in terms of an undefined yy is not a complete derivative. Skipping this step is the single most common way marks are lost on this topic.

How is differentiating u with respect to v different from an ordinary derivative?

An ordinary derivative dudx\dfrac{du}{dx} measures how uu changes as xx changes. Differentiating uu with respect to vv instead measures how uu changes as the other function vv changes, using dudv=du/dxdv/dx\dfrac{du}{dv}=\dfrac{du/dx}{dv/dx}. In fact the ordinary derivative is just the special case v=xv=x, since then dv/dx=1dv/dx=1 and the ratio collapses to du/dxdu/dx. So it is not a new rule to memorise separately — it is the same chain-rule idea, just letting you pick a reference variable other than xx.

Before this

Where this leads