Artificial intelligent assistant

Prove that a function from a metric space into [0,1] is continuous and real valued. $(M,d)$ is a metric space and $X$ is a subset of $M$. define $d(x,X) = \inf \\{d(x,y)| y \epsilon X\\}$ A and B are closed subsets of M such that $A \cap B = \phi$ a. Prove that $$g(x) = \frac{d(x,A)}{d(x,A) + d(x,B)}$$ is continuous from M into [0,1]. b. Also prove that there exists open subsets $U,V$ such that $A \subset U$ and $B \subset V$ and $U \cap V = \phi$ The question had 2 previous parts where I had to prove that $f(x) = d(x,X)$ is continuous, I managed to prove that but am fumbling with these. $\\\\\\\\\\\\\\\$

Continuity is quite clear one you know that $f(x) = d(x,A)$ is continuous, and so is $f'(x) = d(x,B)$.

Check that $A \cap B = \emptyset$ implies that $d(x,A) + d(x,B) > 0$. This uses that $x \in \overline{X}$ iff $d(x,X) = 0$ for subsets of $X$.

So we have a quotient of continuous functions (you need that division and addition are continuous on the real numbers), which is continuous.

b) follows from pulling back disjoint neighbourhoods of $0$ and $1$ under this $g$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy da76c1ffa42711babacb118fb07285ea