Processing math: 61%
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Mathematics LibreTexts

14.5: The Chain Rule

( \newcommand{\kernel}{\mathrm{null}\,}\)

Learning Objectives
  • State the chain rules for one or two independent variables.
  • Use tree diagrams as an aid to understanding the chain rule for several independent and intermediate variables.
  • Perform implicit differentiation of a function of two or more variables.

In single-variable calculus, we found that one of the most useful differentiation rules is the chain rule, which allows us to find the derivative of the composition of two functions. The same thing is true for multivariable calculus, but this time we have to deal with more than one form of the chain rule. In this section, we study extensions of the chain rule and learn how to take derivatives of compositions of functions of more than one variable.

Chain Rules for One or Two Independent Variables

Recall that the chain rule for the derivative of a composite of two functions can be written in the form

ddx(f(g(x)))=f(g(x))g(x).

In this equation, both f(x) and g(x) are functions of one variable. Now suppose that f is a function of two variables and g is a function of one variable. Or perhaps they are both functions of two variables, or even more. How would we calculate the derivative in these cases? The following theorem gives us the answer for the case of one independent variable.

Theorem 14.5.1: Chain Rule for One Independent Variable

Suppose that x=g(t) and y=h(t) are differentiable functions of t and z=f(x,y) is a differentiable function of x and y. Then z=f(x(t),y(t)) is a differentiable function of t and

dzdt=zxdxdt+zydydt,

where the ordinary derivatives are evaluated at t and the partial derivatives are evaluated at (x,y).

Proof

The proof of this theorem uses the definition of differentiability of a function of two variables. Suppose that f is differentiable at the point P(x0,y0), where x0=g(t0) and y0=h(t0) for a fixed value of t0. We wish to prove that z=f(x(t),y(t)) is differentiable at t=t0 and that Equation ??? holds at that point as well.

Since f is differentiable at P, we know that

z(t)=f(x,y)=f(x0,y0)+fx(x0,y0)(xx0)+fy(x0,y0)(yy0)+E(x,y),

where

lim(x,y)(x0,y0)E(x,y)(xx0)2+(yy0)2=0.

We then subtract z0=f(x0,y0) from both sides of this equation:

z(t)z(t0)=f(x(t),y(t))f(x(t0),y(t0))=fx(x0,y0)(x(t)x(t0))+fy(x0,y0)(y(t)y(t0))+E(x(t),y(t)).

Next, we divide both sides by tt0:

z(t)z(t0)tt0=fx(x0,y0)x(t)x(t0)tt0+fy(x0,y0)y(t)y(t0)tt0+E(x(t),y(t))tt0.

Then we take the limit as t approaches t0:

limtt0z(t)z(t0)tt0=fx(x0,y0)limtt0(x(t)x(t0)tt0)+fy(x0,y0)limtt0(y(t)y(t0)tt0)+limtt0E(x(t),y(t))tt0.

The left-hand side of this equation is equal to dz/dt, which leads to

dzdt=fx(x0,y0)dxdt+fy(x0,y0)dydt+limtt0E(x(t),y(t))tt0.

The last term can be rewritten as

limtt0E(x(t),y(t))tt0=limtt0E(x,y)(xx0)2+(yy0)2(xx0)2+(yy0)2tt0)=limtt0(E(x,y)(xx0)2+(yy0)2)limtt0((xx0)2+(yy0)2tt0).

As t approaches t0,(x(t),y(t)) approaches (x(t0),y(t0)), so we can rewrite the last product as

lim(x,y)(x0,y0)E(x,y)(xx0)2+(yy0)2lim(x,y)(x0,y0)((xx0)2+(yy0)2tt0).

Since the first limit is equal to zero, we need only show that the second limit is finite:

lim(x,y)(x0,y0)(xx0)2+(yy0)2tt0=lim(x,y)(x0,y0)(xx0)2+(yy0)2(tt0)2=lim(x,y)(x0,y0)(xx0tt0)2+(yy0tt0)2=[lim(x,y)(x0,y0)(xx0tt0)]2+[lim(x,y)(x0,y0)(yy0tt0)]2.

