Let $A \subset \mathbb{R}^n$ be closed and $d_A(x) = \inf_{a \in A} \|x-a\|$. I need to show that $d_A$ is convex if and only if $A$ is convex.
I have no good ideas in either direction. Can somebody please give me a hint?
For the direction ($\Longleftarrow$), my attempt was:
Let $a_1 := \operatorname*{argmin}_{a \in A} \|x-a\|, a_2 := \operatorname*{argmin}_{a\in A} \|y-a\|$, then:
\begin{align*} d_A(x) &= \inf_{a \in A} \|\lambda x + (1 - \lambda)y - a\| = \inf \|\lambda(x-a) + (1-\lambda) (y-a)\|\\ &\leq \lambda \|x-a_1\| + (1-\lambda)\|y-a_2\| = \lambda d_A(x) + (1-\lambda)d_A(y) \end{align*}
However, I'm not sure whether the inequality in the third step is actually correct.
In case $A$ is convex: For $x_i \in A$ let $a_i = \operatorname{argmin}_{a\in A} \| x_i - a \|$, which is an element of $A$ as $A$ is closed. For $t\in (0,1)$ we have $(1-t)a_1 + ta_2 \in A$ as $A$ is convex and thus $$d_A((1-t)x_1 + tx_2) \le \| (1-t)x_1 + tx_2 - ((1-t)a_1 + ta_2)\| \le (1-t) d_A(x_1) + t d_A(x_2).$$
In case $d_A$ ist convex: For $x,y\in A$ and $t\in (0,1)$ show that $d_A( (1-t) x + ty) = 0$ and thus $(1-t)x+ty\in A$ as $A$ is closed.