In short

Logarithmic differentiation is a technique where you take the natural logarithm of both sides of y = f(x), simplify using log properties, then differentiate implicitly to find dy/dx. It is essential for functions of the form f(x)^{g(x)} (variable base and variable exponent), and makes life dramatically easier for products and quotients with many factors.

Differentiate f(x) = x^x for x > 0.

Stop and think about which rule you would use. The power rule? That requires a constant exponent — but here the exponent is x, which varies. The exponential rule? That requires a constant base — but here the base is x, which also varies. Neither rule fits. Both the base and the exponent depend on x, and no formula you have learned so far handles this directly.

This is the problem that logarithmic differentiation was invented to solve. The idea is disarmingly simple: take \ln of both sides, use the properties of logarithms to pull the exponent down, and then differentiate. The logarithm turns a function that defies every known rule into one that yields to techniques you already have.

Why the logarithm helps

The power of logarithmic differentiation comes from three properties of \ln that you already know from the logarithmic functions article:

Differentiation is easy on sums and differences (the sum rule). It is hard on products and quotients (the product and quotient rules generate multiple terms). And it is sometimes impossible when the exponent varies (no standard rule applies). The logarithm transforms the hard structures into easy ones before you differentiate, so you never have to fight with them.

The cost is small: after differentiating, you have \frac{1}{y}\frac{dy}{dx} on the left side instead of \frac{dy}{dx}, so you multiply by y at the end. Since y is the function you started with, you always know what it is.

The technique in three steps

Here is the method, stated in full generality. Given y = f(x) where f(x) > 0:

Step 1. Take the natural logarithm of both sides: \ln y = \ln f(x).

Step 2. Simplify the right side using logarithm properties — \ln(AB) = \ln A + \ln B, \ln(A/B) = \ln A - \ln B, \ln(A^n) = n \ln A.

Step 3. Differentiate both sides with respect to x. On the left side, \frac{d}{dx}[\ln y] = \frac{1}{y} \cdot \frac{dy}{dx} by the chain rule (since y is a function of x). On the right side, differentiate whatever you got after simplifying. Then solve for \frac{dy}{dx} by multiplying both sides by y.

The result always takes the form:

\frac{dy}{dx} = y \cdot [\text{derivative of } \ln y]

Since you know y — it is the function you started with — you substitute it back in at the end.

The case that demands it: f(x)^{g(x)}

Start with the problem from the opening. Differentiate y = x^x for x > 0.

Step 1. Take \ln of both sides:

\ln y = \ln(x^x) = x \ln x

The logarithm property \ln(a^b) = b \ln a pulls the exponent x down to become a coefficient. What was an impossible exponent is now a simple product.

Step 2. Differentiate both sides with respect to x.

Left side: \frac{d}{dx}[\ln y] = \frac{1}{y} \cdot \frac{dy}{dx}.

Right side: \frac{d}{dx}[x \ln x]. This is a product, so use the product rule:

\frac{d}{dx}[x \ln x] = 1 \cdot \ln x + x \cdot \frac{1}{x} = \ln x + 1

So:

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

Step 3. Multiply both sides by y = x^x:

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

That's the answer. The derivative of x^x is x^x(\ln x + 1). At x = 1, this gives 1^1(0 + 1) = 1. At x = 2, this gives 4(\ln 2 + 1) \approx 4(1.693) \approx 6.77. The function x^x grows very fast, and the derivative captures that: it contains the original function as a factor, multiplied by a quantity that is itself increasing.

Notice that \frac{dy}{dx} = 0 when \ln x + 1 = 0, which gives \ln x = -1, so x = e^{-1} = 1/e \approx 0.368. At this point, the function x^x reaches its minimum value of (1/e)^{1/e} \approx 0.6922. For x < 1/e the derivative is negative (the function is decreasing), and for x > 1/e it is positive (the function is increasing).

