Tutorials › Calculus III › The Chain Rule with Multiple Independent Parameters

Chain Rule and Implicit Differentiation · Tutorial 354 of 999

The Chain Rule with Multiple Independent Parameters

Find each parameter’s derivative by tracing how that parameter changes every intermediate variable, then adding the resulting contributions.

Intermediate 9 min read

What You'll Learn

  • State the multivariable chain rule for derivatives with respect to two parameters.
  • Distinguish changes along the s path from changes along the t path.
  • Compute derivatives when three intermediate variables depend on both parameters.
  • Check chain-rule results by differentiating the composite function directly.
  • Recognize and correct common errors in tracking parameter dependencies.

One Output, Two Independent Parameters

A quantity can depend on several intermediate variables, while those variables depend in turn on more than one parameter. In that situation, the output can change when either parameter changes. To find its partial derivatives, trace the dependencies separately: first ask how the output changes as \(s\) varies with \(t\) fixed, then how it changes as \(t\) varies with \(s\) fixed.

Suppose \(x=x(s,t)\), \(y=y(s,t)\), and \(z=z(s,t)\), and define \(w=f(x(s,t),y(s,t),z(s,t))\). The partial derivative \(w_s\) measures change with respect to \(s\) while \(t\) is held fixed. The partial derivative \(w_t\) measures change with respect to \(t\) while \(s\) is held fixed. Each intermediate variable may contribute to either derivative, but its contribution uses the derivative with respect to the parameter being varied.

Definition: If \(f\) is differentiable at \((x,y,z)\), and \(x(s,t)\), \(y(s,t)\), and \(z(s,t)\) are differentiable at \((s,t)\), then the composite function \(w=f(x(s,t),y(s,t),z(s,t))\) has partial derivatives \[ w_s=f_x x_s+f_y y_s+f_z z_s,\qquad w_t=f_x x_t+f_y y_t+f_z z_t. \] Here \(f_x,f_y,f_z\) are evaluated at \((x(s,t),y(s,t),z(s,t))\), and the derivatives of \(x,y,z\) are evaluated at \((s,t)\).

Keep the Two Dependency Paths Separate

The formulas have the same structure, but they use different derivatives of the intermediate variables. For \(w_s\), use \(x_s,y_s,z_s\); for \(w_t\), use \(x_t,y_t,z_t\). In each case, multiply the change along a path by the rate at which the output responds to that intermediate variable, then add the contributions.

Parameter being varied Contributions to the output derivative
\(s\), with \(t\) fixed \(f_xx_s,\ f_yy_s,\ f_zz_s\)
\(t\), with \(s\) fixed \(f_xx_t,\ f_yy_t,\ f_zz_t\)

The partial derivatives \(f_x,f_y,f_z\) describe the output’s sensitivity to changes in its own inputs. The derivatives such as \(x_s\) and \(z_t\) describe how those inputs respond to the parameters. The chain rule combines these two kinds of information.

Worked Example: Computing Both Derivatives and Checking Them Directly

Let \(f(x,y,z)=x^2+yz\), where \(x=s+t\), \(y=s-t\), and \(z=st\). Find \(w_s\) and \(w_t\).

First find the partial derivatives of \(f\) and of the intermediate variables:

$$ f_x=2x,\qquad f_y=z,\qquad f_z=y, $$
$$ x_s=1,\quad y_s=1,\quad z_s=t, \qquad x_t=1,\quad y_t=-1,\quad z_t=s. $$

For the \(s\) derivative, use only the \(s\)-derivatives of the intermediate variables:

$$ \begin{aligned} w_s &=f_xx_s+f_yy_s+f_zz_s\\ &=2x(1)+z(1)+y(t)\\ &=2(s+t)+st+(s-t)t\\ &=2s+2t+st+st-t^2\\ &=2s+2t+2st-t^2. \end{aligned} $$

For the \(t\) derivative, use the \(t\)-derivatives instead:

$$ \begin{aligned} w_t &=f_xx_t+f_yy_t+f_zz_t\\ &=2x(1)+z(-1)+y(s)\\ &=2(s+t)-st+(s-t)s\\ &=2s+2t-st+s^2-st\\ &=s^2+2s+2t-2st. \end{aligned} $$

Check by substituting the intermediate variables into \(f\) first:

$$ w=(s+t)^2+(s-t)st=s^2+2st+t^2+s^2t-st^2. $$

