# Level set

Points at constant slices of x2 = f(x1).
Lines at constant slices of x3 = f(x1, x2).
Planes at constant slices of x4 = f(x1, x2, x3).
(n − 1)-dimensional level sets for functions of the form f(x1, x2, ..., xn) = a1x1 + a2x2 + ... + anxn where a1, a2, ..., an are constants, in (n + 1)-dimensional Euclidean space, for n = 1, 2, 3.
Points at constant slices of x2 = f(x1).
Contour curves at constant slices of x3 = f(x1, x2).
Curved surfaces at constant slices of x4 = f(x1, x2, x3).
(n − 1)-dimensional level sets of non-linear functions f(x1, x2, ..., xn) in (n + 1)-dimensional Euclidean space, for n = 1, 2, 3.

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

${\displaystyle L_{c}(f)=\left\{(x_{1},\cdots ,x_{n})\,\mid \,f(x_{1},\cdots ,x_{n})=c\right\}~,}$

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 x1 and x2. 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 x1, x2 and x3, 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 namesEdit

Intersections of a co-ordinate function's level surfaces with a trefoil knot. Red curves are closest to the viewer, while yellow curves are farthest.

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.

## ExampleEdit

Log-spaced level curve plot of Himmelblau's function [1]

Given a specific radius r, the equation of a circle defines an isocontour:

${\displaystyle r^{2}=x^{2}+y^{2}.}$

If we choose ${\displaystyle r=5}$  then our isovalue is ${\displaystyle c=5^{2}=25.}$  All points (x,y) that evaluate to 25 constitute the isocontour. This means that they are members of the isocontour's level set. If a point evaluates to less than 25 the point is on the inside of the isocontour. If the result is greater than 25, it is on the outside.

A second example is the logarithmically spaced level curve plot of Himmelblau's function shown in the figure.

## Level sets versus the gradientEdit

Consider a function f whose graph looks like a hill. The blue curves are then the level sets. The red curves follow the direction of the gradient. In other words, the cautious hiker follows the blue paths, while the bold one the red paths.
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 one another.

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 setsEdit

A set of the form

${\displaystyle L_{c}^{-}(f)=\left\{(x_{1},\cdots ,x_{n})\,\mid \,f(x_{1},\cdots ,x_{n})\leq c\right\}}$

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

${\displaystyle L_{c}^{+}(f)=\left\{(x_{1},\cdots ,x_{n})\,\mid \,f(x_{1},\cdots ,x_{n})\geq c\right\}}$

is called a superlevel set of f.[2][3] 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]