Let $f(x)=\min_{y \in C}\|y-x\|$ where $C$ is a closed set in $\mathbb{R}^n$ and $x,y \in \mathbb{R}^n$.
Show $f(x)$ is a Lipschitz function with constant $L=1$.
My try
I need to show $$ |f(x_2)-f(x_1)| \leq \|x_2-x_1\| \quad \forall x_1,x_2 \in \mathbb{R}^n $$
When $x_1,x_2 \in C$, it is trivial because $f(x_2)=f(x_1)=0$. When one of them is in $C$, let's say $x_1$, then $f(x_1)=0$ and $|f(x_2)-f(x_1)|=\min_{y \in C}\|y-x_2\|\leq \|x_1-x_2\|$ because $x_1 \in C$.
Question
How can I show it when neither $x_1$ nor $x_2$ is in $C$?
I am tailoring the general solution posted here to answer your question:
Let $z \in C$ and $x_1, x_2 \in \mathbb{R}^n$ be arbitrary points. Using triangle inequality you can write the following:
$$ \begin{aligned} \|z-x_1\| &\leq \|z-x_2\|+\|x_2-x_1\| \\ \min_{y \in C}\|y-x_1\|\leq \|z-x_1\| &\leq \|z-x_2\|+\|x_2-x_1\| \\ \min_{y \in C}\|y-x_1\| &\leq \min_{y \in C} \|y-x_2\|+\|x_2-x_1\| \end{aligned} $$ where in the second line we know that $\min_{y \in C}\|y-x_1\|\leq \|z-x_1\|$ because $z \in C$, and in the third line we know that $z$ is an arbitrary point so we can let it be a minimizer of $\|y-x_2\|$ over $C$ to achieve $\min_{y \in C} \|y-x_2\|$. Thus we have $$ \min_{y \in C}\|y-x_1\| - \min_{y \in C} \|y-x_2\| \leq \|x_2-x_1\| \tag{1}. $$ Switch $x_1$ and $x_2$ to get the following: $$ \min_{y \in C}\|y-x_2\| - \min_{y \in C} \|y-x_1\| \leq \|x_2-x_1\| \tag{2}. $$ Put (1) and (2) together, then you get $$ \Big| \min_{y \in C}\|y-x_2\| - \min_{y \in C} \|y-x_1\| \Big| \leq \|x_2-x_1\| $$ which means $|f(x_2)-f(x_1)| \leq \|x_2-x_1\|$.