Differentiating this expression gives \(w_s=2s+2t+2st-t^2\) and \(w_t=2s+2t+s^2-2st\). The second expression is the same as \(s^2+2s+2t-2st\), so both chain-rule results check.

Why the Formula Works

The two formulas follow from the same local principle: a small change in \(s\) and \(t\) produces changes in \(x,y,z\), and those input changes produce a change in \(w\). Differentiability lets us describe these changes by their linear parts, with errors that become negligible compared with the size of the parameter change.

Derivation: At a fixed parameter point, write the small changes as \(\Delta s,\Delta t\). Differentiability of each intermediate variable gives \[ \Delta x=x_s\Delta s+x_t\Delta t+o(r),\quad \Delta y=y_s\Delta s+y_t\Delta t+o(r),\quad \Delta z=z_s\Delta s+z_t\Delta t+o(r), \] where \(r=\sqrt{(\Delta s)^2+(\Delta t)^2}\), and \(o(r)\) denotes an error whose ratio to \(r\) tends to zero as \(r\) tends to zero. Differentiability of \(f\) gives \[ \Delta w=f_x\Delta x+f_y\Delta y+f_z\Delta z+o(r). \] Substitute the three expressions for \(\Delta x,\Delta y,\Delta z\) into the expression for \(\Delta w\), and collect the coefficients of \(\Delta s\) and \(\Delta t\): \[ \Delta w=(f_xx_s+f_yy_s+f_zz_s)\Delta s +(f_xx_t+f_yy_t+f_zz_t)\Delta t+o(r). \] By the definition of differentiability, the coefficients of \(\Delta s\) and \(\Delta t\) are the partial derivatives \(w_s\) and \(w_t\). This gives the stated formulas.

Evaluate the Derivatives at the Right Inputs

In an application, the expressions \(f_x,f_y,f_z\) are first found as functions of \(x,y,z\). To use them in the chain rule, evaluate them at the current intermediate values \(x(s,t),y(s,t),z(s,t)\). The derivatives \(x_s,x_t,y_s,y_t,z_s,z_t\), by contrast, come from differentiating the intermediate-variable formulas with respect to their parameters.

Worked Example: Evaluating Both Partial Derivatives at a Point

Let \(f(x,y,z)=xy+z^2\), with \(x=s^2+t\), \(y=e^s\), and \(z=\cos t\). Find \(w_s\) and \(w_t\), then evaluate them at \((s,t)=(1,0)\).

The derivatives of the outer function are \(f_x=y\), \(f_y=x\), and \(f_z=2z\). The parameter derivatives are \(x_s=2s\), \(y_s=e^s\), \(z_s=0\), and \(x_t=1\), \(y_t=0\), \(z_t=-\sin t\). Thus

$$ \begin{aligned} w_s &=f_xx_s+f_yy_s+f_zz_s\\ &=y(2s)+x(e^s)+2z(0)\\ &=2se^s+(s^2+t)e^s\\ &=e^s(s^2+2s+t), \end{aligned} $$
$$ \begin{aligned} w_t &=f_xx_t+f_yy_t+f_zz_t\\ &=y(1)+x(0)+2z(-\sin t)\\ &=e^s-2\cos t\sin t. \end{aligned} $$

At \((1,0)\), the intermediate values are \(x=1\), \(y=e\), and \(z=1\). The outer derivatives there are \(f_x=e\), \(f_y=1\), and \(f_z=2\). Also \(x_s=2\), \(y_s=e\), \(z_s=0\), while \(x_t=1\), \(y_t=0\), and \(z_t=0\). Therefore

$$ w_s(1,0)=e(2)+1(e)+2(0)=3e,\qquad w_t(1,0)=e(1)+1(0)+2(0)=e. $$

To check, substitute into the composite function: \(w=(s^2+t)e^s+\cos^2t\). Direct differentiation gives \(w_s=e^s(s^2+2s+t)\) and \(w_t=e^s-2\cos t\sin t\). At \((1,0)\), these are \(3e\) and \(e\), as obtained from the chain rule.

A Dependency Path Can Have More Than One Contribution

The sum in each chain-rule formula is important. A parameter can change several intermediate variables at once, and every resulting route to the output contributes. A zero derivative on one route removes only that route’s contribution; it does not remove the other terms.

Worked Example: Tracking Three Separate Contributions

Let \(f(x,y,z)=xyz\), where \(x=s+t\), \(y=s^2-t\), and \(z=st\). Find \(w_s\) and \(w_t\) at \((1,2)\), and verify the answers by differentiating the composite expression.

