Let $A\subset \mathbb{R}^n$ be a convex set. Show that $f:\mathbb{R}^n\to\mathbb{R}$ defined by $f(x) = d(x,A)$ is convex 
Let $A\subset \mathbb{R}^n$ be a convex set. Show that
  $f:\mathbb{R}^n\to\mathbb{R}$ defined by $f(x) = d(x,A)$ is convex

All I need to prove is that:
$$f((1-t)x+ty) = d((1-t)x+ty, A) \le (1-t)f(x)+tf(y) = (1-t)d(x,A)+td(y,A)$$
*for all $t\in[0,1]$ and $x,y\in \mathbb{R}^n$
By using the fact that $A$ is convex. A convex set is defined as:

A set $C$ in $S$(vector space) is said to be convex if, for all $x$
  and $y$ in $C$ and all $t$ in the interval $[0, 1]$, the point $(1 −
 t)x + ty$ also belongs to $C$

and the distance from $x$ to a set $A$ is: 
$$d(x,A) = \inf \{d(x,a), a\in A\}$$
To begin I'd choose a generic $a\in A$ and try to work with it to show that
$$d((1-t)x+ty, a) \le (1-t)d(x,a)+td(y,a)\tag{1}$$
I'm tempted to think something related to the triangular inequality $d(x,y)\le d(x,a) + d(a,y)$ by doing something like:
$$d((1-t)x+ty, a)\le d((1-t)x+ty, b) + d(b,a)\tag{2}$$
for some $b\in \mathbb{R}^n$, but the right side of $(2)$ is already bigger than the right side of $(1)$. Also, I'm not even using the fact that $A$ is convex yet. 
Could somebody help me? 

Let $E = \{(x,t) | \exists a \in A \text{ such that } t \ge \|x-a\| \}$. Since $\|\cdot\|$ is convex, it is straightforward to check that $E$ is
convex.
Let $l(x) = \inf_{(x,t) \in E} t $ and notice that $d(x,A) = l(x)$.
Suppose $\lambda \in [0,1]$ and
 $(x_k,t_k) \in E$ for $k=1,2$, then we have
$\lambda (x_1,t_1)+(1-\lambda)(x_2,t_2) \in E$ and
hence
$l(\lambda x_1 + (1-\lambda) x_2) \le \lambda t_1 + (1-\lambda) t_2$.
Now take the $\inf$ on the right hand side over $(x_k,t_k) \in E$ to get $l(\lambda x_1 + (1-\lambda) x_2) \le \lambda l(x_1) + (1-\lambda) l(x_2)$.
