AP Calculus AB and BC

Logarithmic Differentiation: Steps and Worked Examples

Logarithmic differentiation means taking the natural log of both sides of y = f(x), simplifying with log properties, differentiating implicitly, and multiplying by y. Use it when the variable appears in both the base and the exponent, as in x^x, or when a function is a long product, quotient, and power.

When you need it

Two derivative rules deal with exponents, and each one requires part of the expression to be constant. The power rule needs a constant exponent. The exponential rule needs a constant base. A function such as xxx^x has a variable in both places, so neither rule applies.

FunctionBaseExponentMethodDerivative
x5x^5variableconstantPower rule5x45x^4
5x5^xconstantvariableExponential rule5xln⁡55^x \ln 5
xxx^xvariablevariableLogarithmic differentiationxx(ln⁡x+1)x^x(\ln x + 1)

Logarithmic differentiation handles the third row. It combines three tools you already have: the derivative of ln⁡x\ln x, the chain rule (Topic 3.1, The Chain Rule), and implicit differentiation (Topic 3.2, Implicit Differentiation). The same technique is also a convenient option for a function built from several factors multiplied, divided, and raised to powers, where the product and quotient rules would be long.

The four steps

  1. Take the natural log of both sides of y=f(x)y = f(x).
  2. Expand the right side with logarithm properties until no products, quotients, or powers remain inside a logarithm.
  3. Differentiate both sides with respect to xx. The left side, ln⁡y\ln y, becomes 1y⋅dydx\frac{1}{y} \cdot \frac{dy}{dx} by the chain rule.
  4. Multiply both sides by yy, then replace yy with the original function.

Step 2 is where the method pays off. Three properties turn multiplication into addition and exponents into coefficients:

ln⁡(ab)=ln⁡a+ln⁡bln⁡(ab)=ln⁡a−ln⁡bln⁡(ab)=bln⁡a\ln(ab) = \ln a + \ln b \qquad \ln\left(\frac{a}{b}\right) = \ln a - \ln b \qquad \ln\left(a^b\right) = b \ln a

The third property is the one that brings a variable exponent down to where the product rule can reach it.

The general pattern for a variable base and exponent

Suppose y=uvy = u^v, where uu and vv are both functions of xx and u>0u > 0. Taking logs gives ln⁡y=vln⁡u\ln y = v \ln u. The right side is a product, so differentiating it takes the product rule:

1y⋅dydx=dvdxln⁡u+v⋅1u⋅dudx\frac{1}{y} \cdot \frac{dy}{dx} = \frac{dv}{dx} \ln u + v \cdot \frac{1}{u} \cdot \frac{du}{dx}

Multiplying by y=uvy = u^v gives the derivative:

dydx=uv[dvdxln⁡u+vu⋅dudx]\frac{dy}{dx} = u^v \left[ \frac{dv}{dx} \ln u + \frac{v}{u} \cdot \frac{du}{dx} \right]

There is no need to memorize this. Running the four steps on each problem is more reliable than recalling the formula. For y=xxy = x^x, u=xu = x and v=xv = x, and the bracket becomes ln⁡x+1\ln x + 1.

The same result by rewriting with e

An equivalent route skips the implicit step. Since u=eln⁡uu = e^{\ln u} for u>0u > 0, any power can be rewritten with base ee:

xx=exln⁡xx^x = e^{x \ln x}

Now the base is constant and the chain rule applies. The derivative of the exponent xln⁡xx \ln x is ln⁡x+1\ln x + 1, so

ddx[exln⁡x]=exln⁡x(ln⁡x+1)=xx(ln⁡x+1)\frac{d}{dx}\left[e^{x \ln x}\right] = e^{x \ln x}(\ln x + 1) = x^x(\ln x + 1)

Both methods give the same answer every time. Use whichever you find easier to carry out. The page on the derivative of x to the x works this function in full.

Where students lose points

  • Using the power rule on xxx^x and writing x⋅xx−1x \cdot x^{x-1}. The power rule requires a constant exponent.
  • Using the exponential rule on xxx^x and writing xxln⁡xx^x \ln x. The exponential rule requires a constant base.
  • Stopping at 1y⋅dydx\frac{1}{y} \cdot \frac{dy}{dx}. The answer is dydx\frac{dy}{dx}, so multiply by yy.
  • Leaving yy in the final answer. Replace it with the original expression in xx.
  • Splitting the log of a sum. ln⁡(a+b)\ln(a + b) does not simplify. The properties cover products, quotients, and powers only.
  • Forgetting the product rule on vln⁡uv \ln u when both factors contain xx.

Domain

The natural log needs a positive input, so the method as written assumes y>0y > 0. For a product or quotient that can be negative, take ln⁡∣y∣\ln |y| instead. The derivative of ln⁡∣y∣\ln |y| is still 1y⋅dydx\frac{1}{y} \cdot \frac{dy}{dx}, so the steps do not change, and the result holds wherever y≠0y \ne 0.

For how this technique relates to ordinary implicit differentiation, see logarithmic vs implicit differentiation.

Worked examples

Worked example

