$f:X\to Y$ continuous $\iff$ $f^{-1}(U)$ open for all $U\subset Y$.

Let $X,Y\subset \mathbb R$. Is it true that $f:X\to Y$ continuous $\iff$ $f^{-1}(U)$ open for all open subset $U\subset Y$. The implication is of course correct. But I have doubt for the reciprocal. I know that for all $U$ in the topology of $Y$ the result is true (it's in fact the topological definition of continuity). But I suspect that there it can have set $V$ open for the topology of $Y$ that is not open in $\mathbb R$ such that $f^{-1}(V)$ is not open in $X$, and thus that $f$ wouldn't be continuous. What do you think ?

• If this is not your definition of continuity, then what is it? – Magdiragdag Sep 16 '17 at 9:33

You right ! Let $$f:[0,1]\to [0,1]$$ defined by $$f(x)=\begin{cases}0&x\in [0,1)\\1&x=1.\end{cases}$$ You will have that $f^{-1}(U)$ is open for all open $U\subset [0,1]$ but $f$ is not continuous.

• Note that $(\frac12,1]$ is open in $[0,1]$, but its preimage $\{0,1\}$ is not open in $[0,1]$, so $f$ is not continuous. – Magdiragdag Sep 16 '17 at 9:34
• @Magdiragdag: Yes, but since the tag is written as "real-analysis", I suspect that the OP is asking about open of $\mathbb R$ that are included in $[0,1]$. – Surb Sep 16 '17 at 9:35
• That is probably the OP's source of confusion but the OP does state "[there is a] set $V$ open for the topology of $Y$ that is not open in ${\mathbb R}$", so the OP is not thinking about that. – Magdiragdag Sep 16 '17 at 9:37
• @Magdiragdag: Oh yes, you right... but Surb : it's exactly the type of example I was looking for (I indeed confused open of $\mathbb R$ included in $Y$ and element of $Y$ topology... I have so much problem with this things....grrrrr :-) Topology is so hard to give natural representation...) – MathBeginner Sep 16 '17 at 9:41
• @MathBeginner: At the beginning it looks strange, I know. But don't worry, you will catch it :) – Surb Sep 16 '17 at 9:46