Inmathematics, alevel set of areal-valued functionf ofnreal variables is aset where the function takes on a givenconstant valuec, that is:
When the number of independent variables is two, a level set is called alevel curve, also known ascontour line orisoline; so a levelcurve is the set of all real-valued solutions of an equation in two variablesx1 andx2. Whenn = 3, a level set is called alevel surface (orisosurface); so a levelsurface is the set of all real-valued roots of an equation in three variablesx1,x2 andx3. For higher values ofn, the level set is alevel hypersurface, the set of all real-valued roots of an equation inn > 3 variables (ahigher-dimensionalhypersurface).
A level set is a special case of afiber.

Level sets show up in many applications, often under different names. For example, animplicit curve is a level curve, which is considered independently of its neighbor curves, emphasizing that such a curve is defined by animplicit equation. Analogously, a level surface is sometimes called an implicit surface or anisosurface.
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 asisobar,isotherm,isogon,isochrone,isoquant andindifference curve.
Consider the 2-dimensional Euclidean distance: A level set of this function consists of those points that lie at a distance of from the origin, that make acircle. For example,, because. Geometrically, this means that the point lies on the circle of radius 5 centered at the origin. More generally, asphere in ametric space with radius centered at can be defined as the level set.
A second example is the plot ofHimmelblau'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.


To understand what this means, imagine that two hikers are at the same location on a mountain. One of them is bold, and decides to go in the direction where the slope is steepest. The other one is more cautious and does not want to either climb or descend, choosing a path which stays 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 iff is differentiable, a level set is ahypersurface and amanifold outside thecritical points off. At a critical point, a level set may be reduced to a point (for example at alocal extremum off ) or may have asingularity such as aself-intersection point or acusp.
A set of the form
is called asublevel set off (or, alternatively, alower level set ortrench off). Astrict sublevel set off is
Similarly
is called asuperlevel set off (or, alternatively, anupper level set off). And astrict superlevel set off is
Sublevel sets are important inminimization theory. ByWeierstrass's theorem, theboundness of somenon-empty sublevel set and the lower-semicontinuity of the function implies that a function attains its minimum. Theconvexity of all the sublevel sets characterizesquasiconvex functions.[2]