A variable base and a variable exponent

Find dydx\frac{dy}{dx} for y=x2xy = x^{2x}, where x>0x > 0.

  1. Take the natural log of both sides: ln⁡y=ln⁡(x2x)\ln y = \ln\left(x^{2x}\right).
  2. Bring the exponent down: ln⁡y=2xln⁡x\ln y = 2x \ln x.
  3. Differentiate both sides. The left side is 1y⋅dydx\frac{1}{y} \cdot \frac{dy}{dx}. The right side is a product: 2⋅ln⁡x+2x⋅1x=2ln⁡x+22 \cdot \ln x + 2x \cdot \frac{1}{x} = 2\ln x + 2.
  4. Multiply by yy: dydx=y(2ln⁡x+2)\frac{dy}{dx} = y(2\ln x + 2).
  5. Replace yy with x2xx^{2x} and factor out the 22.

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

Worked example

A trig function raised to a variable power

Find dydx\frac{dy}{dx} for y=(sin⁡x)xy = (\sin x)^x, where 0<x<π0 < x < \pi.

  1. On 0<x<π0 < x < \pi, sin⁡x\sin x is positive, so the logarithm is defined. Take logs: ln⁡y=xln⁡(sin⁡x)\ln y = x \ln(\sin x).
  2. Differentiate the left side: 1y⋅dydx\frac{1}{y} \cdot \frac{dy}{dx}.
  3. Differentiate the right side with the product rule. The derivative of ln⁡(sin⁡x)\ln(\sin x) is cos⁡xsin⁡x=cot⁡x\frac{\cos x}{\sin x} = \cot x by the chain rule, so the right side becomes 1⋅ln⁡(sin⁡x)+xcot⁡x1 \cdot \ln(\sin x) + x \cot x.
  4. Multiply by yy and substitute y=(sin⁡x)xy = (\sin x)^x.

dydx=(sin⁡x)x[ln⁡(sin⁡x)+xcot⁡x]\frac{dy}{dx} = (\sin x)^x \left[\ln(\sin x) + x \cot x\right]

Worked example

A long product and quotient

Let y=x2x+1(x+3)4y = \frac{x^2 \sqrt{x + 1}}{(x + 3)^4} for x>0x > 0. Find dydx\frac{dy}{dx}, then find the slope at x=1x = 1.

  1. Take logs and expand completely: ln⁡y=2ln⁡x+12ln⁡(x+1)−4ln⁡(x+3)\ln y = 2\ln x + \frac{1}{2}\ln(x + 1) - 4\ln(x + 3).
  2. Differentiate both sides term by term: 1y⋅dydx=2x+12(x+1)−4x+3\frac{1}{y} \cdot \frac{dy}{dx} = \frac{2}{x} + \frac{1}{2(x + 1)} - \frac{4}{x + 3}.
  3. Multiply by yy and substitute the original function: dydx=x2x+1(x+3)4[2x+12(x+1)−4x+3]\frac{dy}{dx} = \frac{x^2 \sqrt{x + 1}}{(x + 3)^4} \left[\frac{2}{x} + \frac{1}{2(x + 1)} - \frac{4}{x + 3}\right].
  4. Evaluate at x=1x = 1. The function value is y=1⋅244=2256y = \frac{1 \cdot \sqrt{2}}{4^4} = \frac{\sqrt{2}}{256}. The bracket is 2+14−1=542 + \frac{1}{4} - 1 = \frac{5}{4}.
  5. Multiply: 2256⋅54=521024\frac{\sqrt{2}}{256} \cdot \frac{5}{4} = \frac{5\sqrt{2}}{1024}.

dydx=x2x+1(x+3)4[2x+12(x+1)−4x+3]\frac{dy}{dx} = \frac{x^2 \sqrt{x + 1}}{(x + 3)^4} \left[\frac{2}{x} + \frac{1}{2(x + 1)} - \frac{4}{x + 3}\right], and the slope at x=1x = 1 is 521024\frac{5\sqrt{2}}{1024}.

Frequently asked questions

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

The power rule ddx[xn]=nxn−1\frac{d}{dx}\left[x^n\right] = n x^{n-1} is derived for a constant exponent nn. In xxx^x the exponent changes with xx, so the rule does not apply. Logarithmic differentiation, or rewriting as exln⁡xe^{x \ln x}, gives the correct derivative xx(ln⁡x+1)x^x(\ln x + 1).

Do I have to use logarithmic differentiation on products and quotients?

No. For products and quotients it is a convenience, since the product, quotient, and chain rules give the same answer with more algebra. It is required, or replaced by the evln⁡ue^{v \ln u} rewrite, only when a variable appears in both the base and the exponent.

Why does ln⁡y\ln y differentiate to 1y⋅dydx\frac{1}{y} \cdot \frac{dy}{dx}?

Because yy is a function of xx, ln⁡y\ln y is a composition. The chain rule differentiates the outer function ln⁡\ln to get 1y\frac{1}{y}, then multiplies by the derivative of the inside, dydx\frac{dy}{dx}. This is the same step used throughout implicit differentiation.