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โ0limโhf(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โfโdtdxโ+โyโfโdtdyโ=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โ0โhf(x+heiโ)โf(x)โ |
| Mixed partial (Clairaut) | fxyโ=fyxโ (if continuous) |
| Chain rule (1 dep) | dtdzโ=โxโfโdtdxโ+โyโfโdtdyโ |
| 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โzโdtdxโ+โyโzโdtdyโ=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