Quiz 2

Multivariable Functions & Partial Derivatives

1379 words
7 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Multivariable Functions & Partial Derivatives ## 🎯 Learning Objectives After this topic you will be able to: - Visualise functions $f: \mathbb{R}^n \to \mathbb{R}$ as surfaces, contour maps, and colour plots - Compute partial derivatives of any order - Interpret partial derivatives as slopes in coordinate directi...

Multivariable Functions & Partial Derivatives

🎯 Learning Objectives

After this topic you will be able to:
  • Visualise functions f:RnRf: \mathbb{R}^n \to \mathbb{R} as surfaces, contour maps, and colour plots
  • Compute partial derivatives of any order
  • Interpret partial derivatives as slopes in coordinate directions
  • Use the chain rule for multivariable functions
  • Compute partial derivatives of implicit functions

📋 Prerequisites

  • Single-variable calculus (BSMA1001) — derivatives, chain rule
  • The transition from 1D to nnD is the key leap in this course

1. Intuition: From Curves to Surfaces

A single-variable function f(x)f(x) gives a curve in R2\mathbb{R}^2. A multivariable function f(x,y)f(x,y) gives a surface in R3\mathbb{R}^3. (Diagram)

1.1 Ways to Visualise f(x,y)f(x,y)

MethodDescriptionExample f(x,y)=x2+y2f(x,y) = x^2 + y^2
3D surface plotPlot z=f(x,y)z = f(x,y) as a surfaceParaboloid
Contour plotLevel curves f(x,y)=cf(x,y) = cConcentric circles
Colour mapColour pixels by function valueHeat map

2. Partial Derivatives

2.1 Definition

Definition (Partial Derivative). The partial derivative of f(x1,,xn)f(x_1, \dots, x_n) with respect to xix_i is:
>fxi=limh0f(x1,,xi+h,,xn)f(x1,,xn)h>> \frac{\partial f}{\partial x_i} = \lim_{h \to 0} \frac{f(x_1, \dots, x_i + h, \dots, x_n) - f(x_1, \dots, x_n)}{h} >
To compute: treat all variables except xix_i as constants, then differentiate normally.
Example 1: Partial derivatives of f(x,y)=x2y+y3f(x,y) = x^2y + y^3
fx=2xy\frac{\partial f}{\partial x} = 2xy (treat yy as constant) fy=x2+3y2\frac{\partial f}{\partial y} = x^2 + 3y^2 (treat xx as constant) Example 2: Partial derivatives of f(x,y,z)=exysin(z)f(x,y,z) = e^{xy}\sin(z)
fx=yexysin(z)\frac{\partial f}{\partial x} = ye^{xy}\sin(z) fy=xexysin(z)\frac{\partial f}{\partial y} = xe^{xy}\sin(z) fz=exycos(z)\frac{\partial f}{\partial z} = e^{xy}\cos(z)

2.2 Geometric Interpretation

fx(a,b)\frac{\partial f}{\partial x}(a,b) is the slope of the surface z=f(x,y)z = f(x,y) at (a,b)(a,b) in the xx-direction (holding yy fixed at bb). (Diagram)

3. Higher-Order Partial Derivatives

Definition (Second partial derivatives).
>fxx=2fx2=x(fx)>> f_{xx} = \frac{\partial^2 f}{\partial x^2} = \frac{\partial}{\partial x}\left(\frac{\partial f}{\partial x}\right) >
>fxy=2fyx=y(fx)>> f_{xy} = \frac{\partial^2 f}{\partial y \partial x} = \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial x}\right) >
Similarly fyxf_{yx} and fyyf_{yy}.

3.1 Clairaut's Theorem (Equality of Mixed Partials)

Theorem (Clairaut). If fxyf_{xy} and fyxf_{yx} are continuous at a point, then:
>fxy=fyx>> f_{xy} = f_{yx} >
Order of mixed partials doesn't matter for "nice" functions (most functions you'll encounter).
Example 3: Higher-order partials
f(x,y)=x3y2+x2yf(x,y) = x^3y^2 + x^2y
fx=3x2y2+2xyf_x = 3x^2y^2 + 2xy fy=2x3y+x2f_y = 2x^3y + x^2
fxx=6xy2+2yf_{xx} = 6xy^2 + 2y fyy=2x3f_{yy} = 2x^3 fxy=6x2y+2xf_{xy} = 6x^2y + 2x fyx=6x2y+2xf_{yx} = 6x^2y + 2x (same as fxyf_{xy} ✓)

4. The Chain Rule

4.1 One Independent Variable

If z=f(x,y)z = f(x,y) and x=x(t)x = x(t), y=y(t)y = y(t), then:
dzdt=fxdxdt+fydydt\frac{dz}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt}

4.2 Multiple Independent Variables

