# Open and Closed Set Criteria for Continuity of Functions on Metric Spaces

Recall from the Continuity of Functions on Metric Spaces page that if $(S, d_S)$ and $(T, d_T)$ are metric spaces and $f : S \to T$ then $f$ is said to be continuous at a point $p \in S$ if for all $\epsilon > 0$ there exists a $\delta > 0$ such that if $d_S(x, p) < \delta$ then $d_T(f(x), f(p)) < \epsilon$.

We also said that $f$ is continuous on all of $S$ if $f$ is continuous at each point $p \in S$.

We will now look at two very important theorems which tell us when a function $f$ is continuous on all of $S$ or not in terms of open and closed sets.

Theorem 1: Let $(S, d_S)$ and $(T, d_T)$ be metric spaces and let $f : S \to T$. Then $f$ is continuous on all of $S$ if and only if for every open set $V$ in $T$ we have that the inverse image $f^{-1}(V)$ is open in $S$. |

*In the proof below we will use the "ball-definition" of continuity of $f$. Recall that $f : S \to T$ is continuous at a point $p \in S$ if for all $\epsilon > 0$ there exists a $\delta > 0$ such that $f(B_S(p, \delta)) \subseteq B_T(f(p), \epsilon)$.*

**Proof:**$\Rightarrow$ Suppose that $f : S \to T$ is continuous on all of $S$ and let $V$ be an open set in $T$. Consider the set $f^{-1}(V)$. If $f^{-1}(V) = \emptyset$ then we are done since the emptyset is open in $S$. Otherwise, let $p \in f^{-1}(V)$. Then $f(p) \in V$.

- Since $V$ is open there exists an $\epsilon > 0$ such that:

- Since $f$ is continuous at $p$, for this given $\epsilon$ there exists a $\delta > 0$ such that:

- Therefore:

- This shows that $f^{-1}(V)$ is open in $S$.

- $\Leftarrow$ Now suppose that for all open sets $V$ in $T$ we have that the inverse images $f^{-1}(V)$ are open sets in $S$. To show that $f$ is continuous on all of $S$ we must show that $f$ is continuous for every $p \in S$.

- Let $p \in S$ be such that $y = f(p)$. Then for every $\epsilon > 0$, the ball centered at $y = f(p)$ with radius $\epsilon > 0$ is open in $T$, i.e., $B_T(y, \epsilon) = B_T(f(p), \epsilon)$ is open in $T$.

- Since $B_T(f(p), \epsilon)$ is open in $T$ we have that the inverse image $f^{-1}(B_T(f(p), \epsilon))$ is open in $S$. Now, since $f(p) \in B_T(f(p), \epsilon)$ we have that $p \in f^{-1}(B_T(f(p), \epsilon))$ and since $f^{-1}(B_T(f(p), \epsilon))$ is open in $S$ there exists a $\delta > 0$ such that:

- Therefore $f$ is continuous at each $p \in S$, so $f$ is continuous on all of $S$. $\blacksquare$

Theorem 2: Let $(S, d_S)$ and $(T, d_T)$ be metric spaces and let $f : S \to T$. Then $f$ is continuous on all of $S$ if and only if for every closed set $V$ in $T$ we have that the inverse image $f^{-1}(V)$ is closed in $S$. |

*The only difference between Theorem 1 and Theorem 2 is the replacement of the word "open" with "closed".*

**Proof:**$\Rightarrow$ Suppose that $f$ is continuous on all of $S$. Then by Theorem 1, for every open set in $T$ the inverse image is open in $S$.

- Let $V$ be any closed set in $T$. Then $T \setminus V$ is open in $T$ so $f^{-1}(T \setminus V) = f^{-1}(T) \setminus f^{-1}(V) = S \setminus f^{-1}(V)$ is open in $S$. Hence $f^{-1}(V)$ is closed in $S$.

- So for every closed set $V$ in $T$ we have that $f^{-1}(V)$ is closed in $S$.

- $\Leftarrow$ Suppose that for every closed set $V$ in $T$ we have that $f^{-1}(V)$ is closed in $S$. Let $U$ be an open set in $T$. Then $T \setminus U$ is closed in $T$, and $f^{-1}(T \setminus U)$ is closed in $S$. Furthermore:

- So $S \setminus f^{-1}(U)$ is closed and $f^{-1}(U)$ is open. So for every open set $U$ in $T$ we have that $f^{-1}(U)$ is open in $S$, so by Theorem 1, $f$ is continuous on all of $S$. $\blacksquare$