WEBVTT
00:00:04.300 --> 00:00:05.440
Who doesn’t like fractals?
00:00:05.680 --> 00:00:10.640
They’re a beautiful blend of simplicity and complexity, often including these infinitely repeating patterns.
00:00:11.280 --> 00:00:13.760
Programmers, in particular, tend to be especially fond of them.
00:00:14.040 --> 00:00:20.520
Because it takes a shockingly small amount of code to produce images that are way more intricate than any human hand ever could hope to draw.
00:00:21.440 --> 00:00:28.840
But a lot of people don’t actually know the definition of a fractal, at least not the one that Benoit Mandelbrot, the father of fractal geometry, had in mind.
00:00:29.600 --> 00:00:33.280
A common misconception is that fractals are shapes that are perfectly self-similar.
00:00:34.080 --> 00:00:39.920
For example, this snowflake looking shape right here, called the Von Koch snowflake, consists of three different segments.
00:00:40.720 --> 00:00:47.320
And each one of these is perfectly self-similar, in that when you zoom in on it, you get a perfectly identical copy of the original.
00:00:49.520 --> 00:00:54.200
Likewise, the famous Sierpinski triangle consists of three smaller identical copies of itself.
00:00:55.040 --> 00:00:57.720
And don’t get me wrong, self-similar shapes are definitely beautiful.
00:00:58.200 --> 00:01:00.520
And they’re a good toy model for what fractals really are.
00:01:01.080 --> 00:01:10.160
But Mandelbrot had a much broader conception in mind, one motivated not by beauty but more by a pragmatic desire to model nature in a way that actually captures roughness.
00:01:12.360 --> 00:01:19.520
In some ways, fractal geometry is a rebellion against calculus, whose central assumption is that things tend to look smooth if you zoom in far enough.
00:01:20.320 --> 00:01:30.480
But Mandelbrot saw this as overly idealized, or at least needlessly idealized, resulting in models that neglect the finer details of the thing that they’re actually modeling, which can matter!
00:01:32.040 --> 00:01:37.760
What he observed is that self-similar shapes give a basis for modeling the regularity in some forms of roughness.
00:01:38.320 --> 00:01:44.160
But the popular perception that fractals only include perfectly self-similar shapes is another overidealization.
00:01:44.640 --> 00:01:49.040
One that ironically goes against the pragmatic spirit of fractal geometry’s origins.
00:01:49.720 --> 00:01:55.360
The real definition of fractals has to do with this idea of fractal dimension, the main topic of this video.
00:01:56.280 --> 00:02:04.480
You see, there is a sense, a certain way to define the word dimension in which the Sierpinski triangle is approximately 1.585-dimensional.
00:02:05.160 --> 00:02:08.760
That the Von Koch curve is approximately 1.262-dimensional.
00:02:09.720 --> 00:02:12.840
The coastline of Britain turns out to be around 1.21-dimensional.
00:02:13.320 --> 00:02:18.880
And in general, it’s possible to have shapes whose dimension is any positive real number, not just whole numbers.
00:02:22.360 --> 00:02:27.640
I think when I first heard someone reference fractional dimension like this, I-I just thought it was nonsense, right?
00:02:27.640 --> 00:02:29.840
I mean, mathematicians are clearly just making stuff up.
00:02:30.400 --> 00:02:33.760
Dimension is something that usually only makes sense for natural numbers, right?
00:02:34.080 --> 00:02:35.440
A line is one-dimensional.
00:02:35.440 --> 00:02:36.760
A plane, that’s two-dimensional.
00:02:37.120 --> 00:02:39.680
The space that we live in, that’s three-dimensional, and so on.
00:02:40.360 --> 00:02:46.240
And in fact, any linear algebra student who just learned the formal definition of dimension, in that context, would agree.
00:02:46.640 --> 00:02:48.320
It only makes sense for counting numbers.
00:02:49.160 --> 00:02:52.240
And, of course, the idea of fractal dimension is just made up.
00:02:52.760 --> 00:02:54.400
I mean, this is math, everything is made up.
00:02:55.200 --> 00:02:59.400
But the question is whether or not it turns out to be a useful construct for modeling the world.
00:03:00.160 --> 00:03:00.800
And I think you’ll agree.
00:03:01.320 --> 00:03:06.080
Once you learn how fractal dimension is defined, it’s something that you start seeing almost everywhere that you look.
00:03:09.040 --> 00:03:13.360
It actually helps to start the discussion here by only looking at perfectly self-similar shapes.
00:03:13.920 --> 00:03:17.680
In fact, I’m gonna start with four shapes, the first three of which aren’t even fractals.
00:03:18.120 --> 00:03:21.760
A line, a square, a cube, and a Sierpinski triangle.
00:03:22.840 --> 00:03:24.200
All of these shapes are self-similar.
00:03:24.680 --> 00:03:30.880
A line can be broken up into two smaller lines, each of which is a perfect copy of the original, just scaled down by a half.
00:03:31.600 --> 00:03:38.280
A square can be broken down into four smaller squares, each of which is a perfect copy of the original just scaled down by a half.
00:03:39.960 --> 00:03:42.760
Likewise, a cube can be broken down into eight smaller cubes.
00:03:42.760 --> 00:03:45.200
Again, each one is a scaled-down version by one-half.
00:03:46.080 --> 00:03:51.120
And the core characteristic of the Sierpinski triangle is that it’s made of three smaller copies of itself.
00:03:51.680 --> 00:03:56.200
And the length of the side of one of those smaller copies is one-half the side length of the original triangle.
00:03:58.280 --> 00:04:00.360
Now it’s fun to compare how we measure these things.
00:04:00.680 --> 00:04:04.000
We’d say that the smaller line is one-half the length of the original line.
00:04:04.520 --> 00:04:07.800
The smaller square is one-quarter the area of the original square.
00:04:08.360 --> 00:04:11.760
The small cube is one-eighth the volume of the original cube.
00:04:12.440 --> 00:04:16.720
And that smaller Sierpinski triangle, well, we’ll talk about how to measure that in just a moment.
00:04:18.400 --> 00:04:24.880
What I want is a word that generalizes the idea of length, area, and volume, but that I can apply to all of those shapes and more.
00:04:25.720 --> 00:04:28.400
And typically in math, the word that you’d use for this is measure.
00:04:28.920 --> 00:04:31.680
But I think it might be more intuitive to talk about mass.
00:04:32.000 --> 00:04:39.480
As in, imagine that each of these shapes is made out of metal, a thin wire, a flat sheet, a solid cube, and some kind of Sierpinski mesh.
00:04:40.360 --> 00:04:46.160
Fractal dimension has everything to do with understanding how the mass of these shapes changes as you scale them.
00:04:47.360 --> 00:04:52.920
The benefit of starting the discussion with self-similar shapes is that it gives us a nice clear-cut way to compare masses.
00:04:55.080 --> 00:05:05.160
When you scale down that line by one-half, the mass is also scaled down by one-half, which you can viscerally see because it takes two copies of that smaller one to form the whole.
00:05:07.320 --> 00:05:15.160
When you scale down a square by one-half, its mass is scaled down by one-fourth, where again you can see this by piecing together four of the smaller copies to get the original.
00:05:19.360 --> 00:05:28.680
Likewise, when you scale down that cube by one-half, the mass is scaled down by one-eighth, or one-half cubed, because it takes eight copies of that smaller cube to rebuild the original.
00:05:31.400 --> 00:05:38.720
And when you scale down this Sierpinski triangle by a factor of a half, wouldn’t you agree that it makes sense to say that its mass goes down by a factor of one-third?
00:05:39.240 --> 00:05:42.440
I mean, it takes exactly three of those smaller ones to form the original.
00:05:45.280 --> 00:05:52.080
But notice that for the line, the square, and the cube, the factor by which the mass changed is this nice clean integer power of one-half.
00:05:53.920 --> 00:05:56.400
In fact, that exponent is the dimension of each shape.
00:05:59.640 --> 00:06:16.520
And what’s more, you could say that what it means for a shape to be, for example, two-dimensional, what puts the two in two-dimensional is that when you scale it by some factor, its mass is scaled by that factor raised to the second power.
00:06:19.080 --> 00:06:27.040
And maybe what it means for a shape to be three-dimensional is that when you scale it by some factor, the mass is scaled by the third power of that factor.
00:06:31.640 --> 00:06:36.640
So if this is our conception of dimension, what should the dimensionality of a Sierpinski triangle be?
00:06:38.520 --> 00:06:46.040
You’d wanna say that when you scale it down by a factor of one-half, its mass goes down by one-half to the power of — well, whatever its dimension is.
00:06:46.640 --> 00:06:50.800
And because it’s self-similar, we know that we want its mass to go down by a factor of one-third.
00:06:52.760 --> 00:06:58.240
So what’s the number 𝐷 such that raising one-half to the power of 𝐷 gives you one-third?
00:06:59.360 --> 00:07:02.160
Well, that’s the same as asking two to the what equals three.
00:07:02.640 --> 00:07:05.680
The quintessential type of question that logarithms are meant to answer.
00:07:06.080 --> 00:07:12.240
And when you go and plug-in log base two of three to a calculator, what you’ll find is that it’s about 1.585.
00:07:13.360 --> 00:07:20.120
So in this way, the Sierpinski triangle is not one-dimensional, even though you could define a curve that passes through all its points.
00:07:20.520 --> 00:07:23.360
And nor is it two-dimensional, even though it lives in the plane.
00:07:24.160 --> 00:07:26.320
Instead, it’s 1.585-dimensional.
00:07:27.240 --> 00:07:31.840
And if you wanna describe its mass, neither length nor area seem like the fitting notions.
00:07:32.400 --> 00:07:34.720
If you tried, its length would turn out to be infinite.
00:07:35.120 --> 00:07:36.520
And its area would turn out to be zero.
00:07:38.920 --> 00:07:44.120
Instead, what you want is whatever the 1.585-dimensional analog of length is.
00:07:45.960 --> 00:07:49.160
Here, let’s look at another self-similar fractal, the Von Koch curve.
00:07:49.920 --> 00:07:56.680
This one is composed of four smaller identical copies of itself, each of which is a copy of the original scaled down by one-third.
00:07:57.680 --> 00:07:59.160
So the scaling factor is one-third.
00:07:59.560 --> 00:08:01.600
And the mass has gone down by a factor of one-fourth.
00:08:04.120 --> 00:08:11.040
So that means the dimension should be some number 𝐷 so that when we raise one-third to the power of 𝐷, it gives us one-fourth.
00:08:12.400 --> 00:08:15.280
Well, that’s the same as saying three to the what equals four.
00:08:15.720 --> 00:08:18.880
So you can go and plug into a calculator log base three of four.
00:08:19.400 --> 00:08:22.000
And that comes out to be around 1.262.
00:08:22.880 --> 00:08:27.040
So in a sense, the Von Koch curve is a 1.262-dimensional shape.
00:08:29.360 --> 00:08:30.120
Here’s another fun one.
00:08:30.600 --> 00:08:33.480
This is kind of the right-angled version of the Koch curve.
00:08:36.840 --> 00:08:41.680
It’s built up of eight scaled-down copies of itself, where the scaling factor here is one-fourth.
00:08:45.040 --> 00:08:51.560
So if you wanna know its dimension, it should be some number 𝐷 such that one-fourth to the power of 𝐷 equals one-eighth.
00:08:51.800 --> 00:08:54.000
The factor by which the mass just decreased.
00:08:56.640 --> 00:08:59.880
And in this case, the value we want is log base four of eight.
00:09:00.280 --> 00:09:02.080
And that’s exactly three-halves.
00:09:02.600 --> 00:09:06.640
So evidently, this fractal is precisely 1.5-dimensional.
00:09:08.040 --> 00:09:08.960
Does that kind of makes sense?
00:09:09.240 --> 00:09:13.600
It’s weird, but it’s all just about scaling and comparing masses while you scale.
00:09:15.120 --> 00:09:20.040
And what I’ve described so far, everything up to this point is what you might call self-similarity dimension.
00:09:20.760 --> 00:09:25.960
It does a good job making the idea of fractional dimension seem at least somewhat reasonable, but there’s a problem.
00:09:26.560 --> 00:09:28.120
It’s not really a general notion.
00:09:28.520 --> 00:09:34.480
I mean, when we were reasoning about how a mass’s shape should change, it relied on the self-similarity of the shapes.
00:09:34.760 --> 00:09:37.440
That you could build them up from smaller copies of themselves.
00:09:38.160 --> 00:09:40.240
But that seems unnecessarily restrictive.
00:09:40.840 --> 00:09:43.920
After all, most two-dimensional shapes are not at all self-similar.
00:09:45.400 --> 00:09:47.520
Consider the disk, the interior of a circle.
00:09:48.200 --> 00:09:49.440
We know that’s two-dimensional.
00:09:49.760 --> 00:09:58.640
And you could say that this is because when you scale it up by a factor of two, its mass proportional to the area gets scaled by the square of that factor, in this case four.
00:09:59.560 --> 00:10:04.880
But it’s not like there’s some way to piece together four copies of that smaller circle to rebuild the original.
00:10:05.600 --> 00:10:10.240
So how do we know that that bigger disk is exactly four times the mass of the original?
00:10:12.400 --> 00:10:20.720
Answering that requires a way to make this idea of mass a little more mathematically rigorous, since we’re not dealing with physical objects made of matter, are we?
00:10:21.080 --> 00:10:24.320
We’re dealing with purely geometric ones living in an abstract space.
00:10:25.320 --> 00:10:28.000
And there’s a couple ways to think about this, but here is a common one.
00:10:29.040 --> 00:10:33.720
Cover the plane with the grid and highlight all of the grid squares that are touching the disk.
00:10:34.280 --> 00:10:35.600
And now count how many there are.
00:10:38.000 --> 00:10:40.960
In the back of our minds, we already know that a disk is two-dimensional.
00:10:41.320 --> 00:10:44.960
And the number of grid squares that it touches should be proportional to its area.
00:10:46.000 --> 00:10:54.040
A clever way to verify this empirically is to scale up that disk by some factor, like two, and count how many grid squares touch this new scaled-up version.
00:10:54.920 --> 00:11:03.760
What you should find is that that number has increased approximately in proportion to the square of our scaling factor, which in this case means about four times as many boxes.
00:11:04.920 --> 00:11:08.040
Well, admittedly, what’s on the screen here might not look that convincing.
00:11:08.360 --> 00:11:10.520
But it’s just because the grid is really coarse.
00:11:10.920 --> 00:11:16.880
If instead you took a much finer grid, one that more tightly captures the intent we’re going for here by measuring the size of the circle.
00:11:17.440 --> 00:11:23.760
That relationship of quadrupling the number of boxes touched when you scale the disk by a factor of two should shine through more clearly.
00:11:25.520 --> 00:11:30.280
I’ll admit though that when I was animating this, I was surprised by just how slowly this value converges to four.
00:11:32.080 --> 00:11:33.280
Here’s one way to think about this.
00:11:33.680 --> 00:11:42.920
If you were to plot the scaling factor compared to the number of boxes that the scaled disk touches, your data should very closely fit a perfect parabola.
00:11:43.360 --> 00:11:48.280
Since the number of boxes touched is roughly proportional to the square of the scaling factor.
00:11:51.000 --> 00:11:58.600
For larger and larger scaling values, which is actually equivalent to just looking at a finer grid, that data is gonna more perfectly fit that parabola.
00:12:02.440 --> 00:12:08.760
Now getting back to fractals, let’s play this game with the Sierpinski triangle, counting how many boxes are touching points in that shape.
00:12:10.560 --> 00:12:17.040
How would you imagine that number compares to scaling up the triangle by a factor of two and counting the new number of boxes touched?
00:12:20.000 --> 00:12:25.960
Well, the proportion of boxes touched by the big one to the number of boxes touched by the small one should be about three.
00:12:26.880 --> 00:12:30.800
After all, that bigger version is just built up of three copies of the smaller version.
00:12:32.720 --> 00:12:38.960
You could also think about this as two raised to the dimension of the fractal, which we just saw is about 1.585.
00:12:40.040 --> 00:12:46.600
And so, if you were to go and plot the scaling factor in this case against the number of boxes touched by the Sierpinski triangle.
00:12:47.240 --> 00:12:55.160
The data would closely fit a curve with the shape of 𝑦 equals 𝑥 to the power 1.585, just multiplied by some proportionality constant.
00:12:57.200 --> 00:13:04.360
But importantly, the whole reason that I’m talking about this is that we can play the same game with non-self-similar shapes that still have some kind of roughness.
00:13:04.840 --> 00:13:06.960
And the classic example here is the coastline of Britain.
00:13:07.920 --> 00:13:11.840
If you plot that coastline into the plane and count how many boxes are touching it.
00:13:12.280 --> 00:13:16.440
And then scale it by some amount and count how many boxes are touching that new scaled version.
00:13:17.240 --> 00:13:26.240
What you’d find is that the number of boxes touching the coastline increases approximately in proportion to the scaling factor raised to the power of 1.21.
00:13:27.920 --> 00:13:31.720
Here, it’s kind of fun to think about how you would actually compute that number empirically.
00:13:32.520 --> 00:13:36.000
As in, imagine I give you some shape, and you’re a savvy programmer.
00:13:36.560 --> 00:13:37.840
How would you find this number?
00:13:42.640 --> 00:13:47.520
So what I’m saying here is that if you scale this shape by some factor, which I’ll call 𝑠.
00:13:48.040 --> 00:13:56.760
The number of boxes touching that shape should equal some constant multiplied by that scaling factor raised to whatever the dimension is, the value that we’re looking for.
00:13:58.240 --> 00:14:06.560
Now if you have some data plot that closely fits a curve that looks like the input raised to some power, it can be hard to see exactly what that power should be.
00:14:08.040 --> 00:14:11.160
So a common trick is to take the logarithm of both sides.
00:14:11.960 --> 00:14:14.480
That way, the dimension is gonna drop down from the exponent.
00:14:14.800 --> 00:14:17.040
And we’ll have a nice clean linear relationship.
00:14:18.120 --> 00:14:28.680
What this suggests is that if you were to plot the log of the scaling factor against the log of the number of boxes touching the coastline, the relationship should look like a line.
00:14:28.960 --> 00:14:31.280
And that line should have a slope equal to the dimension.
00:14:33.360 --> 00:14:42.280
So what that means is that if you tried out a whole bunch of scaling factors, counted the number of boxes touching the coast in each instant, and then plotted the points on the log-log plot.
00:14:43.320 --> 00:14:47.480
You could then do some kind of linear regression to find the best fit line to your data set.
00:14:48.040 --> 00:14:53.880
And when you look at the slope of that line, that tells you the empirical measurement for the dimension of what you’re examining.
00:14:54.680 --> 00:15:01.120
I just think that makes this idea of fractal dimension so much more real and visceral compared to abstract artificially perfect shapes.
00:15:02.080 --> 00:15:08.000
And once you’re comfortable thinking about dimension like this, you, my friend, have become ready to hear the definition of a fractal.
00:15:10.320 --> 00:15:16.360
Essentially, fractals are shapes whose dimension is not an integer, but instead some fractional amount.
00:15:17.440 --> 00:15:24.480
What’s cool about that is that it’s a quantitative way to say that they’re shapes that are rough, and that they stay rough even as you zoom in.
00:15:25.800 --> 00:15:30.480
Technically, there’s a slightly more accurate definition, and I’ve included it in the video description.
00:15:30.960 --> 00:15:36.920
But this idea here of a noninteger dimension almost entirely captures the idea of roughness that we’re going for.
00:15:38.560 --> 00:15:41.800
There is one nuance, though, that I haven’t brought up yet, but it’s worth pointing out.
00:15:42.360 --> 00:15:50.720
Which is that this dimension, at least as I’ve described it so far using the box counting method, can sometimes change based on how far zoomed in you are.
00:15:53.000 --> 00:15:57.480
For example, here’s a shape sitting in three dimensions which, at a distance, looks like a line.
00:15:58.320 --> 00:16:04.040
In 3D, by the way, when you do a box counting, you have a 3D grid full of little cubes instead of little squares.
00:16:04.040 --> 00:16:05.280
But it works the same way.
00:16:06.440 --> 00:16:12.200
At this scale where the shape’s thickness is smaller than the size of the boxes, it looks one-dimensional.
00:16:12.680 --> 00:16:16.400
Meaning, the number of boxes it touches is proportional to its length.
00:16:17.600 --> 00:16:23.560
But when you scale it up, it starts behaving a lot more like a tube, touching the boxes on the surface of that tube.
00:16:24.200 --> 00:16:30.640
And so, it’ll look two-dimensional, with the number of boxes touched being proportional to the square of the scaling factor.
00:16:31.760 --> 00:16:33.000
But it’s not really a tube.
00:16:33.400 --> 00:16:35.840
It’s made of these rapidly winding little curves.
00:16:36.400 --> 00:16:43.080
So once you scale it up even more, to the point where the boxes can pick up on the details of those curves, it looks one-dimensional again.
00:16:43.840 --> 00:16:48.280
With the number of boxes touched scaling directly in proportion to the scaling constant.
00:16:49.560 --> 00:16:54.240
So actually, assigning a number to a shape for its dimension can be tricky.
00:16:54.840 --> 00:16:57.960
And it leaves room for differing definitions and differing conventions.
00:17:01.120 --> 00:17:04.880
In a pure math setting, there are indeed numerous definitions for dimension.
00:17:05.480 --> 00:17:10.840
But all of them focus on what the limit of this dimension is at closer and closer zoom levels.
00:17:14.760 --> 00:17:20.000
You can think of that in terms of the plot as the limit of this slope, as you move farther and farther to the right.
00:17:21.200 --> 00:17:27.920
So for a purely geometric shape to be a genuine fractal, it has to continue looking rough, even as you zoom in infinitely far.
00:17:30.040 --> 00:17:37.640
But in a more applied setting, like looking at the coastline of Britain, it doesn’t really make sense to talk about the limit as you zoom in more and more.
00:17:38.040 --> 00:17:40.200
I mean, at some point, you’d just be hitting atoms.
00:17:40.920 --> 00:17:46.760
Instead, what you do is you look at a sufficiently wide range of scales, from very zoomed out up to very zoomed in.
00:17:47.080 --> 00:17:48.600
And compute the dimension at each one.
00:17:49.920 --> 00:18:00.000
And in this more applied setting, a shape is typically considered to be a fractal only when the measured dimension stays approximately constant, even across multiple different scales.
00:18:00.640 --> 00:18:04.960
For example, the coastline of Britain doesn’t just look 1.21-dimensional at a distance.
00:18:05.360 --> 00:18:10.560
Even if you zoom in by a factor of a thousand, the level of roughness is still around 1.21.
00:18:11.640 --> 00:18:18.600
That right there is the sense in which many shapes from nature actually are self-similar, albeit not perfect self-similarity.
00:18:19.720 --> 00:18:23.240
Perfectly self-similar shapes do play an important role in fractal geometry.
00:18:23.880 --> 00:18:29.400
What they give us are simple-to-describe low-information examples of this phenomenon of roughness.
00:18:29.720 --> 00:18:33.720
Roughness that persists at many different scales and at arbitrarily close scales.
00:18:34.800 --> 00:18:35.480
And that’s important!
00:18:35.480 --> 00:18:39.000
It gives us the primitive tools for modeling these fractal phenomena.
00:18:39.760 --> 00:18:43.920
But I think it’s also important not to view them as the prototypical examples of fractals.
00:18:44.240 --> 00:18:47.080
Since fractals in general actually have a lot more character to them.
00:18:50.800 --> 00:18:56.240
I really do think that this is one of those ideas where once you learn it, it makes you start looking at the world completely differently.
00:18:56.920 --> 00:19:02.720
What this number is, what this fractional dimension gives us, is a quantitative way to describe roughness.
00:19:03.360 --> 00:19:12.000
For example, the coastline of Norway is about 1.52-dimensional, which is a numerical away to communicate the fact that it’s way more jaggedy than Britain’s coastline.
00:19:12.880 --> 00:19:20.040
The surface of a calm ocean might have a fractal dimension only barely above two, while a stormy one might have a dimension closer to 2.3.
00:19:21.320 --> 00:19:24.480
In fact, fractal dimension doesn’t just arise frequently in nature.
00:19:25.120 --> 00:19:30.320
It seems to be the core differentiator between objects that arise naturally and those that are just man-made.
00:19:32.680 --> 00:19:50.640
For the final animation here, I have a certain whimsical 𝜋-creature fractal I wanna show you.