MAT1052 · Week 9 · Partial Derivatives, Chain Rule

Partial derivatives and the chain rule

You learn to take partial derivatives and second-order derivatives of a multivariable function, to apply the chain rule with a tree diagram, and to find derivatives of implicit functions with the formula -F_x/F_y.

partial derivativesecond-order partial derivativemixed partial derivativeClairaut's theoremLaplace equationchain ruletree diagramimplicit differentiationrelated rates

This week we carry the concept of the derivative over to multivariable functions. The idea is simple: hold all the other variables constant and take the derivative you know with respect to a single variable. This is called the partial derivative. On top of it we will build two important tools: the chain rule, which computes the derivative when variables depend on other variables, and the implicit differentiation formula, which gives the derivative of functions given by an equation. The exam almost always has a “find all second-order partials”, a chain rule and a related rates question.

Golden rules:

  1. When computing fxf_x, yy behaves like a number. y2y^2, sin⁡y\sin y, eye^y are all constant factors.
  2. fxyf_{xy} means “first with respect to xx, then with respect to yy”. For continuous functions the order does not change the result (Clairaut).
  3. In the chain rule, draw a tree: for every path from the dependent variable to the independent variable, multiply the derivatives, and add the paths.
  4. In implicit differentiation, do not forget the minus sign at the start of the formula: dydx=−FxFy\dfrac{dy}{dx} = -\dfrac{F_x}{F_y}.

The partial derivative

Definition.

fx(a,b)=lim⁡h→0f(a+h,b)−f(a,b)h,fy(a,b)=lim⁡h→0f(a,b+h)−f(a,b)h.f_x(a,b) = \lim_{h\to0}\frac{f(a+h,b)-f(a,b)}{h},\qquad f_y(a,b) = \lim_{h\to0}\frac{f(a,b+h)-f(a,b)}{h}.

Notations: fx=∂f∂x=∂z∂x=Dxff_x = \dfrac{\partial f}{\partial x} = \dfrac{\partial z}{\partial x} = D_xf.

Geometry. Cut the surface z=f(x,y)z = f(x,y) with the plane y=by = b. The slope of the resulting curve at the point (a,b)(a,b) is fx(a,b)f_x(a,b). So fxf_x measures how steeply the surface rises as you walk in the xx direction. fyf_y does the same in the yy direction.

Example 1. f(x,y)=x3y2+4xy−y3f(x,y) = x^3y^2+4xy-y^3.

fx=3x2y2+4y,fy=2x3y+4x−3y2.f_x = 3x^2y^2+4y,\qquad f_y = 2x^3y+4x-3y^2.

At (1,2)(1,2): fx=12+8=20f_x = 12+8 = 20, fy=4+4−12=−4f_y = 4+4-12 = -4. So at this point the surface rises quickly in the xx direction and falls in the yy direction.

Example 2 (the chain rule inside). f(x,y)=sin⁡(xy2)f(x,y) = \sin(xy^2). fx=cos⁡(xy2)⋅y2f_x = \cos(xy^2)\cdot y^2. Here y2y^2 is the derivative of the inner function with respect to xx. fy=cos⁡(xy2)⋅2xyf_y = \cos(xy^2)\cdot2xy.

Example 3 (quotient). f(x,y)=xx+yf(x,y) = \dfrac{x}{x+y}. fx=(x+y)−x(x+y)2=y(x+y)2f_x = \dfrac{(x+y)-x}{(x+y)^2} = \dfrac{y}{(x+y)^2}. fy=0−x(x+y)2=−x(x+y)2f_y = \dfrac{0-x}{(x+y)^2} = -\dfrac{x}{(x+y)^2}.

It is the same with three variables: in f(x,y,z)f(x,y,z), for fzf_z hold xx and yy constant.

PITFALL · constant factor or variable? For f=x2eyf = x^2e^y, fx=2xeyf_x = 2xe^y. There is no need to apply the product rule; eye^y is constant with respect to xx. On the other hand fy=x2eyf_y = x^2e^y, and here x2x^2 is constant. Many people make mistakes in the exam by applying the product rule unnecessarily.

Second-order partial derivatives

You take the partial derivative of the partial derivative again. There are four:

fxx=∂2f∂x2,fyy=∂2f∂y2,fxy=∂∂y(∂f∂x)=∂2f∂y ∂x,fyx=∂2f∂x ∂y.f_{xx} = \frac{\partial^2f}{\partial x^2},\quad f_{yy} = \frac{\partial^2f}{\partial y^2},\quad f_{xy} = \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial x}\right) = \frac{\partial^2f}{\partial y\,\partial x},\quad f_{yx} = \frac{\partial^2f}{\partial x\,\partial y}.

A notation trap: in subscripts the order is left to right (fxyf_{xy}: first xx), while in the ∂\partial notation it is read right to left.

