In mathematics, a **level set** of a real-valued function *f* of *n* real variables is a set of the form

that is, a set where the function takes on a given constant value *c*.

When the number of variables is two, a level set is generically a curve, called a level curve, contour line, or isoline. So a level curve is the set of all real-valued solutions of an equation in two variables *x*_{1} and *x*_{2}. When *n* = 3, a level set is called a level surface (see also isosurface), and for higher values of *n* the level set is a level hypersurface. So a *level surface* is the set of all real-valued roots of an equation in three variables *x*_{1}, *x*_{2} and *x*_{3}, and a level hypersurface is the set of all real-valued roots of an equation in *n* (*n* > 3) variables.

A level set is a special case of a fiber.

## Alternative names

Level sets show up in many applications, often under different names.

For example, an implicit curve is a level curve, which is considered independently of its neighbor curves, emphasizing that such a curve is defined by an implicit equation. Analogously, a level surface is sometimes called an implicit surface or an isosurface.

The name isocontour is also used, which means a contour of equal height. In various application areas, isocontours have received specific names, which indicate often the nature of the values of the considered function, such as isobar, isotherm, isogon, isochrone, isoquant and indifference curve.

## Examples

Consider the 2-dimensional Euclidean distance:

A second example is the plot of Himmelblau's function shown in the figure to the right. Each curve shown is a level curve of the function, and they are spaced logarithmically: if a curve represents , the curve directly "within" represents , and the curve directly "outside" represents .

## Level sets versus the gradient

**Theorem:**If the function f is differentiable, the gradient of f at a point is either zero, or perpendicular to the level set of f at that point.

To understand what this means, imagine that two hikers are at the same location on a mountain. One of them is bold, and he decides to go in the direction where the slope is steepest. The other one is more cautious; he does not want to either climb or descend, choosing a path which will keep him at the same height. In our analogy, the above theorem says that the two hikers will depart in directions perpendicular to each other.

A consequence of this theorem (and its proof) is that if f is differentiable, a level set is a hypersurface and a manifold outside the critical points of f. At a critical point, a level set may be reduced to a point (for example at a local extremum of f ) or may have a singularity such as a self-intersection point or a cusp.

## Sublevel and superlevel sets

A set of the form

is called a **sublevel set** of *f* (or, alternatively, a **lower level set** or **trench** of *f*). A **strict sublevel** set of *f* is

Similarly

is called a **superlevel set** of *f*.^{[2]}^{[3]} And similarly a **strict superlevel set** of f is

Sublevel sets are important in minimization theory. The boundness of some non-empty sublevel set and the lower-semicontinuity of the function implies that a function attains its minimum, by Weierstrass's theorem. The convexity of all the sublevel sets characterizes quasiconvex functions.^{[4]}

## See also

## References

**^**Simionescu, P.A. (2011). "Some Advancements to Visualizing Constrained Functions and Inequalities of Two Variables".*Journal of Computing and Information Science in Engineering*.**11**(1). doi:10.1115/1.3570770.**^**Voitsekhovskii, M.I. (2001) [1994], "Level set",*Encyclopedia of Mathematics*, EMS Press**^**Weisstein, Eric W. "Level Set".*MathWorld*.**^**Kiwiel, Krzysztof C. (2001). "Convergence and efficiency of subgradient methods for quasiconvex minimization".*Mathematical Programming, Series A*. Berlin, Heidelberg: Springer.**90**(1): 1–25. doi:10.1007/PL00011414. ISSN 0025-5610. MR 1819784.