How to show that $f = g$? [duplicate]

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$?


Solution 1:

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)$.

Solution 2:

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)

Solution 3:

Another proof:

Let $h = f-g$, $h:X\to Y$. Since $f$ and $g$ are continuous, so is $h$. Hence, $h^{-1}(\{0\})$ is a closed subset of $X$, and since it contains a dense subset of $X$, then it is equal to $X$. Therefore, $h=0$ on $X$, and so $f=g$ on $X$.