The function $y = x^x$ for $x > 0$. The minimum occurs at $x = 1/e \approx 0.368$, where $dy/dx = x^x(\ln x + 1) = 0$. After the minimum, the function rises steeply — by $x = 2$ it has already reached $4$, and by $x = 3$ it is $27$.

The general formula for [f(x)]^{g(x)}

The same technique handles any function of the form y = [f(x)]^{g(x)} where f(x) > 0. Take \ln:

\ln y = g(x) \ln f(x)

Differentiate both sides:

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

Multiply by y:

\frac{dy}{dx} = [f(x)]^{g(x)} \left[g'(x) \ln f(x) + g(x) \cdot \frac{f'(x)}{f(x)}\right]

You do not need to memorise this formula. The three-step technique — take \ln, differentiate, multiply by y — produces it every time. The formula is just what happens when you apply the technique to the general case.

Another example: y = (\sin x)^x for 0 < x < \pi

Take \ln: \ln y = x \ln(\sin x).

Differentiate: \frac{1}{y}\frac{dy}{dx} = \ln(\sin x) + x \cdot \frac{\cos x}{\sin x} = \ln(\sin x) + x\cot x.

Multiply by y: \frac{dy}{dx} = (\sin x)^x\left[\ln(\sin x) + x\cot x\right].

The structure is identical to x^x: two terms arise from the product rule, one involving the derivative of the exponent and one involving the derivative of the base.

The function $y = (\sin x)^x$ for $0 < x < \pi$. At $x = \pi/2$, $\sin x = 1$ so $y = 1$. As $x$ approaches $\pi$, $\sin x$ approaches $0$ and the function drops to $0$. The derivative at any point can only be found by logarithmic differentiation.

A third type: y = x^{1/x}

This is another f(x)^{g(x)} form, with f(x) = x and g(x) = 1/x. Take \ln:

\ln y = \frac{1}{x} \ln x = \frac{\ln x}{x}

Differentiate (using the quotient rule on \ln x / x):

\frac{1}{y}\frac{dy}{dx} = \frac{(1/x) \cdot x - \ln x \cdot 1}{x^2} = \frac{1 - \ln x}{x^2}

Multiply by y:

\frac{dy}{dx} = x^{1/x} \cdot \frac{1 - \ln x}{x^2}

The derivative is zero when 1 - \ln x = 0, i.e., x = e. At x = e, the function x^{1/x} reaches its maximum value e^{1/e} \approx 1.4447. For x > e the derivative is negative, so x^{1/x} decreases. This means that among all the nth roots of n (for positive integers n), \sqrt[3]{3} \approx 1.442 is the largest — it is the integer closest to e.

The function $y = x^{1/x}$. The maximum occurs at $x = e$, where $y = e^{1/e} \approx 1.4447$. The integer values show $\sqrt[2]{2} = \sqrt[4]{4} \approx 1.414$ and $\sqrt[3]{3} \approx 1.442$. Since $3$ is the integer closest to $e$, $\sqrt[3]{3}$ is the largest $n$th root of $n$.

When products and quotients have many factors

Logarithmic differentiation is not only for variable-exponent functions. It is also the best tool whenever you need to differentiate a product or quotient of many factors.

Consider

y = \frac{x^3 (2x+1)^4}{\sqrt{x^2 + 1}}

You could differentiate this with the product rule and quotient rule. The product rule on the numerator alone would require differentiating x^3 (2x+1)^4, which is itself a product. The quotient rule then adds another layer. The computation is correct but painful — many terms, many places to make algebraic errors.

Logarithmic differentiation cuts through all of it. Take \ln of both sides:

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

The product became a sum, the quotient became a subtraction, and the exponents became coefficients. Now differentiate:

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

And multiply by y:

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

Done. No product rule, no quotient rule, no expanding, no simplifying intermediate expressions. The logarithm converted multiplication into addition, which is always easier to differentiate.

Here is the count: the logarithmic method required differentiating three terms, each of the form c \ln(u), producing three simple fractions. The direct method would have required the quotient rule on a fraction whose numerator is itself a product (requiring the product rule), generating at least six terms before simplification. The logarithmic method wins by a wide margin, and the margin grows with every additional factor.