If z=f(x,y)z = f(x,y) and x=x(s,t)x = x(s,t), y=y(s,t)y = y(s,t), then:
zs=fxxs+fyys\frac{\partial z}{\partial s} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial s} zt=fxxt+fyyt\frac{\partial z}{\partial t} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial t} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial t}
Example 4: Chain rule
f(x,y)=x2+y2f(x,y) = x^2 + y^2, x=t2x = t^2, y=ety = e^t.
dfdt=fxdxdt+fydydt=2x2t+2yet=4xt+2yet\frac{df}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt} = 2x \cdot 2t + 2y \cdot e^t = 4xt + 2ye^t.
Substitute: x=t2x = t^2, y=ety = e^t: dfdt=4t3+2e2t\frac{df}{dt} = 4t^3 + 2e^{2t}.
Direct check: f(t)=t4+e2tf(t) = t^4 + e^{2t}, dfdt=4t3+2e2t\frac{df}{dt} = 4t^3 + 2e^{2t}

5. Edge Cases & Gotchas

SituationWhat Happens
** ff not continuous at a point**Partial derivatives may not exist
** fxyfyxf_{xy} \neq f_{yx} **Possible for pathological functions; Clairaut's theorem requires continuity
**Point where fx=fy=0f_x = f_y = 0 **Critical point (potential local min, max, or saddle)

6. Common Pitfalls

❌ Pitfall 1: Forgetting which variable is held constant

x(x2+xy+y2)=2x+y\frac{\partial}{\partial x}(x^2 + xy + y^2) = 2x + y — the yy in y2y^2 is constant, so derivative is 0. The yy in xyxy is constant, so derivative is yy.

❌ Pitfall 2: Confusing fxyf_{xy} with 2fxy\frac{\partial^2 f}{\partial x \partial y}

fxy=y(fx)f_{xy} = \frac{\partial}{\partial y}(\frac{\partial f}{\partial x}), so it's differentiate with respect to xx first, then yy. But by Clairaut, order often doesn't matter.

❌ Pitfall 3: Applying chain rule with wrong dependency tree

Draw a dependency tree: if ff depends on x,yx,y, which depend on s,ts,t, the chain rule has two terms.

7. Formula Summary Table

ConceptFormula
Partial derivativefxi=limh0f(x+hei)f(x)h\frac{\partial f}{\partial x_i} = \lim_{h\to0} \frac{f(x+he_i)-f(x)}{h}
Mixed partial (Clairaut)fxy=fyxf_{xy} = f_{yx} (if continuous)
Chain rule (1 dep)dzdt=fxdxdt+fydydt\frac{dz}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt}
Chain rule (multi)zs=fxxs+fyys\frac{\partial z}{\partial s} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial s}

8. 📝 Practice Questions

Q1: Compute partial derivatives
f(x,y)=sin(xy)+xeyf(x,y) = \sin(xy) + xe^y. Find fxf_x and fyf_y.
Solution: fx=ycos(xy)+eyf_x = y\cos(xy) + e^y (treat yy constant) fy=xcos(xy)+xeyf_y = x\cos(xy) + xe^y (treat xx constant) Q2: Second partials
f(x,y)=ln(x2+y2)f(x,y) = \ln(x^2 + y^2). Find fxxf_{xx}, fxyf_{xy}, fyxf_{yx}, fyyf_{yy}.
Solution: fx=2xx2+y2f_x = \frac{2x}{x^2+y^2}, fy=2yx2+y2f_y = \frac{2y}{x^2+y^2}. fxx=2(x2+y2)2x(2x)(x2+y2)2=2(y2x2)(x2+y2)2f_{xx} = \frac{2(x^2+y^2) - 2x(2x)}{(x^2+y^2)^2} = \frac{2(y^2 - x^2)}{(x^2+y^2)^2}. fxy=2x(2y)(x2+y2)2=4xy(x2+y2)2f_{xy} = \frac{-2x(2y)}{(x^2+y^2)^2} = \frac{-4xy}{(x^2+y^2)^2}. fyx=2y(2x)(x2+y2)2=4xy(x2+y2)2f_{yx} = \frac{-2y(2x)}{(x^2+y^2)^2} = \frac{-4xy}{(x^2+y^2)^2} (same ✓). fyy=2(x2+y2)2y(2y)(x2+y2)2=2(x2y2)(x2+y2)2f_{yy} = \frac{2(x^2+y^2) - 2y(2y)}{(x^2+y^2)^2} = \frac{2(x^2 - y^2)}{(x^2+y^2)^2}. Q3: Chain rule
z=exyz = e^{xy}, x=costx = \cos t, y=sinty = \sin t. Find dzdt\frac{dz}{dt}.
Solution: dzdt=zxdxdt+zydydt=yexy(sint)+xexy(cost)\frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt} = ye^{xy}(-\sin t) + xe^{xy}(\cos t). =exy(ysint+xcost)=ecostsint(sin2t+cos2t)=ecostsintcos(2t)= e^{xy}(-y\sin t + x\cos t) = e^{\cos t\sin t}(-\sin^2 t + \cos^2 t) = e^{\cos t\sin t}\cos(2t). Q4: Verification of Clairaut
Verify fxy=fyxf_{xy} = f_{yx} for f(x,y)=tan1(y/x)f(x,y) = \tan^{-1}(y/x).
Solution: fx=yx2+y2f_x = \frac{-y}{x^2+y^2}, fy=xx2+y2f_y = \frac{x}{x^2+y^2}. fxy=(x2+y2)+y(2y)(x2+y2)2=x2y2+2y2(x2+y2)2=y2x2(x2+y2)2f_{xy} = \frac{-(x^2+y^2) + y(2y)}{(x^2+y^2)^2} = \frac{-x^2 - y^2 + 2y^2}{(x^2+y^2)^2} = \frac{y^2 - x^2}{(x^2+y^2)^2}. fyx=(x2+y2)x(2x)(x2+y2)2=x2+y22x2(x2+y2)2=y2x2(x2+y2)2f_{yx} = \frac{(x^2+y^2) - x(2x)}{(x^2+y^2)^2} = \frac{x^2 + y^2 - 2x^2}{(x^2+y^2)^2} = \frac{y^2 - x^2}{(x^2+y^2)^2}. Equal ✓. Q5: Implicit differentiation
If x2+y2+z2=1x^2 + y^2 + z^2 = 1, find zx\frac{\partial z}{\partial x}.
Solution: Differentiate both sides w.r.t. xx, treating zz as function of x,yx,y: 2x+0+2zzx=0zx=xz2x + 0 + 2z \frac{\partial z}{\partial x} = 0 \Rightarrow \frac{\partial z}{\partial x} = -\frac{x}{z} (for z0z \neq 0). Q6: Tangent plane equation
Find the tangent plane to z=x2+y2z = x^2 + y^2 at (1,2,5)(1,2,5).
Solution: z0=5z_0 = 5, fx(1,2)=2f_x(1,2) = 2, fy(1,2)=4f_y(1,2) = 4. Tangent plane: z5=2(x1)+4(y2)z - 5 = 2(x-1) + 4(y-2), or z=2x+4y5z = 2x + 4y - 5. Q7: Linear approximation
Approximate f(1.1,1.9)f(1.1, 1.9) for f(x,y)=x2yf(x,y) = x^2y using linearisation at (1,2)(1,2).
Solution: f(1,2)=2f(1,2) = 2, fx=2xyf_x = 2xy, fx(1,2)=4f_x(1,2) = 4, fy=x2f_y = x^2, fy(1,2)=1f_y(1,2) = 1. L(x,y)=2+4(x1)+1(y2)=4x+y4L(x,y) = 2 + 4(x-1) + 1(y-2) = 4x + y - 4. L(1.1,1.9)=4(1.1)+1.94=4.4+1.94=2.3L(1.1, 1.9) = 4(1.1) + 1.9 - 4 = 4.4 + 1.9 - 4 = 2.3. Actual: f(1.1,1.9)=(1.1)2(1.9)=1.21×1.9=2.299f(1.1, 1.9) = (1.1)^2(1.9) = 1.21 \times 1.9 = 2.299. Close! Q8: 3-variable function partials
f(x,y,z)=xyz+xyf(x,y,z) = xyz + \frac{x}{y}. Find fxf_x, fyf_y, fzf_z.
Solution: fx=yz+1yf_x = yz + \frac{1}{y} fy=xzxy2f_y = xz - \frac{x}{y^2} fz=xyf_z = xy Q9: Partial differential equation
Show f(x,y)=exsinyf(x,y) = e^{-x}\sin y satisfies Laplace's equation fxx+fyy=0f_{xx} + f_{yy} = 0.
Solution: fx=exsinyf_x = -e^{-x}\sin y, fxx=exsinyf_{xx} = e^{-x}\sin y. fy=excosyf_y = e^{-x}\cos y, fyy=exsinyf_{yy} = -e^{-x}\sin y. fxx+fyy=exsinyexsiny=0f_{xx} + f_{yy} = e^{-x}\sin y - e^{-x}\sin y = 0 ✓. Q10: Wave equation
Show u(x,t)=sin(xat)u(x,t) = \sin(x-at) satisfies the wave equation utt=a2uxxu_{tt} = a^2 u_{xx}.
Solution: ux=cos(xat)u_x = \cos(x-at), uxx=sin(xat)u_{xx} = -\sin(x-at). ut=acos(xat)u_t = -a\cos(x-at), utt=a2sin(xat)=a2(sin(xat))=a2uxxu_{tt} = -a^2\sin(x-at) = a^2(-\sin(x-at)) = a^2 u_{xx} ✓.

🔗 Cross-References

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.