Topology
Topology — Donuts and Coffee Cups
Stretch and bend without tearing — a donut equals a coffee cup, but not a sphere
Topology studies properties of shapes that don't change under continuous deformation — stretching and bending without tearing or gluing. Famously, a donut and coffee cup are topologically equivalent (both have one hole), while a sphere and donut are not (zero vs one hole). The number of holes — the genus — classifies all closed orientable surfaces. Topology underpins modern geometry, knot theory, the shape of the universe, and exotic results in physics.
- EquivalenceTwo shapes equivalent if one can deform into other without tearing
- Genus gNumber of "holes" — sphere=0, donut=1, double-donut=2
- Euler characteristic χχ = V − E + F (for polyhedra); for closed orientable surface χ = 2 − 2g
- Sphereχ = 2 — five Platonic solids all have χ = 2
- Torus (donut)χ = 0
- Term coinedListing 1847 — "topology" from Greek topos (place) + logos (study)
Interactive visualization
Press play, or step through manually. The visualization is yours to drive — try it before reading on.
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
What topology is
Topology is the mathematical study of shapes and spaces, focusing on properties that don't change under continuous deformation — stretching, bending, twisting (but not tearing or gluing).
The classic illustration — a donut and a coffee cup are topologically equivalent. Imagine the donut made of clay; you can push and stretch it into the cup shape (the cup's handle becomes the donut's hole). Both have exactly one hole.
A sphere, however, has no holes. You cannot continuously deform a sphere into a donut without tearing (to make a hole). So sphere ≠ donut topologically.
Genus — counting holes
For closed orientable surfaces (no boundary, two-sided), the genus g is the number of "donut holes" or "handles":
| Surface | Genus g | Euler χ | Examples |
|---|---|---|---|
| Sphere | 0 | 2 | Ball, cube, cone, all Platonic solids |
| Torus (donut) | 1 | 0 | Donut, coffee cup, ring, T-shirt with hole |
| Double torus | 2 | −2 | Pretzel with two holes, figure-8 surface |
| Triple torus | 3 | −4 | Three-holed pretzel |
| g-handle torus | g | 2 − 2g | Sphere with g handles attached |
Classification theorem for closed orientable surfaces — every such surface is homeomorphic to a sphere with g handles, for some non-negative integer g. Genus is a complete invariant; surfaces with the same genus are equivalent.
Euler characteristic
For a polyhedron with V vertices, E edges, and F faces, Euler's formula states:
V − E + F = 2
Try it on a cube — V=8, E=12, F=6. 8 − 12 + 6 = 2 ✓. On a tetrahedron — 4 − 6 + 4 = 2 ✓. The "2" is the Euler characteristic of the sphere.
For a polyhedral mesh on any closed orientable surface of genus g:
V − E + F = 2 − 2g
For a torus (g=1) — V − E + F = 0. A simple torus mesh — V=16, E=32, F=16 (each face is a quad). 16 − 32 + 16 = 0 ✓.
Homeomorphism — formal "equivalence"
Two spaces X and Y are homeomorphic if there's a function f: X → Y that is:
- Continuous (no jumps).
- Bijective (one-to-one correspondence).
- Has a continuous inverse.
Examples of homeomorphic pairs:
- Square and circle — both 1D closed curves.
- Closed disk and closed square — both 2D regions with boundary.
- Donut surface and coffee cup surface — both genus 1.
- Open interval (0, 1) and entire real line ℝ — both unbounded 1D.
Pairs that are NOT homeomorphic:
- Sphere and torus — different genus.
- Closed and open interval — closed has boundary, open doesn't.
- Circle and figure-8 — figure-8 has a "branching point."
Knots — embeddings of circles
A knot is a circle embedded in 3D space. Two knots are equivalent if one can be deformed into the other (without cutting). The basic knots:
- Unknot — a plain circle, the trivial knot.
- Trefoil — 3 crossings, the simplest non-trivial knot. Has two "chiralities" — left-handed and right-handed.
- Figure-8 knot — 4 crossings, achiral (equals its mirror image).
Distinguishing knots is hard — different presentations of the same knot can look very different. Knot invariants (Jones polynomial, Alexander polynomial) are computational tools that assign each knot a value, distinct for different knots.
Topological invariants
An invariant is a property that depends only on the topological type, not the specific representation. Computing an invariant on two shapes — if they differ, the shapes are NOT topologically equivalent. (If they agree, more work is needed.)
| Invariant | What it measures | Examples |
|---|---|---|
| Genus g | Number of handles | Sphere=0, Torus=1, etc. |
| Euler characteristic χ | V − E + F (or generalization) | Sphere=2, Torus=0 |
| Connected components | How many "pieces" | Two disjoint circles = 2 |
| Fundamental group π₁ | Homotopy classes of loops | Sphere — trivial; Torus — ℤ × ℤ |
| Homology groups | Higher-dimensional "holes" | Distinguish complex shapes |
| Orientability | Two-sided or one-sided | Möbius — non-orientable |
JavaScript — Euler characteristic checks
// Verify Euler's formula on a polyhedron
function eulerChar(V, E, F) {
return V - E + F;
}
// Platonic solids — all should give 2 (genus 0, sphere)
console.log('Tetrahedron:', eulerChar(4, 6, 4)); // 2
console.log('Cube:', eulerChar(8, 12, 6)); // 2
console.log('Octahedron:', eulerChar(6, 12, 8)); // 2
console.log('Dodecahedron:', eulerChar(20, 30, 12)); // 2
console.log('Icosahedron:', eulerChar(12, 30, 20)); // 2
// Torus mesh — should give 0
// 4x4 grid wrapped into torus: 16 vertices, 32 edges (16 horiz + 16 vert), 16 quads
console.log('Torus:', eulerChar(16, 32, 16)); // 0
// Genus from Euler characteristic for closed orientable surface
function genusFromEuler(chi) {
return (2 - chi) / 2;
}
console.log('Sphere genus:', genusFromEuler(2)); // 0
console.log('Torus genus:', genusFromEuler(0)); // 1
console.log('Double torus genus:', genusFromEuler(-2)); // 2
// Topological equivalence check (simple case — same genus)
function topologicallyEquivalent(g1, g2, orientable1, orientable2) {
return g1 === g2 && orientable1 === orientable2;
}
console.log(topologicallyEquivalent(1, 1, true, true)); // true (donut = coffee cup)
console.log(topologicallyEquivalent(0, 1, true, true)); // false (sphere ≠ donut)
Where topology shows up
- Pure mathematics. Foundation for differential geometry, algebraic geometry, dynamical systems. Theorems like Brouwer fixed-point theorem, Borsuk-Ulam theorem, Poincaré conjecture (proved 2003 by Perelman).
- Topological data analysis (TDA). Extracts shape features from point clouds via persistent homology. Used in genomics, neuroscience, image analysis.
- Computer graphics — mesh editing. Mesh simplification must preserve topology (genus). Topology-preserving operations are well-defined.
- Physics — topological insulators. Materials with conducting surfaces and insulating bulk; their behavior is dictated by topological invariants. Topological quantum computing exploits this.
- DNA biology. DNA strands form knots and links during replication. Enzymes (topoisomerases) cut and rejoin DNA to manage topology. Knot theory describes this.
- Cosmology. What is the topology of the universe? Simply connected? Multi-connected (torus-like)? Open question; observations suggest "flat and simply connected" but it's hard to verify on cosmic scales.
- Network theory. Topology of internet graph, social networks. Algebraic topology distinguishes different network types.
Common mistakes
- Confusing topology with geometry. Geometry cares about distance and angle; topology only about continuous deformation. A pointy star and round circle have the same topology but very different geometry.
- Thinking "no holes" means topologically simple. Sphere has no holes but isn't trivial — it's distinct from a disk (which has a boundary). Topology tracks more than holes.
- Using "genus" for non-orientable surfaces. Genus is for orientable surfaces. Non-orientable surfaces use "non-orientable genus" or "cross-cap number" — Möbius strip + boundary, Klein bottle = 2 cross-caps.
- Confusing homeomorphism with diffeomorphism. Homeomorphism — continuous and continuous-invertible. Diffeomorphism — smooth and smoothly invertible. Two spheres of different sizes are diffeomorphic; but exotic 7-spheres exist (Milnor, 1956) — homeomorphic to standard 7-sphere but not diffeomorphic.
- Mis-counting genus visually. A pretzel with 3 holes has genus 3. A handle attached to a sphere adds 1 to genus. T-shirts with 1 hole (the body cavity, plus arm holes that are boundary) — careful, T-shirts have boundary, so they're not closed surfaces.
- Treating Euler char as a complete invariant. χ alone doesn't distinguish non-orientable surfaces from orientable ones with the same χ. (Klein bottle and torus both have χ = 0.) Need orientability + χ.
Frequently asked questions
Why is a donut equivalent to a coffee cup?
Both have exactly one hole (genus 1). Imagine a clay donut — you can squish it, push the dough around the hole into a depression to form a cup body, while keeping the hole as the handle. No tearing or gluing required, just deformation. Topologically they're identical. By contrast, a sphere has no holes (genus 0) — you can't make a hole without tearing, so a sphere is NOT equivalent to a donut.
What is genus, exactly?
For a closed (no boundary) orientable surface, genus g is the number of "handles" or "donut holes." Sphere — g = 0. Donut (torus) — g = 1. Double torus (figure-8 surface) — g = 2. Genus completely classifies closed orientable surfaces — two surfaces are homeomorphic if and only if they have the same genus. This is one of topology's foundational results (classification theorem for surfaces).
What is Euler's formula and how is it related?
Euler's formula for polyhedra — V − E + F = 2 for any convex polyhedron (V vertices, E edges, F faces). The "2" is the Euler characteristic χ of the sphere. Generalizing — for a polyhedral mesh on a closed orientable surface of genus g, V − E + F = 2 − 2g. Euler characteristic is a topological invariant (doesn't change under deformation), making it a powerful tool for classification.
What's the difference between topology and geometry?
Geometry cares about distances, angles, and curvature. Topology only cares about properties preserved under continuous deformation. A circle and an ellipse have different geometries (different shapes); topologically they're identical (both are circles, or 1-dimensional manifolds without boundary). A square and circle — geometrically very different (corners vs smooth), topologically the same. Topology is "rubber sheet geometry."
What's a knot, topologically?
A knot is an embedding of a circle into 3D space, considered up to continuous deformation (without cutting). The unknot is a plain circle. Trefoil is the simplest non-trivial knot. Knots are studied via invariants — knot polynomials (Jones, Alexander) distinguish different knots. Knot theory has applications in DNA topology (DNA strands knot during replication), polymer chemistry, and quantum field theory.
What is a homeomorphism?
A homeomorphism is a continuous, invertible map with a continuous inverse — formal definition of "topological equivalence." Two spaces X and Y are homeomorphic if there's a homeomorphism between them. Examples — open interval (0, 1) is homeomorphic to ℝ (via tan(π(x − 1/2))); closed disk is homeomorphic to closed square; sphere minus a point is homeomorphic to a plane. Different homeomorphisms can give different geometric results, but topologically the spaces are "the same."
How is topology used in real applications?
Topological data analysis (TDA) — extract shape features from point clouds, used in cancer research, neuroscience, materials science. GPS and routing — topology of the network determines paths. Computer graphics — mesh simplification preserves topology (genus). Physics — topological insulators (materials with conducting surface but insulating bulk), topological quantum computing (uses anyons, exotic 2D quasi-particles). Cosmology — what is the topology of the universe? (Probably simply connected, but not proven.)