# Continuous function on metric space

I'm trying to show:

Let $(X,d)$ be a metric space and let $A, B$ be nonempty subsets, which are also closed and disjoint. Let $\rho_A:X\to \mathbb{R}$ be such that $\rho_A=d(x,A)$ and $\rho_B:X\to \mathbb{R}$ be such that $\rho_B=d(x,B)$, with $x\in X$ (distance from one point to a set).

Prove that the function $\frac{\rho_A}{\rho_A+\rho_B}:X\to \mathbb{R}$ is continuous in $X$.

I have only the definition of continuous function (with balls) and some results. I can not use yet sequences.

A corollary says that composition of continuous functions is a continuous function on metric spaces. Now, the sum of continuous functions is continuous (in the metric space $\mathbb{R}$) but the division of continuous functions is not necessarily a continuous function in $\mathbb{R}$.

Any help? Thank you very much.

-
First you should show that the function is well-defined, that is, that you are not dividing by zero. – Rasmus Jun 4 '12 at 14:47
The quotiont of functions is continuous as long as the denominator stays away from zero. So you need to focus on the question whether $\rho_A + \rho_B$ can become zero or not, and if yes, how the function then behaves. – user20266 Jun 4 '12 at 14:48
@Rasmus, just because $A$ and $B$ are not disjoint, I think this is enough. Otherwise fine right? – Hiperion Jun 4 '12 at 14:51
@Hiperion: Disjointess is not enough (but it is required), you have to use the property that $A$ and $B$ are closed. Hint: $\bar{A}=\{x\in X:d(x,A)=0\}$, where $\bar{A}$ is the closure of $A$ in $X$. – T. Eskin Jun 4 '12 at 14:55
@JasonDeVito: You probably mean that the sum equals $0$? – T. Eskin Jun 4 '12 at 15:01

You first need to show that the function $\rho_A$ (and $\rho_B$ ) is continuous.
If $A$ is any set, then let $\rho_A(x) = \inf_{a\in A} d(x,a)$. Now suppose $d(x,a) \leq \rho_A(x)+\epsilon$, then for any $y$ we have $d(y,a) \leq d(x,y)+d(x,a) \leq d(x,y)+\rho_A(x)+\epsilon$, from which is follows that $\rho_A(y)-\rho_A(x) \leq d(x,y)+\epsilon$. Reversing the roles of $x$ and $y$ shows that $|\rho_A(x)-\rho_A(y)| \leq d(x,y)+\epsilon$. Since this is true for arbitrary $\epsilon>0$, it follows that the $\rho_A$ is Lipschitz continuous of rank $1$. This is true for any set.
Now suppose $A$ is closed, and $x\notin A$. Then $\exists \epsilon>0$ such that if $d(x,y)< \epsilon$, then $y\notin A$. It follows that $d(x,a) \geq \epsilon$ whenever $a \in A$. Hence $\rho_A(x) \geq \epsilon > 0$.
Since $A$ and $B$ are disjoint, it follows that for any $x$, either $x\notin A$ or $x\notin B$, hence $\rho_A(x)+\rho_B(x) > 0$. Then the function $\frac{1}{\rho_A + \rho_B}$ is continuous. The desired result follows from this.