# Continuity.
## The $\epsilon - \delta$ Defintion of Continuity
The first notion of continuity is the infamous $\epsilon - \delta$ formulation. It states that a function $f: \mathbb{R}^n \mapsto \mathbb{R}^m$ is continuous if and only if for every $a \in \mathbb{R}$, $\forall \epsilon > 0, \exists \delta > 0$ such that $f(B_{\delta}(a)) \subset B_{\epsilon}(f(a))$.
What is that, you may wonder? Those are balls. Intuitivley, continuous functions map "nearby" points to "nearby" points.
Let's stick to single variable functions for now. There a ball $B_\epsilon(a)$ is simply the set of points $x \in \mathbb{R}$ such that |x - a| < $\epsilon$. (i.e the set of points that are within epsilon of distance from a). In two dimensions, the ball would be the set of points in the disk centered about a with radius epsilon.
This definition is saying that a function is continuous at a point a if and only if for every given epsilon radius around the image f(a), you can find a $\delta > 0$ (delta) such that $|x - a| < \delta \implies |f(x) - f(a)| < \epsilon$.

# The Topological Definition of Continuity
It states that a function $f: \mathbb{R}^n \mapsto \mathbb{R}^m$ is continuous if and only if for every open set $V \subset \mathbb{R}^m$, the preimage $f^{-1}(V)$ is open.
What is an open set? A set $U$ is open if for all $x \in U$, $\exists \epsilon > 0$ such that $B_{\epsilon} = \{x| d(x,a) < \epsilon\}$. (d is a distance metric, could be euclidean distance metric for example).
Why non - open set mapping to open set is bad. Christ, I barely can wrap my non continuous mind around it. But I will try.
Suppose for the sake of contradiction, that for some open $V \subset \mathbb{R}^m$ in the range, its preimage $f^{-1}(V)$ in the domain is not open. Since it's not open there must be some $x \in f^{-1}(V)$ such that every possible radius $\delta$, the ball $B_{\delta}(x)$ is not a subset of $f^{-1}(V)$. A part of it sticks out from the set. Where do those non included points map to? Not to the set V, thats for sure, even though x and the rest of the included points do. They could get mapped literally anywhere in the codomain, or maybe they get mapped to nothing at all. Either way, under such a map f, nearby points are not mapped to nearby points. The notion of "nearby" is formalized through the concept of open sets, also called neighborhoods. Basically, to summarize, there are points in the neighborhood of x in the domain that f maps to fucking wherever - tearing the neighborhood apart by the seam. That is not continuous behavior.
For example, let's look at a function $f(x) = \frac{x}{x-2}$. It's clearly discontinuous at x = 2. (It's also undefined. Rememeber that there are more ways for a function to be discontinuous at a point other than being undefined, but whatever). Let's go visit the suburbs in the domain $\mathbb{R}$. Ah, here is the home of $x = 2$, and around it is an open interval of some radius.
Apply the function f. Lets look at some neighborhood around x = 2, say $\epsilon = 0.5$, so we have the ball/neighborhood (1.5, 2.5). That's an open set. Let us now drag this back into the domain by finding the preimage of this set - aka what maps to (1.5, 2.5)?

Nothing around x = 2.

There is no way to adjust that black region around x =2 so that it is a subset of the purple region. Compare this to the behavior of a nice continuous function like y = x.

## Why mapping non open sets to open sets is bad (non continuous). Finally.
Let's consider a non - open set around x = 2 in the domain, like (1.7, 2.3] for example. It's closed since no matter what, there is no ball around the boundary point 2.3 included in the interval.
However; (1.7, 2.3] maps to an open set - namely, $(2.3, \infty)$. As you can see, the (relativley) nearby points in the neighborhood (1.7, 2.3] were ripped apart, a decent chunk of them exploding up towards infinity.

Then the preimage of $(2.3, \infty)$ (open) is (1.7, 2.3] which is not open.