# Let $I, J\subseteq \Bbb R$ be open intervals, and let $f:I\to\Bbb R$ be a function.

Let $$I, J\subseteq \Bbb R$$ be open intervals, and let $$f:I \to\Bbb R$$ be a function.

Suppose that $$f$$ is continuous. Let $$x \in f^{-1} (J)$$.

Prove that there is an open interval $$K\subseteq \Bbb R$$ such that $$x \in K \cap I \subseteq f^{-1} (J)$$

What I have tried so far:

Since $$f$$ is continuous it follows that there exists a point $$c\in\Bbb R$$ such that $$\lim_{x→c}f(x)=f(c)$$. Since $$x\in f^{-1}(J)$$, then there exists $$y \in J$$ such that $$f(c)=y$$.

Also, $$x$$ is continuous for any $$\epsilon>0$$, it also follows that $$|f(x)-f(c)|<\epsilon$$.

It then follows that when $$|x-y|<\delta$$, $$c$$ must be an element of $$f^{-1} (J)$$.

It can then be seen that $$–\delta<|x-c|<\delta-\epsilon<|f(x)-f(c)|<\epsilon$$, which can be manipulated to show that $$x$$ falls somewhere between $$c-δ$$ and $$c+δ$$.

If we then let $$x\in(c-\delta,c+\delta)=k\cap I\subseteq f^{-1}(J)$$, and therefore $$x$$ must be a subset of $$k\cap I\subseteq f^{-1}(J)$$.

Therefore: $$x\subseteq k∩I\subseteq f^{-1}(J)$$

Try expounding on this:
If $$x$$ is in $$f^{-1}(J)$$ then $$f(x) = y$$ for some $$y$$ in $$J$$ . Since $$J$$ is an open interval, there exists some $$\epsilon$$ such that the interval $$(y - \epsilon, y + \epsilon)$$ is completely contained in $$J$$.
Now, since $$f$$ is continuous at $$x$$ we know that given this $$\epsilon$$, there exists a $$\delta$$ such that $$|z - x| < \delta$$ implies $$|f(z) - f(x)| = |f(z) - y| < \epsilon$$. Or, in other words, $$|z - x| < \delta$$ implies $$f(z)$$ is an element of $$(y - \epsilon, y + \epsilon)$$. How does this help us?

You suppose $f: I \rightarrow \mathbb{R}$, and let $x \in I$ be such that $f(x) \in J$. We must find an open interval $I_0 \subset I$ such that $x \in I_0 \subset f^{-1}(J)$. (This equivalent to your claim: the intersection of two open intervals is again an open interval, if not empty).
But $J$ is an interval, so there is some small interval $J_0:= (f(x)-\epsilon, f(x)+ \epsilon) \subset J$. And $f$ is continuous. So there is some small $\delta$ such that $|y-x|< \delta \Rightarrow f(y) \in J_0$. Let $I_0 := (x-\delta, x + \delta)$. (Note: without loss of generality, $I_0 \subset I$; if not, just pick a smaller $\delta$).
We know that $f(I_0) \subset J_0 \subset J$. Also, $x \in I_0$. So $x \in I_0 \subset f^{-1}(J_0) \subset f^{-1}(J)$.
If you want you can let $K:= I_0$.