Let $C$ be a non-empty, convex and closed subset of $\mathbb{R}^d$ and $x \in \mathbb{R}^d$, consider:
$$\inf_{y \in C} \|x - y\|^2. \tag{1}$$
Show that (1) has a unique solution (that is, there exists a unique $y \in C$ such that $\|x - y\|^2 \leqslant \|x - z\|^2$ for all $z \in C$) which we will call the projection of $x$ onto $C$ and denote $\operatorname{proj}_C(x)$. Show that $x = \operatorname{proj}_C(x)$ if and only if $x \in C$.