For the outer function, \(f_x=yz\), \(f_y=xz\), and \(f_z=xy\). For the intermediate variables, \(x_s=1\), \(y_s=2s\), \(z_s=t\), and \(x_t=1\), \(y_t=-1\), \(z_t=s\). At \((1,2)\), \(x=3\), \(y=-1\), and \(z=2\). Consequently, \(f_x=-2\), \(f_y=6\), and \(f_z=-3\), while \(x_s=1,y_s=2,z_s=2\) and \(x_t=1,y_t=-1,z_t=1\).

The \(s\)-derivative is

$$ w_s=(-2)(1)+(6)(2)+(-3)(2)=-2+12-6=4. $$

The \(t\)-derivative is

$$ w_t=(-2)(1)+(6)(-1)+(-3)(1)=-2-6-3=-11. $$

For a direct check, the composite expression is \(w=(s+t)(s^2-t)st\). Applying the product rule at \((1,2)\), the \(s\)-derivative is

$$ \begin{aligned} w_s(1,2) &=t(s^2-t)(s+t)+st(2s)(s+t)+st(s^2-t)(1)\big|_{(1,2)}\\ &=2(-1)(3)+2(2)(3)+2(-1)(1)\\ &=-6+12-2=4. \end{aligned} $$

For the \(t\)-derivative, the product rule gives

$$ \begin{aligned} w_t(1,2) &=s(s^2-t)(s+t)+st(s^2-t)(1)+st(s+t)(-1)\big|_{(1,2)}\\ &=1(-1)(3)+2(-1)(1)+2(3)(-1)\\ &=-3-2-6=-11. \end{aligned} $$

Both direct calculations agree with the chain-rule values.

Common Mistake: Mixing the Parameter Derivatives

A frequent error is to use an \(s\)-derivative of an intermediate variable when calculating \(w_t\), or to omit a term because the same variable also depends on the other parameter. The \(t\)-derivative must use \(x_t,y_t,z_t\) throughout.

Pitfall: In the second example, \(z_t=-\sin t\), not \(z_s\). An incorrect calculation would be \[ w_t=f_xx_t+f_yy_t+f_zz_s=e^s+0+2\cos t(0)=e^s. \] This omits the change in \(z=\cos t\) as \(t\) changes. The correction is \[ w_t=f_xx_t+f_yy_t+f_zz_t =e^s+0+2\cos t(-\sin t) =e^s-2\cos t\sin t. \]

The mistake happens to give the correct value at \(t=0\), because \(z_t=-\sin 0=0\) there. That accidental agreement at one point does not make the formula correct. Checking the general derivative, or checking at a point where \(\sin t\ne0\), exposes the missing contribution.

Using the Chain Rule Reliably

A dependable calculation keeps the two parameter paths distinct from the beginning. Before substituting lengthy expressions, write down which derivatives belong to each parameter. Then evaluate the outer partial derivatives at the intermediate values and simplify each result.

1
Find the outer partial derivatives.
Compute \(f_x,f_y,f_z\) with \(x,y,z\) treated as independent inputs.
2
Differentiate the intermediate variables.
Calculate \(x_s,y_s,z_s\) and separately \(x_t,y_t,z_t\).
3
Build each parameter derivative.
Use the \(s\)-derivatives only in the formula for \(w_s\), and the \(t\)-derivatives only in the formula for \(w_t\).
4
Substitute and check.
Evaluate the outer partials at the intermediate values, simplify, and, when practical, differentiate the composite expression directly to verify the result.

This method is useful whenever several quantities respond to multiple controls, coordinates, or parameters. For example, if a modeled output depends on three intermediate measurements and each measurement depends on two experimental settings, the two partial derivatives describe distinct sensitivities. Keeping the paths separate makes clear which setting causes each contribution and prevents one parameter’s rates of change from being mistakenly assigned to the other.

Check Your Understanding

For each question, keep track of which parameter is being varied and which is held fixed.

  1. If \(w=f(x(s,t),y(s,t),z(s,t))\), write the formula for \(w_s\) and identify where each factor is evaluated.
  2. Write the corresponding formula for \(w_t\). Which derivatives of the intermediate variables appear in it?
  3. For \(x=s+t\), \(y=s-t\), and \(z=st\), list \(x_s,y_s,z_s\) and \(x_t,y_t,z_t\).
  4. Why can a chain-rule calculation for \(w_t\) be wrong even if it gives the right answer at one particular point?
  5. State the differentiability conditions that allow the two-parameter chain rule to apply.