Stand outside and look at the ground. It's flat. Obviously flat, ruler-flat, all the way to the horizon.
But you already know the Earth is a sphere. Photos from orbit settled that centuries ago, actually millennia ago if you count the Greeks.
So which is it? Is the ground flat, or is it curved?
Both, depending on how much of it you're looking at. And the branch of geometry built entirely around that fact, that something can be locally flat and globally curved at the same time, is the study of manifolds.
What does "locally flat" actually mean?
Picture an ant standing on a beach ball. From the ant's point of view, right where its six legs are standing, the surface looks like... a floor. Flat, boring, ordinary.
Walk the ant a few inches in any direction and nothing changes. Still flat. The ant could spend its whole life never noticing the ball curves away underneath it, as long as it never looks very far.
But here's the thing: zoom the view back out, and that same patch of "floor" is obviously part of a sphere. The surface didn't change. Only how much of it you're looking at did.
Shrink the window and watch the curve flatten against the tangent line.
Drag the slider to shrink the window you're looking through. Watch the curve, a slice through a sphere, sag further below the flat tangent line as you zoom out, and flatten almost perfectly against it as you zoom in. Notice the readout on the right: the gap between "curved" and "flat" doesn't just shrink as you zoom in... it shrinks faster than the window does. That's what locally flat actually means: the error vanishes faster than the scale you're measuring it at.
So can we draw a flat map of a curved thing?
If a small enough patch of a curved surface looks flat, can we describe the whole surface using flat, ordinary coordinates, patch by patch? That's exactly what mapmakers have done for centuries. It's also exactly what a manifold needs: a way to talk about a curved space using the flat coordinates we already understand.
Take the simplest curved surface there is, a sphere, and try to flatten it with a single map. Pick a point on top, the north pole, and shine a light from it straight through the sphere onto a flat plane below. Every point on the sphere except the north pole itself lands somewhere on that plane.
Drag the point. Near the north pole its shadow on the chart line shoots to infinity.
Drag the point around the sphere's outline. Watch its shadow on the flat line below move to match. Now drag it close to the north pole, the very point we're projecting from... and watch the shadow rocket off toward infinity. One single flat map can't cover a whole curved surface. There's always at least one point where it breaks down.
The fix is almost too simple: use a second map, centered on a different point (the south pole works great), to cover whatever the first one missed. A handful of overlapping flat maps, each valid on its own patch, can cover the entire sphere with no gaps left over. We call one of these flat maps a chart, and the whole collection an atlas, yes, exactly like the book of maps on a shelf. That word isn't a coincidence. It's literally where the math term comes from.
How do we prove a surface is curved without ever leaving it?
Here's a strange question. The ant on the beach ball can't see the whole ball. It only ever experiences tiny flat-looking patches. So is there any way for the ant to detect curvature at all, using measurements it can actually make while stuck on the surface?
Yes. And the trick is beautifully simple: draw a triangle, and add up its angles.
On a flat sheet of paper, the three angles of any triangle always add up to . Always, no exceptions, one of the first things you prove in geometry class. But draw a triangle on a sphere instead, using the straightest lines available on that surface (arcs of great circles, a sphere's equivalent of "straight"), and the angles add up to more than .
Grow the triangle on the globe. Its angle sum climbs past 180°, the flat one never moves.
Drag the slider to grow the triangle. Watch its angle sum climb well past as it gets bigger, while a flat triangle sitting right next to it stubbornly stays at exactly no matter what. Now shrink the spherical triangle back down... and its angle sum creeps back toward , matching the flat one almost perfectly. A tiny triangle can't tell curved from flat. A big one always can.
This overshoot, how far the angle sum climbs past , is called the angular excess, and it's directly proportional to the area the triangle encloses:
where is the sphere's radius. Curvature isn't something you have to step outside and see. You can measure it entirely from within, just by drawing a shape and adding up angles.
So what is a manifold, precisely?
We've now got every ingredient we need. A manifold is a space where every point has a small neighborhood that looks like ordinary flat space (that's the ant's patch), and the whole thing can be covered by overlapping flat charts (that's the atlas), even though the space as a whole might be curved, twisted, or shaped nothing like flat space at all.
We write it like this: an -dimensional manifold is a space where every point has a neighborhood that matches up, one-to-one and continuously, with an open patch of , ordinary flat -dimensional space. The matching-up function is the chart. A sphere is a 2-dimensional manifold: locally it matches flat , globally it's curved into a ball. A circle is a 1-dimensional manifold. The surface of a donut is a 2-dimensional manifold too, and so, weirdly enough, is the space of every possible configuration of a robot arm's joint angles.
Notice what got left out of that definition: nothing about distance, or angles, or curvature. Those are extra structure you can optionally bolt on top later (that's a whole separate subject, Riemannian geometry). A manifold, on its own, is just the promise that "zoomed in enough, it's flat." Everything else is decoration.
Can we actually build a curved manifold out of flat pieces?
Here's the reverse question, and it has a wonderfully hands-on answer. Instead of starting with a curved shape and covering it in flat charts, what if we start with something totally flat, and glue the edges together according to a rule?
You've actually done this already, if you've ever played Pac-Man or Asteroids. Fly off the right edge of the screen, and you reappear on the left. Fly off the top, and you reappear on the bottom. The screen is flat, but the rule for what happens at the edges makes it behave like something else entirely.
Press play. The glued edges of a flat square physically meet as it folds into a torus.
Press play. Watch a flat square, its top and bottom edges wired together and its left and right edges wired together, physically fold itself into a donut shape, a torus. Every arrow that pointed at a partner edge now touches that partner directly. Nothing about the surface itself changed. We just relabeled which points count as "the same point," and a flat square became a curved manifold.
This is the deepest trick in the whole subject: a manifold doesn't have to be handed to you as a finished curved shape sitting in space. You can build one from nothing but flat pieces and a gluing rule, and the curvature you see afterward is just a side effect of how the gluing forces the pieces to sit together.
Why does any of this actually matter?
Manifolds sound like pure abstraction until you notice they're already running the world. Einstein's general relativity describes spacetime itself as a 4-dimensional manifold, flat enough locally that you never feel the Earth's gravity bending space around you, curved enough globally to bend starlight and hold the Moon in orbit.
Robotics leans on manifolds constantly. The set of all possible orientations a robot arm's joints can take isn't a flat space, it's a manifold built by gluing together circles, since each joint can rotate all the way around and land back where it started, exactly like our torus. And in machine learning, the premise behind a lot of modern AI, the "manifold hypothesis," is the bet that messy high-dimensional data, every possible photo of a face, say, actually lies on a much lower-dimensional curved surface tucked inside that huge space, one with its own local flatness just waiting to be found.
An ant that can't tell curved from flat, a torus built from a video game screen, and the shape of spacetime itself all obey the exact same rule.
The short version
A manifold is any space where zooming in far enough always makes it look flat, even if it's dramatically curved once you zoom back out. That local flatness lets us describe it with ordinary flat coordinates, called charts, and a collection of overlapping charts covering the whole space is called an atlas, since one chart is rarely enough. Curvature can be detected entirely from inside the space, without ever stepping outside it, just by drawing a triangle and adding up its angles. And a manifold doesn't even have to start out curved: glue the edges of something perfectly flat together with the right rule, like a video game's wraparound screen, and you get a genuinely curved shape, a torus, for free.
Next time someone tells you the Earth is flat, you can actually agree with them. Just make sure they know how small a patch you're both talking about.
All visualizations are interactive React components running entirely in your browser, using SVG. No libraries beyond React.