Engineering Mathematics · Calculus for ML
Multivariable Surfaces
In Engineering Mathematics because once a function has many inputs, its behavior is better imagined as a surface or landscape than as a single curve.
Multivariable calculus needs geometric intuition. This topic reads a two-input function as a height surface, then uses levels and directional steps to interpret movement on that surface.
- Engineering Mathematics
- Medium level
- 4 concepts
1Many-input functions create landscapes
A function with several inputs no longer looks like a line on paper. It is better understood as a surface or landscape whose height records the function value above each input location.
That picture matters because gradients, ridges, flat regions, and contours all become geometric statements about the same object. Optimization language only becomes intuitive once the function is seen this way.
The surface picture places (1,2) higher than (2,1) because the second coordinate is weighted twice in x^2+2y^2.
Read a surface value
- Choose input pointPick coordinates in the input plane, such as (x,y).
- Evaluate functionCompute f(x,y) at that point.
- Read heightTreat the result as the surface height over that input.
Height on a simple bowl
For f(x,y)=x^2+2y^2, compute the surface height at (1,2) and at (2,1).
- f(1,2)1^2+2(2^2)=1+8=9
- f(2,1)2^2+2(1^2)=4+2=6
- Height comparison(1,2) is higher because 9>6
Pro tip. The ordered pair is not a data point label here; it is the surface coordinate where the height is evaluated.
For f(x,y)=2x^2+y^2, what is the height at (1,3)?
- 11
- 10
- 7
- 5
2(1)^2+3^2=2+9=11. The input point maps to a surface height.
2A level set keeps the height fixed
A level set collects all input points where the function has the same value. Instead of showing the full height surface, it slices the surface at one chosen height.
Contours are useful because moving along a level set does not change the function value, while crossing contours changes it. That distinction is central to reading optimization maps.
Figure. A level set keeps the function value fixed while x and y vary. Parallel contour lines are the static map of equal-height slices.
Check a level set
- Fix levelChoose the constant value c in f(x,y)=c.
- Test pointsEvaluate f at candidate points.
- Group equal valuesPoints with the same value sit on the same level set.
Read a level set with numbers
For f(x,y)=x^2+y^2, decide whether (1,2), (2,1), and (0,3) lie on the same level set.
- f(1,2)1^2+2^2=5
- f(2,1)2^2+1^2=5
- f(0,3)0^2+3^2=9
- Level-set reading(1,2) and (2,1) share level 5; (0,3) is on level 9
Pro tip. Equal height does not mean equal coordinates; it means the function value matches.
For f(x,y)=x^2+y^2, which points share a level set?
- (1,2) and (2,1)
- (1,2) and (0,2)
- (3,0) and (1,1)
- (0,0) and (1,0)
Both (1,2) and (2,1) give height 5, so they sit on the same level.
3A directional derivative predicts one chosen step
A gradient contains all coordinate sensitivities, but a directional derivative asks a narrower question: what happens if I step in this particular direction?
The answer is the dot product between the gradient and a unit direction vector. A negative value predicts local descent along that direction; zero predicts a locally level move.
The step travels left from (3,-1) on a bowl centered at (1,-1), so it moves downhill toward the center.
Predict along a direction
- Compute gradientFind \nabla f at the current point.
- Choose unit directionUse a direction vector with length 1.
- DotCompute \nabla f\cdot u to estimate change per unit step.
Directional step with explicit numbers
For f(x,y)=(x-1)^2+(y+1)^2, start at (3,-1). Use unit direction u=(-1,0) and a step length 0.25.
- \nabla f(x,y)(2(x-1), 2(y+1))
- \nabla f(3,-1)(4,0)
- Directional derivative \nabla f\cdot u(4,0)\cdot(-1,0)=-4
- Linear prediction for step 0.25f changes by about -4(0.25)=-1
- Exact check at (2.75,-1)(1.75)^2+0^2=3.0625 from starting value 4
Pro tip. The linear prediction says the loss should drop by about 1; the exact drop is 0.9375 because curvature appears over the finite step.
Coding lab. Predict and check one directional step runs in the app, with checks on your output.
Gradient is (6,8) and unit direction is (0.6,0.8). Directional derivative equals:
- 10
- 14
- 4.8
- 1
Dot the gradient with the unit direction: 6(0.6)+8(0.8)=3.6+6.4=10.
4Gradients cut across level sets
At a regular point, the gradient points across nearby level sets rather than along them. Moving along a contour keeps the height unchanged to first order, while moving with the gradient changes height fastest.
This explains why contour maps are useful for optimization. The local gradient tells which way crosses contours most aggressively, while tangent movement stays approximately level.
Figure. Gradients cut across nearby level sets because they point in the direction of fastest increase, not along a constant-height contour.
Compare two directions
- Find gradientCompute the gradient at the point.
- Test tangentDot the gradient with a candidate tangent direction.
- Test crossingDot the gradient with a crossing direction.
Level versus crossing movement
For f(x,y)=x^2+y^2 at (1,2), compare directions u_T=(2,-1)/\sqrt{5} and u_G=(1,2)/\sqrt{5}.
- \nabla f(1,2)(2,4)
- \nabla f\cdot u_T(2,4)\cdot(2,-1)/\sqrt{5}=(4-4)/\sqrt{5}=0
- \nabla f\cdot u_G(2,4)\cdot(1,2)/\sqrt{5}=10/\sqrt{5}=2\sqrt{5}
- Readingu_T is locally level; u_G crosses levels upward fastest among these two
Pro tip. A zero directional derivative means locally tangent to a level set, not globally constant forever.
At a point, gradient (2,4) and direction (2,-1) give dot product 0. What does that direction do locally?
- Moves along a level direction
- Moves steepest upward
- Moves steepest downward
- Cannot be interpreted
Zero first-order change means the direction is tangent to a level set locally.
Notes
- A scalar-valued function of two variables can be visualized as a height surface over the input plane.
- Level sets and contours show where the function value stays constant.
- A directional derivative estimates how the height changes when you step in a chosen direction.
Formulas
- A two-variable surface can be written as z = f(x, y).
- A level set has the form f(x, y) = c for a fixed value c.
- The directional derivative in unit direction u is grad f . u.
Exam traps & shortcuts
- Contour lines often explain optimization behavior more clearly than the full 3D surface picture.
- Before comparing two moves, check whether the direction vector is scaled consistently.
Reference tables
The same function can be read through several geometric lenses.
| Term | Meaning |
|---|---|
| Surface height | f(x,y) at a chosen input point |
| Level set | All points where f(x,y) has one fixed value |
| Directional derivative | Local change per unit step in a chosen direction |
| Gradient | Direction of fastest local increase and normal to the level set |
Recap
Surface intuition supports the later optimization topics.
- Landscape
- A multivariable function is naturally read as a height landscape over its input coordinates.
- Contours
- Level sets show equal-value regions and help interpret movement on the surface.
- Direction
- A directional derivative predicts the local height change for one chosen step.
- Gradient
- The gradient crosses level sets; tangent directions have zero first-order change.
Practise Multivariable Surfaces
Reading is free and needs no account. Practice, mocks and progress live in the app.
- A 5-question practice set that ends the chapter
- 4 quick checks with worked explanations
- Timed mocks scored with the real marking scheme
- Readiness tracked per topic, kept on your device