Showing that a function $f$ has a unique fixed point in a metric space.

Hint: Consider the function $$ g(x) = d(x,f(x)) $$ Note that this is a continuous function (why?) over a compact space, so it attains its minimum.

Suppose for contradiction that the minimimum of $g$ over $X$ is not $0$. That is, suppose that for every $x \in X$, $g(x) \geq \epsilon > 0$. By compactness, there is an $x^* \in X$ is such that $g(x^*) = \epsilon$. Reach a contradiction (how?) to conclude that $g$ must have a minimum of $0$.

Uniqueness is easy using the inequality.