Introduction
A change in an independent variable can affect a final quantity through more than one intermediate variable. If \(z=f(u,v)\), and both \(u\) and \(v\) depend on \(x\) and \(y\), then changing \(x\) may change \(z\) through \(u\), through \(v\), or through both.
The chain rule accounts for all those routes. For each independent variable, it multiplies the derivative along each route and adds the results. The key is to track which variables depend on which others, then evaluate each derivative at the inputs where it belongs.
The Two-Intermediate-Variable Rule
Suppose \(u=u(x,y)\) and \(v=v(x,y)\), and define \(z=f(u,v)\). The composite function can be written as \(z=f(u(x,y),v(x,y))\). Provided the functions are differentiable at the relevant points, the partial derivatives of \(z\) are:
Here \(f_u\) and \(f_v\) are the partial derivatives of the outer function \(f\), with its inputs regarded as \(u\) and \(v\). They are evaluated at \((u(x,y),v(x,y))\). The derivatives \(u_x,u_y,v_x,v_y\) describe the intermediate variables' dependence on \(x\) and \(y\), and are evaluated at the relevant \((x,y)\).
For example, \(x\) affects \(z\) along the paths \(x\to u\to z\) and \(x\to v\to z\). The path through \(u\) contributes \(f_u u_x\); the path through \(v\) contributes \(f_v v_x\). Both contributions must be included, even if one of the intermediate variables appears less prominent in the formulas.
Why the Contributions Add
The rule follows from the first-order approximations for differentiable functions. Work at a fixed point \((x_0,y_0)\), and set \(u_0=u(x_0,y_0)\), \(v_0=v(x_0,y_0)\). For small changes \(h\) and \(k\), differentiability of \(u\) and \(v\) gives
In these expressions, the derivatives on the right are evaluated at \((x_0,y_0)\). The notation \(o(r)\) means a remainder whose ratio to \(r\) tends to zero as \(r\) tends to zero. Let the two changes in the intermediate variables be \(\Delta u\) and \(\Delta v\). Since the displayed linear terms are bounded by a constant times \(r\), both \(\Delta u\) and \(\Delta v\) are \(O(r)\).
Differentiability of \(f\) at \((u_0,v_0)\) means that its change has the form
Because \(\Delta u\) and \(\Delta v\) are \(O(r)\), the final remainder is \(o(r)\). Substituting their first-order expressions into the two linear terms therefore gives
where the outer derivatives are evaluated at \((u_0,v_0)\), and the inner derivatives at \((x_0,y_0)\). The coefficient of \(h\) is the partial derivative with respect to \(x\); the coefficient of \(k\) is the partial derivative with respect to \(y\). This proves the stated formulas. In particular, differentiability of the component functions at the points in question is a sufficient condition. Merely having partial derivatives at those points, without suitable differentiability, does not in general justify applying this rule.
Worked Examples
Worked Example: A Polynomial and Trigonometric Outer Function
Let \(z=f(u,v)=u^2v+\sin v\), where \(u=x+y^2\) and \(v=xy\). Find \(z_x\) and \(z_y\) at \((x,y)=(1,2)\).
First compute the intermediate values:
The outer partial derivatives are
At \((u,v)=(5,2)\), these become \(f_u=2\cdot5\cdot2=20\) and \(f_v=5^2+\cos2=25+\cos2\). The inner derivatives are \(u_x=1\), \(u_y=2y\), \(v_x=y\), and \(v_y=x\). At \((1,2)\), they are \(u_x=1\), \(u_y=4\), \(v_x=2\), and \(v_y=1\). Thus
Check by substituting the intermediate variables first: \(z=(x+y^2)^2xy+\sin(xy)\). Direct partial differentiation gives
At \((1,2)\), the first expression is \(2\cdot5\cdot1\cdot2+25\cdot2+2\cos2=70+2\cos2\). The second is \(2\cdot5\cdot4\cdot2+25+ \cos2=105+\cos2\), confirming both results.
Worked Example: An Exponential Composite
Let \(z=f(u,v)=e^{u+v}\), with \(u=x^2-y\) and \(v=xy^2\). Find \(z_x\) and \(z_y\) at \((1,1)\).
At that point, \(u=1^2-1=0\), \(v=1\cdot1^2=1\), so \(u+v=1\). The outer derivatives are \(f_u=e^{u+v}\) and \(f_v=e^{u+v}\), both equal to \(e\) at \((u,v)=(0,1)\). The inner derivatives are \(u_x=2x\), \(u_y=-1\), \(v_x=y^2\), and \(v_y=2xy\). At \((1,1)\), they have values \(2,-1,1,2\), respectively. Applying the rule gives
For a check, substitution gives \(z=e^{x^2-y+xy^2}\). Direct differentiation yields \(z_x=e^{x^2-y+xy^2}(2x+y^2)\) and \(z_y=e^{x^2-y+xy^2}(-1+2xy)\). At \((1,1)\), these are \(e(2+1)=3e\) and \(e(-1+2)=e\), as required.
Worked Example: A Quotient of Intermediate Variables
Let \(z=f(u,v)=u/v\), where \(u=x-y\) and \(v=x+y\). Find the partial derivatives at \((3,1)\). The rule applies near this point because \(v=3+1=4\ne0\), so the quotient is defined there.
The intermediate values are \(u=3-1=2\) and \(v=3+1=4\). The outer partial derivatives are \(f_u=1/v\) and \(f_v=-u/v^2\). At \((u,v)=(2,4)\), they are \(f_u=1/4\) and \(f_v=-2/16=-1/8\). The inner derivatives are \(u_x=1\), \(u_y=-1\), \(v_x=1\), and \(v_y=1\). Therefore
As a check, the composite is \(z=(x-y)/(x+y)\). Direct differentiation gives \(z_x=2y/(x+y)^2\) and \(z_y=-2x/(x+y)^2\). At \((3,1)\), these equal \(2/16=1/8\) and \(-6/16=-3/8\), agreeing with the chain-rule results.
A Common Mistake: Leaving Out a Path
A frequent error is to include only one of the intermediate variables when differentiating. For instance, in the first example, a mistaken calculation of \(z_x(1,2)\) might keep the route through \(u\) but omit the route through \(v\):
This is wrong because \(x\) changes \(v=xy\) as well as \(u=x+y^2\). The omitted contribution is \(f_vv_x=(25+\cos2)\cdot2\). Including both paths gives the correction:
A useful check is to list every intermediate variable that depends on the independent variable being differentiated. If both \(u\) and \(v\) depend on \(x\), both terms belong in \(z_x\). If one variable does not depend on \(x\), its corresponding term is zero.
Using the Rule Reliably
For a composite \(z=f(u(x,y),v(x,y))\), a consistent calculation proceeds in three stages:
Compute \(f_u\) and \(f_v\), treating \(u\) and \(v\) as the inputs to \(f\).
Compute \(u_x,u_y,v_x,v_y\) from the intermediate-variable formulas.
Use \(z_x=f_u u_x+f_vv_x\) and \(z_y=f_u u_y+f_vv_y\), then evaluate at the requested inputs.
When evaluating at a particular point, keep the evaluation stages clear: first determine \(u\) and \(v\) there, then evaluate \(f_u\) and \(f_v\) at those intermediate values. The inner derivatives are evaluated at the original \((x,y)\). Mixing up those inputs is another avoidable source of errors.
The rule is useful whenever a quantity is built through intermediate variables: changing a coordinate can influence the output by several routes. Adding the contributions captures the total first-order effect of that coordinate change. The same reasoning applies separately to each independent variable, so the expressions for \(z_x\) and \(z_y\) differ in their inner derivatives but share the same outer derivatives at a given point.
Check Your Understanding
Use the chain rule for a function \(z=f(u,v)\) with \(u=u(x,y)\) and \(v=v(x,y)\). Keep track of all dependencies in each problem.
- Write the formulas for \(z_x\) and \(z_y\) in terms of the outer and inner partial derivatives.
- If \(u_x=0\) at a point but \(v_x\ne0\), what remains of the formula for \(z_x\) at that point?
- For \(z=u^2+v\), \(u=x+y\), and \(v=xy\), compute \(z_x\) and \(z_y\) at \((1,2)\).
- In the quotient example, why is it necessary to check that \(v\ne0\) before applying the rule?
- State the differentiability condition used in the derivation and explain why partial derivatives alone may not suffice.