Since x(t) and y(t) are both differentiable functions of t, both limits inside the last radical exist. Therefore, this value is finite. This proves the chain rule at t=t0; the rest of the theorem follows from the assumption that all functions are differentiable over their entire domains.

Closer examination of Equation ??? reveals an interesting pattern. The first term in the equation is fxdxdt and the second term is fydydt. Recall that when multiplying fractions, cancelation can be used. If we treat these derivatives as fractions, then each product “simplifies” to something resembling f/dt. The variables x and y that disappear in this simplification are often called intermediate variables: they are independent variables for the function f, but are dependent variables for the variable t. Two terms appear on the right-hand side of the formula, and f is a function of two variables. This pattern works with functions of more than two variables as well, as we see later in this section.

Example 14.5.1: Using the Chain Rule

Calculate dz/dt for each of the following functions:

  1. z=f(x,y)=4x2+3y2,x=x(t)=sint,y=y(t)=cost
  2. z=f(x,y)=x2y2,x=x(t)=e2t,y=y(t)=et
Solution

a. To use the chain rule, we need four quantities—z/x,z/y,dx/dt, and dy/dt:

  • zx=8x
  • dxdt=cost
  • zy=6y
  • dydt=sint

Now, we substitute each of these into Equation ???:

dzdt=zxdxdt+zydydt=(8x)(cost)+(6y)(sint)=8xcost6ysint.

This answer has three variables in it. To reduce it to one variable, use the fact that x(t)=sint and y(t)=cost. We obtain

dzdt=8xcost6ysint=8(sint)cost6(cost)sint=2sintcost.

This derivative can also be calculated by first substituting x(t) and y(t) into f(x,y), then differentiating with respect to t:

z=f(x,y)=f(x(t),y(t))=4(x(t))2+3(y(t))2=4sin2t+3cos2t.

Then

dzdt=2(4sint)(cost)+2(3cost)(sint)=8sintcost6sintcost=2sintcost,

which is the same solution. However, it may not always be this easy to differentiate in this form.

b. To use the chain rule, we again need four quantities—z/x,z/dy,dx/dt, and dy/dt:

  • zx=xx2y2
  • dxdt=2e2t
  • zy=yx2y2
  • dydt=et.

We substitute each of these into Equation ???:

dzdt=zxdxdt+zydydt=(xx2y2)(2e2t)+(yx2y2)(et)=2xe2tyetx2y2.

To reduce this to one variable, we use the fact that x(t)=e2t and y(t)=et. Therefore,

dzdt=2xe2t+yetx2y2=2(e2t)e2t+(et)ete4te2t=2e4t+e2te4te2t.

To eliminate negative exponents, we multiply the top by e2t and the bottom by e4t:

dzdt=2e4t+e2te4te2te2te4t=2e6t+1e8te2t=2e6t+1e2t(e6t1)=2e6t+1ete6t1.

Again, this derivative can also be calculated by first substituting x(t) and y(t) into f(x,y), then differentiating with respect to t:

z=f(x,y)=f(x(t),y(t))=(x(t))2(y(t))2=e4te2t=(e4te2t)1/2.

Then

dzdt=12(e4te2t)1/2(4e4t+2e2t)=2e4t+e2te4te2t.

This is the same solution.

Exercise 14.5.1

Calculate dz/dt given the following functions. Express the final answer in terms of t.

z=f(x,y)=x23xy+2y2,x=x(t)=3sin2t,y=y(t)=4cos2t

Hint

Calculate z/x,z/dy,dx/dt, and dy/dt, then use Equation ???.

Answer

dzdt=fxdxdt+fydydt=(2x3y)(6cos2t)+(3x+4y)(8sin2t)=92sin2tcos2t72(cos22tsin22t)=46sin4t72cos4t.

It is often useful to create a visual representation of Equation ??? for the chain rule. This is called a tree diagram for the chain rule for functions of one variable and it provides a way to remember the formula (Figure 14.5.1). This diagram can be expanded for functions of more than one variable, as we shall see very shortly.

