If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Doodling in math: Squiggle inception

How to draw squiggles like a Hilbert. Created by Vi Hart.

Want to join the conversation?

Video transcript

Maybe you like to draw squiggles when you're bored in class. Somehow the wandering path of the line, that goes the monotone droning of the teacher, perfectly capturing the way it goes on, and on, about the same things, over and over, but without really going anywhere in a deep display of artistic metaphor. But once you're a veteran of bored doodling, you learn that some squiggles are better than others. Good squiggles really fill up the page, squiggling around themselves as densely as possible, in a single line that doesn't cross itself. It's like the ideal would be to sit down at the beginning of your least favorite class, put your pencil on the page, and keep drawing a single line, filling up more and more space until the bell rings, which is basically what your teacher is doing, except with words. You might find yourself developing some strategies. For example, you're careful not to cut off a chunk of space, because you might want to get back in there later. And if you leave only a little room to get to a certain section, then when you go there, you fill up a lot of it before you leave that section again, or else, instead of a doodle, you'll have an unhappy don't-dle. Or maybe you decide to make a meta-squiggle. A squiggle made out of squiggles. This can be done kind of abstractly, or extremely precisely. For example, let's say you're drawing this simple squiggle, then you draw that squiggle, using that squiggle. But to make it fill up space nicely, you make the outside parts bigger. Then to make it precise, you make the number of squiggles always the same. It's easy to keep squiggling this squiggle all the way across the page if you keep the rhythm of it in your head. This one's like, down a squiggle, up a squiggle, down a squiggle, up a squiggle, down a squiggle, up a squiggle, down a squiggle, up a squiggle, down a squiggle, up a squiggle. But after you've done that awhile, you decide to go a level deeper. A squiggle, within a squiggle, within a squiggle. That's right, we're going three levels down. This serious business could go something like this. Right a squiggle, left a squiggle, right a squiggle, left, woop, right a squiggle, left a squiggle, right a squiggle, left, woop, right a squiggle, left a squiggle, right a squiggle, left, woop. And the next one is even crazier. Like, and up a squiggle, down a squiggle, up a squiggle, down, woop, up a squiggle down a squiggle, up a squiggle, down, woop, up a squiggle, down a squiggle, up a squiggle, down, woop, wop, all the way over here. And, down a squiggle, up a squiggle, down a squiggle, up, woop, down a squiggle, up a squiggle, down a squiggle, up, woop, down a squiggle, up a squiggle, down a squiggle, up, wop, all the way over here. OK, but say you're me and you're in math class. This mean that you have graph paper. Opportunity for precision. You could draw that first curve like this. Squig-a, squig-a, squig-a, squig-a, squig-a, squig-a, squig-a, squig-a. The second iteration to fit squiggles going up and down will have a line three boxes across on top and bottom, if you want the squiggles as close on the grid as possible without touching. You might remind yourself by saying, three a-squig, a-squig, a-squiggle, three, a-squig, a-squig, a-squiggle. The next iteration has a woop, and you have to figure out how long that's going to be. Meanwhile, other lengths change to keep everything close. And, two a-squig, a-squig, a-squiggle. Three, a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle. Two, nine. Two, a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle. Three, a-squig, a-squig, a-squiggle, two, nine. We could write the pattern down like this. So what would the next pattern be? Five. Two a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle. Two, nine. Two a-squig, a-squig, a-squiggle. Three, a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle, two. Nine. Two a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle. Three a-squig, a-squig, a-squiggle. Two, nine. And 15 all the way over to here. And now, Yeah. I can talk that fast totally. OK, But let's not get too far from your original purpose, which was to nicely fill a page with this squiggle. The nicest page filling squiggles have kind of the same density of squiggle everywhere. You don't want to be clumped up here, but have left over space there, because monsters may start growing in the left over space. On graph paper, you can be kind of precise about it. Say you want a squiggle that goes through every box exactly once, and can be extended infinitely. So you try some of those, and decide that, since the point of them is to fill up all the space, you call them space filling curves. Yeah, that's actually a technical term, but be careful because your curve might actually be a snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake, snake-- Also, to make it neater, you draw the lines on the lines, and shift the rules so that you go through each intersection on the graph paper exactly once. Which is the same thing, as far as space is concerned. Here's a space filling curve that a guy named Hilbert made up, because Hilbert was awesome, but he's dead now. Here's the first iteration. For the second one, we're going to build it piece-by-piece by connecting four copies of the first. So here's one. Put the second space away next to it, and connect those. Then turn the page to put the third sideways under the first, and connect those. And then the fourth will be the mirror image of that on the other side. Now you've got one nice curve. The third iteration will be made out of four copies of the second iteration. So first build another second iteration curve out of four copies of the first iteration-- one, two, three, four-- then put another next to it, then two sideways on the bottom. Connect them all up. There you go. The fourth iteration is made of four copies of the third iteration, the same way. If you learn to do the second iteration in one piece, it'll make this go faster. Then build two third iterations facing up next to each other, and two underneath sideways. You can keep going until you run out of room, or you can make each new version the same size by making each line half the length. Or you can make it out of snakes. Or if you have friends, you can each make an iteration of the same size, and put them together. Or invent your own fractal curve so that you could be cool like Hilbert. Who was like, mathematics? I'm going to invent meta-mathematics like a boss.