Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm busy with a topology course, but the following question has me somewhat stumped. The entire question is, let $(X,d)$ be a metric space and $f:X \rightarrow X$ be continuous. Show that $X \rightarrow R$, $x \mapsto d(x,f(x))$ is continuous.

I've tried proving it with the old-fashioned $\epsilon$-$\delta$ definition, but I quickly run out of options with that approach. If someone could give me a nudge in the right direction, it would be much appreciated!

share|cite|improve this question
Do you know that the composition of continuous functions is continuous? Now note that $f$ is continuous and $d(x,y)$ is continuous. – Asaf Karagila Jun 5 '12 at 21:07
up vote 6 down vote accepted

The distance function $d: X\times X\longrightarrow \mathbb{R}^+ \cup \{0\}$ is continuous (this is an important fact on its own and you can prove it by using the triangle inequality). So is the function $i:X\longrightarrow X\times X$ defined by $i(x)=(x,f(x))$, because its projections are continuous. The composition of continuous functions is continuous.

share|cite|improve this answer
Compositionality of topological properties is what makes it so fun! – Ben Millwood Jun 5 '12 at 22:01

Hint: $d(x,f(x)) \leq d(x,y) + d(y,f(y)) + d(f(y),f(x))$

share|cite|improve this answer

Let $x_0\in X$. Let $\epsilon>0$. Then exist $\delta'>0$ with $d(f(x),f(x_0))\leq \epsilon/2$ if $d(x,x_0)<\delta'$. Let $\delta=\min \{\delta', \epsilon/2\}$. Suposse $d(x,x_0)<\delta$. By the triangular inequality $$0\leq d(x,f(x))\leq d(x,x_0)+d(x_0,f(x))\leq d(x,x_0)+d(x_0,f(x_0))+d(f(x),f(x_0))$$ and then $$-\epsilon<-d(x_0,f(x_0))\leq d(x,f(x))-d(x_0,f(x_0))\leq d(x,x_0)+d(f(x),f(x_0))\leq \epsilon/2+\epsilon/2=\epsilon.$$ Therefore $$|d(x,f(x))-d(x_0,f(x_0))|\leq \epsilon.$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.