Skip to content
Tutorials Center
My learning

Topics

Lesson 15 of 36 · Continuity and Homeomorphism

Continuous Functions

Define continuity through open preimages, connect it to epsilon-delta, closed sets and composition, and test it on finite spaces and real functions with code.

In calculus, a continuous function is one you can draw without lifting your pen. In topology we need a definition that works for functions between any two spaces, including spaces with no distance. The answer is surprisingly short: a function is continuous when preimages of open sets are open. This lesson shows why that is the right definition and how it matches the calculus one.

The definition

Let (X, τ_X) and (Y, τ_Y) be topological spaces. A function f: X → Y is continuous if for every open set V ⊆ Y, the preimage f⁻¹(V) = { x ∈ X : f(x) ∈ V } is open in X.

Because preimages commute with complements, this is the same as saying: preimages of closed sets are closed. And it is enough to check basis (or subbasis) elements of Y, because every open set is a union of basis elements and preimages preserve unions.

Why preimages?

Think of an open set V around f(x) as a "tolerance". Continuity says: for any tolerance around the output, you can find a neighborhood of the input that lands inside it. Preimages capture exactly that: if x ∈ f⁻¹(V), then f⁻¹(V) is a neighborhood of x all of whose points map into V. Images of open sets would not work: f(x) = x² is continuous, but it maps the open interval (−1, 1) onto [0, 1), which is not open.

Agreement with ε–δ

For functions between metric spaces, the topological definition is equivalent to the familiar one: f is continuous at a if for every ε > 0 there is δ > 0 such that d(x, a) < δ implies d(f(x), f(a)) < ε. In ball language: the ball B(f(a), ε) is open, so f⁻¹(B(f(a), ε)) is open and contains a, hence contains some ball B(a, δ).

Basic examples and facts

  • Constant functions are continuous: the preimage of any set is ∅ or X.
  • The identity id: X → X is continuous, and so is the inclusion of a subspace.
  • Composition: if f: X → Y and g: Y → Z are continuous, so is g ∘ f: X → Z. For W open in Z, (g ∘ f)⁻¹(W) = f⁻¹(g⁻¹(W)) is open.
  • From a discrete space, every function is continuous (every subset is open).
  • Into an indiscrete space, every function is continuous (only ∅ and Y need checking, and their preimages are ∅ and X).
  • Continuity depends on the topologies, not only on the function. The identity map from a finer topology to a coarser one is continuous; the other way round it generally is not.

Checking continuity on finite spaces

For finite spaces we can test the definition literally: compute the preimage of every open set of Y and see whether it is in τ_X. The code does this for all four functions from the Sierpiński space {0, 1} (open sets ∅, , {0, 1}) to itself.

Python Which functions on the Sierpinski space are continuous?

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The map that swaps 0 and 1 is not continuous: the preimage of the open set is , which is not open. The identity and the two constants are continuous. So the Sierpiński space has an asymmetry that a continuous function must respect.

Counting continuous maps between finite spaces

Because everything is finite, we can even count: how many continuous functions are there from one space to another? This also demonstrates the earlier facts, since from the discrete space all functions are continuous.

Python Counting continuous functions between small spaces

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Read the table: maps from the discrete space are always 4 of 4, maps into the indiscrete space are always 4 of 4, and maps from the indiscrete space to the discrete space only keep the constants.

Continuity at a point in a real function

Back on the real line, the ε–δ definition can be explored numerically. The helper below shrinks δ until sampled points within δ of a map to within ε of f(a). It is a heuristic search based on samples, not a proof, but it shows what continuity asks for. For f(x) = x² at a = 3 a δ always exists; for a step function at its jump, none does.

Python Searching for delta (a sampled stand-in for epsilon-delta)

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

For x² at a = 3, |x² − 9| = |x − 3||x + 3| is below ε when δ is roughly ε/7 for small ε, so the search finds values of that size. For the step function, no δ works for ε < 1 because every window around 0 contains points mapped to 0 and to 1.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Which is the topological definition of a continuous function f: X to Y?

    Continuity is defined by open preimages; images of open sets need not be open (x squared maps (-1, 1) to [0, 1)).
  2. 2. Which function is always continuous, whatever the topology on Y?

    From a discrete space every subset is open, so every preimage is open.
  3. 3. In the Sierpinski space with open sets {}, {1}, {0, 1}, the swap map 0 <-> 1 is not continuous because...

    The preimage of the open set {1} under the swap is {0}, and {0} is not open.
  4. 4. If f and g are continuous, what about g composed with f?

    The preimage under the composite is f^(-1)(g^(-1)(W)), a preimage of a preimage of an open set.

Summary

  • f: X → Y is continuous when f⁻¹(V) is open for every open V ⊆ Y (equivalently, for basis elements, or closed sets).
  • For metric spaces this is the same as ε–δ continuity.
  • Constants, identities, inclusions and compositions of continuous maps are continuous.
  • Maps from a discrete space and into an indiscrete space are always continuous.
  • Continuity depends on the topologies: change them and the same function may stop being continuous.

Next: Homeomorphisms