This is a torus - the mathematical word for "a bagel-shape". It comes to you right out of the mathematical oven. Delicious!
But right as you're about to eat your bagel, a passing mathematician bumps into you and the torus shape gets squished! Oh no!
Is this weird thing still bagel-shaped? At first glance it sure seems like this squished bagel carries enough bagel-ness to be called a bagel (especially if you're hungry).
But what if our torus was squished in a weirder way? Does this still have enough "bagel-ness" to be a bagel? Where should we draw the line?
So: how do you define 'bagel-ness'? And can we find a definition that consistently says our squished shape is still a bagel?
It turns out one way of defining bagel-ness is to enlist the help of an ant and looking at the ways you can walk on its surface. Let's say you're a delivery ant, walking on the surface of our bagel, and we want to walk between points A and points B to deliver a package.
How do we get there? There's a bunch of different paths the ant can take to get from point A to point B. Which one should our intrepid delivery ant choose?
We should probably choose the shortest path. Here's one way of finding the shortest one: start with any path, and imagine it's a rubber band, stretched taut. Then, let it go. Our path-rubber-band will get tighter and tighter, until eventually it's as tight as can be around our shape's surface.
But that's not actually the shortest path - this second path is shorter! These are two different shortest paths, according to this rubber band!
In fact, we know that the two paths are different because it's actually impossible to rubber-band-pull our way from the first path to the second without lifting the rubber band. One way to see this is that the first path goes through the donut hole, and the second path doesn't.
And squishing our shape doesn't change that fact: as long as there's at least one hole in a shape, there'll always be more than one shortest path. One way to think about this is that the rubber band's tightness "absorbs" the squish.
We have our answer: if you have a shape which has multiple different smallest rubber-band paths, in the same way as a bagel, then that shape is a torus!
In fact, here's something even cooler: we can also use the same technique to find out if a shape is a squished sphere.
On a sphere, every path can be rubber-banded into only one shortest path. It's not like a bagel, where there are at least two different paths. In other words: putting rubber bands on a surface can tell the difference between spheres and bagels.
And just like before, the types of smallest paths on a sphere is the same as the types of smallest paths on a squished sphere too. In other words: putting rubber bands on a surface can tell the difference between spheres and bagels, no matter how you squish them.
In other words, thanks to our friendly deliveryant, we now know have a recipe to tell if a shape is a squished bagel or not:
Bagelness (adj): When a surface has multiple different shortest-after-rubber-band-pull paths (and they really are different, meaning you can't turn one path into another without cutting one of them apart)
Great!
And that's how a mathematician defines bagel-ness: by the number of paths an ant walking on the bagel can take to make deliveries! In fact, sometimes when a mathematician is trying to understand some really complicated shape, instead of studying the shape itself, they'll try to study the ways you can draw paths in that shape instead (treating rubber-band-movable paths as the same thing). If it has rubber-band-paths like a bagel, then it's a bagel in a weird, squishy way.
We can even use it to detect disguised tori in video games. In the original Pac-Man, for example, if you walk far enough left you emerge on the right side of the screen. That means there's two paths along which Pac-Man can walk to deliver a package, and they can't be shortened - so Pac-Man's video game world is actually torus-shaped too!
A quick side note: the bagel-ness of a shape always stays the same when you squish it smoothly, but if you squish in such a way that you tear something, or make a surface not three-dimensional, then it might not stay the same. Mathematicians like to stick to types of squishing where:
You can undo the squish
The squish is continuous (nothing teleports)
If you pause the squishing transformation, the partially-squished result is always still a smooth surface.
In conclusion: if you want to be able to recognize shapes no matter how (smoothly) deformed and squished they might get, mathematicians look at the paths between points on that shape.
Thanks!
Credits: Ant model from Poly By Google, CC-BY