# Continuous functions between metric spaces are equal if they are equal on a dense subset

If two functions defined on metric spaces $X$ and $Y$ are equal on a dense subset of $X$ and are continuous also, then are they equal on all of the metric space $X$?

-
That does not seem to be a question, but an assertion. (It looks to be a true assertion, by the way). –  Henning Makholm Sep 25 '12 at 17:35
Dear @HenningMakholm, I have another question: assume the two functions are $1/x$ on $\mathbb R \setminus \{0\}$. After extending them, can we say that they are equal at $0$? I asked this related question here. Can one say $\infty = \infty$? Probably, since otherwise the answer to this question would have to be "no". –  Rudy the Reindeer Oct 18 '12 at 14:10
@MattN.: In this question, the functions were (at least in my understanding) supposed to already be continuous on the entire metric space; it was just the equality between them that was known only for a dense subset. It is true that "any two continuous functions $\mathbb R\to\mathbb R$ that are $1/x$ on $\mathbb R\setminus\{0\}$ are equal", but only vacuously so, because there are no such functions in the first place! –  Henning Makholm Oct 18 '12 at 14:31

## 2 Answers

This is correct. Suppose $f$ and $g$ are continuous functions on a metric space $X$ and agree on a dense subset $Y$. For any $x\in X$, we have some sequence $(y_n)$ in $Y$ such that $y_n\to x$, so $f(y_n)\to f(x)$ and $g(y_n)\to g(x)$. Since $f(y_n)=g(y_n)$ for all $n$, this implies $f(x)=g(x)$.

-

Yes. The set of points where the functions $f,g\colon X\to Y$ agree is closed and contains a dense subset. The closure of a dense subset is $X$. (This does not require metric spaces, it is sufficient that $X$ is any topological space and $Y$ is Hausdorff)

-