Continuous Function and Open Subsets in $\mathbb R$

Let $E$ be a subset in $\mathbb R$, $f$ a real-value function on $E$.
Prove that $f$ is continuous on $E\iff$ for every open subset $V$ of $\mathbb R$, $f^{-1}(V)$ in open relative to $E$.

My question is about the ($\Rightarrow$) direction only.
Let $f$ be a continuous function on $E$ and $V$ a open subset on $\mathbb R$.
If $f^{-1}(V)=\{\}$, then it is open. Suppose that $f^{-1}(V)\neq\{\}$. Let $p\in f^{-1}(V)$.
Then $f(p)\in V$. Select $\epsilon$ such that $N_\epsilon(f(p))\subset V$.

My question is this. At this point, we do not know if $p$ is an element of $E$.
If $p\in E$, since $f$ is continuous on $E$, $\exists\delta$ such that $f(x)\in N_\epsilon(f(p))$ for all $x\in N_\delta(p)\cap E$.
Thus $N_\delta(p)\cap E\subset f^{-1}(V)$.

But, suppose that $p\notin E$. How do I know that the above statement is still true?
I tried the following:
Let $q\in E$ be a point such that $f(q)\in N_\epsilon(f(p))$
Select $\alpha$ such that $N_\alpha(f(q))\in N_\epsilon(f(p))$.
Then $\exists\delta$ such that $f(x)\in N_\alpha(f(q))$ for all $x\in N_\delta(q)\cap E$.
But this only shows that $N_\delta(q)\cap E\subset f^{-1}(V)$, not $N_\delta(p) ....$
I also thought about showing that if $p\notin E$, then $N_\delta(p)\cap E=\{\}$,
but I have no idea about how to do it.

• What is your definition of continuity? – Pedro Tamaroff May 28 '13 at 1:00
• You're worrying unnecessarily. You should be assuming $f^{-1}(V)\cap E\ne\emptyset$ and choosing $p\in f^{-1}(V)\cap E$. – Ted Shifrin May 28 '13 at 1:00
• I have a suggestion for your math formatting. You should put entire mathematical expressions in dollar signs. For instance, instead of $f^{-1}$(V) = {} it should be $f^{-1}(V)=\{\}$ which is written $f^{-1}(V)=\{\}$. – Karl Kronenfeld May 28 '13 at 1:06
• Note that: You can replace R by any other metric space. – Gaston Burrull May 28 '13 at 1:43
• @Peter you must assume the standart definition, the $\epsilon$-$\delta$ one (always in metric spaces this is the standart definition, for the contrary in topological spaces is the definition with open sets) – Gaston Burrull May 28 '13 at 6:39

You must change only one step in your proof:

When you say:

"If $f^{-1}(V)=\{\}$ then it is open"

reeplace by

"If $f^{-1}(V)\cap E=\{\}$" then $f^{-1}(V)$ is open relative to $E$".

Then the following line must be

"suppose now $f^{-1}(V)\cap E\neq\{\}$ then exists $p\in f^{-1}(V)\cap E$"

and your problem was solved since $p\in E$.

• Thanks for pointing this out. After all the work, I entirely forgot where I was starting from .... – Andy Tam May 29 '13 at 3:47
• Glad to be of help. – Gaston Burrull May 29 '13 at 3:53