= Solution
Put $d=\operatorname{dist}(x,Z)$. If $d=0$, the zero functional works. If $d>0$, then $x\notin\overline Z$, and on $M=Z+\operatorname{span}\{x\}$ define
$$
f_0(z+ax)=ad.
$$
The representation is unique, so this is linear. For $a\ne0$,
$$
|f_0(z+ax)|=|a|d=\operatorname{dist}(ax,Z)\leq\|z+ax\|,
$$
and the bound also holds for $a=0$. Thus $\|f_0\|\leq1$. The <Hahn-Banach theorem> extends it to $f\in X'$ with the same bound, proving
$$
\boxed{f|_Z=0,\qquad f(x)=d,\qquad\|f\|\leq1.}
$$
No closedness assumption on $Z$ was required; <distance> is unchanged on taking its <closure>.
Back to article page