Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Maps of mountains
A hiking map can’t show height directly, because paper is flat. Instead it draws contour lines: each line joins points at the same height, such as 100 m, 200 m or 300 m. Where the lines crowd together, the ground is steep. Where they spread out, it’s gentle. A ring of rings is a hilltop or a hollow.
Height depends on two inputs, east–west and north–south position. A function with several inputs is a function of several variables. Each contour line is a level set: all the places where the function equals one value.
A Mars rover plans its drive on a “cost map”: a function of position that is high near rocks and steep slopes and low on safe ground. Planners read this map like contour lines, steering along low ground and away from the crowded high contours around hazards.
- 1. Contour lines packed close together mean the ground is…
- 2. All points on one contour line have the same…
- 3. Which is higher, the 200 m line or the 100 m line?
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.Notation and pictures
A function takes to a number. Its graph is a surface in 3-D. Its level sets are
| Level sets | Picture | |
|---|---|---|
| circles of radius | a bowl | |
| ellipses | an elongated bowl | |
| hyperbolas | a saddle | |
| hyperbolas | a saddle rotated 45° | |
| parallel lines | a tilted plane |
For three inputs, the level sets are surfaces, like the “isosurfaces” of temperature in a room. In dimensions, you can’t draw the function, but level sets still make sense.
- 1. f(x, y) = x² + y² at (3, 4)?
- 2. The level set x² + y² = 9 is a circle of radius…
- 3. The level sets of x² − y² are…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Limits and continuity need every direction
means gets close to however approaches, from every direction and along every curve. For , the line gives . That’s 0 along the axes and ½ along , so the limit at the origin does not exist.
Sublevel sets and convexity
The sublevel set is the region inside a contour. If is convex, every sublevel set is convex. The converse fails, and functions with convex sublevel sets are called quasi-convex. Non-convex losses like Himmelblau’s have sublevel sets made of separate islands. Those islands are the multiple minima that make optimization hard.
Where several-variable functions appear
| Field | Function |
|---|---|
| ML | loss over all weights; contour slices show the valleys optimizers must navigate |
| robotics | cost maps, potential fields, signed distance to obstacles |
| physics | temperature , potential energy, pressure fields |
| statistics | likelihoods and densities, e.g. a 2-D Gaussian with elliptical contours |
- 1. xy/(x² + y²) along y = x tends to…
- 2. Sublevel sets of a convex function are…
- 3. x² + 4y² = 4 crosses the y-axis at y = …
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.The precise definition, and a trap
iff for all there is with . Here the distance is any norm on ; they are all equivalent (A2.1-2).
Trap. tends to 0 along every straight line through the origin. Along the parabola , however, . So the limit doesn’t exist, even though every line suggests 0. One counterexample path settles non-existence. Proving existence needs an estimate valid in every direction, such as polar coordinates or a squeeze.
Proof: convex functions have convex sublevel sets
If and , convexity gives . ∎
When is a level set a nice curve?
If is smooth and its gradient (A3.2-3) is nonzero at a point of , the implicit function theorem says that near that point is a smooth curve (a surface, in higher dimensions). Where the gradient vanishes, at critical points, level sets can cross or collapse to a point. The 0-level of is an X.
Exercise 3.1: Show that xy/(x² + y²) is bounded even though it has no limit at 0
(from ), so . It is bounded but direction-dependent, so it has no limit.
- 1. xy²/(x² + y⁴) along x = y² →
- 2. Limits along all straight lines agree. Does the limit exist?
- 3. A level set may fail to be a smooth curve where…
Level 4: Expert
★★★★★ Expert⏱ 40 minResearchers: original papers and open problems.Signed distance fields
The signed distance function to an obstacle set is positive outside, zero on the boundary and negative inside. Its zero level set is the obstacle’s surface, and it satisfies (the eikonal equation). Motion planners like CHOMP (Ratliff et al., 2009) and TrajOpt push trajectories toward larger . Neural networks learn SDFs of whole scenes for mapping and grasping (DeepSDF, Park et al., 2019; iSDF, Ortiz et al., 2022).
More research uses of level sets
- Loss-landscape visualization. Plotting a 2-D slice through random, filter-normalized directions showed why skip connections make landscapes smoother (Li et al., 2018).
- Artificial potential fields (Khatib, 1986) navigate robots downhill on attractive-plus-repulsive functions, like the “robot cost map” in the demo. Spurious local minima, islands in the sublevel sets, are their known weakness.
- Level-set methods (Osher and Sethian, 1988) represent moving boundaries as the zero level set of an evolving function. They are used for fluid interfaces, image segmentation and shape optimization of aerospace structures.
- Probability. The contours of a 2-D Gaussian are ellipses set by the covariance (A2.3-3). Confidence regions in robot localization are drawn exactly this way.
References
- O. Khatib (1986). “Real-time obstacle avoidance for manipulators and mobile robots.” International Journal of Robotics Research, 5(1).
- S. Osher, J. Sethian (1988). “Fronts propagating with curvature-dependent speed.” Journal of Computational Physics, 79(1).
- N. Ratliff, M. Zucker, J. A. Bagnell, S. Srinivasa (2009). “CHOMP: Gradient optimization techniques for efficient motion planning.” ICRA.
- H. Li, Z. Xu, G. Taylor, C. Studer, T. Goldstein (2018). “Visualizing the loss landscape of neural nets.” NeurIPS.
- J. J. Park, P. Florence, J. Straub, R. Newcombe, S. Lovegrove (2019). “DeepSDF: Learning continuous signed distance functions for shape representation.” CVPR.
- J. Ortiz, A. Clegg, J. Dong, E. Sucar, D. Novotny, M. Zollhoefer, M. Mukadam (2022). “iSDF: Real-time neural signed distance fields for robot perception.” RSS.
- J. Stewart (2015). Calculus: Early Transcendentals, 8th ed. Chapter 14.