Semicontinuity is the right continuity notion for optimization and variational arguments. It is weak enough to survive limits, but strong enough to guarantee minimizers on compact sets.
Lower and upper semicontinuity
Lower semicontinuity prevents sudden downward jumps; upper semicontinuity prevents sudden upward jumps.
Definition. On a topological space \(X\), an extended-real function \(f:X\to[-\infty,\infty]\) is lower semicontinuous if every sublevel set \[ \{x\in X:f(x)\le a\},\qquad a\in\mathbb R, \] is closed. It is upper semicontinuous if \(-f\) is lower semicontinuous.
Proposition (equivalent descriptions). If \(X\) is metric, the following are equivalent: \[ \begin{array}{ll} \text{(i)}&f\text{ is lower semicontinuous};\\ \text{(ii)}&\{f>a\}\text{ is open for every }a\in\mathbb R;\\ \text{(iii)}&f(x)\le\liminf_{n\to\infty}f(x_n)\text{ whenever }x_n\to x;\\ \text{(iv)}&\operatorname{epi}f=\{(x,t):f(x)\le t\}\text{ is closed in }X\times\mathbb R. \end{array} \]
Proof. Conditions (i) and (ii) are complementary formulations. If sublevel sets are closed and \(x_n\to x\), then for any \(a>\liminf f(x_n)\), a subsequence lies in \(\{f\le a\}\); closedness gives \(f(x)\le a\), and \(a\downarrow\liminf f(x_n)\) proves (iii). Conversely, if \(\{f\le a\}\) were not closed, metric sequential closure would give \(x_n\to x\) with \(f(x_n)\le a<f(x)\), contradicting (iii).
If \(f\) is lower semicontinuous and \((x_n,t_n)\to(x,t)\) with \(f(x_n)\le t_n\), then \(f(x)\le\liminf f(x_n)\le t\), so the epigraph is closed. Conversely, if the epigraph is closed and \(x_n\to x\), pass to a subsequence along which \(f(x_n)\) converges to \(\liminf f(x_n)\); when this value is finite, the epigraph limit gives (iii), while the infinite cases are immediate.
Example (indicator functions encode constraints). For \(C\subset X\), define \[ \iota_C(x)= \begin{cases} 0,&x\in C,\\ +\infty,&x\notin C. \end{cases} \] Then \(\iota_C\) is lower semicontinuous exactly when \(C\) is closed. Minimizing \(g+\iota_C\) over \(X\) is therefore the same as minimizing \(g\) over \(C\), and closed constraints become part of the objective without changing variational arguments.
Extreme value principle
Compactness turns semicontinuity into existence of optimizers.
Theorem. If \(K\) is nonempty and compact and \(f:K\to(-\infty,\infty]\) is lower semicontinuous, then \(f\) is bounded below and attains its minimum, provided it is not identically \(+\infty\).
Proof. Choose \(x_0\in K\) with \(f(x_0)<\infty\). If \(\inf_Kf=-\infty\), choose \(x_n\) with \(f(x_n)\le-n\). A convergent subsequence \(x_{n_k}\to x\) would give \[ f(x)\le\liminf_k f(x_{n_k})=-\infty, \] contrary to the codomain. Thus \(m=\inf_Kf\in\mathbb R\). Choose \(x_n\) with \(f(x_n)\downarrow m\). Compactness gives \(x_{n_k}\to x\in K\), and lower semicontinuity yields \(f(x)\le m\). By definition of the infimum, equality holds.
Dini-type monotone convergence
Monotonicity plus compactness can upgrade pointwise convergence to uniform convergence.
Theorem. If \(K\) is compact, \(f_n\) are continuous, \(f_n\downarrow0\) pointwise, then \(f_n\to0\) uniformly.
Proof. For \(\varepsilon>0\), the sets \(U_n=\{x:f_n(x)\lt \varepsilon\}\) are open and increasing, and pointwise convergence gives \(\bigcup_n U_n=K\). Compactness gives \(K=U_N\) for some \(N\), and monotonicity gives \(f_n\lt \varepsilon\) on \(K\) for all \(n\ge N\).
Convergence of minimizing sequences
The direct method separates existence into compactness of candidates and lower semicontinuity of the objective.
Proposition. If \(K\) is compact and \(f\) is lower semicontinuous, every minimizing sequence has a subsequence converging to a minimizer.
Proof. Any minimizing sequence lies in compact \(K\), so it has a convergent subsequence. Lower semicontinuity at the subsequential limit gives a value no larger than the limiting infimum, hence equal to the minimum.
Inf-compact objectives on noncompact spaces
On a noncompact domain, compact sublevel sets localize every sufficiently good candidate.
Theorem. Let \(X\) be a topological space and \(f:X\to(-\infty,\infty]\) be lower semicontinuous and not identically \(+\infty\). If every finite sublevel set \(\{f\le a\}\) is compact, then \(f\) attains its minimum.
Proof. Choose \(x_0\) with \(f(x_0)<\infty\) and a minimizing sequence \((x_n)\). Eventually \(f(x_n)\le f(x_0)+1\), so its tail lies in the compact sublevel set \(K=\{f\le f(x_0)+1\}\). A convergent subnet, or a subsequence in metric spaces, has limit \(x\in K\). Lower semicontinuity gives \(f(x)\le\liminf f(x_n)=\inf_Xf\), hence equality.
Example (coercivity in Euclidean space). If \(f:\mathbb R^d\to(-\infty,\infty]\) is lower semicontinuous and \(f(x)\to\infty\) as \(\|x\|\to\infty\), then every finite sublevel set is closed and bounded, hence compact by Heine-Borel. The theorem gives a global minimizer. This is the existence step underlying many \(M\)-estimators and penalized objectives.