The distance between an element and a subset of a metric space. I got stuck on an assignment. Can you help me to solve this?

Let $(X,d)$ be a metric space, and let $C$ be a subst. Define the function:
  $$
f \quad : \quad X \longrightarrow \mathbb{R} 
\quad : \quad x \ \longmapsto \ \inf \{ d(x,a) : a \in C \}
$$
  Prove that this function is continuous.

Research effort
Let's write $d(x,C) := \inf \{ d(x,a) : a \in C \}$. We can make a sequence Cauchy $(a_n)_{n \in \mathbb{N}}$ such that the resulting sequence $(d(x,a_n))_{n \in \mathbb{N}}$ converges to $d(x,C)$. We can find a sequence $(y_n)$ with the same properties with respect to $y$. With this knowledge I tried to find an upper bound:
$$
|d(x,C)- d(y,C)| \quad \leq \quad |d(x,C)- d(x, a_n)| + |d(y,a_n)- d(y,C)|
$$
The leftmost term will be small. The rightmost term might become small too, but I can't see it. can you please help me?
 A: You want to find a $\delta>0$ such that whenever $d(x,y)<δ$ it follows 
$|d(x,C)-d(y,C)|<\varepsilon$. Both $d(x,C)$ and $d(y,C)$ are infima of certain subsets $$D_x=\{d(x,c)\mid c\in C\}$$ and $D_y$ of $[0,\infty)$. You can show that $\inf D_y\le\inf D_x+ε$ by showing that for every $a\in D_x$ there is a $b\in D_y$ with $b\le a+ε$. Since each $a\in D_x$ is determined by a point $c\in C$ so that $a=d(x,c)$, this allows us to compare $a=d(x,c)$ and $d(y,c)$.  
$\qquad$ But if $d(x,y)<ε$, then $b:=d(y,c)<d(x,c)+ε=a+ε$ and $b\in D_y$.
Symmetrically, if $b=d(y,e)\in D_y$, then each $x\in B_ε(y)$ satisfies 
$D_x\ni a:=d(x,e)<d(y,e)+ε$, so we also have $\inf D_x\le\inf D_y+ε$. If you combine both inequalities you get $$|\inf D_y-\inf D_x|\le ε$$
Note that this shows that $d(x,C)$ is even uniformly continuous.
A: I think this is just triangle inequality.
$d(x,C) = \inf_{c\in C} d(x,c) \leq  \inf_{c\in C} d(x,y) + d(y,c) = d(x,y) + d(y,C)$
symetrically
$d(y,C) \leq d(x,y) + d(x,C)$
so
$\|d(x,C)-d(y,C)\| \leq d(x,y)$
so it is a contraction (hence many properties)