A diagram that starts with z = f(x, y). Along the first branch, it is written ∂z/∂x, then x = x(t), then dx/dt, then t, and finally it says ∂z/∂x dx/dt. Along the other branch, it is written ∂z/∂y, then y = y(t), then dy/dt, then t, and finally it says ∂z/∂y dy/dt.
Figure 14.5.1: Tree diagram for the case dzdt=zxdxdt+zydydt.

In this diagram, the leftmost corner corresponds to z=f(x,y). Since f has two independent variables, there are two lines coming from this corner. The upper branch corresponds to the variable x and the lower branch corresponds to the variable y. Since each of these variables is then dependent on one variable t, one branch then comes from x and one branch comes from y. Last, each of the branches on the far right has a label that represents the path traveled to reach that branch. The top branch is reached by following the x branch, then the t branch; therefore, it is labeled (z/x)×(dx/dt). The bottom branch is similar: first the y branch, then the t branch. This branch is labeled (z/y)×(dy/dt). To get the formula for dz/dt, add all the terms that appear on the rightmost side of the diagram. This gives us Equation.

In Chain Rule for Two Independent Variables, z=f(x,y) is a function of x and y, and both x=g(u,v) and y=h(u,v) are functions of the independent variables u and v.

Theorem 14.5.2: Chain Rule for Two Independent Variables

Suppose x=g(u,v) and y=h(u,v) are differentiable functions of u and v, and z=f(x,y) is a differentiable function of x and y. Then, z=f(g(u,v),h(u,v)) is a differentiable function of u and v, and

zu=zxxu+zyyu

and

zv=zxxv+zyyv.

We can draw a tree diagram for each of these formulas as well as follows.

A diagram that starts with z = f(x, y). Along the first branch, it is written ∂z/∂x, then x = g(u, v), at which point it breaks into another two branches: the first subbranch says ∂x/∂u, then u, and finally it says ∂z/∂x ∂x/∂u; the second subbranch says ∂x/∂v, then v, and finally it says ∂z/∂x ∂x/∂v. Along the other branch, it is written ∂z/∂y, then y = h(u, v), at which point it breaks into another two branches: the first subbranch says ∂y/∂u, then u, and finally it says ∂z/∂y ∂y/∂u; the second subbranch says ∂y/∂v, then v, and finally it says ∂z/∂y ∂y/∂v.
Figure 14.5.2: Tree diagram for zu=zxxu+zyyu and zv=zxxv+zyyv.

To derive the formula for z/u, start from the left side of the diagram, then follow only the branches that end with u and add the terms that appear at the end of those branches. For the formula for z/v, follow only the branches that end with v and add the terms that appear at the end of those branches.

There is an important difference between these two chain rule theorems. In Chain Rule for One Independent Variable, the left-hand side of the formula for the derivative is not a partial derivative, but in Chain Rule for Two Independent Variables it is. The reason is that, in Chain Rule for One Independent Variable, z is ultimately a function of t alone, whereas in Chain Rule for Two Independent Variables, z is a function of both u and v.

Example 14.5.2: Using the Chain Rule for Two Variables

Calculate ∂z/∂u and ∂z/∂v using the following functions:

z=f(x,y)=3x^2−2xy+y^2,\; x=x(u,v)=3u+2v,\; y=y(u,v)=4u−v. \nonumber

Solution

To implement the chain rule for two variables, we need six partial derivatives—∂z/∂x,\; ∂z/∂y,\; ∂x/∂u,\; ∂x/∂v,\; ∂y/∂u, and ∂y/∂v:

\begin{align*} \dfrac{∂z}{∂x} &=6x−2y & & \dfrac{∂z}{∂y}=−2x+2y \\[4pt] \dfrac{∂x}{∂u} &=3 & & \dfrac{∂x}{∂v}=2 \\[4pt] \dfrac{∂y}{∂u} &=4 & & \dfrac{∂y}{∂v}=−1. \end{align*}

To find ∂z/∂u, we use Equation \ref{chain2a}:

\begin{align*} \dfrac{∂z}{∂u} &=\dfrac{∂z}{∂x}⋅\dfrac{∂x}{∂u}+\dfrac{∂z}{∂y}⋅\dfrac{∂y}{∂u} \\[4pt] &=3(6x−2y)+4(−2x+2y) \\[4pt] &=10x+2y. \end{align*}

Next, we substitute x(u,v)=3u+2v and y(u,v)=4u−v:

\begin{align*} \dfrac{∂z}{∂u} &=10x+2y \\[4pt] &=10(3u+2v)+2(4u−v) \\[4pt] &=38u+18v. \end{align*}

To find ∂z/∂v, we use Equation \ref{chain2b}:

\begin{align*} \dfrac{∂z}{∂v} &=\dfrac{∂z}{∂x}\dfrac{∂x}{∂v}+\dfrac{∂z}{∂y}\dfrac{∂y}{∂v} \\[4pt] &=2(6x−2y)+(−1)(−2x+2y) \\[4pt] &=14x−6y. \end{align*}

Then we substitute x(u,v)=3u+2v and y(u,v)=4u−v:

\begin{align*} \dfrac{∂z}{∂v} &=14x−6y \\[4pt] &=14(3u+2v)−6(4u−v) \\[4pt] &=18u+34v \end{align*}

Exercise \PageIndex{2}

Calculate ∂z/∂u and ∂z/∂v given the following functions:

z=f(x,y)=\dfrac{2x−y}{x+3y},\quad x(u,v)=e^{2u}\cos 3v,\quad y(u,v)=e^{2u}\sin 3v. \nonumber

Hint

Calculate ∂z/∂x,\; ∂z/∂y,\; ∂x/∂u,\; ∂x/∂v,\; ∂y/∂u, and ∂y/∂v, then use Equation \ref{chain2a} and Equation \ref{chain2b}.

Answer

\dfrac{∂z}{∂u}=0,\quad \dfrac{∂z}{∂v}=\dfrac{−21}{(3\sin 3v+\cos 3v)^2}

The Generalized Chain Rule

Now that we’ve see how to extend the original chain rule to functions of two variables, it is natural to ask: Can we extend the rule to more than two variables? The answer is yes, as the generalized chain rule states.

Theorem \PageIndex{3}: Generalized Chain Rule

Let w=f(x_1,x_2,…,x_m) be a differentiable function of m independent variables, and for each i∈{1,…,m}, let x_i=x_i(t_1,t_2,…,t_n) be a differentiable function of n independent variables. Then

\dfrac{∂w}{∂t_j}=\dfrac{∂w}{∂x_1}\dfrac{∂x_1}{∂t_j}+\dfrac{∂w}{∂x_2}\dfrac{∂x_2}{∂t_j}+⋯+\dfrac{∂w}{∂x_m}\dfrac{∂x_m}{∂t_j} \nonumber

for any j∈{1,2,…,n}.

In the next example we calculate the derivative of a function of three independent variables in which each of the three variables is dependent on two other variables.

Example \PageIndex{3}: Using the Generalized Chain Rule

Calculate ∂w/∂u and ∂w/∂v using the following functions:

\begin{align*} w &=f(x,y,z)=3x^2−2xy+4z^2 \\[4pt] x &=x(u,v)=e^u\sin v \\[4pt] y &=y(u,v)=e^u\cos v \\[4pt] z &=z(u,v)=e^u. \end{align*}

Solution

The formulas for ∂w/∂u and ∂w/∂v are

\begin{align*} \dfrac{∂w}{∂u} =\dfrac{∂w}{∂x}⋅\dfrac{∂x}{∂u}+\dfrac{∂w}{∂y}⋅\dfrac{∂y}{∂u}+\dfrac{∂w}{∂z}⋅\dfrac{∂z}{∂u} \\[4pt] \dfrac{∂w}{∂v} =\dfrac{∂w}{∂x}⋅\dfrac{∂x}{∂v}+\dfrac{∂w}{∂y}⋅\dfrac{∂y}{∂v}+\dfrac{∂w}{∂z}⋅\dfrac{∂z}{∂v}. \end{align*}

Therefore, there are nine different partial derivatives that need to be calculated and substituted. We need to calculate each of them:

\begin{align*} \dfrac{∂w}{∂x}&=6x−2y \dfrac{∂w}{∂y}=−2x \dfrac{∂w}{∂z}=8z \\[4pt] \dfrac{∂x}{∂u}&=e^u\sin v \dfrac{∂y}{∂u}=e^u\cos v \dfrac{∂z}{∂u}=e^u \\[4pt] \dfrac{∂x}{∂v}&=e^u\cos v \dfrac{∂y}{∂v}=−e^u\sin v \dfrac{∂z}{∂v}=0. \end{align*}

Now, we substitute each of them into the first formula to calculate ∂w/∂u:

\begin{align*} \dfrac{∂w}{∂u} &=\dfrac{∂w}{∂x}⋅\dfrac{∂x}{∂u}+\dfrac{∂w}{∂y}⋅\dfrac{∂y}{∂u}+\dfrac{∂w}{∂z}⋅\dfrac{∂z}{∂u} \\[4pt] &=(6x−2y)e^u\sin v−2xe^u\cos v+8ze^u, \end{align*}

then substitute x(u,v)=e^u \sin v, \, y(u,v)=e^u\cos v, and z(u,v)=e^u into this equation:

\begin{align*} \dfrac{∂w}{∂u} &=(6x−2y)e^u\sin v−2xe^u\cos v+8ze^u \\[4pt] &=(6e^u\sin v−2eu\cos v)e^u\sin v−2(e^u\sin v)e^u\cos v+8e^{2u} \\[4pt] &=6e^{2u}\sin^2 v−4e^{2u}\sin v\cos v+8e^{2u} \\[4pt] &=2e^{2u}(3\sin^2 v−2\sin v\cos v+4). \end{align*}

Next, we calculate ∂w/∂v:

\begin{align*} \dfrac{∂w}{∂v} &=\dfrac{∂w}{∂x}⋅\dfrac{∂x}{∂v}+\dfrac{∂w}{∂y}⋅\dfrac{∂y}{∂v}+\dfrac{∂w}{∂z}⋅\dfrac{∂z}{∂v} \\[4pt] &=(6x−2y)e^u\cos v−2x(−e^u\sin v)+8z(0), \end{align*}

then we substitute x(u,v)=e^u\sin v,\, y(u,v)=e^u\cos v, and z(u,v)=e^u into this equation:

\begin{align*} \dfrac{∂w}{∂v} &=(6x−2y)e^u\cos v−2x(−e^u\sin v) \\[4pt] &=(6e^u \sin v−2e^u\cos v)e^u\cos v+2(e^u\sin v)(e^u\sin v) \\[4pt] &=2e^{2u}\sin^2 v+6e^{2u}\sin v\cos v−2e^{2u}\cos^2 v \\[4pt] &=2e^{2u}(\sin^2 v+\sin v\cos v−\cos^2 v). \end{align*}

Exercise \PageIndex{3}

Calculate ∂w/∂u and ∂w/∂v given the following functions:

\begin{align*} w &=f(x,y,z)=\dfrac{x+2y−4z}{2x−y+3z} \\[4pt] x &=x(u,v)=e^{2u}\cos3v \\[4pt] y &=y(u,v)=e^{2u}\sin 3v \\[4pt] z &=z(u,v)=e^{2u}. \end{align*}

Hint

Calculate nine partial derivatives, then use the same formulas from Example \PageIndex{3}.

Answer

\dfrac{∂w}{∂u}=0

\dfrac{∂w}{∂v}=\dfrac{15−33\sin 3v+6\cos 3v}{(3+2\cos 3v−\sin 3v)^2}

Example \PageIndex{4}: Drawing a Tree Diagram

Create a tree diagram for the case when

w=f(x,y,z),\quad x=x(t,u,v),\quad y=y(t,u,v),\quad z=z(t,u,v) \nonumber

and write out the formulas for the three partial derivatives of w.

Solution

Starting from the left, the function f has three independent variables: x,\, y, and z. Therefore, three branches must be emanating from the first node. Each of these three branches also has three branches, for each of the variables t,\, u, and v.

A diagram that starts with w = f(x, y, z). Along the first branch, it is written ∂w/∂x, then x = x(t, u, v), at which point it breaks into another three subbranches: the first subbranch says t and then ∂w/∂x ∂x/∂t; the second subbranch says u and then ∂w/∂x ∂x/∂u; and the third subbranch says v and then ∂w/∂x ∂x/∂v. Along the second branch, it is written ∂w/∂y, then y = y(t, u, v), at which point it breaks into another three subbranches: the first subbranch says t and then ∂w/∂y ∂y/∂t; the second subbranch says u and then ∂w/∂y ∂y/∂u; and the third subbranch says v and then ∂w/∂y ∂y/∂v. Along the third branch, it is written ∂w/∂z, then z = z(t, u, v), at which point it breaks into another three subbranches: the first subbranch says t and then ∂w/∂z ∂z/∂t; the second subbranch says u and then ∂w/∂z ∂z/∂u; and the third subbranch says v and then ∂w/∂z ∂z/∂v.
Figure \PageIndex{3}: Tree diagram for a function of three variables, each of which is a function of three independent variables.

The three formulas are

\begin{align*} \dfrac{∂w}{∂t} &=\dfrac{∂w}{∂x}\dfrac{∂x}{∂t}+\dfrac{∂w}{∂y}\dfrac{∂y}{∂t}+\dfrac{∂w}{∂z}\dfrac{∂z}{∂t} \\[4pt] \dfrac{∂w}{∂u} &=\dfrac{∂w}{∂x}\dfrac{∂x}{∂u}+\dfrac{∂w}{∂y}\dfrac{∂y}{∂u}+\dfrac{∂w}{∂z}\dfrac{∂z}{∂u} \\[4pt] \dfrac{∂w}{∂v} &=\dfrac{∂w}{∂x}\dfrac{∂x}{∂v}+\dfrac{∂w}{∂y}\dfrac{∂y}{∂v}+\dfrac{∂w}{∂z}\dfrac{∂z}{∂v}. \end{align*}

Exercise \PageIndex{4}

Create a tree diagram for the case when

w=f(x,y),\quad x=x(t,u,v),\quad y=y(t,u,v) \nonumber

and write out the formulas for the three partial derivatives of w.

Hint

Determine the number of branches that emanate from each node in the tree.

Answer

\begin{align*}\dfrac{∂w}{∂t} &=\dfrac{∂w}{∂x}\dfrac{∂x}{∂t}+\dfrac{∂w}{∂y}\dfrac{∂y}{∂t} \\[4pt] \dfrac{∂w}{∂u} &=\dfrac{∂w}{∂x}\dfrac{∂x}{∂u}+\dfrac{∂w}{∂y}\dfrac{∂y}{∂u} \\[4pt] \dfrac{∂w}{∂v} &=\dfrac{∂w}{∂x}\dfrac{∂x}{∂v}+\dfrac{∂w}{∂y}\dfrac{∂y}{∂v} \end{align*}

A diagram that starts with w = f(x, y). Along the first branch, it is written ∂w/∂x, then x = x(t, u, v), at which point it breaks into another three subbranches: the first subbranch says t and then ∂w/∂x ∂x/∂t; the second subbranch says u and then ∂w/∂x ∂x/∂u; and the third subbranch says v and then ∂w/∂x ∂x/∂v. Along the second branch, it is written ∂w/∂y, then y = y(t, u, v), at which point it breaks into another three subbranches: the first subbranch says t and then ∂w/∂y ∂y/∂t; the second subbranch says u and then ∂w/∂y ∂y/∂u; and the third subbranch says v and then ∂w/∂y ∂y/∂v.

Implicit Differentiation

Recall from implicit differentiation provides a method for finding dy/dx when y is defined implicitly as a function of x. The method involves differentiating both sides of the equation defining the function with respect to x, then solving for dy/dx. Partial derivatives provide an alternative to this method.

Consider the ellipse defined by the equation x^2+3y^2+4y−4=0 as follows.

An ellipse with center near (0, –0.7), major axis horizontal and of length roughly 4.5, and minor axis of length roughly 3.
Figure \PageIndex{4}: Graph of the ellipse defined by x^2+3y^2+4y−4=0.

This equation implicitly defines y as a function of x. As such, we can find the derivative dy/dx using the method of implicit differentiation:

\begin{align*} \dfrac{d}{dx}(x^2+3y^2+4y−4) &=\dfrac{d}{dx}(0) \\[4pt] 2x+6y\dfrac{dy}{dx}+4\dfrac{dy}{dx} &=0 \\[4pt] (6y+4)\dfrac{dy}{dx} &=−2x\\[4pt] \dfrac{dy}{dx} &=−\dfrac{x}{3y+2}\end{align*}

We can also define a function z=f(x,y) by using the left-hand side of the equation defining the ellipse. Then f(x,y)=x^2+3y^2+4y−4. The ellipse x^2+3y^2+4y−4=0 can then be described by the equation f(x,y)=0. Using this function and the following theorem gives us an alternative approach to calculating dy/dx.

Theorem \PageIndex{4}: Implicit Differentiation of a Function of Two or More Variables

Suppose the function z=f(x,y) defines y implicitly as a function y=g(x) of x via the equation f(x,y)=0. Then

\dfrac{dy}{dx}=−\dfrac{∂f/∂x}{∂f/∂y} \label{implicitdiff1}

provided f_y(x,y)≠0.

If the equation f(x,y,z)=0 defines z implicitly as a differentiable function of x and y, then

\dfrac{dz}{dx}=−\dfrac{∂f/∂x}{∂f/∂z} \qquad\text{and}\qquad \dfrac{dz}{dy}=−\dfrac{∂f/∂y}{∂f/∂z}\label{implicitdiff2}

as long as f_z(x,y,z)≠0.

Equation \ref{implicitdiff1} is a direct consequence of Equation \ref{chain2a}. In particular, if we assume that y is defined implicitly as a function of x via the equation f(x,y)=0, we can apply the chain rule to find dy/dx:

\begin{align*} \dfrac{d}{dx}f(x,y) &=\dfrac{d}{dx}(0) \\[4pt] \dfrac{∂f}{∂x}⋅\dfrac{dx}{dx}+\dfrac{∂f}{∂y}⋅\dfrac{dy}{dx} &=0 \\[4pt]\dfrac{∂f}{∂x}+\dfrac{∂f}{∂y}⋅\dfrac{dy}{dx} &=0. \end{align*}

Solving this equation for dy/dx gives Equation \ref{implicitdiff1}. Equation \ref{implicitdiff1} can be derived in a similar fashion.

Let’s now return to the problem that we started before the previous theorem. Using Theorem \PageIndex{4} and the function f(x,y)=x^2+3y^2+4y−4, we obtain

\begin{align*} \dfrac{∂f}{∂x} &=2x\\[4pt] \dfrac{∂f}{∂y} &=6y+4. \end{align*}

Then Equation \ref{implicitdiff1} gives

\dfrac{dy}{dx}=−\dfrac{∂f/∂x}{∂f/∂y}=−\dfrac{2x}{6y+4}=−\dfrac{x}{3y+2}, \nonumber

which is the same result obtained by the earlier use of implicit differentiation.

Example \PageIndex{5}: Implicit Differentiation by Partial Derivatives
  1. Calculate dy/dx if y is defined implicitly as a function of x via the equation 3x^2−2xy+y^2+4x−6y−11=0. What is the equation of the tangent line to the graph of this curve at point (2,1)?
  2. Calculate ∂z/∂x and ∂z/∂y, given x^2e^y−yze^x=0.
Solution

a. Set f(x,y)=3x^2−2xy+y^2+4x−6y−11=0, then calculate f_x and f_y: f_x(x,y)=6x−2y+4 and f_y(x,y)=−2x+2y−6.

The derivative is given by

\dfrac{dy}{dx}=−\dfrac{∂f/∂x}{∂f/∂y}=\dfrac{6x−2y+4}{−2x+2y−6}=\dfrac{3x−y+2}{x−y+3}. \nonumber

The slope of the tangent line at point (2,1) is given by

\dfrac{dy}{dx}\Bigg|_{(x,y)=(2,1)}=\dfrac{3(2)−1+2}{2−1+3}=\dfrac{7}{4} \nonumber

To find the equation of the tangent line, we use the point-slope form (Figure \PageIndex{5}):

\begin{align*} y−y_0 &=m(x−x_0)\\[4pt]y−1 &=\dfrac{7}{4}(x−2) \\[4pt] y &=\dfrac{7}{4}x−\dfrac{7}{2}+1\\[4pt] y &=\dfrac{7}{4}x−\dfrac{5}{2}.\end{align*}

A rotated ellipse with equation 3x2 – 2xy + y2 + 4x – 6y – 11 = 0 and with tangent at (2, 1). The equation for the tangent is given by y = 7/4 x – 5/2. The ellipse’s major axis is parallel to the tangent line.
Figure \PageIndex{5}: Graph of the rotated ellipse defined by 3x^2−2xy+y^2+4x−6y−11=0.

b. We have f(x,y,z)=x^2e^y−yze^x. Therefore,

\begin{align*} \dfrac{∂f}{∂x} &=2xe^y−yze^x \\[4pt] \dfrac{∂f}{∂y} &=x^2e^y−ze^x \\[4pt] \dfrac{∂f}{∂z} &=−ye^x\end{align*}

Using Equation \ref{implicitdiff2},

\begin{align*} \dfrac{∂z}{∂x} &=−\dfrac{∂f/∂x}{∂f/∂y} & &\text{and} & \dfrac{∂z}{∂y} =−\dfrac{∂f/∂y}{∂f/∂z} \\[4pt] &=−\dfrac{2xe^y−yze^x}{−ye^x} & & &=−\dfrac{x^2e^y−ze^x}{−ye^x} \\[4pt] &=\dfrac{2xe^y−yze^x}{ye^x} & & & =\dfrac{x^2e^y−ze^x}{ye^x} \end{align*}

Exercise \PageIndex{5}

Find dy/dx if y is defined implicitly as a function of x by the equation x^2+xy−y^2+7x−3y−26=0. What is the equation of the tangent line to the graph of this curve at point (3,−2)?

Hint

Calculate ∂f/dx and ∂f/dy, then use Equation \ref{implicitdiff1}.

Solution

\dfrac { d y } { d x } = \left. \frac { 2 x + y + 7 } { 2 y - x + 3 } \right| _ { ( 3 , - 2 ) } = \dfrac { 2 ( 3 ) + ( - 2 ) + 7 } { 2 ( - 2 ) - ( 3 ) + 3 } = - \dfrac { 11 } { 4 } \nonumber

Equation of the tangent line: y=−\dfrac{11}{4}x+\dfrac{25}{4}

Key Concepts

  • The chain rule for functions of more than one variable involves the partial derivatives with respect to all the independent variables.
  • Tree diagrams are useful for deriving formulas for the chain rule for functions of more than one variable, where each independent variable also depends on other variables.

Key Equations

  • Chain rule, one independent variable

\dfrac{dz}{dt}=\dfrac{∂z}{∂x}⋅\dfrac{dx}{dt}+\dfrac{∂z}{∂y}⋅\dfrac{dy}{dt}

  • Chain rule, two independent variables

\dfrac{dz}{du}=\dfrac{∂z}{∂x}⋅\dfrac{∂x}{∂u}+\dfrac{∂z}{∂y}⋅\dfrac{∂y}{∂u}\dfrac{dz}{dv}=\dfrac{∂z}{∂x}⋅\dfrac{∂x}{∂v}+\dfrac{∂z}{∂y}⋅\dfrac{∂y}{∂v}

  • Generalized chain rule

\dfrac{∂w}{∂t_j}=\dfrac{∂w}{∂x_1}\dfrac{∂x_1}{∂t_j}+\dfrac{∂w}{∂x_2}\dfrac{∂x_1}{∂t_j}+⋯+\dfrac{∂w}{∂x_m}\dfrac{∂x_m}{∂t_j}

Glossary

generalized chain rule
the chain rule extended to functions of more than one independent variable, in which each independent variable may depend on one or more other variables
intermediate variable
given a composition of functions (e.g., f(x(t),y(t))), the intermediate variables are the variables that are independent in the outer function but dependent on other variables as well; in the function f(x(t),y(t)), the variables x and y are examples of intermediate variables
tree diagram
illustrates and derives formulas for the generalized chain rule, in which each independent variable is accounted for

14.5: The Chain Rule is shared under a not declared license and was authored, remixed, and/or curated by LibreTexts.

Support Center

How can we help?