Another worked product: y = \sqrt[5]{\dfrac{(x-1)(x+3)^2}{(x+5)^3}} for x > 1

Take \ln:

\ln y = \frac{1}{5}\left[\ln(x-1) + 2\ln(x+3) - 3\ln(x+5)\right]

Differentiate:

\frac{1}{y}\frac{dy}{dx} = \frac{1}{5}\left[\frac{1}{x-1} + \frac{2}{x+3} - \frac{3}{x+5}\right]

Multiply by y:

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

Notice how the fifth root, which would have required converting to a 1/5 exponent and then using the chain rule on a complicated inside, is absorbed effortlessly by the logarithm. The outer 1/5 simply becomes a constant multiplier.

An alternative route: the exponential rewrite

There is a second way to handle f(x)^{g(x)} that avoids the implicit-differentiation flavour. Rewrite the function using e:

y = [f(x)]^{g(x)} = e^{g(x) \ln f(x)}

Now this is a standard exponential e^u where u = g(x) \ln f(x), and you can differentiate it with the chain rule:

\frac{dy}{dx} = e^{g(x) \ln f(x)} \cdot \frac{d}{dx}[g(x) \ln f(x)]

Since e^{g(x) \ln f(x)} = [f(x)]^{g(x)} = y, this gives the same answer as the logarithmic method. Some students prefer this route because it stays entirely within the chain rule framework and avoids the "\frac{1}{y}\frac{dy}{dx}" step. Both methods produce the same result; use whichever feels more natural to you.

For example, to differentiate x^x: rewrite as e^{x \ln x}, then \frac{d}{dx}[e^{x \ln x}] = e^{x \ln x} \cdot (\ln x + 1) = x^x(\ln x + 1).

When to use logarithmic differentiation

The following diagram summarises the decision:

When to use logarithmic differentiationA decision tree. The top box asks: is the function f(x) to the g(x)? If yes, logarithmic differentiation is required. If no, the next question is: is it a product or quotient of 3 or more factors? If yes, logarithmic differentiation is strongly preferred. If no, use the standard rules. Is it f(x)^g(x)? yes no Use log diff (required) Product/quotient of 3+ factors? yes no Log diff (preferred) Standard rules suffice
Decision tree for logarithmic differentiation. If both the base and exponent are variable, you have no choice — logarithmic differentiation is the only method. For messy products and quotients, it is the cleanest method. For simple expressions, the standard rules are faster.

Here is the decision rule:

Computing one from start to finish

Example 1: Differentiate $y = x^{\sin x}$ for $x > 0$

Step 1. Take the natural logarithm of both sides.

\ln y = \sin x \cdot \ln x

Why: \ln(a^b) = b \ln a. The exponent \sin x comes down as a coefficient, turning an impossible differentiation into a tractable product.

Step 2. Differentiate both sides with respect to x. The left side gives \frac{1}{y}\frac{dy}{dx}. The right side is a product of \sin x and \ln x, so apply the product rule.

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

Why: product rule. The derivative of \sin x is \cos x; the derivative of \ln x is 1/x.

Step 3. Multiply both sides by y = x^{\sin x}.

\frac{dy}{dx} = x^{\sin x}\left(\cos x \cdot \ln x + \frac{\sin x}{x}\right)

Why: solving for dy/dx means clearing the 1/y on the left, which is the same as multiplying by y.

Step 4. Check at a specific point. At x = \pi/2: y = (\pi/2)^{\sin(\pi/2)} = (\pi/2)^1 = \pi/2 \approx 1.571. The derivative is (\pi/2)^1\left(\cos(\pi/2) \cdot \ln(\pi/2) + \frac{\sin(\pi/2)}{\pi/2}\right) = (\pi/2)\left(0 + \frac{2}{\pi}\right) = 1.

