When Neither the Power Rule nor the Exponential Rule Applies
The Power Rule differentiates \(x^n\) when the exponent \(n\) is a constant, and the exponential rule differentiates \(b^x\) when the base \(b\) is a constant. A function such as \(x^{x^2}\) or \(x^{\sin x}\) breaks both rules, because the base and the exponent are both functions of \(x\). The tool for this situation is logarithmic differentiation: take the natural logarithm, which turns the exponent into a factor, then differentiate implicitly. The earlier tutorial applied this idea to \(x^x\). Here the exponent is replaced by a general differentiable function \(g(x)\).
Throughout, \(x>0\), so that \(x^{g(x)}=e^{g(x)\ln x}\) is defined for every real exponent and \(\ln x\) exists.
Derivation by Logarithmic Differentiation
Since \(y=x^{g(x)}>0\), we may write \(\ln y=g(x)\ln x\).
The left side is \(\dfrac{y'}{y}\) by the Chain Rule. The right side is a product, so the Product Rule gives \(g'(x)\ln x+g(x)\cdot\dfrac1x\).
Multiply by \(y=x^{g(x)}\): \(y'=x^{g(x)}\left(g'(x)\ln x+\dfrac{g(x)}{x}\right)\).
The two terms in the parentheses have a clear meaning. If the exponent were frozen at a constant \(n\), the Power Rule would give \(n\,x^{n-1}=x^{g}\cdot\dfrac{g}{x}\), which is the second term. If the base were frozen at a constant \(b\), the exponential rule would give \(b^{g}\ln b\cdot g'\), and the first term \(x^{g}\,g'\ln x\) has the same shape with \(b\) replaced by \(x\). The true derivative is the sum of these two contributions, one from letting the exponent vary and one from letting the base vary.
Worked Example: A Polynomial Exponent
Differentiate \(y=x^{x^2}\) for \(x>0\).
Here \(g(x)=x^2\) and \(g'(x)=2x\). The theorem gives
Check at \(x=1\): \(y(1)=1\), and the formula gives \(1^{2}\,(2\cdot0+1)=1\). A difference quotient from \(y(1.001)\approx1.001002\) and \(y(0.999)\approx0.999002\) is about \(1.000\), as predicted.
Worked Example: A Trigonometric Exponent
Differentiate \(y=x^{\sin x}\) for \(x>0\) and evaluate the derivative at \(x=2\).
With \(g(x)=\sin x\) and \(g'(x)=\cos x\),
At \(x=2\): \(\sin2\approx0.909297\), \(\cos2\approx-0.416147\), \(\ln2\approx0.693147\). Then \(2^{\sin2}\approx1.8781\) and the bracket is \(-0.416147(0.693147)+\dfrac{0.909297}{2}\approx-0.288443+0.454649=0.166206\). So \(y'(2)\approx1.8781\times0.166206\approx0.3121\).
Check: a difference quotient of \(x^{\sin x}\) using \(x=2.001\) and \(x=1.999\) gives a value near \(0.312\).
Worked Example: A Linear Exponent
Differentiate \(y=x^{2x+1}\) and evaluate at \(x=1\).
Here \(g(x)=2x+1\), \(g'(x)=2\), so
At \(x=1\), \(\ln1=0\) and \(x^{2x+1}=1\), so \(y'(1)=1\cdot\left(0+3\right)=3\).
Check: \(y(1.001)\approx1.003005\) and \(y(0.999)\approx0.997005\), giving a difference quotient of \(3.000\).
A Consistency Test
Whenever a general formula is derived, test it on a case where the answer is already known. Take the constant exponent \(g(x)=3\). Then \(g'(x)=0\) and the theorem gives \(y'=x^{3}\left(0\cdot\ln x+\dfrac3x\right)=3x^{2}\), the ordinary Power Rule. For \(g(x)=x\) it gives \(x^x(\ln x+1)\), the result from the previous tutorial. A formula that fails such tests has an error.
Common Mistakes
Using only the Power Rule. Applying \(g\,x^{g-1}\) to \(x^{x^2}\) would give \(x^2\cdot x^{x^2-1}=x^{x^2+1}\). At \(x=2\) this is \(2^5=32\), while the correct derivative is \(2^{5}(2\ln2+1)\approx76.3\). The missing factor is the part coming from the variable exponent.
Using only the exponential rule. Writing \(\dfrac{d}{dx}x^{g}=x^{g}\,g'\ln x\) leaves out the Power Rule contribution \(g\,x^{g-1}\). For \(g(x)=3\), it would give \(0\) instead of \(3x^2\).
Forgetting the domain. The logarithm step needs \(x>0\). For negative \(x\), \(x^{g(x)}\) is generally not defined for non-integer exponents, so the formula should not be applied there.
Worked Example: A Derivative That Vanishes
Find where \(y=x^{1/x}\) is increasing and decreasing for \(x>0\).
From the practice formula with \(g(x)=\dfrac1x\) and \(g'(x)=-\dfrac1{x^2}\),
The factor \(x^{1/x-2}\) is positive for \(x>0\), so the sign of \(y'\) is the sign of \(1-\ln x\). It is positive for \(0<x<e\), zero at \(x=e\), and negative for \(x>e\). The function increases up to \(x=e\) and then decreases, so its maximum is \(e^{1/e}\approx1.4447\).
Check: \(1.5^{1/1.5}\approx1.3104\), \(e^{1/e}\approx1.4447\) and \(4^{1/4}\approx1.4142\), consistent with a peak at \(x=e\).
Summary of the Rule
| Situation | Derivative | Method |
|---|---|---|
| \(x^n\), \(n\) constant | \(n\,x^{n-1}\) | Power Rule |
| \(b^{x}\), \(b\) constant | \(b^x\ln b\) | Exponential rule |
| \(x^{g(x)}\), \(x>0\) | \(x^{g}\left(g'\ln x+\dfrac gx\right)\) | Logarithmic differentiation |
The third row contains the first two as special cases, which is the best way to remember it: freezing the exponent recovers the Power Rule term, and freezing the base recovers the exponential-rule term. When a problem has this form, the procedure is always the same: take logarithms, differentiate implicitly, multiply back by the original function, and simplify. State \(x>0\) at the start, because the argument depends on it.
Worked Example: A Tangent Line Estimate
Use the derivative of \(y=x^{2x+1}\) at \(x=1\) to estimate \(1.05^{3.1}\).
From the earlier example, \(y(1)=1\) and \(y'(1)=3\). The tangent line is \(y=1+3(x-1)=3x-2\). At \(x=1.05\) the exponent is \(2(1.05)+1=3.1\), so
Check: the exact value is \(1.05^{3.1}\approx1.16329\). The tangent-line estimate is slightly low, which means the curve bends upward there, a feature that the first derivative alone cannot show.
It is worth seeing why the answer is not simply the sum of two independent pieces. The change in \(x^{g(x)}\) when \(x\) moves comes from two sources at once: the base changes, which affects the power through the Power Rule, and the exponent changes, which affects the power through the exponential rule. For small changes these effects add, and that is exactly the sum inside the parentheses. This reasoning is the same one used in multivariable calculus to differentiate a function of two variables along a path, and it explains why the formula contains both a \(\ln x\) term and a \(\frac1x\) term.
Where This Fits in the Course
This tutorial belongs to the module “Exponential and Logarithmic Derivatives”. The tutorial just before it is “Differentiating x to the x,” and the one that follows is “Differentiating a Function Raised to Another Function.”
A Second Route: Rewrite as an Exponential
Logarithmic differentiation can be replaced by a rewrite. For \(x>0\), \(x^{g(x)}=e^{g(x)\ln x}\), so the Chain Rule applied to the exponential gives
the same formula. For \(g(x)=x^2\), the derivative of the exponent is \(\dfrac{d}{dx}(x^2\ln x)=2x\ln x+x\), so \(\dfrac{d}{dx}x^{x^2}=x^{x^2}(2x\ln x+x)\), matching the first worked example. Having two routes to the same answer is a useful check on any individual calculation.
Practice Problems with Answers
Try each problem before reading the answer. Each answer below was verified by differentiation or by evaluating a difference quotient or integral numerically.
- Differentiate \(x^{3x}\) for \(x>0\).
Answer. \(x^{3x}(3\ln x+3)\). - Differentiate \(x^{\cos x}\) and evaluate at \(x=1\).
Answer. \(x^{\cos x}\left(-\sin x\ln x+\dfrac{\cos x}{x}\right)\); at \(x=1\) this is \(\cos1\approx0.5403\). - Differentiate \(x^{\ln x}\).
Answer. Since \(x^{\ln x}=e^{(\ln x)^2}\), the derivative is \(x^{\ln x}\cdot\dfrac{2\ln x}{x}\). The general formula agrees: \(x^{\ln x}\left(\dfrac{\ln x}{x}+\dfrac{\ln x}{x}\right)\). - Show that \(x^{1/x}\) has a critical point at \(x=e\).
Answer. With \(g=1/x\) and \(g'=-1/x^2\): \(\dfrac{d}{dx}x^{1/x}=x^{1/x-2}(1-\ln x)\), which is zero when \(\ln x=1\).
Check Your Understanding
Work these without looking back, then confirm each answer with a difference quotient.
- Differentiate \(x^{3x}\) for \(x>0\).
- Find the derivative of \(x^{\cos x}\) and evaluate it at \(x=1\).
- Show that the general formula reduces to the Power Rule when \(g(x)=n\) is constant.
- Differentiate \(x^{\ln x}\) and simplify the result.
- Explain which part of \(x^{g}(g'\ln x+g/x)\) comes from the variable exponent and which from the variable base.