TITLE: Relation between convex set and convex function
QUESTION [5 upvotes]: Let $E$ be an normed vector space and $A\subset E$ be a closed nonempty set. Define
$$\phi(x)=\operatorname{dist}(x,A)=\inf_{a\in A}\|x-a\|$$
Prove that if $\phi$ is convex then $A$ is convex.
Definition of convex set: We will say $A$ is convex if for e
very $x,y\in A$ and $\lambda \in [0,1]$ we have $\lambda x+(1-\lambda)y\in A$
Definition of convex function: We will say that $\phi$ is convex if for every $x,y\in A$ and $\lambda\in[0,1]$ we have $\phi(\lambda x+(1-\lambda)y)\leq\lambda\phi(x)+(1-\lambda)\phi(y)$.

REPLY [3 votes]: If for every subset $B$ of $E$ we define $\rho_B: E\to [0, \infty)$ given by $\rho_B(x)=\mathrm{dist}(x, B)= \inf\limits_{y\in B} \Vert x-y\Vert $then it's easy to see that $\rho_B(x)=0$ if and only if $x\in \bar{B}$ where $\bar{B}$ denotes the closure of the set $B$. In case $B$ is closed, $\rho_B(x)=0$ if and only if $x\in B$ .
Suppose $\phi$ is as given above and let $x, y\in A$ and $0<\lambda<1$. Then, by definition,
$$
0\leq \phi(\lambda x+ (1-\lambda)y)\leq \lambda\phi(x)+ (1-\lambda)\phi(y)
$$
Since $x, y\in A$, then $\phi(x)=\phi(y)=0$. This implies that $\phi(\lambda x+ (1-\lambda)y)=0$. Since $A$ is closed, this happens only if $\lambda x+ (1-\lambda)y\in A$. Hence $A$ is convex