Let $ X \subset \mathbb{R}$ be a non-empty, open set and let $f: X \rightarrow \mathbb{R}$ be a continuous function. Show that the inverse image of an open set is open under f, i.e. show:
If $M \subset \mathbb{R}$ is open, then $f^{-1}(M)$ is open as well.
I think that this should basically follow from the definitions, but I'm still having some troubles with the proof.
Suppose $M \subset \mathbb{R}$ is open, then it follows that $\forall z \in M, \exists r > 0: K_r(z) \subseteq M$
Since f is continuous it follows for each $x_0 \in X$ that for each $\epsilon > 0 ,\exists \delta > 0 : |f(x)-f(x_0)|< \epsilon, \forall x \in X: |x-x_0|<\delta$
Now I need to show that $f^{-1}(M)$ is open, so that for each $z \in M, \exists r>0: K_r(f^{-1}(z_0)) \subseteq f^{-1}(M)$
I'm not sure how to prove this. I guess since $z = f(x)$ and since M is open we have that $\exists r>0:\{z:|z-z_0|<r\}\subseteq M$. And since f is continuous: $|f(x)-f(x_0)| = |z-z_0|< \epsilon$ for all $|x-x_0|<\delta$, but since $|x-x_0|=|f^{-1}(z)-f^{-1}(z_0)|<\delta$ it somehow follows from that that $f^{-1}(M)$ is open?!
Which is just horrible and probably completely wrong. But I'm really confused from all the definitions right now and need some help please.