In mathematical analysis, **semicontinuity** (or **semi-continuity**) is a property of extended real-valued functions that is weaker than continuity. An extended real-valued function is **upper** (respectively, **lower**) **semicontinuous** at a point if, roughly speaking, the function values for arguments near are not much higher (respectively, lower) than

A function is continuous if and only if it is both upper and lower semicontinuous. If we take a continuous function and increase its value at a certain point to for some , then the result is upper semicontinuous; if we decrease its value to then the result is lower semicontinuous.

The notion of upper and lower semicontinuous function was first introduced and studied by René Baire in his thesis in 1899.^{[1]}

Assume throughout that is a topological space and is a function with values in the extended real numbers .

A function is called **upper semicontinuous at a point** if for every real there exists a neighborhood of such that for all .^{[2]}
Equivalently, is upper semicontinuous at if and only if

where lim sup is the limit superior of the function at the point .

A function is called **upper semicontinuous** if it satisfies any of the following equivalent conditions:^{[2]}

- (1) The function is upper semicontinuous at every point of its domain.
- (2) All sets with are open in , where .
- (3) All superlevel sets with are closed in .
- (4) The hypograph is closed in .
- (5) The function is continuous when the codomain is given the left order topology. This is just a restatement of condition (2) since the left order topology is generated by all the intervals .

A function is called **lower semicontinuous at a point** if for every real there exists a neighborhood of such that for all .
Equivalently, is lower semicontinuous at if and only if

where is the limit inferior of the function at point .

A function is called **lower semicontinuous** if it satisfies any of the following equivalent conditions:

- (1) The function is lower semicontinuous at every point of its domain.
- (2) All sets with are open in , where .
- (3) All sublevel sets with are closed in .
- (4) The epigraph is closed in .
- (5) The function is continuous when the codomain is given the right order topology. This is just a restatement of condition (2) since the right order topology is generated by all the intervals .

Consider the function piecewise defined by:

This function is upper semicontinuous at but not lower semicontinuous.

The floor function which returns the greatest integer less than or equal to a given real number is everywhere upper semicontinuous. Similarly, the ceiling function is lower semicontinuous.

Upper and lower semicontinuity bear no relation to continuity from the left or from the right for functions of a real variable. Semicontinuity is defined in terms of an ordering in the range of the functions, not in the domain.^{[3]} For example the function

is upper semicontinuous at while the function limits from the left or right at zero do not even exist.

If is a Euclidean space (or more generally, a metric space) and is the space of curves in (with the supremum distance ), then the length functional which assigns to each curve its length is lower semicontinuous.^{[4]} As an example, consider approximating the unit square diagonal by a staircase from below. The staircase always has length 2, while the diagonal line has only length .

Let be a measure space and let denote the set of positive measurable functions endowed with the topology of convergence in measure with respect to Then by Fatou's lemma the integral, seen as an operator from to is lower semicontinuous.

Unless specified otherwise, all functions below are from a topological space to the extended real numbers Several of the results hold for semicontinuity at a specific point, but for brevity they are only stated for semicontinuity over the whole domain.

- A function is continuous if and only if it is both upper and lower semicontinuous.
- The indicator function of a set (defined by if and if ) is upper semicontinuous if and only if is a closed set. It is lower semicontinuous if and only if is an open set.
^{[note 1]}

- The sum of two lower semicontinuous functions is lower semicontinuous
^{[5]}(provided the sum is well-defined, i.e., is not the indeterminate form ). The same holds for upper semicontinuous functions. - If both functions are non-negative, the product function of two lower semicontinuous functions is lower semicontinuous. The corresponding result holds for upper semicontinuous functions.
- A function is lower semicontinuous if and only if is upper semicontinuous.
- The composition of upper semicontinuous functions is not necessarily upper semicontinuous, but if is also non-decreasing, then is upper semicontinuous.
^{[6]} - The minimum and the maximum of two lower semicontinuous functions are lower semicontinuous. In other words, the set of all lower semicontinuous functions from to (or to ) forms a lattice. The same holds for upper semicontinuous functions.
- The (pointwise) supremum of an arbitrary family of lower semicontinuous functions (defined by ) is lower semicontinuous.
^{[7]}

- In particular, the limit of a monotone increasing sequence of continuous functions is lower semicontinuous. (The Theorem of Baire below provides a partial converse.) The limit function will only be lower semicontinuous in general, not continuous. An example is given by the functions defined for for

- Likewise, the infimum of an arbitrary family of upper semicontinuous functions is upper semicontinuous. And the limit of a monotone decreasing sequence of continuous functions is upper semicontinuous.

- (
**Theorem of Baire**)^{[note 2]}Assume is a metric space. Every lower semicontinuous function is the limit of a monotone increasing sequence of extended real-valued continuous functions on ; if does not take the value , the continuous functions can be taken to be real-valued.^{[8]}^{[9]}

- And every upper semicontinuous function is the limit of a monotone decreasing sequence of extended real-valued continuous functions on ; if does not take the value the continuous functions can be taken to be real-valued.

- If is a compact space (for instance a closed bounded interval ) and is upper semicontinuous, then has a maximum on If is lower semicontinuous on it has a minimum on

- (
*Proof for the upper semicontinuous case*: By condition (5) in the definition, is continuous when is given the left order topology. So its image is compact in that topology. And the compact sets in that topology are exactly the sets with a maximum. For an alternative proof, see the article on the extreme value theorem.)

- Any upper semicontinuous function on an arbitrary topological space is locally constant on some dense open subset of
- Tonelli's theorem in functional analysis characterizes the weak lower semicontinuity of nonlinear functionals on
*L*^{p}spaces in terms of the convexity of another function.