Multivariable Functions & Partial Derivatives
1379 words
7 min read
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:Rn→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 nD is the key leap in this course
1. Intuition: From Curves to Surfaces
A single-variable function f(x) gives a curve in R2. A multivariable function f(x,y) gives a surface in R3.
(Diagram)
1.1 Ways to Visualise f(x,y)
| Method | Description | Example f(x,y)=x2+y2 |
|---|---|---|
| 3D surface plot | Plot z=f(x,y) as a surface | Paraboloid |
| Contour plot | Level curves f(x,y)=c | Concentric circles |
| Colour map | Colour pixels by function value | Heat map |
2. Partial Derivatives
2.1 Definition
>∂xi∂f=h→0limhf(x1,…,xi+h,…,xn)−f(x1,…,xn)>Definition (Partial Derivative). The partial derivative of f(x1,…,xn) with respect to xi is:
To compute: treat all variables except xi as constants, then differentiate normally.
Example 1: Partial derivatives of f(x,y)=x2y+y3∂x∂f=2xy (treat y as constant) ∂y∂f=x2+3y2 (treat x as constant) Example 2: Partial derivatives of f(x,y,z)=exysin(z)∂x∂f=yexysin(z) ∂y∂f=xexysin(z) ∂z∂f=exycos(z)
2.2 Geometric Interpretation
∂x∂f(a,b) is the slope of the surface z=f(x,y) at (a,b) in the x-direction (holding y fixed at b).
(Diagram)
3. Higher-Order Partial Derivatives
>fxx=∂x2∂2f=∂x∂(∂x∂f)>Definition (Second partial derivatives).
>fxy=∂y∂x∂2f=∂y∂(∂x∂f)>
Similarly fyx and fyy.
3.1 Clairaut's Theorem (Equality of Mixed Partials)
>fxy=fyx>Theorem (Clairaut). If fxy and fyx are continuous at a point, then:
Order of mixed partials doesn't matter for "nice" functions (most functions you'll encounter).
Example 3: Higher-order partialsf(x,y)=x3y2+x2yfx=3x2y2+2xy fy=2x3y+x2fxx=6xy2+2y fyy=2x3 fxy=6x2y+2x fyx=6x2y+2x (same as fxy ✓)
4. The Chain Rule
4.1 One Independent Variable
If z=f(x,y) and x=x(t), y=y(t), then:
4.2 Multiple Independent Variables
If z=f(x,y) and x=x(s,t), y=y(s,t), then:
Example 4: Chain rulef(x,y)=x2+y2, x=t2, y=et.dtdf=∂x∂fdtdx+∂y∂fdtdy=2x⋅2t+2y⋅et=4xt+2yet.Substitute: x=t2, y=et: dtdf=4t3+2e2t.Direct check: f(t)=t4+e2t, dtdf=4t3+2e2t ✓
5. Edge Cases & Gotchas
| Situation | What Happens |
|---|---|
| ** f not continuous at a point** | Partial derivatives may not exist |
| ** fxy=fyx ** | Possible for pathological functions; Clairaut's theorem requires continuity |
| **Point where fx=fy=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 — the y in y2 is constant, so derivative is 0. The y in xy is constant, so derivative is y.
❌ Pitfall 2: Confusing fxy with ∂x∂y∂2f
fxy=∂y∂(∂x∂f), so it's differentiate with respect to x first, then y. But by Clairaut, order often doesn't matter.
❌ Pitfall 3: Applying chain rule with wrong dependency tree
Draw a dependency tree: if f depends on x,y, which depend on s,t, the chain rule has two terms.
7. Formula Summary Table
| Concept | Formula |
|---|---|
| Partial derivative | ∂xi∂f=limh→0hf(x+hei)−f(x) |
| Mixed partial (Clairaut) | fxy=fyx (if continuous) |
| Chain rule (1 dep) | dtdz=∂x∂fdtdx+∂y∂fdtdy |
| Chain rule (multi) | ∂s∂z=∂x∂f∂s∂x+∂y∂f∂s∂y |
8. 📝 Practice Questions
Q1: Compute partial derivativesf(x,y)=sin(xy)+xey. Find fx and fy.Solution: fx=ycos(xy)+ey (treat y constant) fy=xcos(xy)+xey (treat x constant) Q2: Second partialsf(x,y)=ln(x2+y2). Find fxx, fxy, fyx, fyy.Solution: fx=x2+y22x, fy=x2+y22y. fxx=(x2+y2)22(x2+y2)−2x(2x)=(x2+y2)22(y2−x2). fxy=(x2+y2)2−2x(2y)=(x2+y2)2−4xy. fyx=(x2+y2)2−2y(2x)=(x2+y2)2−4xy (same ✓). fyy=(x2+y2)22(x2+y2)−2y(2y)=(x2+y2)22(x2−y2). Q3: Chain rulez=exy, x=cost, y=sint. Find dtdz.Solution: dtdz=∂x∂zdtdx+∂y∂zdtdy=yexy(−sint)+xexy(cost). =exy(−ysint+xcost)=ecostsint(−sin2t+cos2t)=ecostsintcos(2t). Q4: Verification of ClairautVerify fxy=fyx for f(x,y)=tan−1(y/x).Solution: fx=x2+y2−y, fy=x2+y2x. fxy=(x2+y2)2−(x2+y2)+y(2y)=(x2+y2)2−x2−y2+2y2=(x2+y2)2y2−x2. fyx=(x2+y2)2(x2+y2)−x(2x)=(x2+y2)2x2+y2−2x2=(x2+y2)2y2−x2. Equal ✓. Q5: Implicit differentiationIf x2+y2+z2=1, find ∂x∂z.Solution: Differentiate both sides w.r.t. x, treating z as function of x,y: 2x+0+2z∂x∂z=0⇒∂x∂z=−zx (for z=0). Q6: Tangent plane equationFind the tangent plane to z=x2+y2 at (1,2,5).Solution: z0=5, fx(1,2)=2, fy(1,2)=4. Tangent plane: z−5=2(x−1)+4(y−2), or z=2x+4y−5. Q7: Linear approximationApproximate f(1.1,1.9) for f(x,y)=x2y using linearisation at (1,2).Solution: f(1,2)=2, fx=2xy, fx(1,2)=4, fy=x2, fy(1,2)=1. L(x,y)=2+4(x−1)+1(y−2)=4x+y−4. L(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.299. Close! Q8: 3-variable function partialsf(x,y,z)=xyz+yx. Find fx, fy, fz.Solution: fx=yz+y1 fy=xz−y2x fz=xy Q9: Partial differential equationShow f(x,y)=e−xsiny satisfies Laplace's equation fxx+fyy=0.Solution: fx=−e−xsiny, fxx=e−xsiny. fy=e−xcosy, fyy=−e−xsiny. fxx+fyy=e−xsiny−e−xsiny=0 ✓. Q10: Wave equationShow u(x,t)=sin(x−at) satisfies the wave equation utt=a2uxx.Solution: ux=cos(x−at), uxx=−sin(x−at). ut=−acos(x−at), utt=−a2sin(x−at)=a2(−sin(x−at))=a2uxx ✓.
🔗 Cross-References
- Next topic: Limits & Continuity
- Week 10 (Gradient): ∇f collects all partial derivatives
- Week 11 (Hessian): H collects all second partials
- BSMA1001 (Maths 1): Single-variable derivatives
- BSCS3004 (Deep Learning): Backpropagation uses the chain rule extensively Join Discord Previous8.3 Orthogonal TransformationsNext9.2 Gradient & Directional Derivatives