Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 36 ยท Getting Started

What Is Topology?

Meet topology, the math of shape without distance: what it studies, why a mug equals a donut, and how invariants such as holes tell shapes apart.

Topology is the branch of math that studies shape without measuring it. A geometer asks how long a side is or how large an angle is. A topologist asks a coarser question: if you may stretch, squeeze and bend a shape, but never tear it or glue points together, what stays the same?

This lesson gives you the big picture. You will see what "the same shape" means in topology, meet the idea of an invariant, and compute two of them with code: the Euler characteristic of a surface and the number of pieces and holes in a picture.

Rubber-sheet geometry

Imagine a shape made of perfectly stretchy rubber. You can pull it, twist it and dent it. You are not allowed to cut it, puncture it, or fuse two parts together. Two shapes are topologically equivalent (the formal word is homeomorphic, which you will meet in Homeomorphisms) when one can be deformed into the other under those rules.

Some examples:

  • A circle, a square outline and a triangle outline are all the same. Each is a single closed loop.
  • A solid ball and a solid cube are the same.
  • A coffee mug with one handle and a donut are the same. Both have a single hole.
  • A donut and a ball are not the same. A ball has no hole, and you cannot make one without puncturing it.

The famous joke "a topologist cannot tell a donut from a coffee mug" is true, and it is the whole point: the properties topology cares about do not depend on size, angles or straightness.

"No tearing and no gluing" is an intuition, not a definition. The exact definition uses open sets and continuous functions, and it is the subject of the rest of this track.

Why throw away distance?

Distance is a lot of information, and often we do not need it. Consider a subway map. It is wildly wrong about real distances and angles, yet it is perfect for planning a trip, because it keeps what matters: which stations connect to which. That is a topological map.

Throwing away distance also makes results more general. A theorem that only uses "closeness" (open sets) works for the real line, for the plane, for spaces of functions and for strange finite spaces alike. You will see all of those in this track.

Invariants

An invariant is a property or number that does not change under the allowed deformations. Invariants are the main tool of topology, and they work in one direction only:

  • If two shapes have different invariants, they are definitely not equivalent.
  • If two shapes have the same invariants, they might be equivalent, but you have not proved it.

Common invariants include the number of connected pieces, the number of holes, and whether the shape is compact or has an edge. Later chapters define each one carefully.

The Euler characteristic

For a surface cut into polygon faces, define ฯ‡ = V โˆ’ E + F, where V is the number of vertices, E the number of edges and F the number of faces. For every way of cutting a sphere into faces, ฯ‡ = 2. For every way of cutting a torus (the surface of a donut), ฯ‡ = 0. The number depends on the surface, not on how you cut it. That makes it an invariant.

The code below computes ฯ‡ for a tetrahedron, a cube, and two grid-shaped tori built by wrapping a square grid around so the edges meet.

Python Euler characteristic of four surfaces

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 tetrahedron and the cube are both spheres in disguise (inflate them and you get a ball's surface), so both give 2. Both tori give 0, however fine the grid is.

Counting pieces and holes

Two more invariants are easy to see: the number of separate pieces and the number of holes. For a picture made of pixels, you can compute both with a flood fill, which walks from a starting pixel to all pixels reachable by steps up, down, left and right.

  • Pieces = number of connected groups of # pixels.
  • Holes = number of groups of . pixels that are completely enclosed. To count them, add a border of . around the picture. The outside is then one big group, and every other group of . is a hole.

This is a discrete stand-in for the real idea: pixels are not a true topological space, but the counting rule matches what your eye sees on simple shapes.

Python Pieces and holes in a pixel picture

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.

A ring has one piece and one hole, a figure eight has one piece and two holes, and a solid block has one piece and no holes. Stretching any of them as rubber would not change those counts.

Where topology shows up

Topology is not only pure math. Network design uses the same "who connects to whom" thinking. Robotics asks about the shape of the space of all joint angles. Data analysis counts holes in point clouds. Physics classifies phases of matter by invariants. Within pure math, topology is the language underneath analysis, geometry and algebra.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which of these is NOT topologically equivalent to a circle?

    A figure eight has a point where two loops meet; removing that point leaves two pieces, while removing any point from a circle leaves one piece. The triangle and square outlines are single loops.
  2. 2. A topologist may deform a shape by stretching and bending. Which action is NOT allowed?

    Tearing (and gluing) changes how the points are connected, so it is forbidden.
  3. 3. Two surfaces have different Euler characteristics. What can you conclude?

    An invariant that differs proves the shapes are different. (Equal values would prove nothing by themselves.)
  4. 4. What is V - E + F for any polyhedron that is a deformed sphere?

    Every sphere-like polyhedron has chi = 2; for example the cube has 8 - 12 + 6 = 2.

Summary

  • Topology studies properties preserved by stretching and bending without tearing or gluing.
  • Two shapes related this way are homeomorphic; a mug and a donut are, a ball and a donut are not.
  • An invariant is a quantity that does not change under such deformations. Different invariants prove shapes differ; equal invariants do not prove they match.
  • The Euler characteristic V โˆ’ E + F is 2 for spheres and 0 for tori.
  • Counting pieces and holes is a simple, computable pair of invariants.

Next: Sets, Functions and Relations: a Review