# Thread: Function from Metric Space to R is Continuous

1. ## Function from Metric Space to R is Continuous

Let $(M, d)$ be a metric space. Let $f:M\longrightarrow M$ be a continuous function. Let $g:M\longrightarrow\mathbb{R}$ be defined by $x\longmapsto d(x,f(x))$. Show that $g$ is continuous.

So what we know is that $f$ is continuous, so for any $\eta>0$, there exists $\mu>0$ such that:

$d(x,y)<\mu \Rightarrow d(f(x),f(y))<\eta$

But what we want to do for any $\epsilon>0$ is to produce $\delta>0$ such that:

$d(x,y)<\delta \Rightarrow |g(x)-g(y)|=|d(x,f(x))-d(y,f(y))|<\epsilon$

I have a feeling we'll want to produce $\delta$ in terms of $\epsilon, \eta, \mu$. I was thinking breaking something up using a triangle inequality, but I've tried a few different ways that have all led to dead ends.

2. You can use the inequality $|d(x,z)-d(y,z)|\leq d(x,y)$ and write $d(x,f(x))-d(y,f(y))=d(x,f(x))-d(x,f(y))+d(x,f(y))-d(y,f(y))$.

3. I already tried that and came up with a dead end. The result of that yields:

$|g(x)-g(y)|\leq d(f(x),f(y))+d(x,y)$

Which if we let those be less than $\eta, \mu$ respectively from the previous part, we get:

$|g(x)-g(y)|<\eta+\mu$

Which I just don't see how you could possibly get $\delta$ out of something of that sort.

4. Given $\eta$, we can find $\mu$ such that $d(f(x),f(y))\leq \frac{\eta}2$ if $d(x,y)\leq \mu$. We can choose this $\mu$ smaller than $\frac{\eta}2$.