Continuity of the distance function Let $A$ be convex compact subset of $\mathbb{R}^n$. For each $x\in \mathbb{R}^n$, there exists $y_x\in A$ such that $d(x,y_x)=d(x,A)$. Defined function $P_A:\mathbb{R}^n\to A$ where $P_A(x)=y_x$. Prove that $P_A$ is continuous?.
Here $d$ denote normal metric on $\mathbb{R}^n$.
 A: It suffices to show that $$d(P_A(x),P_A(y))\leq d(x,y)\qquad(*)$$ for all points $x,y\in\Bbb R^n$. This is more or less the definition of continuity. Now, set $x'=P_A(x)$ and $y'=P_A(y)$. Because of convexity, the line segment $[x',y']$ is completely contained in $A$.
$\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad$ 
Actually, it suffices to solve $(*)$ just for line segments $A$ (instead of general compact and convex sets). This is simple linear algebra and some case analysis and I will leave this to you. But assume you have already shown this, i.e. for any $x,y\in\Bbb R^n$ and any line segment $L$ we have $d(P_L(x),P_L(y))\leq P(x,y)$. Then, from the definition of $x'$ and $y'$ we can deduce
$$P_{[x',y']}(x)=x',\qquad P_{[x',y']}(y)=y'.$$
Because if you assume $x''=P_{[x',y']}(x)\not= x'$ this would mean $d(x,x'')<d(x,x')$ (because $P_A(x)$ is unique, this is another easy exercise) and because $x''\in[x',y']\subseteq A\to x''\in A$ this would contradict our choice of $x'$.
So you found that
$$d(P_A(x),P_A(y))=d(x',y')=d(P_{[x',y']}(x),P_{[x',y']}(y))<d(x,y)$$
and we are done. $\square$