Clairaut’s theorem. If fxyf_{xy} and fyxf_{yx} are continuous around a point, they are equal at that point. This holds for all the functions in the scope of this course, so you should get the same result whichever order you take the mixed derivative in. It is a free way to check your computation.

Example 4. f(x,y)=xexyf(x,y) = xe^{xy}.

f_x  = e^(xy) + x·y·e^(xy)                 (product rule, x appears twice)
f_xy = x·e^(xy) + [x·e^(xy) + x·y·x·e^(xy)] = 2x e^(xy) + x^2 y e^(xy)
f_y  = x·x·e^(xy) = x^2 e^(xy)
f_yx = 2x e^(xy) + x^2·y·e^(xy)            (the same, Clairaut ✓)
at the point (1,0): f_xy = 2

Laplace’s equation. Functions that satisfy the equation uxx+uyy=0u_{xx}+u_{yy} = 0 are called harmonic; heat distribution and electric potential satisfy this equation. u=exsin⁡yu = e^x\sin y: uxx=exsin⁡yu_{xx} = e^x\sin y, uyy=−exsin⁡yu_{yy} = -e^x\sin y, the sum is 00.

The chain rule

One parameter. If z=f(x,y)z = f(x,y), x=x(t)x = x(t), y=y(t)y = y(t), then

dzdt=∂z∂xdxdt+∂z∂ydydt.\frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt}+\frac{\partial z}{\partial y}\frac{dy}{dt}.

Two parameters. If x=x(s,t)x = x(s,t), y=y(s,t)y = y(s,t), then

∂z∂s=∂z∂x∂x∂s+∂z∂y∂y∂s,∂z∂t=∂z∂x∂x∂t+∂z∂y∂y∂t.\frac{\partial z}{\partial s} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial s}+\frac{\partial z}{\partial y}\frac{\partial y}{\partial s},\qquad\frac{\partial z}{\partial t} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial t}+\frac{\partial z}{\partial y}\frac{\partial y}{\partial t}.

Tree diagram. Put zz at the top, the intermediate variables (xx, yy) below it, and the independent variables (ss, tt) at the bottom. Each path from zz to ss is a term: multiply the derivatives along the path. Then add all the paths. This rule works for any number of variables.

          z
        /   \
      x       y
     / \     / \
    s   t   s   t
∂z/∂s = (∂z/∂x)(∂x/∂s) + (∂z/∂y)(∂y/∂s)    ← two paths: z-x-s and z-y-s

Example 5. z=x2+y2z = x^2+y^2, x=t2x = t^2, y=2ty = 2t. dzdt=2x⋅2t+2y⋅2\dfrac{dz}{dt} = 2x\cdot2t+2y\cdot2. At t=1t=1, x=1x = 1, y=2y = 2: 4+8=124+8 = 12. Check: z=t4+4t2z = t^4+4t^2, z′=4t3+8t=12z' = 4t^3+8t = 12 ✓.

Example 6 (three intermediate variables). w=xyzw = xyz, x=u+vx = u+v, y=u−vy = u-v, z=uvz = uv. ∂w∂u=yz⋅1+xz⋅1+xy⋅v\dfrac{\partial w}{\partial u} = yz\cdot1+xz\cdot1+xy\cdot v. At (u,v)=(2,1)(u,v) = (2,1): x=3x = 3, y=1y = 1, z=2z = 2, the result is 2+6+3=112+6+3 = 11.

TIP · when do you plug in the values? First write the derivative expression in general. Then compute the values of xx, yy from the values of ss, tt. Plug everything in at once at the end. Forgetting to compute the values of the intermediate variables (plugging ss in place of xx) is the most common mistake.

The physical face of the chain rule: several quantities change with time, and the rate of change of a composite quantity is asked. Write the formula, apply the chain rule with respect to tt, plug in the given values. The derivative of a decreasing quantity is entered as negative.

Implicit differentiation

If the equation F(x,y)=0F(x,y) = 0 defines yy as a function of xx, then from the chain rule

dydx=−FxFy(Fy≠0).\frac{dy}{dx} = -\frac{F_x}{F_y}\qquad(F_y\neq0).

With three variables, if F(x,y,z)=0F(x,y,z) = 0 defines zz as a function of x,yx,y, then

∂z∂x=−FxFz,∂z∂y=−FyFz.\frac{\partial z}{\partial x} = -\frac{F_x}{F_z},\qquad\frac{\partial z}{\partial y} = -\frac{F_y}{F_z}.

Example 7. x3+y3=6xyx^3+y^3 = 6xy at the point (3,3)(3,3) (the folium of Descartes). F=x3+y3−6xyF = x^3+y^3-6xy. Fx=3x2−6y=9F_x = 3x^2-6y = 9, Fy=3y2−6x=9F_y = 3y^2-6x = 9. dydx=−1\dfrac{dy}{dx} = -1.

