Tutorials › Real Analysis › Chain Rule

Differentiation · Tutorial 404 of 1000

Chain Rule

Learn how to differentiate compositions, identify the correct evaluation points, and use the Chain Rule to obtain derivatives of powers and affine changes of variable.

Advanced 9 min read

What You'll Learn

  • State the Chain Rule with its domain and differentiability hypotheses
  • Identify the outer and inner functions in a composition
  • Evaluate the outer derivative at the inner function’s value
  • Differentiate powers of differentiable functions using the Chain Rule
  • Handle compositions where the inner derivative or outer derivative is zero
  • Apply the rule to affine changes of variable

Why Composition Requires Its Own Rule

The Product Rule and Quotient Rule describe how derivatives behave when functions are combined by multiplication or division. A composition combines functions differently: the output of one function becomes the input of another. For example, in \(f(g(x))\), a change in \(x\) first changes \(g(x)\), and that change then affects the value of \(f\). The Chain Rule accounts for both stages.

The derivative of the outer function must be evaluated at the value supplied by the inner function. This is the central point to keep track of: the derivative of \(f\) is evaluated at \(g(a)\), not generally at \(a\). The derivative of \(g\), in turn, is evaluated at \(a\).

Theorem (Chain Rule): Let \(I\) and \(J\) be intervals, let \(a\) be an interior point of \(I\), and let \(g:I\to J\) be differentiable at \(a\). Suppose \(f:J\to\mathbb{R}\) is differentiable at \(b=g(a)\), where \(b\) is an interior point of \(J\). Then \(f\circ g:I\to\mathbb{R}\), defined by \((f\circ g)(x)=f(g(x))\), is differentiable at \(a\), and $$ (f\circ g)'(a)=f'(g(a))g'(a). $$

The theorem is pointwise: \(f\) and \(g\) need not be differentiable everywhere on their intervals. The hypotheses concern \(g\) at \(a\) and \(f\) at the one value \(g(a)\). The next tutorial proves the Chain Rule from the definition of the derivative.

How to Apply the Rule

Before differentiating, identify the functions and the input at which each derivative is evaluated. If the expression is \(f(g(x))\), then the outer function is \(f\) and the inner function is \(g\). The formula is

$$ \text{derivative of the composition at }a = \text{outer derivative at }g(a) \times \text{inner derivative at }a. $$

This is not merely a prescription to multiply two derivatives with the same input. The values at which they are evaluated usually differ. A reliable calculation first finds \(g(a)\), then evaluates \(f'\) there, and finally multiplies by \(g'(a)\).

