# Continuity Question with Dense Set

Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be continuous. Prove that if $S$ is a dense (i.e., closure of $S$ is $\mathbb{R}$) subset of $\mathbb{R}$ such that $f(s) = 0$ for every $s$ in $S$, then $f(x) = 0$ for every $x$ in $\mathbb{R}$.

I think the following may be helpful:

Let $f$ be a function with domain $E$ and fix $P\in E$. The function $f$ is continuous at $P$ if and only if for every sequence $\{a_{j}\}\subseteq E$ satisfying $\lim_{j \to \infty} a_{j} = P$ it holds that $\lim_{j \to \infty} f(a_{j}) = f(P)$

-
the set $\{x|f(x)\neq 0\}$ is open, $S$ is dense – Blah Feb 23 '12 at 17:41
A great argument! (@Blah) Alex, your idea is probably more typical of such situations and one can continue that way, but I just love Blah's argument. There are no sequences here, no metric, just pure topology and all in one sentence. – savick01 Feb 23 '12 at 17:44
I am almost certain this is a duplicate, but I cannot find the question it is a duplicate of. – Asaf Karagila Feb 23 '12 at 17:46
You can try to prove the more general thing: $f(\overline{A}) \subset \overline{f(A)}$ for continuous $f$ and every $A \subset \mathbb{R}$ (it can even be taken as a definition of continuity). – Najib Idrissi Feb 23 '12 at 17:46
@savick01 Ah, sorry to misread your comment. Blast this common name! – Alex Becker Feb 23 '12 at 21:14

## 2 Answers

Since $f$ is continuous $f^{-1}(\{0\})$ is closed in $\mathbb{R}$, it's dense by the hypothesis. So it must be $\mathbb{R}$ and this implies $f = 0$

-
Yes, that's another way of saying the proof from the first comment:) – savick01 Feb 23 '12 at 17:58

Since $S$ is dense, for any $x\in \mathbb R$ we have some sequence $(s_n)$ with each $s_n\in S$ such that $x=\lim\limits_{n\to \infty}s_n$. Thus $$f(x)=f(\lim\limits_{n\to\infty}s_n)=\lim\limits_{n\to\infty}f(s_n)=\lim\limits_{n\to\infty}0=0$$ so $f(x)=0$ for all $x\in\mathbb R$.

-