Why the minus? The derivative of the equality F(x,y(x))=0F(x,y(x)) = 0 with respect to xx is Fx+Fydydx=0F_x+F_y\dfrac{dy}{dx} = 0. When you solve, the minus comes out.

Common mistakes

WrongCorrect
Setting the terms with yy to 00 in fxf_xyy is a constant factor; only the summands that do not contain xx become 00
yxy−1yx^{y-1} for the derivative of xyx^y with respect to yyxyln⁡xx^y\ln x
Taking the order the wrong way in fxyf_{xy}First xx, then yy (it should come out the same anyway by Clairaut)
Skipping a path in the chain ruleDraw the tree, add all the paths
Plugging the values of s,ts,t directly into zxz_xFirst compute x(s,t)x(s,t), y(s,t)y(s,t)
Forgetting the minus in implicit differentiation−Fx/Fy-F_x/F_y
Taking a decreasing quantity as positive in related ratesDecreasing: the derivative is negative
Writing Fx/FyF_x/F_y for ∂z/∂x\partial z/\partial xFzF_z in the denominator

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Let f(x,y)=x3y2−4xyf(x,y) = x^3y^2-4xy. Find fx(1,2)f_x(1,2).

Show answer
44

Hold yy constant: fx=3x2y2−4yf_x = 3x^2y^2-4y. At (1,2)(1,2): 3⋅1⋅4−8=43\cdot1\cdot4-8 = 4.

Question 2easy

Let f(x,y)=exysin⁡yf(x,y) = e^{xy}\sin y. Find fy(0,π)f_y(0,\pi).

Show answer
−1-1

xx is constant, product rule in yy: fy=xexysin⁡y+exycos⁡yf_y = xe^{xy}\sin y+e^{xy}\cos y.
At (0,π)(0,\pi): 0+e0cos⁡π=−10+e^0\cos\pi = -1.

Question 3easy

Let f(x,y)=ln⁡(x2+y2)f(x,y) = \ln(x^2+y^2). Find fx(1,1)f_x(1,1).

Show answer
11

fx=2xx2+y2f_x = \dfrac{2x}{x^2+y^2}. At (1,1)(1,1): 22=1\dfrac{2}{2} = 1.

Question 4medium

Let f(x,y)=x2y3+sin⁡(xy)f(x,y) = x^2y^3+\sin(xy). Find fxy(1,0)f_{xy}(1,0).

Show answer
11

fx=2xy3+ycos⁡(xy)f_x = 2xy^3+y\cos(xy). Now with respect to yy: fxy=6xy2+cos⁡(xy)−xysin⁡(xy)f_{xy} = 6xy^2+\cos(xy)-xy\sin(xy).
At (1,0)(1,0): 0+1−0=10+1-0 = 1.

Question 5medium

Let f(x,y)=xyf(x,y) = x^y (x>0x>0). Find fx(2,3)f_x(2,3) and fy(2,3)f_y(2,3).

Show answer
fx=12f_x = 12, fy=8ln⁡2f_y = 8\ln2

With respect to xx, yy is a constant exponent, power rule: fx=yxy−1f_x = yx^{y-1}, at (2,3)(2,3): 3⋅4=123\cdot4 = 12.
With respect to yy, the base is constant, exponential rule: fy=xyln⁡xf_y = x^y\ln x, at (2,3)(2,3): 8ln⁡2≈5.5458\ln2\approx5.545.

Question 6easy

Does u(x,y)=x2−y2+2xyu(x,y) = x^2-y^2+2xy satisfy Laplace's equation uxx+uyy=0u_{xx}+u_{yy}=0?

Show answer
Yes

ux=2x+2yu_x = 2x+2y, uxx=2u_{xx} = 2. uy=−2y+2xu_y = -2y+2x, uyy=−2u_{yy} = -2.uxx+uyy=2−2=0u_{xx}+u_{yy} = 2-2 = 0. The function is harmonic.

Question 7medium

Let z=x2yz = x^2y with x=cos⁡tx = \cos t, y=sin⁡ty = \sin t. Find dzdt\dfrac{dz}{dt} at t=π/4t = \pi/4.

Show answer
−2/4-\sqrt2/4

dzdt=zxdxdt+zydydt=2xy(−sin⁡t)+x2cos⁡t\dfrac{dz}{dt} = z_x\dfrac{dx}{dt}+z_y\dfrac{dy}{dt} = 2xy(-\sin t)+x^2\cos t.t=π/4t = \pi/4: x=y=22x = y = \frac{\sqrt2}{2}. 2⋅12⋅(−22)+12⋅22=−22+24=−242\cdot\frac12\cdot\left(-\frac{\sqrt2}{2}\right)+\frac12\cdot\frac{\sqrt2}{2} = -\frac{\sqrt2}{2}+\frac{\sqrt2}{4} = -\frac{\sqrt2}{4}.

Question 8medium

Let z=exyz = e^{x}y with x=stx = st, y=s+ty = s+t. Find ∂z∂s\dfrac{\partial z}{\partial s} at (s,t)=(1,0)(s,t) = (1,0).

Show answer
11

∂z∂s=zx∂x∂s+zy∂y∂s=exy⋅t+ex⋅1\dfrac{\partial z}{\partial s} = z_x\dfrac{\partial x}{\partial s}+z_y\dfrac{\partial y}{\partial s} = e^xy\cdot t+e^x\cdot1.(s,t)=(1,0)(s,t) = (1,0): x=0x = 0, y=1y = 1. 1⋅1⋅0+1=11\cdot1\cdot0+1 = 1.

Question 9medium

Find dydx\dfrac{dy}{dx} at (1,1)(1,1) if x2+xy+y3=3x^2+xy+y^3 = 3.

Show answer
−3/4-3/4

F(x,y)=x2+xy+y3−3F(x,y) = x^2+xy+y^3-3. dydx=−FxFy=−2x+yx+3y2\dfrac{dy}{dx} = -\dfrac{F_x}{F_y} = -\dfrac{2x+y}{x+3y^2}.
At (1,1)(1,1): −34-\dfrac{3}{4}.

Question 10hard

If xz+y2z3=2xz+y^2z^3 = 2 defines zz as a function of xx and yy, find ∂z∂x\dfrac{\partial z}{\partial x} at (1,1,1)(1,1,1).

Show answer
−1/4-1/4

F=xz+y2z3−2F = xz+y^2z^3-2. ∂z∂x=−FxFz=−zx+3y2z2\dfrac{\partial z}{\partial x} = -\dfrac{F_x}{F_z} = -\dfrac{z}{x+3y^2z^2}.
At (1,1,1)(1,1,1): −11+3=−14-\dfrac{1}{1+3} = -\dfrac14.

Question 11hard

The radius of a cylinder increases at 0.10.1 cm/s and its height decreases at 0.20.2 cm/s. How fast is the volume changing when r=5r=5 cm and h=10h=10 cm?

Show answer
5π≈15.715\pi\approx15.71 cm3^3/s

V=πr2hV = \pi r^2h. Chain rule: dVdt=Vrdrdt+Vhdhdt=2πrh⋅r′+πr2⋅h′\dfrac{dV}{dt} = V_r\dfrac{dr}{dt}+V_h\dfrac{dh}{dt} = 2\pi rh\cdot r'+\pi r^2\cdot h'.2π(5)(10)(0.1)+π(25)(−0.2)=10π−5π=5π2\pi(5)(10)(0.1)+\pi(25)(-0.2) = 10\pi-5\pi = 5\pi. Positive: the volume is increasing.

Question 12medium

Let f(x,y)=xey+x2y3f(x,y) = xe^y+x^2y^3. Find fyx(1,1)f_{yx}(1,1) and verify it equals fxy(1,1)f_{xy}(1,1).

Show answer
e+6e+6

fy=xey+3x2y2f_y = xe^y+3x^2y^2, then with respect to xx: fyx=ey+6xy2f_{yx} = e^y+6xy^2. At (1,1)(1,1): e+6e+6.
The other order: fx=ey+2xy3f_x = e^y+2xy^3, fxy=ey+6xy2f_{xy} = e^y+6xy^2, the same. Clairaut's theorem: if the derivatives are continuous, the order does not matter.

Verification: All partial derivatives were checked with central differences, mixed derivatives with nested central differences, chain rule results against the direct numerical derivative of the composite function, and implicit derivatives against the difference quotient of z(x) solved with Newton's method in node (verify/MAT1052/09.mjs).

Review card

f_x: hold y CONSTANT, differentiate with respect to x. f_y: hold x constant Notation: f_x = ∂f/∂x. f_xy = (f_x)_y (first x then y) Clairaut: if the derivatives are continuous f_xy = f_yx x^y: ∂/∂x = y x^(y-1), ∂/∂y = x^y ln x Chain (1 parameter): dz/dt = z_x x'(t) + z_y y'(t) Chain (2 parameters): ∂z/∂s = z_x x_s + z_y y_s Tree: for EVERY path from z to t multiply the derivatives, add the paths Implicit: F(x,y)=0 → dy/dx = -F_x/F_y F(x,y,z)=0 → ∂z/∂x = -F_x/F_z, ∂z/∂y = -F_y/F_z (MINUS!) Laplace: u_xx + u_yy = 0 Plug in the values last; first find the general derivative