How to differentiate a function with a variable exponent using logarithmic differentiation

Logarithmic differentiation transforms functions of the form y=[f(x)]g(x)y = [f(x)]^{g(x)} into manageable products by applying the natural logarithm to both sides. This method applies whenever the base and the exponent are both non-constant functions of the independent variable, where standard power and exponential rules fail.

The setup

Identify a function of the form y=f(x)g(x)y = f(x)^{g(x)} where f(x)>0f(x) > 0. Begin by applying the natural logarithm to both sides of the equation, yielding ln(y)=ln(f(x)g(x))\ln(y) = \ln(f(x)^{g(x)}). Use the logarithm power rule to rewrite the right side as a product: ln(y)=g(x)ln(f(x))\ln(y) = g(x) \ln(f(x)).

The steps

  1. Apply ln\ln to both sides of y=f(x)g(x)y = f(x)^{g(x)}. 2. Rewrite the right side as g(x)ln(f(x))g(x)\ln(f(x)). 3. Differentiate both sides implicitly with respect to xx. The left side becomes 1ydydx\frac{1}{y} \frac{dy}{dx}. The right side requires the product rule and chain rule. 4. Multiply both sides of the equation by yy to isolate dydx\frac{dy}{dx}. 5. Substitute the original expression for yy back into the right side to express the final derivative strictly in terms of xx.

Checking the result

Verify that the final derivative contains the original function f(x)g(x)f(x)^{g(x)} as a leading factor. You can cross-check the result by rewriting the original function using base ee, such that y=eg(x)ln(f(x))y = e^{g(x)\ln(f(x))}, and differentiating using the standard exponential chain rule. Both methods must yield identical expressions.

Common errors

A frequent error is forgetting to multiply the differentiated right side by yy in the final step. Another common mistake is applying the standard power rule to f(x)g(x)f(x)^{g(x)}, incorrectly yielding g(x)f(x)g(x)1g(x)f(x)^{g(x)-1}, which is mathematically invalid for variable exponents. Finally, students often misapply the product rule when differentiating g(x)ln(f(x))g(x)\ln(f(x)).

Worked example

Find the derivative of y=xsin(x)y = x^{\sin(x)} with respect to xx.

Let y=xsin(x)y = x^{\sin(x)}. Apply the natural logarithm to both sides: ln(y)=ln(xsin(x))\ln(y) = \ln(x^{\sin(x)}). Use log properties to bring down the exponent: ln(y)=sin(x)ln(x)\ln(y) = \sin(x) \ln(x). Differentiate both sides with respect to xx. The left side is 1ydydx\frac{1}{y} \frac{dy}{dx}. The right side uses the product rule: ddx[sin(x)]ln(x)+sin(x)ddx[ln(x)]=cos(x)ln(x)+sin(x)1x\frac{d}{dx}[\sin(x)] \ln(x) + \sin(x) \frac{d}{dx}[\ln(x)] = \cos(x)\ln(x) + \sin(x)\frac{1}{x}. Equate the two sides: 1ydydx=cos(x)ln(x)+sin(x)x\frac{1}{y} \frac{dy}{dx} = \cos(x)\ln(x) + \frac{\sin(x)}{x}. Multiply by yy: dydx=y[cos(x)ln(x)+sin(x)x]\frac{dy}{dx} = y \left[ \cos(x)\ln(x) + \frac{\sin(x)}{x} \right]. Substitute y=xsin(x)y = x^{\sin(x)} back into the equation: dydx=xsin(x)[cos(x)ln(x)+sin(x)x]\frac{dy}{dx} = x^{\sin(x)} \left[ \cos(x)\ln(x) + \frac{\sin(x)}{x} \right].

FAQ

Run your own problem

References: Stewart Calculus, 8th Edition, Section 3.6 · OpenStax Calculus Volume 1, Chapter 3.9

See also