=== Necessary Condition === Let $\operatorname{Dom} \left( {f} \right)$ be the domain of $f$. Let $\operatorname{Im} \left( {f} \right)$ be the image of $f$. Let $f^{-1} \left [{O}\right]$ be the preimage of $O$ under $f$. Thus by definition: : $\operatorname{Im} \left( {f} \right)$ is the set of points $q$ in the codomain of $f$ satisfying $q = f \left( {p} \right)$ for a point $p$ in $\operatorname{Dom} \left( {f} \right)$. :$f^{-1} \left [{O}\right]$ is the set of points $p$ in $\operatorname{Dom} \left( {f} \right)$ such that $f \left( {p} \right) \in O$. Let $f$ be continuous. Let $O$ be an open real set that overlaps with $\operatorname{Im} \left( {f} \right)$. We need to show that $f^{-1} \left [{O}\right]$ is open. $(1): \quad$ It is shown that $f^{-1} \left [{O}\right]$ is non-empty. A point $q_1$ exists in $O \cap \operatorname{Im} \left( {f} \right)$ as $O$ and $\operatorname{Im} \left( {f} \right)$ overlap. In particular, $q_1 \in \operatorname{Im} \left( {f} \right)$. Therefore, by the definition of $\operatorname{Im} \left( {f} \right)$, a point $p_1$ in $\operatorname{Dom} \left( {f} \right)$ exists satisfying $f \left( {p_1} \right) = q_1$. Also, $q_1 \in O$, which gives: {{begin-eqn}} {{eqn | o = \implies       | l = q_1 \in O       | r = f \left( {p_1} \right) \in O       | c = as $f \left( {p_1} \right) = q_1$ }} {{eqn | o = \implies       | r = p_1 \in f^{-1} \left[ {O} \right]       | c = by the definition of $f^{-1} \left[ {O} \right]$ }} {{end-eqn}} Accordingly, $f^{-1} \left [{O}\right]$ is non-empty. $(2): \quad$ It is shown that the function $f$ maps $\left( {x - \delta \,.\,.\, x + \delta} \right)$ into $O$. Let $x$ be a point in $f^{-1} \left [{O}\right]$. This means that $x \in \operatorname{Dom} \left( {f} \right)$ and $f \left( {x} \right) \in O$. We know that $f$ is continuous. Accordingly, $f$ is continuous at $x$ as $x \in \operatorname{Dom} \left( {f} \right)$. Let an $\epsilon > 0$ be given. That $f$ is continuous at $x$, means that: : a $\delta > 0$ exists such that $f \left( {y} \right) \in \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ whenever $y \in \left( {x - \delta \,.\,.\, x + \delta} \right) \cap \operatorname{Dom} \left( {f} \right)$. We know that $f \left( {x} \right) \in O$. Also, $O$ is open. This allows us to choose $\epsilon \in \R_{>0}$ small enough such that: :$\left({f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right) \subseteq O$ We know that $x \in \operatorname{Dom} \left( {f} \right)$. Also, $\operatorname{Dom} \left( {f} \right)$ is open. This allows us to choose $\delta \in \R_{>0}$ small enough such that: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq \operatorname{Dom} \left( {f} \right)$ Having chosen $\epsilon$ and $\delta$ in this way, we have, where $f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]$ is the image of $\left( {x - \delta \,.\,.\, x + \delta} \right)$ by $f$: :$f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right] \subseteq \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ as $f \left( {y} \right) \in \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ whenever $y \in \left( {x - \delta \,.\,.\, x + \delta} \right)$ which implies: :$f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right] \subseteq O$ as $\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right) \subseteq O$. $(3): \quad$ It is shown that the interval $\left( {x - \delta \,.\,.\, x + \delta} \right)$ is a subset of $f^{-1} \left [{O}\right]$. Keep in mind that by Subset of Domain is Subset of Preimage of Image: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left[ {f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]} \right]$ Continuing by elaborating on $f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right] \subseteq O$: {{begin-eqn}} {{eqn | o = \implies       | l = f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right] \subseteq O       | r = f^{-1} \left[ {f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]} \right] \subseteq f^{-1} \left [{O}\right]       | c = by Image of Subset is Subset of Image }} {{eqn | o = \implies       | r = \left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left [{O}\right]       | c = as $\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left[ {f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]} \right]$ }} {{end-eqn}} Because: :$f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right] \subseteq O$ it follows that: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left [{O}\right]$ Since $x$ is an arbitrary point in $f^{-1} \left [{O}\right]$, it follows by the definition of open set that $f^{-1} \left [{O}\right]$ is open. {{qed|lemma}} === Sufficient Condition === Let $\operatorname{Dom} \left( {f} \right)$ be the domain of $f$. Let $\operatorname{Im} \left( {f} \right)$ be the image of $f$. Let $f^{-1} \left [{O}\right]$ be the preimage of $O$ under $f$. Thus by definition: : $\operatorname{Im} \left( {f} \right)$ is the set of points $q$ in the codomain of $f$ satisfying $q = f \left( {p} \right)$ for a point $p$ in $\operatorname{Dom} \left( {f} \right)$. :$f^{-1} \left [{O}\right]$ is the set of points $p$ in $\operatorname{Dom} \left( {f} \right)$ such that $f \left( {p} \right) \in O$. Let $f^{-1} \left [{O}\right]$ be open for every open real set $O$ that overlaps with $\operatorname{Im} \left( {f} \right)$. We need to show that $f$ is continuous. Let $O$ be an open real set that overlaps with $\operatorname{Im} \left( {f} \right)$. $(1): \quad$ It is shown that $\operatorname{Dom} \left( {f} \right)$ is non-empty. A point $q_1$ exists in $O \cap \operatorname{Im} \left( {f} \right)$ as $O$ and $\operatorname{Im} \left( {f} \right)$ overlap. In particular, $q_1 \in \operatorname{Im} \left( {f} \right)$. Therefore, by the definition of $\operatorname{Im} \left( {f} \right)$, a point $p_1$ in $\operatorname{Dom} \left( {f} \right)$ exists satisfying $q_1 = f \left( {p_1} \right)$. Accordingly, $\operatorname{Dom} \left( {f} \right)$ is non-empty. $(2): \quad$ It is shown that the set $f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$ is open. Let $x$ be a point in $\operatorname{Dom} \left( {f} \right)$. Let $\epsilon > 0$ be given. The open interval $\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ overlaps with $\operatorname{Im} \left( {f} \right)$ as $f \left( {x} \right) \in \operatorname{Im} \left( {f} \right)$. In other words, $\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ is an open real set that overlaps with $\operatorname{Im} \left( {f} \right)$. Accordingly, $f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$ is open by assumption. $(3): \quad$ It is shown that the interval $\left( {x - \delta \,.\,.\, x + \delta} \right)$ is a subset of $f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$. By the definition of preimage of $\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ under $f$: :$x \in f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$ as: : $x \in \operatorname{Dom} \left( {f} \right)$ and $f \left( {x} \right) \in \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ Since $f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$ is open, a $\delta \in \R_{>0}$ exists such that: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$ which implies: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq \operatorname{Dom} \left( {f} \right)$ as $f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right] \subseteq \operatorname{Dom} \left( {f} \right)$ by the definition of $f^{-1}$ $(4): \quad$ It is shown that the set $f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]$ is a subset of $\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$. Keep in mind that: Because: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq \operatorname{Dom} \left( {f} \right)$ it follows that: :$f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]$ is defined. Because: :$f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right] \subseteq \operatorname{Dom} \left( {f} \right)$ it follows that: :$f \left[ {f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]} \right]$ is defined. By Subset of Codomain is Superset of Image of Preimage: :$f \left[ {f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]} \right] \subseteq \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ We continue by elaborating on $\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$: {{begin-eqn}} {{eqn | l = \left( {x - \delta \,.\,.\, x + \delta} \right)        | o = \subseteq       | r = f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right] }} {{eqn | ll= \implies       | l = f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]       | o = \subseteq       | r = f \left[ {f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]} \right]       | c = by Image of Subset is Subset of Image }} {{eqn | ll= \implies       | l = f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]       | o = \subseteq       | r = \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)       | c = as $f \left[ {f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]} \right] \subseteq \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ }} {{end-eqn}} Because: :$\left( {x - \delta \,.\,.\, x + \delta} \right) \subseteq f^{-1} \left[ {\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)} \right]$ it follows that: :$f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right] \subseteq \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$ In other words, a point in $f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]$ is also a point in $\left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$. Accordingly, let $y \in \left( {x - \delta \,.\,.\, x + \delta} \right)$. Because: : $f \left( {y} \right) \in f \left[ {\left( {x - \delta \,.\,.\, x + \delta} \right)} \right]$ it follows that: :$f \left( {y} \right) \in \left( {f \left( {x} \right) - \epsilon \,.\,.\, f \left( {x} \right) + \epsilon} \right)$  Therefore, by the definition of continuity, $f$ is [Definition:Continuous Real Function at Point|continuous]] at $x$. Since $x$ is an arbitrary point in the domain of $f$, $f$ is continuous. {{qed}}