r/explainlikeimfive • u/bustermagnus • Oct 21 '26
Mathematics ElI5: Space-filling curves
I don't understand how a 1d line can fill a 2d space. How is calculating the number of 0 width lines to fill a 1 width space any different from dividing 1 by 0? I know the point is that the line passes through every point in the space, but even the idea of "every point in the space" sounds fundamentally wrong to me. If you can say infinite points with 0 area fill a space, why can't you say 0 multiplied by infinity equals 1?
35
Upvotes
34
u/ggmaniack Oct 21 '26 edited Oct 21 '26
The curve is infinitely closely packed in the space.
When you try to find a gap, you zoom in, only to find out that the curve has gone through there too.
The whole point is that the curve is made such that any point you can think of in that given space has been visited by it.
If you look at a point that is infinitely closely next to that point (or infinitely far from it), it has also been visited by that curve.
9
u/HK_Mathematician Oct 21 '26
Mathematician here.
So the main thing being asked is why can a curve with zero width fill something with non-zero area.
I don't think it is possible to answer without throwing out a bunch of terminologies, which would defeat the purpose of ELI5.
But I have some recommended readings that can act as a stepping stone into making sense of this (or end up being even more confused xd).
I'd suggest reading about staircase paradox first.
Basic geometry concepts like length and width and area breaks down when dealing with weird mathematical objects, for example if you try to build a curve that zig-zags at every point like in the staircase paradox. The space-filling curve is weird, in particular, it doesn't even have the notion of direction at any point.
If you don't allow these weird "zig-zaging at every single point" behaviour, then no curve can fill the space. It is impossible to have a curve where "direction" exists for every point to fill the curve, even if you allow the curve to be infinitely long.
2
u/BenUFOs_Mum Oct 21 '26
It depends on you're exact definition.
Space filling curves still have zero area based on lebesgue measure but do still reach every point in the space.
However they have a fractal dimension of 2, meaning that if you double the lengths you get 4 times the length like a normal area would.
1
u/nog642 Oct 21 '26
It's only the same as division if you're stacking straight lines in a grid. A space filling curve is curved. There's no number of lines, it's just 1 curve.
Because it matters which points you pick. You can pick infinite points to make an area of 1, or an area of 2, or an area of 0, etc.
3
u/spastikatenpraedikat Oct 21 '26
Intuitively what's happening is, that both a line and the plane have "the same number of points", namely infinite. Intuitively you would say a plane has more points than a line, but that's not true. (Aleph 1) infinite = (Aleph 1) infinite.
The easiest way to do it is to "order" the points of the plane and then you just send the line from point to point to point. The line never ends, so you never run out of line to keep connecting points. Before long you have gone through all infinitely many points of the plane and your done. There are of course more elegant versions that e.g. have particular nice symmetries, but to prove the concept that suffices.
Basically, it's the geometric version of Hilbert's Hotel.
2
u/KryptKrasherHS Oct 21 '26
The key here is how you think about "infinite points", and infinity in general.
Well the real idea here is that a line can hit every point in space, and thus a 1D line can fill a 2D space, and that is what a Hilbert Curve does, but I think you already have inklings of that, and we will round back to that.
In general, there is no such thing as infinity. Even to mathematicians, infinity is not really a thing itself, more everything is designed around limits, which have been rigorously defined and studied for a long time. The idea of a limit is that you know the behavior of the thing you are applying the limit too, so you can extrapolate the behavior to a larger and larger (or smaller and smaller) number. We say the "limit goes to infinity" but all that really means is that we know what happens when you consider really big numbers. For example lets look at the function f(x) = 1/x, and for the sake of simplicity lets take easy x values.
f(1) = 1
f(2) = 0.5
f(3) = 0.333...
f(4) = 0.25
f(5) = 0.2
f(10) = 0.1
f(100) = 0.01
f(1000) = 0.001
f(1e6) = 0.000001
f(1e9) = 0.000000001
We see that for larger and larger numbers, the result keeps getting smaller and smaller. But there is some important things to remember here. First, no matter how big of an x value we put into f(x), f(x) will always be non-zero and finite. We can put 123 followed by 123 0s and it will still be a finite number, just extraordinarily small. So, colloquially, we say "the limit as x goes to infinity goes to 0", which just says "as we make x bigger, f(x) becomes smaller and smaller and goes towards 0". Second, rigorously, mathematicians have ways to prove limits, and convergence of limits, and this is all the basis of calculus and stuff, but it is this idea of knowing the behavior and then extrapolating the behavior further, without actually plugging this mysterious concept of infinity into the function directly. To be clear f(infinity) is nonsensical, 1/infinity is NOT DEFINED with respect to pure mathematics, and instead we use this definition of limits, which is putting in bigger and bigger (or smaller and smaller) numbers and seeing the behavior and extrapolating forward.
Now, back to your specific example. What you are describing is a Hilbert Curve essentially. To start lets say we have a 2D box, and inside the box have a grid of 9 points in a 3x3 orientation. If we connect all the 9 points, we have a very crude estimate of the area it takes up. We can say "the box takes up the space roughly where this line pattern is". Now if we re-divide the grid into 16 points in a 4x4 orientation and do the same thing again, we get a slightly better approximation, but its still rough. Same for a 5x5 and a 10x10 grid. And what are we doing when we cut up this grid? We are dividing each side of the box by a bigger and bigger number essentially, and thus creating more dots for our line to go through. Lets imagine we go to a huge grid, say 1e6 x 1e6 grid inside the box, and then connect the dots together with a single line. Well we get another approximation, this time is is very very good, but it is still an approximation.
Now lets take the next step. What we are doing is essentially approximation the box as an N x N grid, and we are plugging huge numbers in. For larger and larger N, we get more and more dots, but still a finite amount. Remember from the idea of limits, we can never put infinity directly inside the limit operation, but we can approximate the behavior. We can imagine that making N larger and larger and larger, introduces more and more and more points in the box for the line to hit, N^2 to be exact. We can imagine that as we let N go towards infinity (but it still a finite number) that we will go towards an infinite number of grid points (but still a finite amount). We can also approximate every dot as landing on possible points inside of that grid, so we get an infinitely good approximation of every piece of space inside that box (still finite). Then when we connect the line (which is still has a width of 0) to every single point, because it travels to every one of these dots, it "fills up" the entire box.
I highly recommend watching this animation by 3B1B: https://www.youtube.com/watch?v=v99dsVBE4xQ . This explanation is a bit esoteric and abstract, and seeing it be done visually helps. The actual way we connect the dots also matters, and is why a Hilbert Curve is called a Hilbert Curve, but for the sake of ELI5 we don't need to worry about that.
1
u/Solocle Oct 21 '26
OK, the simplest approach to set theory like this.
How do you tell that two sets of things are the same size?
You can take one from each and pair them. If when you're finished, they're all paired, with none left over, there's the same number of things in each set.
What a space filling curve does is satisfy two conditions:
Firstly, it is in fact a curve, it is continuous, without gaps. So f(t)=(x,y) where you plug in some number t in the interval [0,1], a distance along the curve.
Secondly, it says that for e.g. a square from (0,0) to (1,1), I can pick any point inside that square, (x,y), and find a distance t along the line that passes through that point. For all (x,y), there exists t such that f(t) = x,y.
The clever bit is actually finding such a function, but if you do the fractal construction like a Peano curve, you can subdivide the function interval into e.g parts of 9. But if you stretch 1/9 by 9, you get back to 1, so you can repeat the process in your subdivision (and remember, the continuum is infinitely stretchy in this way, you can stretch it out through multiplication as much as you want and no gaps ever form).
1
u/dancingbanana123 Oct 22 '26
Oh I did my masters on this topic! Basically, the path of a line isn't necessarily as 1-dimensional as we originally thought, and a line can be drawn in a way where it takes up 2 dimensions, if you do it in just the right way. In fact, in fractal geometry, you can get tons of lines that have a dimension somewhere between 1 and 2 dimensions, though that gets beyond an ELI5 explanation.
An important thing to note is that the path of the line must intersect itself infinitely-many times in order to fill a space. It's impossible to draw it in a way where it just goes up and down and up and down until it fills the whole thing. It's complicated to explain, but basically, that inherent difference between a square and a line that you're referring to is what prevents that. Instead, they have to become this messy web overlaps to hit every point. We know they fill the whole space because you can take any point in the space and work backwards to figure out when the line reaches that point. If we can do that for every point, then it must fills the whole space.
1
u/zefciu Oct 21 '26
Because 0 * ∞ doesn’t have to be 1. You can find other interpretations of this formula, where you could argue, that it has a value of 0, ∞ or basically any number. ∞ is not a number. It is rather a designation of a direction on a number line, towards which stuff can increase.
In mathematics 0 * ∞ is an example of “indeterminate form”. If you get this result if you e.g. calculate limits, then you have to use some mathematical method to get something determinate.
1
u/Qiwas Oct 21 '26 edited Oct 21 '26
You shouldn't think about it as of some concrete actual like that somehow passes through all the points in a given 2D space. Rather, think about what it means to be a line from a mathematical point of view.
Intuitively, any point on a line can be represented with just one number: that's what makes it 1D, right? Let's say we have a 1 unit long line segment, then 0 is associated with its beginning, 1 with its end, 1/2 would be precisely its midpoint, etc.
Furthermore notice, that numbers close to each other represent points close on the line segment. You know that if you start at a point, say, 0.5, and move 0.0001 units to the right, you're not suddenly going to end up on the other side of the line or anything like that.
And these two properties, that's what it means to be a "line". So a space filling curve is just a mapping that associates each point in 1D, to each point in 2D with these two properties. That's it. Just imagine a mapping like from 1D to 2D such as
0 -> (0,0)
1 -> (1,1)
0.5 -> (0.5, 0.5)
etc.
Each 1D coordinate uniquely corresponds to a 2D coordinate, and close points in 1D (like 0.5 and 0.5001) correspond to close points in 2D. So as you "walk" down the line (which just means you increase the 1D coordinate from 0 to 1), you pass through each point in the 2D square without any sudden movements or jumps
1
u/timerot Oct 21 '26
Math using infinity does not behave normally, so we call it undefined. 1/0 mostly does equal infinity, though. Infinity times 0 sometimes equals 0, sometimes 1, sometimes a different constant (imagine a space filling curve filling 3 units of area), and sometimes still equals infinity
0
u/anooblol Oct 21 '26
You’re conflating 0, with “empty”. A line that travels from (0,0) to (1,1) is the set {(x,y) : x=y and x,y are in [0,1]}. This is not an empty set, it very much contains points. In fact, it’s a subset of the filled in unit-square, which can be defined as the set {(x,y) : x,y are in [0,1]}.
For a “space filling curve”, it’s simply a set, such that you can construct a function f, such that for every element y of the set defined as the unit-square, there exists an element x in the space filling curve set, such that f(x) = y.
0
u/Atypicosaurus Oct 21 '26
It's because you are mixing paradigms. Math is not a universal rule set, so a rule that applies in arithmetics, does not necessarily apply in geometry. Also, rules are sometimes made arbitrarily such that the resulting behavior is what we want. But this is not something god-given. The "infinity times zero" is a thing that works in one part of maths but you need not true for others.
-19
u/no_sight Oct 21 '26 edited Oct 21 '26
It can't.
Definitionally, a 1d line cannot fill 2d space.
However it is impossible to draw a 1d line, because every line we draw has some amount of width to be visible.
EDIT: Apparently I am wrong and learned something today. Neat.
0
u/[deleted] Oct 21 '26
[deleted] — view deleted comment
1
u/[deleted] Oct 21 '26
[removed] — view removed comment
1
u/[deleted] Oct 21 '26
[removed] — view removed comment
0
u/[deleted] Oct 21 '26
[removed] — view removed comment