Why Variable Powers Need Care
A function raised to a constant power is handled by the power rule. A function raised to another function changes in two ways at once: its base changes, and its exponent changes. For example, in \(y=(x^2+1)^{3x-1}\), neither part can be treated as constant.
The natural logarithm gives a systematic way to account for both changes. It turns the exponent into a factor, so the product rule and chain rule can be used. The resulting formula applies to any differentiable positive base and differentiable exponent on an interval.
The Formula and Its Conditions
Let \(I\) be an open interval, and suppose \(f\) and \(g\) are differentiable on \(I\), with \(f(x)>0\) for every \(x\in I\). Define \(y=f(x)^{g(x)}\). Then \(y\) is differentiable on \(I\), and its derivative is:
Both terms inside the parentheses matter. The term \(g'(x)\ln f(x)\) accounts for the changing exponent. The term \(g(x)f'(x)/f(x)\) accounts for the changing base. Either term can be zero in a particular problem, but neither can be omitted from the general rule.
The positivity condition is essential to this real-valued formula: \(\ln f(x)\) is defined only when \(f(x)>0\). If a base is zero or negative, a real power may be defined for some particular exponents, but the formula above does not apply as stated. In practice, first identify an interval on which the base is positive, then differentiate there.
Deriving the Rule
The derivation uses the definition of a real variable power, the derivative of the natural logarithm, and the chain and product rules. Taking a logarithm is legitimate because \(f(x)^{g(x)}>0\) whenever \(f(x)>0\).
Write \(y=f(x)^{g(x)}\). Since \(f(x)>0\), this gives \(y>0\), so we can take \(\ln y\).
By the definition of a real power, \(\ln y=g(x)\ln f(x)\).
The chain rule gives \(y'/y\) on the left. The product rule gives \(g'(x)\ln f(x)+g(x)f'(x)/f(x)\) on the right.
Multiply the resulting equation by \(y\), then substitute \(y=f(x)^{g(x)}\).
For completeness, differentiating the logarithmic equation gives the following identities in sequence:
This proves the formula under the stated assumptions. It also explains why logarithmic differentiation is effective: instead of differentiating a changing base and a changing exponent directly, we differentiate the simpler product \(g(x)\ln f(x)\).
Worked Examples
Worked Example: A Quadratic Base and a Linear Exponent
Differentiate \(y=(x^2+1)^{3x-1}\). The base \(f(x)=x^2+1\) is positive for every real \(x\), and both the base and exponent are differentiable on \(\mathbb{R}\).
Identify the functions and their derivatives:
Substitute them into the formula:
For a numerical check, at \(x=1\), the base is \(2\), the exponent is \(2\), and the expression in parentheses is \(3\ln 2+2\). Thus \(y'(1)=4(3\ln 2+2)\).
To verify the derivative independently, write \(y=\exp((3x-1)\ln(x^2+1))\). Differentiating the exponent gives \(3\ln(x^2+1)+(3x-1)2x/(x^2+1)\). The chain rule for the exponential therefore gives exactly the displayed derivative, including the value \(4(3\ln 2+2)\) at \(x=1\).
Worked Example: A Linear Base and a Quadratic Exponent
Differentiate \(y=(2x+1)^{x^2}\). The base is positive when \(x>-\frac12\), so use the formula on the interval \((-\frac12,\infty)\).
Here the functions and derivatives are:
Substitution gives:
At \(x=1\), \(f(1)=3\), \(g(1)=1\), and the parenthetical factor is \(2\ln 3+\frac23\). Hence \(y'(1)=3(2\ln 3+\frac23)=6\ln 3+2\).
For a check, express the function as \(y=\exp(x^2\ln(2x+1))\). The derivative of the exponent is \(2x\ln(2x+1)+x^2\cdot 2/(2x+1)\). Multiplying by \(\exp(x^2\ln(2x+1))=(2x+1)^{x^2}\) reproduces the formula. At \(x=1\), this is \(3(2\ln 3+\frac23)=6\ln 3+2\), as before.
Worked Example: A Reciprocal Exponent
Differentiate \(y=(x+2)^{1/x}\). The exponent is differentiable for \(x\ne 0\), and the base is positive when \(x>-2\). The formula therefore applies on either interval \((-2,0)\) or \((0,\infty)\); the function itself is considered only where both conditions hold.
Calculate the needed derivatives:
Now substitute and simplify:
At \(x=1\), \(y=3\), and the factor in parentheses is \(-\ln 3+\frac13\). Thus \(y'(1)=3(-\ln 3+\frac13)=1-3\ln 3\).
For verification, \(y=\exp(\ln(x+2)/x)\). The quotient rule gives the derivative of its exponent as \(\big(x/(x+2)-\ln(x+2)\big)/x^2\). Since \(x/(x+2)\cdot 1/x^2=1/(x(x+2))\), this is the same parenthetical factor above. Applying the chain rule for \(\exp\) gives the stated derivative and the same value at \(x=1\).
A Common Mistake
A frequent error is to differentiate the base correctly but treat the exponent contribution as though it were simply \(g'(x)\). For example, consider \(y=(x+1)^x\), whose base is positive for \(x>-1\). An incorrect calculation might combine the ordinary power-rule contribution with \(y g'(x)\):
This is wrong because the exponent contribution must include \(\ln(x+1)\), not just \(g'(x)=1\). Applying the formula with \(f=x+1\), \(f'=1\), \(g=x\), and \(g'=1\) gives:
At \(x=1\), the incorrect expression gives \(1+2=3\), whereas the correct derivative is \(2(\ln 2+\frac12)=2\ln 2+1\). The missing logarithm changes the result. Keeping the two contributions visible—\(g'\ln f\) and \(gf'/f\)—is a reliable way to avoid this mistake.
Using the Formula Reliably
Before differentiating, check the domain rather than assuming that every real variable power is defined. Then identify the base and exponent separately. A short written setup helps prevent their derivatives from being mixed up:
- Choose an interval where \(f(x)>0\).
- Write down \(f(x)\), \(f'(x)\), \(g(x)\), and \(g'(x)\).
- Insert them into \(f^g\big(g'\ln f+gf'/f\big)\).
- Simplify only after both terms have been included.
- When useful, check by differentiating \(\exp(g\ln f)\).
The formula includes familiar special cases. If the exponent is constant, then \(g'=0\), leaving \(y'=f^g\,g f'/f\), which agrees with the power rule for a positive base. If the base is constant \(c>0\), then \(f'=0\), leaving \(y'=c^g g'\ln c\), the chain rule for an exponential with fixed base. These checks show how the general rule accounts for changes in either component.
Most importantly, the positivity condition is part of the result, not an optional technical detail. If the base is positive only on part of its domain, state that interval and apply the formula there. If the base is not positive, do not insert it into a logarithm and proceed as if the real-valued formula still applied.
Check Your Understanding
For each question, pay attention to both the derivative formula and the conditions under which it can be used.
- State the differentiability and positivity conditions needed for the variable-power formula.
- For \(y=(x^2+4)^{\sin x}\), identify \(f\), \(g\), and their derivatives. Write the derivative without attempting to simplify it.
- Differentiate \(y=(3x+2)^{1/x}\), and state an interval on which the real-valued formula applies.
- In the formula, which term accounts for the changing exponent, and which term accounts for the changing base?
- Explain why replacing the exponent contribution \(g'\ln f\) with just \(g'\) is generally incorrect.