I would like some feedback and corrections to my proof below that $f\colon\mathbb{R}\to\mathbb{R}$ is continuous if and only if for every open set $A$ in $\mathbb{R}$ we have $f^{-1}(A)$ open in $\mathbb{R}$, using $\varepsilon\text{-}\delta$ definition of continuity.
($\Rightarrow$). If $f$ is continuous, then for all $a\in\mathbb{R}$ we have that for all $\varepsilon>0$ there is a $\delta>0$ such that for all $x\in X$ with $\left|x-a\right|<\delta$ this is going to imply that $\left|f(x)-f(a)\right|<\varepsilon$.
Take an open set $A\subset f[\mathbb{R}]\subset \mathbb{R}$ (I'm not sure if it's necessary to take it as subset of $f[\mathbb{R}]$). For any $f(a)\in A$, because $f$ is continuous, we can choose any $\varepsilon>0$, so we do it by choosing $\varepsilon_{f(a)}>0$ such that $(f(a)-\varepsilon,f(a)+\varepsilon)\subset A$, and this is possible because $A$ is open by hypothesis.
As $f$ is continuous, this $\varepsilon_{f(a)}>0$ will gives us a $\delta_{a}>0$ such that all $x\in \mathbb{R}$ that are within a distance $\delta_a$ from $a$ will have their image $f(x)$ within a distance $\varepsilon_{f(a)}$ from $f(a)$. That is, we are going to have an open interval $(a-\delta_a,a+\delta_a)$, and because all of the $x\in\mathbb{R}$ inside of this interval have their image $f(x)\in A$, this interval $(a-\delta_a,a+\delta_a)$ is a subset of $f^{-1}(A)$.
If we follow this for all $f(a)\in A$, we are going to end up with an open interval with center $a$ and radius $\delta_a$ for each $a\in f^{-1}(A)$, so $f^{-1}(A)$ is open.
($\Leftarrow$). We have that for every open set $A$ of $\mathbb{R}$ we have $f^{-1}(A)$ open in $\mathbb{R}$.
As $A$ is open in $\mathbb{R}$, for all elements $f(a)\in A$ there is an $\varepsilon_{f(a)}>0$ such that $(f(a)-\varepsilon_{f(a)},f(a)+\varepsilon_{f(a)})$ is a subset of $A$.
So we can obtain an $a\in f^{-1}[(f(a)-\varepsilon_{f(a)},f(a)+\varepsilon_{f(a)})]$. And because $f^{-1}[(f(a)-\varepsilon_{f(a)},f(a)+\varepsilon_{f(a)})]\subset f^{-1}(A)$ and $f^{-1}(A)$ is open, we choose a $\delta_a>0$ such that $(a-\delta_a,a+\delta_a)\subset f^{-1}[(f(a)-\varepsilon_{f(a)},f(a)+\varepsilon_{f(a)})]$.
Therefore, we have that $f[(a-\delta_a,a+\delta_a)]\subset (f(a)-\varepsilon_{f(a)},f(a)+\varepsilon_{f(a)})$ and we conclude that $f$ is continuous.