$f(x):=\rho(x,T(x))$ where $T(x)$ is a Lipschitz function. $(X,\rho)$ is a compact metric space and $T:X\rightarrow X$. I need to prove $f(x)$ is continuous.
I'm trying to use the triangle inequality to say $|f(x)-f(y)|=|\rho(x,T(x))-\rho(y,T(y))| \leq |\rho(x,T(x)|+|\rho(x,y)|+|\rho(y,T(y)|$
Then I plan to use that $T(x)$ is uniformly continuous so I can take $\delta$ such that
$|\rho(x,T(x)| < \frac \epsilon 3$, $|\rho(x,y)|< \frac \epsilon 3$, and $|\rho(y,T(y)| < \frac \epsilon 3$
Am I on the right track?
Can't you just use that composition of continuous functions is continuous?
Also, notice that using the triangle inequality on the distance over the real line (on the absolute value) will not work. Take for instance $X=[0,1]$ with the usual distance and $T(x)=1000+x$. Then $f$ is constant ($1000$).
EDIT: Okay, let's expand this proof.
First, we show that the metric $\rho:X\times X \longrightarrow \mathbb{R}$ is (uniformly) continuous. Here, we asumme $X\times X$ is endowed with the sup product metric $d\big((x,y),(\tilde{x},\tilde{y})\big)=\max\{\rho(x,\tilde{x}),\rho(y,\tilde{y})\}$.
\begin{equation}\tag{1}\label{eq1}\forall \epsilon >0, \,\,\exists \delta >0,\,\,\forall (x,y),(\tilde{x},\tilde{y}) \in X\times X \text{ with } d\big((x,y),(\tilde{x},\tilde{y})\big)\leq\delta,\\ \left|\rho(x,y)-\rho(\tilde{x},\tilde{y})\right|\leq\epsilon\end{equation}
Indeed, using triangle inequality we may write $\rho(x,y) \leq \rho(x,\tilde{x})+\rho(\tilde{x},\tilde{y})+\rho(\tilde{y},y)$, so that when $\rho(x,y)-\rho(\tilde{x},\tilde{y})>0$ we have
\begin{equation}\tag{2}\label{ineq}\left|\rho(x,y)-\rho(\tilde{x},\tilde{y})\right|\leq\rho(x,\tilde{x})+\rho(y,\tilde{y})\leq2\cdot\max\{\rho(x,\tilde{x}),\rho(y,\tilde{y})\}\end{equation}
Similarly, when $\rho(x,y)-\rho(\tilde{x},\tilde{y})<0$, once again by triangle inequality we have that $\rho(\tilde{x},\tilde{y})\leq \rho(\tilde{x},x)+\rho(x,y)+\rho(y,\tilde{y})$. Thus, inequality $\eqref{ineq}$ always holds.
With inequality $\eqref{ineq}$, given $\epsilon > 0$, it suffices to take $\delta = \frac12\epsilon$ to prove $\eqref{eq1}$.
Next, because $T$ is Lipschitz continuous, say with constant $K>0$, we have that:
\begin{equation}\tag{3}\label{eq2}\forall x,y \in X,\,\, \rho(T(x),T(y)) \leq K\cdot \rho(x,y)\end{equation}
Now, you want to show that $f:X \longrightarrow \mathbb{R}$ is continuous. Since $X$ is compact, continuity and uniform continuity are equivalent. We are thus looking to show that:
\begin{equation}\tag{4}\label{eq4}\forall \epsilon >0,\,\,\exists \delta>0,\,\, \forall x,y \in X \text{ with }\rho(x,y)\leq\delta,\\ |f(x)-f(y)|=\left|\rho(x,T(x))-\rho(y,(Y(y))\right|\leq\epsilon\end{equation}
So, let $\epsilon >0$ and $x \in X$.
The final inequality we want to show, that $\left|\rho(x,T(x))-\rho(y,(Y(y))\right|\leq\epsilon$, looks similar to the inequality in $\eqref{eq1}$. Let $\delta_1 >0$ be as the one provided by $\eqref{eq1}$ for our $\epsilon$; it suffices to show that
\begin{equation}\tag{5}\exists \delta>0,\,\, \forall x,y \in X \text{ with }\rho(x,y)\leq\delta,\\ d\big((x,T(x)),(y,T(y))\big)=\max\{\rho(x,y),\rho(T(x),T(y))\}\leq\delta_1\end{equation}
From $\eqref{eq2}$, we have that $d\big((x,T(x)),(y,T(y))\big)\leq \max\{\rho(x,y),K\cdot\rho(x,y)\}$. Thus, if $0 < K \leq 1$ we may take $\delta = \delta_1$, and if $K>1$ we may take $\delta = \frac{1}{K}\delta_1$. Hence, in general, we take $\delta=\min\{\delta_1,\frac1K\delta_1\}$. This proves $\eqref{eq4}$ and concludes the answer.