In calculus, "continuous" meant "no jumps," made precise with $\varepsilon$ and $\delta$. In topology there are no distances, so continuity has to be said with open sets. The definition looks backwards at first (it pulls sets back instead of pushing them forward), but it's exactly the $\varepsilon$-$\delta$ definition in disguise, and it works in every space at once.
Here it is.
Let $(X, \mathcal{T})$ and $(Y, \mathcal{T}')$ be topological spaces. A function $f: X \to Y$ is continuous (relative to the topologies on $X$ and $Y$) if for each open subset $V \subset Y$, the set $f^{-1}(V)$ is an open subset of $X$.
Remember that $f^{-1}(V) = \{x \in X : f(x) \in V\}$ makes sense for every function, invertible or not. Continuity depends on both topologies, not just the formula for $f$.
Let $i(x) = x$ be the identity function on $\mathbb{R}$. Is $i: \mathbb{R}_l \to \mathbb{R}$ continuous? What about $i: \mathbb{R} \to \mathbb{R}_l$?
$i: \mathbb{R}_l \to \mathbb{R}$ is continuous: the preimage of an open set $V$ of $\mathbb{R}$ is $V$ itself, and every standard open set is open in the finer topology $\mathbb{R}_l$.
$i: \mathbb{R} \to \mathbb{R}_l$ is not: $[0, 1)$ is open in $\mathbb{R}_l$, but $i^{-1}([0, 1)) = [0, 1)$ is not open in $\mathbb{R}$.
The identity $X \to X$ is continuous from $(X, \mathcal{T}')$ to $(X, \mathcal{T})$ exactly when $\mathcal{T}'$ is finer than $\mathcal{T}$. That's another way to read the "Fit a Basis Element" game from the first page.
On finite spaces you can check the definition by brute force. Wire up a function and run every open set of $Y$ through $f^{-1}$.
The open sets of $X$ form a chain $\emptyset \subset \{1\} \subset \{1, 2\} \subset X$, so no two nonempty open sets of $X$ are disjoint. That's why a continuous $f$ can't hit both $a$ and $b$: $f^{-1}(\{a\})$ and $f^{-1}(\{b\})$ would be disjoint nonempty open sets.
Depending on the problem, one of these four is much easier to check than the others.
Let $X$ and $Y$ be topological spaces and $f: X \to Y$. Then the following are equivalent:
Proof. $(1) \Rightarrow (2)$. Assume $f$ is continuous. Let $A \subset X$, let $x \in \overline{A}$, and let $V$ be a neighborhood of $f(x)$. By continuity, $f^{-1}(V)$ is an open set of $X$ containing $x$, so (since $x \in \overline{A}$) it intersects $A$ at some point $y$. Then $V$ intersects $f(A)$ at the point $f(y)$. Every neighborhood of $f(x)$ intersects $f(A)$, so $f(x) \in \overline{f(A)}$.
$(2) \Rightarrow (3)$. Let $D \subset Y$ be closed and $B = f^{-1}(D)$. Then $f(B) \subset D$. If $x \in \overline{B}$, then $$f(x) \in f(\overline{B}) \subset \overline{f(B)} \subset \overline{D} = D,$$ so $x \in f^{-1}(D) = B$. Hence $\overline{B} \subset B$, so $\overline{B} = B$ and $f^{-1}(D)$ is closed.
$(3) \Rightarrow (1)$. Let $V$ be open in $Y$. Then $E = Y \setminus V$ is closed, and $$f^{-1}(E) = f^{-1}(Y \setminus V) = X \setminus f^{-1}(V).$$ By assumption $f^{-1}(E)$ is closed, so its complement $f^{-1}(V)$ is open. Hence $f$ is continuous.
$(1) \Rightarrow (4)$. Let $x \in X$ and let $V$ be a neighborhood of $f(x)$. Then $U = f^{-1}(V)$ is a neighborhood of $x$ with $f(U) \subset V$.
$(4) \Rightarrow (1)$. Let $V$ be open in $Y$ and $x \in f^{-1}(V)$. Then $f(x) \in V$, and by assumption there is a neighborhood $W_x$ of $x$ with $f(W_x) \subset V$, that is, $W_x \subset f^{-1}(V)$. So $f^{-1}(V) = \bigcup_{x \in f^{-1}(V)} W_x$ is a union of open sets, hence open. $\blacksquare$
Condition (4) is the $\varepsilon$-$\delta$ definition with the numbers removed: $V$ plays the role of "within $\varepsilon$ of $f(x)$," and $U$ plays the role of "within $\delta$ of $x$."
On the Metric Topology page, condition (4) turns back into the literal calculus definition: for every $\varepsilon > 0$ there is a $\delta > 0$ with $d(x, y) < \delta \Rightarrow d(f(x), f(y)) < \varepsilon$.
Continuous functions pull open sets back to open sets. They do not have to push open sets forward to open sets: the constant map $f: \mathbb{R} \to \mathbb{R}$, $f(x) = 0$, is continuous, but it sends the open set $\mathbb{R}$ to $\{0\}$, which isn't open. Don't prove continuity by showing $f(U)$ is open.
When are two spaces "the same" as topological spaces? When there's a bijection that matches up their open sets in both directions.
Let $X$ and $Y$ be topological spaces and $f: X \to Y$ be a bijection. If both the function $f$ and $f^{-1}: Y \to X$ are continuous, then $f$ is a homeomorphism.
Homeomorphism. Homomorphism. One letter apart, completely different meanings, and you will absolutely need both in the same semester. Topologists and algebraists share a building and a cruel sense of humor.
A homeomorphism gives a one-to-one correspondence between the open sets of $X$ and the open sets of $Y$ ($U \mapsto f(U)$), so anything defined using only open sets (closed, compact, connected, Hausdorff, ...) is the same for both spaces. Lengths and shapes don't count.
Show that $\mathbb{R}$ is homeomorphic to the interval $(-1, 1)$.
Let $f: \mathbb{R} \to (-1, 1)$, $f(x) = \dfrac{x}{1 + |x|}$. It is continuous, and it is a bijection with inverse $g: (-1, 1) \to \mathbb{R}$, $g(y) = \dfrac{y}{1 - |y|}$, which is also continuous. (Check that $f(g(y)) = y$ and $g(f(x)) = x$.) So $f$ is a homeomorphism: the whole infinite line is "the same space" as a short open interval.
Watch out: a continuous bijection doesn't have to be a homeomorphism. The inverse can fail to be continuous.
Let $S^1 = \{(x, y) : x^2 + y^2 = 1\}$ and $f: [0, 1) \to S^1$, $f(t) = (\cos 2\pi t, \sin 2\pi t)$. Is $f$ a homeomorphism?
$f$ is a continuous bijection, but not a homeomorphism. The set $U = [0, \frac{1}{4})$ is open in $[0, 1)$, but $f(U)$ is not open in $S^1$: every open arc around $f(0) = (1, 0)$ contains points $f(t)$ with $t$ close to $1$, which are not in $f(U)$. So $f^{-1}$ is not continuous: it tears the circle open at $(1, 0)$.
When the inverse is continuous onto the image, we get a faithful copy of $X$ sitting inside $Y$.
Let $X$ and $Y$ be topological spaces and $f: X \to Y$ be an injective continuous map. Let $Z = f(X)$, considered as a subspace of $Y$. Then the function $f': X \to Z$ obtained by restricting the range of $f$ is bijective. If $f'$ is a homeomorphism, then $f: X \to Y$ is a topological imbedding, or simply an imbedding, of $X$ in $Y$.
The map $t \mapsto (\cos 2\pi t, \sin 2\pi t)$ from $[0, 1)$ is injective and continuous but not an imbedding, by the example above. On the other hand, $x \mapsto (x, 0)$ is an imbedding of $\mathbb{R}$ in $\mathbb{R}^2$.
The following are statements about constructing continuous functions. Each is given (without proof) assuming that $X$, $Y$, and $Z$ are topological spaces. Each one is a short exercise with the definition.
Rule 6 glues continuous pieces along open sets. The pasting lemma does the same thing with finitely many closed pieces, which is what you need for piecewise formulas like "$f$ for $x \le 0$ and $g$ for $x \ge 0$."
Let $X = D \cup E$, where $D$ and $E$ are closed in $X$. Let $f: D \to Y$ and $g: E \to Y$ be continuous. If $f(x) = g(x)$ for every $x \in D \cap E$, then $f$ and $g$ combine to give a continuous function $h: X \to Y$, defined by setting $h(x) = f(x)$ for $x \in D$ and $h(x) = g(x)$ for $x \in E$.
Proof. The agreement on $D \cap E$ makes $h$ well defined. Let $F$ be a closed subset of $Y$. Then $$h^{-1}(F) = f^{-1}(F) \cup g^{-1}(F).$$ Since $f$ is continuous, $f^{-1}(F)$ is closed in $D$, and since $D$ is closed in $X$, it is closed in $X$ (Exercise 1 on the Closed Sets page). Likewise $g^{-1}(F)$ is closed in $X$. Their union is closed, so $h$ is continuous by condition (3). $\blacksquare$
Both hypotheses matter. Slide $g$ up and down, and switch $D$ from closed to not closed.
With closed pieces, the only thing to check is that the formulas agree on the overlap. Most "is this piecewise function continuous?" questions come down to plugging the boundary point into both formulas.
Exercise 4 needs one new definition.
A collection of subsets $\{A_\alpha\}_{\alpha \in J}$ of $X$ is locally finite if each $x \in X$ has a neighborhood in $X$ that intersects only finitely many of the sets $A_\alpha$.
The first one is a warm-up with homeomorphisms.
Show that the subspace $(a, b)$ of $\mathbb{R}$ is homeomorphic with $(0, 1)$, and the subspace $[a, b]$ is homeomorphic with $[0, 1]$.
Proof. Define $\gamma: [0, 1] \to [a, b]$ by $\gamma(t) = t \cdot b + (1 - t) \cdot a$. It is continuous (a polynomial), and it is a bijection with inverse $\gamma^{-1}(s) = \dfrac{s - a}{b - a}$, which is also continuous. So $\gamma$ is a homeomorphism. The same formula restricts to a bijection $(0, 1) \to (a, b)$ whose inverse is the same restricted formula, so $(0, 1)$ and $(a, b)$ are homeomorphic too. $\blacksquare$
This one combines continuity with the Hausdorff condition.
Let $Y$ be a Hausdorff space and $f: X \to Y$ be continuous. Show that the graph $$G = \{(x, f(x)) : x \in X\}$$ is closed in $X \times Y$.
Proof. Let $(x, y) \in (X \times Y) \setminus G$. Then $y \neq f(x)$, so since $Y$ is Hausdorff there are disjoint open sets $U$ and $V$ with $y \in U$ and $f(x) \in V$. By continuity (condition (4)), there is a neighborhood $W$ of $x$ with $f(W) \subset V$. Then $W \times U$ is a neighborhood of $(x, y)$, and it is disjoint from $G$: if $(w, f(w)) \in W \times U$, then $f(w) \in U$ and $f(w) \in f(W) \subset V$, contradicting $U \cap V = \emptyset$. So $(X \times Y) \setminus G$ is open, and $G$ is closed. $\blacksquare$
Next: continuous extensions into a Hausdorff space are unique.
Let $A \subset X$, let $f: A \to Y$ be continuous, and let $Y$ be Hausdorff. Show that if $f$ can be extended to a continuous function $g: \overline{A} \to Y$, then $g$ is uniquely determined by $f$.
Proof. Suppose $g_1, g_2: \overline{A} \to Y$ are continuous extensions of $f$, and suppose for contradiction that $g_1(x) \neq g_2(x)$ for some $x \in \overline{A}$. Since $g_1 = g_2 = f$ on $A$, we have $x \in \overline{A} \setminus A$. Since $Y$ is Hausdorff, there are disjoint neighborhoods $U$ of $g_1(x)$ and $V$ of $g_2(x)$. By continuity, $g_1^{-1}(U)$ and $g_2^{-1}(V)$ are open in $\overline{A}$ and contain $x$, so their intersection is a neighborhood of $x$ in $\overline{A}$. Since $x$ is in the closure of $A$, that neighborhood contains some $a \in A$. Then $f(a) = g_1(a) \in U$ and $f(a) = g_2(a) \in V$, contradicting $U \cap V = \emptyset$. So $g_1 = g_2$. $\blacksquare$
Finally, the finite version of a generalized pasting lemma. (The locally finite version is the Spicy Bonus.)
Let $\{A_\alpha\}$ be a collection of subsets of $X$ with $X = \bigcup_\alpha A_\alpha$. Let $f: X \to Y$, and suppose $f|_{A_\alpha}$ is continuous for each $\alpha$. Show that if the collection is finite and each $A_\alpha$ is closed, then $f$ is continuous.
Proof. Let $D \subset Y$ be closed. Then $$f^{-1}(D) = \bigcup_{\alpha} \big(f^{-1}(D) \cap A_\alpha\big) = \bigcup_{\alpha} (f|_{A_\alpha})^{-1}(D).$$ Each $(f|_{A_\alpha})^{-1}(D)$ is closed in $A_\alpha$ (since $f|_{A_\alpha}$ is continuous), hence closed in $X$ (since $A_\alpha$ is closed in $X$). A finite union of closed sets is closed, so $f^{-1}(D)$ is closed, and $f$ is continuous. (This is the pasting lemma applied repeatedly.) $\blacksquare$
Infinitely many closed pieces can break the pasting lemma (try gluing the one-point sets $\{x\}$ of $\mathbb{R}$). Local finiteness is exactly what rescues it.
Let $\{A_\alpha\}_{\alpha \in J}$ be a collection of subsets of $X$ with $X = \bigcup_\alpha A_\alpha$, let $f: X \to Y$, and suppose $f|_{A_\alpha}$ is continuous for each $\alpha$. Show that if the collection is locally finite and each $A_\alpha$ is closed, then $f$ is continuous.
Proof. Let $E \subset Y$ be closed, and set $C_\alpha = (f|_{A_\alpha})^{-1}(E)$ for each $\alpha \in J$. As in the finite case, each $C_\alpha$ is closed in $A_\alpha$, hence closed in $X$, and $$f^{-1}(E) = \bigcup_{\alpha \in J} C_\alpha.$$ It remains to show that this union of closed sets is closed. Let $x \notin \bigcup_\alpha C_\alpha$. By local finiteness, $x$ has a neighborhood $W$ that intersects only finitely many $A_\alpha$, say $A_{\alpha_1}, \dots, A_{\alpha_n}$. Since $C_\alpha \subset A_\alpha$, the only $C_\alpha$'s that $W$ can meet are $C_{\alpha_1}, \dots, C_{\alpha_n}$. The set $$W \setminus (C_{\alpha_1} \cup \dots \cup C_{\alpha_n})$$ is open (a finite union of closed sets is closed), contains $x$, and misses every $C_\alpha$. So the complement of $\bigcup_\alpha C_\alpha$ is open, $f^{-1}(E)$ is closed, and $f$ is continuous. $\blacksquare$