Solution (source code)

= Solution

If $C=\mathbb R^n$, the family of proper containing half-spaces is empty and its intersection is, by convention, $\mathbb R^n$. If $C=\varnothing$, every <closed half-space> contains it and their intersection is empty. Now suppose $C$ is a nonempty proper closed <convex set>. Take $x\notin C$ and let $z$ be its <Euclidean projection onto a convex set>. This projection exists: a minimizing sequence can be restricted to a bounded ball, and closedness gives attainment. It is unique by <convexity> and strict <convexity> of squared distance.

For $y\in C$, the segment $z+t(y-z)$ remains in $C$ for $0\leq t\leq1$. Minimality at $t=0$ implies
$$
\left.\frac{d}{dt}\|x-z-t(y-z)\|^2\right|_{t=0+}\geq0,
\qquad\langle x-z,y-z\rangle\leq0.
$$
Thus the <closed half-space> $H_x=\{y:\langle x-z,y-z\rangle\leq0\}$ contains $C$ but excludes $x$, since $\langle x-z,x-z\rangle>0$. Every point outside $C$ is excluded by at least one containing half-space. The reverse inclusion is immediate, giving
$$
\boxed{C=\bigcap\{H:H\text{ is a closed half-space and }C\subseteq H\}.}
$$
This is the <half-space representation of a closed convex set>. The argument gives an explicit separating hyperplane rather than just citing a <Hahn-Banach separation theorem>.