A continuous mapping is determined by its values on a dense set
Let f and g be continuous mappings of a metric space $X$ into a metric space $Y$ and let $E$ be a dense subset of $X$. Prove that $f(E)$ is dense in $f(X)$. If $g(p)=f(p)$ for all $p \in E$, prove that $g(p)=f(p)$ for all $p \in X$.
This is a beautiful problem. Are you doing it in Rudin? Please note that I'm using a very particular definition of density. $E$ being dense in $X$ implies that, for any $x \in X$, we have that for all $\epsilon > 0$ we can find some $p\in E$ so that $d(p,x) < \epsilon$.
So we know $f$ is continuous and $E$ is dense... we should expect to use both of these definitions. Let's prove the first question.
Fix $y\in f(X)$. We want to show that for any $\epsilon > 0$, we can find some $w\in f(E)$ so that $d(y,w) < \epsilon$. This guarantees that $f(E)$ is dense in $f(X)$. We know that $y = f(x)$ for some $x \in X$. Moreover, we know that for any $\epsilon$, we can find a $\delta$ so that $$d(x,p) < \delta \Rightarrow d(f(x), f(p)) < \epsilon.$$ For this particular choice of $\delta$, we can find $p\in E$ so that $d(x,p) < \delta$, since $E$ is dense in $X$. Then $f(p) \in f(E)$ and also we have demonstrated that $d(y, f(p)) < \epsilon$, so choosing $w=f(p)$ we have shown exactly what we set out to prove.
Now onto the second question. We are given that $f(p) = g(p)$ for every $p\in E$. Fix some $x \in X$. We'll show that for any such $x$ we'll have $f(x) = g(x)$.
Since $E$ is dense in $X$, for any $n \in N$, we can choose some $p_n \in E$ so that $d(x,p_n) < \frac{1}{n}$. Thus $\lim_{n\rightarrow \infty} p_n = x$. So we have that $$f(x) = f(\lim p_n) = \lim f(p_n) = \lim g(p_n) = g(\lim p_n) = g(x)$$ where we able to 'commute' the limit with the function each time because $f$ and $g$ are continuous. Also, we were able to replace $f$ with $g$ because they are equal for every $p_n \in E$.
For the first part it is not restrictive to assume $f$ is surjective.
Suppose $U$ is an open set in $Y=f(X)$ such that $U\cap f(E)=\emptyset$. Then $f^{-1}(U)\cap E=\emptyset$ and therefore, by density, $f^{-1}(U)=\emptyset$, so also $U=\emptyset$. Thus every nonempty open set of $f(X)$ has nonempty intersection with $f(E)$, which is density.
For the second part, note that $W=\{x\in X:f(x)\ne g(x)\}$ is open in $X$. Indeed, if $x\in W$, take disjoint neighborhoods $U_1$ and $U_2$ of $f(x)$ and $g(x)$, respectively. Then $V=f^{-1}(U_1)\cap g^{-1}(U_2)$ is a neighborhood of $x$ and $V\subseteq W$. Hence $W$ is open.
As a consequence $E\subseteq X\setminus W$; since $X\setminus W$ is closed and $X$ is the only closed subset of $X$ containing $E$ (by density), we are done.
Notes. The first part is true for any continuous map between topological spaces. The second part is true for any continuous map between topological spaces, provided the codomain is Hausdorff.