The distance between two continuous functions is a continuous function. Let $\phi$ $\psi$ $:K \to Y$ be two continuous functions, where $K$ and $Y$ are metric spaces and $K$ is compact.
Then $f:K \to \mathbb{R}$, $f(x)=d_Y(\phi(x),\psi(x))$ is continuous.
This last statement is written as a simple observation in my book, however I fail to see how it is immediate that f is continuous, so I attempted to prove so using the $\varepsilon-\delta$ definition of continuity.
Here is my attempt:
Let $x_0  \in K$, let $\varepsilon > 0$
We notice that $|f(x)-f(x_0)|\leq |f(x)|+ |f(x_0)|=d_Y(\phi(x),\psi(x))+d_Y(\phi(x_0),\psi(x_0))$
And, $d_Y(\phi(x),\psi(x))+d_Y(\phi(x_0),\psi(x_0)) \leq d_Y(\phi(x),\phi(x_0))+d_Y(\phi(x_0),\psi(x))+d_Y(\phi(x_0),\psi(x))+d_Y(\psi(x),\psi(x_0))$
Therefore, $|f(x)-f(x_0)|\leq d_Y(\phi(x),\phi(x_0))+2d_Y(\phi(x_0),\psi(x))+d_Y(\psi(x),\psi(x_0))$
By hypothesis, both $\phi$ and $\psi$ are continuous, so, for $\frac{\varepsilon}{4}$, there exists $\delta_1>0$ and $\delta_2>0$ such that $d_Y(\phi(x),\phi(x_0))<\frac{\varepsilon}{4}$ if $d_K(x,x_0)<\delta_1$ and $d_Y(\psi(x),\psi(x_0))<\frac{\varepsilon}{4}$ if $d_K(x,x_0)<\delta_2$
So, if $\delta \leq \min\{\delta_1, \delta_2\}$ and $d_K(x,x_0)<\delta$, then $|f(x)-f(x_0)|<\frac{\varepsilon}{2}+2d_Y(\phi(x_0),\psi(x))$
I'm not sure about how I could bound $2d_Y(\phi(x_0),\psi(x))$.
I think the fact that $K$ is compact, and therefore both $\psi$ and $\phi$ are uniformly continuous could be useful, but that still doesn't seem too helpful in bounding $2d_Y(\phi(x_0),\psi(x))$. I have also already proven that $g:Y \to \mathbb{R}$, $g(y)=d_Y(y_0,y)$ is a continuous function, so I was also trying to use function composition.
Overall I'm not that sure about my attempted proof because to me it seems too complex for a statement that is simply given as an observation in the book, so I'm convinced there's an easier way to prove that $f$ is continuous, I'm just unable to see it.
 A: Yes, there's a much easier proof. It's well known that $d_Y\colon Y\times Y\to \Bbb R$ is continuous. Moreover, if $\phi$ and $\psi$ are continuous then $(\phi,\psi)\colon K\to Y\times Y$ is also continuous. Then $f=d_Y\circ (\phi,\psi)$ is continuous.
A: First note that using the triangle inequality we have $|d(a,b)-d(a,b')| \le d(b,b')$.
Then $|d(x,y)-d(x',y')| \le |d(x,y)-d(x,y')+d(x,y')-d(x',y')| \le d(x,x')+d(y,y')$.
Hence $|d(\phi(x),\psi(x))-d(\phi(x'),\psi(x'))| \le d(\phi(x),\phi(x'))+d(\psi(x),\psi(x'))$.Now use continuity of $\phi, \psi$ to finish.
A: By the triangle inequality, we have \begin{aligned}f(x)&=d_Y(\phi(x),\psi(x)) \\&\leq d_Y(\phi(x),\phi(x_0))+ d_Y(\phi(x_0),\psi(x_0))+d_Y(\psi(x_0),\psi(x))\\&
=d_Y(\phi(x),\phi(x_0))+ f(x_0)+d_Y(\psi(x_0),\psi(x)) \, ,\end{aligned}
and
\begin{aligned}f(x_0)&=d_Y(\phi(x_0),\psi(x_0)) \\&\leq d_Y(\phi(x_0),\phi(x))+ d_Y(\phi(x),\psi(x))+d_Y(\psi(x),\psi(x_0))\\&
=d_Y(\phi(x),\phi(x_0))+ f(x)+d_Y(\psi(x_0),\psi(x)) \, .\end{aligned}
So
\begin{aligned}f(x)-f(x_0) \leq d_Y(\phi(x),\phi(x_0))+d_Y(\psi(x_0),\psi(x)) \, ,\end{aligned}
and
\begin{aligned}f(x_0)-f(x) \leq d_Y(\phi(x),\phi(x_0))+d_Y(\psi(x_0),\psi(x)) \, .\end{aligned}
A: Continuity is equivalent to sequential continuity. It's a metic space!
Let $(x_n) \subset K$ converges to $x$ . We need to show $f(x_n) \to f(x) $
By continuity of $\phi, \psi$ we have $\phi(x_n) \to \phi(x) $ and $\psi(x_n) \to \psi(x) $
$f(x_n) =d_Y(\phi(x_n),\psi(x_n))\to d_Y(\phi(x),\psi(x))=f(x)$
Hence $f$ is continuous on $K$
Note : metric is a continuous map.
