A line is one-dimensional, a square two, a cube three. A coastline, it turns out, is somewhere in between, and so is the Koch snowflake's edge. This chapter shows why the length of a fractal curve is the wrong question, what the right number is, and three ways to measure it, two of which you can run yourself below.
Common mix-up: fractal dimension is not a measure of how complicated a picture looks, and it doesn't say what shape something is. The Koch curve, a single unbroken line, and Cantor dust, a cloud of separate points, have exactly the same dimension, 1.2619. Dimension measures one thing: how fast the amount of detail grows as you look more closely.
Lewis Fry Richardson was a British physicist and meteorologist, the man who first tried to forecast the weather by solving equations by hand. Late in life he studied the statistics of wars, and wondered whether the chance of two countries fighting depended on the length of the border they shared. When he went to look up those lengths, he found that different reference books gave noticeably different figures for the same border. Nobody had made a mistake. They had measured with different-sized steps.
Richardson set out to measure the effect. He walked a pair of dividers around coastlines and land frontiers on maps, step by step, at a series of openings, and recorded the total each time. For a smooth curve the totals would have settled down to a single number. For real coastlines they never did. The smaller the step, the longer the coast, without any sign of leveling off. And the growth was regular: plotted on logarithmic axes, the measured length against the step size made a straight line.
Richardson died in 1953, and his results appeared in 1961, in an appendix to his study of war. They might have stayed obscure if Benoit Mandelbrot had not picked them up. His 1967 paper in Science, "How Long Is the Coast of Britain? Statistical Self-Similarity and Fractional Dimension," argued that the slope of Richardson's line was not a nuisance but the most important thing about the coastline: a number describing its roughness, behaving exactly like a dimension that is not a whole number.
Taking logarithms turns the law into a straight line, log L = log M + (1 − D) log r, which is why Richardson's plots were straight. The slope is 1 − D, so you can read the dimension straight off it. For the west coast of Britain, Richardson's measurements give a slope of about −0.25, so D ≈ 1.25. For the coast of South Africa, one of the smoothest he measured, D ≈ 1.02: nearly a plain curve.
So the honest answer to "how long is the coast of Britain?" is: it depends on your ruler, and it depends in a precise way. Ask instead how fast the length grows as the ruler shrinks, and you get a number that doesn't depend on the ruler at all. That number is the fractal dimension.
Richardson's law can't hold forever in either direction. With a ruler longer than the island you get nonsense; with a ruler smaller than a grain of sand you start measuring individual pebbles and then molecules, and the coastline stops being a well-defined line at all. Long before that, the tide moves the waterline by meters twice a day.
What the law claims is that across the range of scales that maps and surveys care about, roughly from tens of meters to hundreds of kilometers, there's no characteristic size where the coast suddenly becomes smooth. That is a statement about the physics of erosion and geology, and the dimension is how you test it. Coasts formed by different processes, such as fjords cut by glaciers or long sandy beaches built by waves, tend to come out with different dimensions.
This island's coast is built by a random fractal rule whose dimension you choose: every edge is replaced by four edges, with the middle two bent into a point that randomly faces in or out, seven times over. The program then does what Richardson did. It walks the coast with dividers at twelve different openings, records the length each time, plots log length against log of one over the ruler, and fits a straight line. Because the plot runs toward shorter rulers, the line climbs, and the fitted dimension is 1 plus its slope. Pick a ruler to see its walk drawn on the island, change the dimension, or roll a new coast.
Here is a way to see why ordinary dimensions are what they are, which then works for fractals too. Take a line segment and cut it into pieces a third as long. You get 3 pieces. Take a square and cut each side into thirds: you get 9 small squares. A cube cut the same way gives 27 small cubes. Three, nine, twenty-seven: 3¹, 3², 3³. The exponent is the dimension.
In general, if a shape is made of N copies of itself, each scaled down by a factor s, then N = sD, and D is the dimension. For ordinary shapes that just restates what you already knew. The surprise is what happens when you apply it to a fractal.
The Koch curve is four copies of itself, each one third as long. If it were one-dimensional, four copies at a third the size would need to be three copies; if it were two-dimensional, it would need nine. It's in between, and the formula says exactly where: 1.2619. The Sierpinski triangle is three copies at half size. A one-dimensional thing would need two copies, a two-dimensional one four; the triangle sits at 1.5850, much closer to a surface than the Koch curve does. That matches the eye: the triangle looks much more like a filled shape than the snowflake's edge does.
This is the similarity dimension. It's the easiest to compute and the most intuitive, but it only works for shapes that are made of exact scaled copies of themselves, and only when the copies don't overlap too much.
| Shape | Copies N | Scale 1/s | D = log N / log s | Topological dimension |
|---|---|---|---|---|
| Line segment | 2 | 1/2 | log 2 / log 2 = 1 | 1 |
| Square | 4 | 1/2 | log 4 / log 2 = 2 | 2 |
| Cube | 8 | 1/2 | log 8 / log 2 = 3 | 3 |
| Cantor set | 2 | 1/3 | log 2 / log 3 ≈ 0.6309 | 0 |
| Koch curve | 4 | 1/3 | log 4 / log 3 ≈ 1.2619 | 1 |
| Sierpinski triangle | 3 | 1/2 | log 3 / log 2 ≈ 1.5850 | 1 |
| Sierpinski carpet | 8 | 1/3 | log 8 / log 3 ≈ 1.8928 | 1 |
| Menger sponge | 20 | 1/3 | log 20 / log 3 ≈ 2.7268 | 1 |
| Cantor dust (plane) | 4 | 1/3 | log 4 / log 3 ≈ 1.2619 | 0 |
What if the copies are not all the same size? Suppose a shape is made of one copy at half size and one at a quarter size. There is no single s to plug in. The fix, due to P. A. P. Moran in 1946, is to ask which D makes the scaled "D-dimensional sizes" add back up to the whole:
For the half-and-quarter example, write x = (1/2)D. Then (1/4)D = x², and the equation is x + x² = 1, whose positive solution is x = (√5 − 1)/2 ≈ 0.618. So D = log(1/0.618) / log 2 = log φ / log 2 ≈ 0.6942, where φ is the golden ratio. Slightly bigger than the Cantor set's 0.6309, which makes sense: one of the pieces is bigger than a third.
The answer is only trustworthy if the copies don't overlap much. The technical requirement, the "open set condition" used by John Hutchinson in 1981, says roughly that you can find a region whose shrunken copies fit inside it without overlapping. Barnsley's fern violates it: its leaflets overlap the main frond, so the Moran equation overestimates its dimension. Box counting, next, has no such restriction.
Similarity dimension needs exact copies. A coastline, a cloud or a photograph of a fern has none. For those there is a more general method, simple enough to do with graph paper.
Lay a grid of square boxes of side s over the shape and count how many boxes contain any part of it. Call that N(s). Now halve the box size and count again. For a smooth curve, halving the boxes roughly doubles the count, because the curve passes through twice as many boxes along its length. For a filled area, halving the boxes multiplies the count by four. For a fractal, the count grows by some factor in between, the same factor at every scale, and that factor tells you the dimension.
The Sierpinski triangle shows the idea perfectly. Draw it on a grid of 1,024 by 1,024 pixels, the way Instrument 2 does. With boxes 512 pixels across you need 3 boxes. With boxes of 256 you need 9; with 128, 27. Every halving of the box multiplies the count by exactly 3, all the way down to single pixels, where there are 3¹⁰ = 59,049 of them. Three is 2 to the power 1.585, and there is the dimension again, found without knowing anything about how the triangle was built.
Real data is messier, in ways worth knowing before you trust a number.
Mathematicians define the box-counting dimension as a limit: D = lim log N(s) / log(1/s) as s goes to 0. The limit doesn't always exist, so there are upper and lower versions, using the limit superior and inferior. You'll also see it called the Minkowski–Bouligand dimension or capacity dimension, and the boxes can be replaced by disks, or by any reasonable family of small sets, without changing the answer.
For exactly self-similar shapes that satisfy the open set condition, the box dimension, the similarity dimension and the Hausdorff dimension all agree. They can disagree on stranger sets. The rational numbers between 0 and 1 are the standard example: they are dense, so every box along the interval contains one and the box dimension is 1; but they are countable, a list of separate points, and their Hausdorff dimension is 0. That difference is the reason mathematicians prefer the Hausdorff dimension, and the reason everyone else uses box counting: it's the one you can compute.
Pick a shape, or choose "Draw your own" and draw on the left panel with a mouse or finger. The program rasterizes the shape onto a grid of 1,024 or 729 pixels a side, then counts how many boxes are occupied at every box size from one pixel up, and fits a line to the log-log plot on the right. The left panel shades the occupied boxes at the size you pick. Narrow the fit range to see how much the answer depends on it.
Box counting and similarity both work by covering a shape with pieces of one size. The definition that mathematicians treat as the real one, introduced by Felix Hausdorff in 1919 and developed by Abram Besicovitch, allows pieces of any sizes, each as small as you like, and it starts from a question you can ask about ordinary shapes.
Ask how long a square is. Lay a curve back and forth across it, closer and closer, and the total length goes to infinity: a square has infinite length. Ask its volume, and the answer is zero: it's flat. Only one question gives a sensible, finite answer, and that's area. The dimension of the square is the power, 2, at which the measurement jumps from infinite to zero. Hausdorff's idea is to make that power a dial that can take any value, not just 1, 2 or 3.
Here is how. Cover the shape with small sets, say little disks, each of diameter at most δ. For a trial dimension d, add up each disk's diameter raised to the power d. Find the cover that makes this sum smallest, then let δ shrink to zero. For a d that's too small, the sum blows up to infinity, like measuring a square's length. For a d that's too big, it falls to zero, like measuring its volume. There is exactly one value where it switches over. That value is the Hausdorff dimension.
Two features make it the mathematicians' favorite. Because each piece can be a different size, the cover can adapt to the shape, using big pieces where it's sparse and tiny ones where it's crowded; that's what makes a countable set of points come out with dimension 0, as it should. And it has clean rules: a set's dimension never exceeds the dimension of anything containing it, and the dimension of a union of countably many sets is the largest of their dimensions.
The price is that it's almost impossible to compute directly. In practice you prove that it equals the similarity dimension, or the box dimension, for the shape you care about, and compute that instead. The famous exceptions are proofs. In 1998 Mitsuhiro Shishikura proved that the boundary of the Mandelbrot set has Hausdorff dimension exactly 2: as rough as a curve in the plane can possibly be, yet (it's believed, though not proven) with zero area.
Cover the Koch curve with the 4ᵏ pieces from step k of its construction, each of diameter 3⁻ᵏ (times the length of the base). The sum for trial dimension d is 4ᵏ × 3⁻ᵏᵈ = (4/3ᵈ)ᵏ. If 3ᵈ is less than 4 this grows without limit as k increases; if 3ᵈ is more than 4 it shrinks to zero. The switch is at 3ᵈ = 4, which is d = log 4 / log 3.
That shows the dimension is at most log 4 / log 3, because one particular cover gives that answer and Hausdorff measure takes the best cover. Proving it's not smaller, that no cleverer cover does better, is the hard half, and it's where the open set condition comes in. Falconer's Fractal Geometry gives the full argument.
Put the numbers in order and a picture emerges. Below 1 are dusts: scattered points with no length. Between 1 and 2 are curves and networks that wiggle more and more until they nearly fill an area. Between 2 and 3 are spongy surfaces and solids full of holes.
| Dimension | Shape | What it is | How it's known |
|---|---|---|---|
| 0.6309 | Cantor set | A line with the middle third removed, forever | Similarity: log 2 / log 3 |
| 1.02 | Coast of South Africa | One of the smoothest coasts Richardson measured | Richardson's divider data, via Mandelbrot (1967) |
| 1.25 | West coast of Britain | The coastline that named the paradox | Richardson's divider data, via Mandelbrot (1967) |
| 1.2619 | Koch curve; Cantor dust | Four copies at one third; one connected, one in pieces | Similarity: log 4 / log 3 |
| 1.5236 | Boundary of the Heighway dragon | The edge of the paper-folding dragon (Chapter 5) | Computed exactly from its self-similar structure |
| 1.5850 | Sierpinski triangle | Three copies at half size | Similarity: log 3 / log 2 |
| 1.8928 | Sierpinski carpet | Eight copies at one third | Similarity: log 8 / log 3 |
| 2 | Boundary of the Mandelbrot set | A curve as rough as a planar set can be | Proof: Shishikura, 1998 |
| 2.7268 | Menger sponge | Twenty copies at one third: a cube full of tunnels | Similarity: log 20 / log 3 |
The Koch curve and the planar Cantor dust both have dimension log 4 / log 3, and they could hardly look more different. One is a single unbroken line; the other is infinitely many separate points. Dimension measures how fast detail accumulates as you zoom. It says nothing about whether the pieces are connected, how they are arranged, or how big the gaps are.
Mandelbrot introduced the word lacunarity, from the Latin lacuna, a gap, for that last property: how gappy or clumpy a fractal is at a given dimension. Two forests can have canopies with the same dimension and different lacunarity, one evenly speckled, one with big clearings. Researchers who classify textures in medical images or landscapes usually measure both.
| Method | Works on | How | Watch out for |
|---|---|---|---|
| Similarity | Exactly self-similar shapes | D = log N / log s from the construction | Overlapping copies (the fern); unequal copies need Moran's equation |
| Divider (Richardson) | Curves | Slope of log length against log ruler; D = 1 − slope | Only for curves; self-affine curves can mislead |
| Box counting | Anything you can draw or photograph | Slope of log N against log(1/s) | Fit range, pixel size, line thickness, grid offset |
| Hausdorff | Every set, in principle | Where the d-dimensional measure jumps from ∞ to 0 | Almost never computable directly; proved, not measured |