1
Separate the functions.
Write the expression as \(f(g(x))\), naming the inner function \(g\) and the outer function \(f\).
2
Differentiate the outer function.
Find \(f'\), but keep its input as a variable until you evaluate it at \(g(x)\).
3
Multiply by the inner derivative.
Multiply \(f'(g(x))\) by \(g'(x)\). Check that the outer derivative is evaluated at the inner function’s value.

Worked Example: A Polynomial Applied to a Quadratic

Let \(H(x)=(x^2+1)^4-3(x^2+1)\), and find \(H'(1)\). Set \(g(x)=x^2+1\) and \(f(u)=u^4-3u\), so \(H=f\circ g\). The Power Rule gives \(f'(u)=4u^3-3\), and \(g'(x)=2x\). At \(x=1\), the inner value is

$$ g(1)=1^2+1=2. $$

Therefore \(f'(g(1))=f'(2)=4(2^3)-3=32-3=29\), while \(g'(1)=2(1)=2\). The Chain Rule yields

$$ H'(1)=f'(g(1))g'(1)=29\cdot 2=58. $$

In particular, the outer derivative was evaluated at \(2\), the value of the inner function at \(1\); evaluating \(f'\) at \(1\) would not follow the rule.

Worked Example: A Reciprocal of an Affine Function

Consider \(R(x)=1/(3x-2)\) at \(a=1\). Take \(g(x)=3x-2\) and \(f(u)=1/u\), defined for \(u\ne0\). The Reciprocal Rule gives \(f'(u)=-1/u^2\). Since \(g(1)=3(1)-2=1\ne0\), the outer function is defined and differentiable at the inner value. Also, \(g'(x)=3\). Hence

$$ R'(1)=f'(g(1))g'(1) =\left(-\frac{1}{1^2}\right)(3) =-3. $$

More generally, the same calculation gives \(R'(x)=-3/(3x-2)^2\) wherever \(3x-2\ne0\). The domain restriction matters: the reciprocal outer function is not defined at zero, so the composition and the Chain Rule calculation apply only where the inner value is nonzero.

Consequences of the Chain Rule

Once the Chain Rule is available, familiar differentiation rules can be applied to a function of another function. The following results make two useful patterns explicit. In each proof, the Chain Rule supplies the composition derivative, while the relevant earlier rule supplies the derivative of the outer function.

Theorem (Derivative of a Power of a Differentiable Function): Let \(I\) be an interval, let \(u:I\to\mathbb{R}\) be differentiable at an interior point \(a\), and let \(n\) be a nonnegative integer. Then \(x\mapsto (u(x))^n\) is differentiable at \(a\). If \(n\geq1\), then $$ \frac{d}{dx}\bigl(u(x)^n\bigr)\bigg|_{x=a} =n\,u(a)^{n-1}u'(a). $$ For \(n=0\), its derivative is \(0\).

Proof. If \(n=0\), then \(u(x)^0=1\) for every \(x\in I\), so the function is constant and has derivative \(0\). Now suppose \(n\geq1\). Define \(p_n:\mathbb{R}\to\mathbb{R}\) by \(p_n(y)=y^n\). The Power Rule says \(p_n'(y)=ny^{n-1}\) for every \(y\in\mathbb{R}\). Since \(u\) is differentiable at \(a\), and \(p_n\) is differentiable at \(u(a)\), the Chain Rule applies to \(p_n\circ u\). Thus

$$ (p_n\circ u)'(a) =p_n'(u(a))u'(a) =n\,u(a)^{n-1}u'(a). $$

Because \((p_n\circ u)(x)=u(x)^n\), this is the stated derivative. \(\square\)

Worked Example: A Fifth Power with a Zero Inner Derivative

Let \(P(x)=(x^3-2x)^5\), and find \(P'(0)\). Take \(u(x)=x^3-2x\) and use the power-of-a-function formula with \(n=5\). Then \(u(0)=0^3-2(0)=0\), and the Power Rule gives \(u'(x)=3x^2-2\), so \(u'(0)=3(0)^2-2=-2\). Consequently,

$$ P'(0)=5u(0)^4u'(0)=5(0)^4(-2)=0. $$

The inner function has a nonzero derivative at \(0\), but the outer function \(y^5\) has derivative \(5y^4=0\) at the inner value \(y=0\). The product in the Chain Rule is therefore zero. This example also illustrates why a zero derivative of a composition need not mean that the inner function has zero derivative.

Theorem (Derivative under an Affine Change of Variable): Let \(I\) and \(J\) be intervals, let \(a\) be an interior point of \(I\), and suppose \(g(x)=mx+c\) maps \(I\) into \(J\). Let \(f:J\to\mathbb{R}\) be differentiable at \(g(a)\), where \(g(a)\) is an interior point of \(J\). Then \(x\mapsto f(mx+c)\) is differentiable at \(a\), and $$ \frac{d}{dx}f(mx+c)\bigg|_{x=a}=m f'(ma+c). $$

Proof. The affine function \(g(x)=mx+c\) is differentiable at \(a\), with \(g'(a)=m\). The assumptions ensure that \(g(a)=ma+c\) lies in \(J\) and that \(f\) is differentiable there. Apply the Chain Rule to \(f\circ g\):

$$ (f\circ g)'(a)=f'(g(a))g'(a) =f'(ma+c)m =m f'(ma+c). $$

Since \((f\circ g)(x)=f(mx+c)\), this proves the formula. It also covers \(m=0\): in that case \(f(mx+c)=f(c)\) is constant, and the displayed derivative is \(0\cdot f'(c)=0\). \(\square\)

What the Formula Tells Us—and What It Does Not

The factors in the Chain Rule correspond to two successive changes. Near \(a\), the inner function changes at rate \(g'(a)\). The outer function, near the input \(g(a)\), changes at rate \(f'(g(a))\). Multiplying these rates gives the rate of the composite function at \(a\). This interpretation helps explain both the order of the factors and the evaluation point for the outer derivative.

A common error is to write \(f'(a)g'(a)\). The correct formula is \(f'(g(a))g'(a)\). These expressions agree only in special circumstances, such as when \(g(a)=a\) or when \(f'\) happens to have the same value at both inputs. Another error is to omit the factor \(g'(a)\). For example, the derivative of \((x^2+1)^4\) is not just \(4(x^2+1)^3\): the inner function \(x^2+1\) has derivative \(2x\), so the full derivative is \(4(x^2+1)^3(2x)\).

The Chain Rule does not say that every composition is differentiable just because the outer function is. Differentiability of the inner function at \(a\) and differentiability of the outer function at \(g(a)\) are both part of the theorem’s hypotheses. Nor can the formula be applied when \(f\) is not defined at \(g(a)\). In the reciprocal example, this is why the input \(3x-2\) must be nonzero.

Finally, the product in the formula can be zero for either of two distinct reasons: \(f'(g(a))\) may be zero, or \(g'(a)\) may be zero. The fifth-power example had the first feature. If \(g'(a)=0\), the formula also gives \((f\circ g)'(a)=0\), provided the hypotheses of the Chain Rule hold. A zero derivative of the composite alone does not tell us which factor vanished.

Check Your Understanding

Use the Chain Rule and its consequences to answer the following.

  1. For \(f(g(x))\), at which input is \(f'\) evaluated when calculating the derivative at \(a\)?
  2. Let \(u(x)=2x^2+1\). Use the power-of-a-function formula to find the derivative of \(u(x)^3\) at \(x=1\).
  3. Suppose \(f'(g(a))=-4\) and \(g'(a)=0\). What does the Chain Rule give for \((f\circ g)'(a)\)?
  4. For \(Q(x)=1/(x^2+3)\), identify an outer and inner function and state the condition that ensures the reciprocal outer function is defined at the inner value.
  5. If \(g(x)=5x-1\), write the derivative of \(f(5x-1)\) at \(x=a\) in terms of \(f'\).