Why: at x = \pi/2, \cos(\pi/2) = 0 kills the first term, and \sin(\pi/2) = 1 simplifies the second. The tangent slope of 1 means the curve is rising at a 45-degree angle at this point.

Result: \dfrac{dy}{dx} = x^{\sin x}\!\left(\cos x \cdot \ln x + \dfrac{\sin x}{x}\right).

The curve $y = x^{\sin x}$ (black) with the tangent line at $x = \pi/2$ (red). At that point the function value is $\pi/2 \approx 1.571$ and the slope is exactly $1$, so the tangent makes a 45-degree angle with the horizontal. The curve oscillates gently because $\sin x$ oscillates — when $\sin x$ is small, $x^{\sin x}$ is close to $1$; when $\sin x$ is near $1$, the function roughly tracks $x$.

Notice how the curve dips toward 1 near x = \pi (where \sin x \approx 0, so x^{\sin x} \approx x^0 = 1) and rises near x = \pi/2 (where \sin x = 1, so x^{\sin x} = x). The oscillation of the exponent \sin x creates a gently undulating growth pattern.

Example 2: Differentiate $y = \dfrac{(x+1)^3(x-2)^4}{(x+3)^5}$ for $x > 2$

Step 1. Take the natural logarithm.

\ln y = 3\ln(x+1) + 4\ln(x-2) - 5\ln(x+3)

Why: logarithm properties convert the product in the numerator into a sum, the quotient into a subtraction, and the exponents into coefficients. Three rules, one line — this is why logarithmic differentiation exists.

Step 2. Differentiate both sides.

\frac{1}{y}\frac{dy}{dx} = \frac{3}{x+1} + \frac{4}{x-2} - \frac{5}{x+3}

Why: each term differentiates by the chain rule. For instance, \frac{d}{dx}[3\ln(x+1)] = 3 \cdot \frac{1}{x+1} \cdot 1. The inner derivative is 1 each time, so it does not produce any visible extra factor.

Step 3. Combine the right side over a common denominator.

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

Expand each numerator term:

  • 3(x-2)(x+3) = 3(x^2 + x - 6) = 3x^2 + 3x - 18
  • 4(x+1)(x+3) = 4(x^2 + 4x + 3) = 4x^2 + 16x + 12
  • 5(x+1)(x-2) = 5(x^2 - x - 2) = 5x^2 - 5x - 10

Sum: (3x^2 + 3x - 18) + (4x^2 + 16x + 12) - (5x^2 - 5x - 10) = 2x^2 + 24x + 4.

Why: combining into a single fraction gives the cleanest final form. You could also leave the answer as three separate fractions — that is correct too, but less tidy.

Step 4. Multiply by y.

\frac{dy}{dx} = \frac{(x+1)^3(x-2)^4}{(x+3)^5} \cdot \frac{2x^2 + 24x + 4}{(x+1)(x-2)(x+3)}
= \frac{2(x^2 + 12x + 2)(x+1)^2(x-2)^3}{(x+3)^6}

Why: factor 2 from 2x^2 + 24x + 4 = 2(x^2 + 12x + 2), then cancel common factors between the original y and the denominator.

Result: \dfrac{dy}{dx} = \dfrac{2(x^2 + 12x + 2)(x+1)^2(x-2)^3}{(x+3)^6}.

The curve $y = \frac{(x+1)^3(x-2)^4}{(x+3)^5}$ for $x > 2$. The function starts at $0$ when $x = 2$ (because the $(x-2)^4$ factor vanishes), then rises. At $x = 4$, $y = (5^3)(2^4)/(7^5) = 2000/16807 \approx 0.119$. The derivative formula tells you the exact slope at every point along this curve.

Try differentiating this same function using the quotient rule and product rule directly — just planning the computation takes longer than the logarithmic method takes to finish. Logarithmic differentiation reduced the problem to differentiating a sum of three terms, each of which is almost trivial.

Common confusions

Going deeper

If you came here to learn the technique and when to use it, you have the complete picture — you can stop here. The rest of this section explores the logarithmic derivative as a concept in its own right and connects it to percentage rates of change.

The logarithmic derivative as a concept

The quantity \frac{1}{y}\frac{dy}{dx}, which appears naturally on the left side of every logarithmic differentiation, has its own name: the logarithmic derivative of y. It is also written \frac{d}{dx}[\ln y] or (\ln y)'.

The logarithmic derivative measures the relative rate of change — the rate of change as a fraction of the current value. If y = 1000 and dy/dx = 50, the ordinary derivative says "growing at 50 units per unit of x." The logarithmic derivative says 50/1000 = 0.05, or "growing at 5% per unit of x." This is why logarithmic scales are used in economics and biology: percentage growth rates are often more informative than absolute ones.

For an exponential function y = Ce^{kx}, the logarithmic derivative is simply k — a constant. This confirms the intuition that exponential growth has a constant percentage rate of change, even as the absolute rate of change accelerates.

Products, quotients, and the additive property

The deepest reason logarithmic differentiation simplifies products and quotients is that the logarithmic derivative converts multiplication into addition:

\frac{d}{dx}[\ln(fg)] = \frac{d}{dx}[\ln f + \ln g] = \frac{f'}{f} + \frac{g'}{g}

The logarithmic derivative of a product is the sum of the logarithmic derivatives. Similarly, the logarithmic derivative of a quotient is a difference. This additive property is why the technique handles many-factor products so cleanly: each factor contributes one simple term, regardless of how complicated the other factors are.

Compare this with the product rule for three factors: \frac{d}{dx}[fgh] = f'gh + fg'h + fgh'. As the number of factors grows, the product rule generates more and more terms, each containing all the other factors. The logarithmic method always gives exactly one term per factor.

Connection to elasticity

In economics, the quantity \frac{x}{y}\frac{dy}{dx} = \frac{d(\ln y)}{d(\ln x)} is called the elasticity of y with respect to x. It measures the percentage change in y per percentage change in x. For a power function y = x^n, the elasticity is exactly n — a constant. This is the economic counterpart of the mathematical fact that \frac{d}{dx}[\ln(x^n)] = n/x.

Verifying x^x with the product rule decomposition

Here is a useful cross-check that deepens understanding. The function x^x can be thought of as simultaneously having a varying base and a varying exponent. Suppose you "freeze" each one in turn:

Add them: x^x + x^x \ln x = x^x(1 + \ln x).

This is exactly the answer logarithmic differentiation gives. The coincidence is not an accident — it is a consequence of the general formula for [f(x)]^{g(x)}. The two terms in the general formula, g'(x) \ln f(x) and g(x) \cdot \frac{f'(x)}{f(x)}, correspond precisely to "vary the exponent, freeze the base" and "vary the base, freeze the exponent." The logarithmic derivative of a function of the form f^g is the sum of its logarithmic derivatives with respect to each piece — a kind of "total derivative" principle.

This decomposition also explains why neither the power rule alone nor the exponential rule alone gives the right answer for x^x: each captures only half of the total rate of change.

Logarithmic differentiation and limits

Logarithmic differentiation also helps evaluate certain limits. Consider \lim_{x \to 0^+} x^x. This is an indeterminate form of type 0^0. Take \ln: \ln(x^x) = x \ln x. As x \to 0^+, x \to 0 and \ln x \to -\infty, giving the form 0 \cdot (-\infty). Rewrite as \frac{\ln x}{1/x}, which is \frac{-\infty}{\infty}, and apply L'Hopital's rule: \frac{1/x}{-1/x^2} = \frac{-x^2}{x} = -x \to 0.

So \ln(x^x) \to 0, which means x^x \to e^0 = 1. The function x^x approaches 1 as x \to 0^+, even though both the base and the exponent are going to zero. The logarithmic rewrite x^x = e^{x \ln x} is what makes this tractable.

Where this leads next

Logarithmic differentiation is a technique, not a concept — but it opens doors to ideas that are genuinely conceptual: