Multivariable CalculusThe Chain Rule and the Gradient2 of 4
The Chain Rule and the Gradient · 2

Implicit Differentiation

When xx and yy are mixed together in an equation that we can't easily solve for yy, we still need a fast way to find the slope dydx\change{\frac{dy}{dx}}.

1

A Shortcut for Implicit Differentiation

Suppose we want to find the slope dydx\change{\frac{dy}{dx}} of the curve

x3+x2y+y3=10\displaystyle \height{x^3 + x^2y + y^3 = 10}

With single-variable calculus, differentiating term by term forces us to use the product rule and chain rule, attach dydx\change{\frac{dy}{dx}} to every yy derivative, and do several steps of algebra to solve for dydx\change{\frac{dy}{dx}}. Partial derivatives let us write down the exact same answer in one step.

A Shortcut for Implicit Differentiation
xx
yy
x3+x2y+y3=10\htmlClass{lc-blue}{x^3 + x^2y + y^3 = 10}
dydx=  ?\htmlClass{lc-pink}{\dfrac{dy}{dx}} = \;?
Text solution
Differentiate in xx with yy held constantTreat yy like a fixed number in F(x,y)=x3+x2y+y3\height{F(x, y) = x^3 + x^2y + y^3} to find the numerator.
Fx\displaystyle \change{F_x} =3x2+2xy\displaystyle = 3x^2 + 2xy
Differentiate in yy with xx held constantTreat xx like a fixed number to find the denominator.
Fy\displaystyle \change{F_y} =x2+3y2\displaystyle = x^2 + 3y^2
Put Fx\change{F_x} over Fy\change{F_y} with a minus signDivide the xx-derivative by the yy-derivative and put a minus sign in front.
dydx\displaystyle \change{\frac{dy}{dx}} =−FxFy\displaystyle = -\frac{\change{F_x}}{\change{F_y}} =−3x2+2xyx2+3y2(Fy≠0)\displaystyle = -\frac{3x^2 + 2xy}{x^2 + 3y^2} \quad (\change{F_y} \neq 0)
2

Why It Works: Staying on a Contour

That shortcut raises three immediate questions: why are we allowed to pretend yy is constant when yy changes with xx, why is the fraction flipped with Fx\change{F_x} on top and Fy\change{F_y} on the bottom, and where does the minus sign come from?

To see why, let's look at a simpler curve, the circle x2+y2=25\height{x^2 + y^2 = 25}, and view it as a flat contour trail at height 25\height{25} on the 3D bowl F(x,y)=x2+y2\height{F(x, y) = x^2 + y^2}.

Why It Works: Staying on a Contour
xx
yy
zz
F(x,y)=x2+y2\htmlClass{lc-blue}{F(x, y) = x^2 + y^2}
25 ft\htmlClass{lc-blue}{25\text{ ft}}
x2+y2=25\htmlClass{lc-blue}{x^2 + y^2 = 25}
Fx dx⏟height change from x+Fy dy⏟height change from y=0  ⟹  dydx=−FxFy(Fy≠0)\displaystyle \begin{gathered}\underbrace{\change{F_x} \, dx}_{\change{\text{height change from } x}} + \underbrace{\change{F_y} \, dy}_{\change{\text{height change from } y}} = 0 \\ \implies \change{\frac{dy}{dx}} = -\frac{\change{F_x}}{\change{F_y}} \quad (\change{F_y} \neq 0)\end{gathered}
A step stays on a level contour only along the tangent line, where the uphill change in one direction and the downhill change in the other cancel out.
3

Steepness Trade-Offs and Vertical Tangents

Let's also see why Fy\change{F_y} belongs in the denominator geometrically, and what happens on the curve at points where Fy=0\change{F_y} = 0.

Steepness Trade-Offs and Vertical Tangents
dydx=−FxFy\htmlClass{lc-pink}{\dfrac{dy}{dx}} = -\dfrac{\htmlClass{lc-pink}{F_x}}{\htmlClass{lc-pink}{F_y}}
Fx=1\htmlClass{lc-pink}{F_x} = 1
Fy=10\htmlClass{lc-pink}{F_y} = 10
dx=1dx = 1
+1 ft\htmlClass{lc-pink}{+1\text{ ft}}
dy=  ?dy = \;?
xx
yy
x2+y2=25\htmlClass{lc-blue}{x^2 + y^2 = 25}
(5, 0)(5,\,0)
(−5, 0)(-5,\,0)
Fy=2y=0Fx=2x≠0\begin{aligned}\htmlClass{lc-pink}{F_y} &= 2y = 0\\[-1pt] \htmlClass{lc-pink}{F_x} &= 2x \neq 0\end{aligned}
Along a level trail on the bowl, the steeper direction takes a smaller step to cancel the other's height change, until one direction flattens out and the tangent line turns vertical.
4

Finding dy/dxdy/dx with Partial Derivatives

Now let's find dydx\change{\frac{dy}{dx}} for an equation that has variable terms on both sides of the equals sign:

ycos⁡(x)+x2y3\displaystyle y\cos(x) + x^2y^3 =5x+8\displaystyle = 5x + 8
Finding dy/dx with Partial Derivatives
ycos⁡(x)+x2y3\displaystyle y\cos(x) + x^2y^3 =5x+8\displaystyle = 5x + 8
dydx\displaystyle \change{\dfrac{dy}{dx}} =  ?\displaystyle = \;?
Text solution
Move variable terms to one sideSubtract 5x5x so the left side is a single formula F(x,y)\height{F(x, y)} equal to a constant.
F(x,y)=ycos⁡(x)+x2y3−5x=8\displaystyle \height{\begin{aligned} F(x, y) &= y\cos(x) + x^2y^3 - 5x \\ &= 8 \end{aligned}}
Differentiate in xx with yy held constantTreat every yy like a fixed number to get the numerator Fx\change{F_x}.
Fx\displaystyle \change{F_x} =−ysin⁡(x)+2xy3−5\displaystyle = -y\sin(x) + 2xy^3 - 5
Differentiate in yy with xx held constantTreat every xx like a fixed number to get the denominator Fy\change{F_y}.
Fy\displaystyle \change{F_y} =cos⁡(x)+3x2y2\displaystyle = \cos(x) + 3x^2y^2
Put Fx\change{F_x} over Fy\change{F_y} with a minus signPlace Fx\change{F_x} on top, Fy\change{F_y} on the bottom, and put a minus sign in front.
dydx=−FxFy=−−ysin⁡(x)+2xy3−5cos⁡(x)+3x2y2(cos⁡(x)+3x2y2≠0)\displaystyle \begin{aligned} \change{\frac{dy}{dx}} &= -\frac{\change{F_x}}{\change{F_y}} \\ &= -\frac{-y\sin(x) + 2xy^3 - 5}{\cos(x) + 3x^2y^2} \\ &\quad (\cos(x) + 3x^2y^2 \neq 0) \end{aligned}
5

Implicit Differentiation with Three Variables

When an equation mixes three variables together, such as

x2z+yz3−2xy=10\displaystyle \height{x^2z + yz^3 - 2xy = 10}

it defines zz implicitly as a function of xx and yy. Instead of a single slope, we want to find the partial derivatives ∂z∂x\change{\frac{\partial z}{\partial x}} (how zz changes when xx changes with yy held constant) and ∂z∂y\change{\frac{\partial z}{\partial y}} (how zz changes when yy changes with xx held constant).

Implicit Differentiation with Three Variables
xx
yy
zz
x2z+yz3−2xy=10\htmlClass{lc-blue}{x^2z + yz^3 - 2xy = 10}
∂z∂x=  ?∂z∂y=  ?\htmlClass{lc-pink}{\dfrac{\partial z}{\partial x}} = \;? \qquad \htmlClass{lc-pink}{\dfrac{\partial z}{\partial y}} = \;?
Fx dx+Fz dz=0  ⟹  ∂z∂x=−FxFz,Fy dy+Fz dz=0  ⟹  ∂z∂y=−FyFz(Fz≠0)\displaystyle \begin{aligned} \change{F_x} \, dx + \change{F_z} \, dz = 0 &\implies \change{\frac{\partial z}{\partial x}} = -\frac{\change{F_x}}{\change{F_z}}, \\ \change{F_y} \, dy + \change{F_z} \, dz = 0 &\implies \change{\frac{\partial z}{\partial y}} = -\frac{\change{F_y}}{\change{F_z}} \\ &\quad (\change{F_z} \neq 0) \end{aligned}

At points where Fz=0\change{F_z} = 0 (with Fx\change{F_x} or Fy\change{F_y} nonzero), a small change in zz doesn't change F\height{F} at all because the surface goes vertical there.

Holding one variable steady slices the constant-temperature surface into a flat curve where the other two temperature changes cancel each other out, except where the surface goes vertical.
6

Finding ∂z/∂x\partial z/\partial x and ∂z/∂y\partial z/\partial y from the Total Change Balance

Let's use this balance to find both ∂z∂x\change{\frac{\partial z}{\partial x}} and ∂z∂y\change{\frac{\partial z}{\partial y}} for our three-variable equation

x2z+yz3−2xy=10\displaystyle \height{x^2z + yz^3 - 2xy = 10}
Finding ∂z/∂x and ∂z/∂y from the Total Change Balance
x2z+yz3−2xy=10\displaystyle \height{x^2z + yz^3 - 2xy = 10}
∂z∂x\displaystyle \change{\dfrac{\partial z}{\partial x}} =−FxFz\displaystyle = -\dfrac{\change{F_x}}{\change{F_z}} =  ?\displaystyle = \;?
∂z∂y\displaystyle \change{\dfrac{\partial z}{\partial y}} =−FyFz\displaystyle = -\dfrac{\change{F_y}}{\change{F_z}} =  ?\displaystyle = \;?
Text solution
Differentiate in xx and in yy for the numeratorsFrom F(x,y,z)=x2z+yz3−2xy\height{F(x, y, z) = x^2z + yz^3 - 2xy}, take the partial derivatives with respect to xx and yy.
Fx\displaystyle \change{F_x} =2xz−2y,Fy\displaystyle = 2xz - 2y, \qquad \change{F_y} =z3−2x\displaystyle = z^3 - 2x
Differentiate in zz for the shared denominatorFind Fz\change{F_z} once, since both partial derivatives of zz use it on the bottom.
Fz\displaystyle \change{F_z} =x2+3yz2\displaystyle = x^2 + 3yz^2
Divide each numerator by Fz\change{F_z} with a minus signPut Fx\change{F_x} and Fy\change{F_y} over the shared denominator Fz\change{F_z} and put a minus sign in front of both fractions.
∂z∂x=−2xz−2yx2+3yz2,∂z∂y=−z3−2xx2+3yz2(x2+3yz2≠0)\displaystyle \begin{aligned} \change{\frac{\partial z}{\partial x}} &= -\frac{2xz - 2y}{x^2 + 3yz^2}, \\ \change{\frac{\partial z}{\partial y}} &= -\frac{z^3 - 2x}{x^2 + 3yz^2} \\ &\quad (x^2 + 3yz^2 \neq 0) \end{aligned}

Summary

When variables are mixed together in an equation and you can't easily solve for the output variable, rewrite the equation with all variable terms on one side as F=c\height{F = c}. (If the output variable is already solved for or takes one step to solve for, such as z=x2y−5xz = x^2y - 5x, differentiate directly instead of setting up F\height{F}.)

Because staying on F=c\height{F = c} means the total change is zero, the changes from the changing variables must cancel each other out. This always puts a minus sign in front and flips the variable positions between the derivative and the partial derivatives:

Two variables (F(x,y)=c)(\height{F(x, y) = c})

From Fx dx+Fy dy=0\change{F_x} \, dx + \change{F_y} \, dy = 0, the slope of the curve is

dydx\displaystyle \change{\frac{dy}{dx}} =−FxFy(Fy≠0)\displaystyle = -\frac{\change{F_x}}{\change{F_y}} \quad (\change{F_y} \neq 0)
For x3+x2y+y3=10\height{x^3 + x^2y + y^3 = 10}, this gives dydx=−3x2+2xyx2+3y2\change{\frac{dy}{dx}} = -\frac{3x^2 + 2xy}{x^2 + 3y^2}. Points on the curve where Fy=0\change{F_y} = 0 and Fx≠0\change{F_x} \neq 0 have a vertical tangent line, like (5,0)(5, 0) on x2+y2=25\height{x^2 + y^2 = 25} where Fy=2y=0\change{F_y} = 2y = 0.

Three variables (F(x,y,z)=c)(\height{F(x, y, z) = c})

Start from the total change balance

Fx dx+Fy dy+Fz dz\displaystyle \change{F_x} \, dx + \change{F_y} \, dy + \change{F_z} \, dz =0\displaystyle = 0
Cross out the variable held constant and solve for the fraction:
∂z∂x=−FxFz,∂z∂y=−FyFz(Fz≠0)\displaystyle \begin{aligned} \change{\frac{\partial z}{\partial x}} &= -\frac{\change{F_x}}{\change{F_z}}, \\ \change{\frac{\partial z}{\partial y}} &= -\frac{\change{F_y}}{\change{F_z}} \quad (\change{F_z} \neq 0) \end{aligned}
For x2z+yz3−2xy=10\height{x^2z + yz^3 - 2xy = 10}, both share the denominator Fz=x2+3yz2\change{F_z} = x^2 + 3yz^2, giving ∂z∂x=−2xz−2yx2+3yz2\change{\frac{\partial z}{\partial x}} = -\frac{2xz - 2y}{x^2 + 3yz^2} and ∂z∂y=−z3−2xx2+3yz2\change{\frac{\partial z}{\partial y}} = -\frac{z^3 - 2x}{x^2 + 3yz^2}. If a problem asks for a different output variable, such as ∂x∂y\change{\frac{\partial x}{\partial y}} with zz held fixed, crossing out Fz dz\change{F_z} \, dz immediately shows ∂x∂y=−FyFx\change{\frac{\partial x}{\partial y}} = -\frac{\change{F_y}}{\change{F_x}}.

7

Practice

1

Find dydx\change{\frac{dy}{dx}} for x4−3x2y2+y3=12\height{x^4 - 3x^2y^2 + y^3 = 12}.

With all variable terms already on the left side, differentiate F(x,y)=x4−3x2y2+y3\height{F(x, y) = x^4 - 3x^2y^2 + y^3} treating yy as a constant number for one part of the fraction, and xx as a constant number for the other.

Find the partial derivatives Fx\change{F_x} and Fy\change{F_y}
Fx=4x3−6xy2,Fy=−6x2y+3y2\displaystyle \begin{aligned} \change{F_x} &= 4x^3 - 6xy^2, \\ \change{F_y} &= -6x^2y + 3y^2 \end{aligned}
Form −FxFy-\frac{\change{F_x}}{\change{F_y}}Watch out for two common mistakes here: leaving off the front minus sign gives 4x3−6xy23y2−6x2y\frac{4x^3 - 6xy^2}{3y^2 - 6x^2y}, and putting Fy\change{F_y} on top instead of Fx\change{F_x} gives −3y2−6x2y4x3−6xy2-\frac{3y^2 - 6x^2y}{4x^3 - 6xy^2}.
dydx\displaystyle \change{\frac{dy}{dx}} =−4x3−6xy23y2−6x2y\displaystyle = -\frac{4x^3 - 6xy^2}{3y^2 - 6x^2y} =6xy2−4x33y2−6x2y\displaystyle = \frac{6xy^2 - 4x^3}{3y^2 - 6x^2y}
2

Find dydx\change{\frac{dy}{dx}} for xsin⁡(y)+y2=4x−cos⁡(x)x\sin(y) + y^2 = 4x - \cos(x).

Are all the variable terms on the same side of the equals sign before you take Fx\change{F_x}?

Move all variable terms to the left sideSubtracting 4x−cos⁡(x)4x - \cos(x) sets the equation equal to a constant. If you differentiate 4x4x while it is still on the right side without subtracting it first, its sign in Fx\change{F_x} flips and gives the wrong numerator in −sin⁡(y)+4−sin⁡(x)xcos⁡(y)+2y-\frac{\sin(y) + 4 - \sin(x)}{x\cos(y) + 2y}.
F(x,y)=xsin⁡(y)+y2−4x+cos⁡(x)=0\displaystyle \height{\begin{aligned} F(x, y) &= x\sin(y) + y^2 - 4x + \cos(x) \\ &= 0 \end{aligned}}
Take the partial derivatives Fx\change{F_x} and Fy\change{F_y} and divide with a minus sign
dydx\displaystyle \change{\frac{dy}{dx}} =−sin⁡(y)−4−sin⁡(x)xcos⁡(y)+2y\displaystyle = -\frac{\sin(y) - 4 - \sin(x)}{x\cos(y) + 2y} =4+sin⁡(x)−sin⁡(y)xcos⁡(y)+2y\displaystyle = \frac{4 + \sin(x) - \sin(y)}{x\cos(y) + 2y}
3

Find all points on the curve x2+xy+y2=12\height{x^2 + xy + y^2 = 12} where the tangent line is vertical.

Which part of dydx=−FxFy\change{\frac{dy}{dx}} = -\frac{\change{F_x}}{\change{F_y}} must equal zero for a vertical tangent, and how do you use the original curve equation to find the coordinates?

Set the denominator Fy=0\change{F_y} = 0With F(x,y)=x2+xy+y2\height{F(x, y) = x^2 + xy + y^2}, be careful not to set the numerator Fx=2x+y=0\change{F_x} = 2x + y = 0 instead, which finds the horizontal tangents at (−2,4)(-2, 4) and (2,−4)(2, -4).
Fy\displaystyle \change{F_y} =x+2y\displaystyle = x + 2y =0  ⟹  x=−2y\displaystyle = 0 \implies \change{x = -2y}
Substitute x=−2y\change{x = -2y} into the curve equation x2+xy+y2=12\height{x^2 + xy + y^2 = 12}
(−2y)2+(−2y)y+y2=12  ⟹  3y2=12  ⟹  y=±2\displaystyle \begin{aligned} (\change{-2y})^2 + (\change{-2y})y + y^2 &= 12 \\ \implies 3y^2 &= 12 \\ \implies y &= \pm 2 \end{aligned}
Find the matching xx-values from x=−2y\change{x = -2y} (where Fx=2x+y≠0\change{F_x} = 2x + y \neq 0)
(−4,2) and (4,−2)\displaystyle (-4, 2) \text{ and } (4, -2)
4

Find ∂z∂x\change{\frac{\partial z}{\partial x}} and ∂z∂y\change{\frac{\partial z}{\partial y}} for x3z−2yz2+xy2=9\height{x^3z - 2yz^2 + xy^2 = 9}.

Which variable's partial derivative goes in the denominator for both ∂z∂x\change{\frac{\partial z}{\partial x}} and ∂z∂y\change{\frac{\partial z}{\partial y}}?

Find Fx\change{F_x}, Fy\change{F_y}, and the shared denominator Fz\change{F_z}When differentiating with respect to zz, remember that xy2xy^2 has no zz in it and goes to 00 (keeping xy2xy^2 in Fz\change{F_z} gives the wrong denominator x3−4yz+xy2x^3 - 4yz + xy^2).
Fx=3x2z+y2,Fy=2xy−2z2,Fz=x3−4yz\displaystyle \begin{aligned} \change{F_x} &= 3x^2z + y^2, \\ \change{F_y} &= 2xy - 2z^2, \\ \change{F_z} &= x^3 - 4yz \end{aligned}
Place Fx\change{F_x} and Fy\change{F_y} over Fz\change{F_z} with a minus sign in front of each(Forgetting the front minus sign gives 3x2z+y2x3−4yz\frac{3x^2z + y^2}{x^3 - 4yz} and 2xy−2z2x3−4yz\frac{2xy - 2z^2}{x^3 - 4yz}.)
∂z∂x=−3x2z+y2x3−4yzand∂z∂y=−2xy−2z2x3−4yz\displaystyle \begin{aligned} \change{\frac{\partial z}{\partial x}} &= -\frac{3x^2z + y^2}{x^3 - 4yz} \quad \text{and} \\ \change{\frac{\partial z}{\partial y}} &= -\frac{2xy - 2z^2}{x^3 - 4yz} \end{aligned}
5

Suppose xx, yy, and zz satisfy xz2+y2z=2xy+4xz^2 + y^2z = 2xy + 4. Treating xx as a function of yy and zz, find ∂x∂y\change{\frac{\partial x}{\partial y}} (with zz held constant) at the point (1,1,2)(1, 1, 2).

Move all variable terms to the left side first, then cross out the dzdz term in Fx dx+Fy dy+Fz dz=0\change{F_x} \, dx + \change{F_y} \, dy + \change{F_z} \, dz = 0 to see which partial derivative belongs in the denominator of ∂x∂y\change{\frac{\partial x}{\partial y}}.

Move 2xy2xy to the left sideSubtract 2xy2xy so that F(x,y,z)=xz2+y2z−2xy=4\height{F(x, y, z) = xz^2 + y^2z - 2xy = 4}. (Leaving 2xy2xy on the right side without subtracting it flips the signs of −2x-2x and −2y-2y in the partial derivatives and gives the wrong formula −2yz+2xz2+2y-\frac{2yz + 2x}{z^2 + 2y}. At (1,1,2)(1, 1, 2) it happens to give −1-1 too, but at most other points it doesn't.)
F(x,y,z)=xz2+y2z−2xy=4\displaystyle \height{F(x, y, z) = xz^2 + y^2z - 2xy = 4}
Set dz=0dz = 0 in the total change balance and solve for ∂x∂y\change{\frac{\partial x}{\partial y}}Because xx is on top of ∂x∂y\change{\frac{\partial x}{\partial y}}, Fx\change{F_x} goes in the denominator. Putting Fz\change{F_z} on the bottom out of habit gives −FyFz=−25-\frac{\change{F_y}}{\change{F_z}} = -\frac{2}{5}, and flipping the fraction to −FxFy-\frac{\change{F_x}}{\change{F_y}} gives the reciprocal, which only gives the right value here because Fx=Fy=2\change{F_x} = \change{F_y} = 2 at (1,1,2)(1, 1, 2).
Fx dx+Fy dy\displaystyle \change{F_x} \, dx + \change{F_y} \, dy =0  ⟹  ∂x∂y\displaystyle = 0 \implies \change{\frac{\partial x}{\partial y}} =−FyFx\displaystyle = -\frac{\change{F_y}}{\change{F_x}} =−2yz−2xz2−2y\displaystyle = -\frac{2yz - 2x}{z^2 - 2y}
Evaluate at (1,1,2)(1, 1, 2)
∂x∂y\displaystyle \change{\frac{\partial x}{\partial y}} =−2(1)(2)−2(1)22−2(1)\displaystyle = -\frac{2(1)(2) - 2(1)}{2^2 - 2(1)} =−1\displaystyle = -1