Assume that $(X,d)$ is compact, and that $f: X \to X$ is continuous. Show that the function $g(x) = d(x,f(x))$ is continuous and has a minimum point.
Consider the function $g(x) = d(x,f(x))$. If $g$ is continuous, then $\forall \epsilon >0 \ \exists \delta > 0$ such that $$d(x,y) < \delta \implies d(g(x), g(y)) < \epsilon.$$ Since $f$ is continuous and that $X$ is compact, we have that $f: X \to X$ is uniformly continuous. Therefore, $\forall \epsilon > 0 \ \exists \delta > 0 \ \text{such that} \ d(x,y) < \delta \implies d(f(x),f(y))< \epsilon.$
But how do we go on from here, considering $d(g(x),g(y)) = d(d(x,f(x)),d(y,f(y)))$ gets quite messy?