Tutorials › Calculus I › Differentiating a Function Raised to Another Function

Exponential and Logarithmic Derivatives · Tutorial 546 of 1495

Differentiating a Function Raised to Another Function

Use logarithms to derive and apply the derivative rule for a differentiable function raised to another differentiable function.

Intermediate 9 min read

What You'll Learn

  • State the domain and differentiability conditions for the variable-power rule.
  • Derive the formula by taking the natural logarithm and using the chain rule.
  • Identify the separate contributions from a changing exponent and a changing base.
  • Differentiate variable powers with positive, nonconstant bases.
  • Check a derivative by differentiating the exponential form of the original function.
  • Detect and correct a common error that omits the logarithm of the base.

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.

Definition: For \(f(x)>0\) and real \(g(x)\), the real-valued variable power is defined by $$ f(x)^{g(x)}=\exp\!\big(g(x)\ln f(x)\big). $$ This definition makes sense for every real exponent when the base is positive.

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:

$$ \frac{d}{dx}\big(f(x)^{g(x)}\big) = f(x)^{g(x)} \left( g'(x)\ln f(x)+g(x)\frac{f'(x)}{f(x)} \right). $$

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\).

1
Set the variable power equal to \(y\).
Write \(y=f(x)^{g(x)}\). Since \(f(x)>0\), this gives \(y>0\), so we can take \(\ln y\).
2
Take natural logarithms.
By the definition of a real power, \(\ln y=g(x)\ln f(x)\).
3
Differentiate both sides.
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.
4
Isolate \(y'\).
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:

$$ \begin{aligned} \ln y &= g(x)\ln f(x),\\ \frac{y'}{y} &=g'(x)\ln f(x)+g(x)\frac{f'(x)}{f(x)},\\ y' &=y\left(g'(x)\ln f(x)+g(x)\frac{f'(x)}{f(x)}\right),\\ y' &=f(x)^{g(x)} \left(g'(x)\ln f(x)+g(x)\frac{f'(x)}{f(x)}\right). \end{aligned} $$

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:

$$ f(x)=x^2+1,\qquad f'(x)=2x,\qquad g(x)=3x-1,\qquad g'(x)=3. $$

Substitute them into the formula:

$$ \begin{aligned} y' &=(x^2+1)^{3x-1} \left(3\ln(x^2+1)+(3x-1)\frac{2x}{x^2+1}\right)\\ &=(x^2+1)^{3x-1} \left(3\ln(x^2+1)+\frac{2x(3x-1)}{x^2+1}\right). \end{aligned} $$

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:

$$ f(x)=2x+1,\qquad f'(x)=2,\qquad g(x)=x^2,\qquad g'(x)=2x. $$

Substitution gives:

$$ \begin{aligned} y' &=(2x+1)^{x^2} \left(2x\ln(2x+1)+x^2\frac{2}{2x+1}\right)\\ &=(2x+1)^{x^2} \left(2x\ln(2x+1)+\frac{2x^2}{2x+1}\right). \end{aligned} $$

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:

$$ f(x)=x+2,\qquad f'(x)=1,\qquad g(x)=\frac1x,\qquad g'(x)=-\frac1{x^2}. $$

Now substitute and simplify:

$$ \begin{aligned} y' &=(x+2)^{1/x} \left(-\frac{\ln(x+2)}{x^2}+\frac1x\frac1{x+2}\right)\\ &=(x+2)^{1/x} \left(-\frac{\ln(x+2)}{x^2}+\frac1{x(x+2)}\right). \end{aligned} $$

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)\):

$$ \text{Incorrect:}\qquad y'=x(x+1)^{x-1}+(x+1)^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:

$$ \begin{aligned} y' &=(x+1)^x\left(\ln(x+1)+\frac{x}{x+1}\right). \end{aligned} $$

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.

  1. State the differentiability and positivity conditions needed for the variable-power formula.
  2. For \(y=(x^2+4)^{\sin x}\), identify \(f\), \(g\), and their derivatives. Write the derivative without attempting to simplify it.
  3. Differentiate \(y=(3x+2)^{1/x}\), and state an interval on which the real-valued formula applies.
  4. In the formula, which term accounts for the changing exponent, and which term accounts for the changing base?
  5. Explain why replacing the exponent contribution \(g'\ln f\) with just \(g'\) is generally incorrect.

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon