Level set#Level sets versus the gradient
{{Short description|Subset of a function's domain on which its value is equal}}
{{for|the computational technique|Level-set method}}
{{redirect|Level surface|the application to force fields|Equipotential surface|water level surfaces|Equigeopotential}}
{{Use American English|date = April 2019}}
{{multiple image
|align=right
|width=140
|image1=Level sets linear function 2d.svg
|caption1=Points at constant slices of {{math|1=x{{sub|2}} = f (x{{sub|1}})}}.
|image2=Level sets linear function 3d.svg
|caption2=Lines at constant slices of {{math|1=x{{sub|3}} = f (x{{sub|1}}, x{{sub|2}})}}.
|image3=Level sets linear function 4d.svg
|caption3=Planes at constant slices of {{math|1=x{{sub|4}} = f (x{{sub|1}}, x{{sub|2}}, x{{sub|3}})}}.
|footer={{math|(n − 1)}}-dimensional level sets for functions of the form {{math|1=f (x{{sub|1}}, x{{sub|2}}, …, x{{sub|n}}) = a{{sub|1}}x{{sub|1}} + a{{sub|2}}x{{sub|2}} + ⋯ + a{{sub|n}}x{{sub|n}}}} where {{math|a{{sub|1}}, a{{sub|2}}, …, a{{sub|n}}}} are constants, in {{math|(n + 1)}}-dimensional Euclidean space, for {{math|1=n = 1, 2, 3}}.}}
{{multiple image
|width=140
|align=right
|image1=Level sets non-linear function 2d.svg
|caption1=Points at constant slices of {{math|1=x{{sub|2}} = f (x{{sub|1}})}}.
|image2=Level sets non-linear function 3d.svg
|caption2=Contour curves at constant slices of {{math|1=x{{sub|3}} = f (x{{sub|1}}, x{{sub|2}})}}.
|image3=Level sets non-linear function 4d.svg
|caption3=Curved surfaces at constant slices of {{math|1=x{{sub|4}} = f (x{{sub|1}}, x{{sub|2}}, x{{sub|3}})}}.
|footer={{math|(n − 1)}}-dimensional level sets of non-linear functions {{math|f (x{{sub|1}}, x{{sub|2}}, …, x{{sub|n}}}}) in {{math|(n + 1)}}-dimensional Euclidean space, for {{math|1=n = 1, 2, 3}}.}}
In mathematics, a level set of a real-valued function {{mvar|f}} of {{mvar|n}} real variables is a set where the function takes on a given constant value {{mvar|c}}, that is:
:
When the number of independent variables is two, a level set is called a level curve, also known as contour line or isoline; so a level curve is the set of all real-valued solutions of an equation in two variables {{math|x{{sub|1}}}} and {{math|x{{sub|2}}}}. When {{math|1=n = 3}}, a level set is called a level surface (or isosurface); so a level surface is the set of all real-valued roots of an equation in three variables {{math|x{{sub|1}}}}, {{math|x{{sub|2}}}} and {{math|x{{sub|3}}}}. For higher values of {{mvar|n}}, the level set is a level hypersurface, the set of all real-valued roots of an equation in {{math|n > 3}} variables (a higher-dimensional hypersurface).
A level set is a special case of a fiber.
Alternative names
Image:trefoil knot level curves.png 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.
Examples
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 a circle. For example, , because . Geometrically, this means that the point lies on the circle of radius 5 centered at the origin. More generally, a sphere in a metric space with radius centered at can be defined as the level set .
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 .
File:Himmelblau contour.svg{{cite journal|last=Simionescu|first=P.A.|title=Some Advancements to Visualizing Constrained Functions and Inequalities of Two Variables|journal= Journal of Computing and Information Science in Engineering|volume=11|issue=1|year=2011|doi=10.1115/1.3570770}}]]
Level sets versus the gradient
:Theorem: If the function {{mvar|f}} is differentiable, the gradient of {{mvar|f}} at a point is either zero, or perpendicular to the level set of {{mvar|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 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 if {{mvar|f}} is differentiable, a level set is a hypersurface and a manifold outside the critical points of {{mvar|f}}. At a critical point, a level set may be reduced to a point (for example at a local extremum of {{mvar|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 (or, alternatively, an upper level set of f). And a strict superlevel set of f is
:
Sublevel sets are important in minimization theory. By Weierstrass's theorem, the boundness of some non-empty sublevel set and the lower-semicontinuity of the function implies that a function attains its minimum. The convexity of all the sublevel sets characterizes quasiconvex functions.{{cite journal|last=Kiwiel|first=Krzysztof C.|title=Convergence and efficiency of subgradient methods for quasiconvex minimization|journal=Mathematical Programming, Series A|publisher=Springer|location=Berlin, Heidelberg|issn=0025-5610|pages=1–25|volume=90|issue=1|doi=10.1007/PL00011414|year=2001|mr=1819784|s2cid=10043417}}