Theory · In depth

Fractals explained in depth, with worked examples

This page is the long version. Instead of pictures alone, every idea is worked through with actual numbers you can check on paper or with a calculator. Read it straight through, or jump to the example you need.

What a fractal really is

Ordinary geometry describes shapes that become simpler when you look closer. Magnify any small piece of a circle and it looks like a straight line; magnify a sphere and it looks like a flat plane. Calculus is built on this fact: zoom in far enough and everything smooth becomes linear.

A fractal is a shape for which this never happens. However far you magnify it, new detail keeps appearing, and the detail is of the same general kind as before. Three ingredients usually come together:

  1. Detail at every scale. There is no zoom level at which the shape becomes smooth.
  2. Some kind of self-similarity. Small parts resemble the whole, either exactly (the Koch curve), approximately (the Mandelbrot set) or only statistically (a coastline).
  3. A fractional dimension. A simple number, usually between the familiar whole numbers, measures how completely the shape fills space.

There is also a fourth, practical ingredient that explains why fractals matter: they are usually produced by a very short rule applied again and again. That is the idea of iteration, and all eight examples below are built on it.

Example 1 · The Cantor set, step by step

Start with the interval from 0 to 1. Remove the open middle third, leaving [0, 1/3] and [2/3, 1]. From each remaining piece remove its middle third again, and repeat forever.

Step nPieces 2ⁿLength of each 3⁻ⁿTotal length (2/3)ⁿ
0111
120.33330.6667
240.11110.4444
380.03700.2963
4160.01230.1975
5320.00410.1317

The total length shrinks by a factor of 2/3 at each step and tends to zero. Yet something infinite survives. Write numbers in base 3: removing the middle third removes the numbers whose first ternary digit must be 1. What remains are exactly the numbers that can be written with the digits 0 and 2 only.

Worked check

Is 1/4 in the Cantor set? In base 3, 1/4 = 0.020202…₃ (because 0.0202…₃ = 2/9 + 2/81 + … = (2/9)/(1 − 1/9) = 1/4). It uses only 0s and 2s, so yes. It is in the set even though it is never the end point of any removed interval.

Because every infinite sequence of 0s and 2s gives a different point, the Cantor set has as many points as the whole interval. A set can have zero length and still be uncountably large. Its dimension, which we compute in Example 3, is about 0.6309: more than a scattering of points, less than a line.

Example 2 · The Koch snowflake in numbers

Start with an equilateral triangle of side 1. On the middle third of every side build an outward-pointing equilateral triangle, then erase its base. Each side becomes four sides, each a third as long. Repeat.

Step nSides 3·4ⁿPerimeter 3·(4/3)ⁿArea (original = 1)
033.0001.0000
1124.0001.3333
2485.3331.4815
31927.1111.5473
47689.4811.5766
∞∞∞1.6000

Why the area converges. At step 1 we add 3 triangles, each with 1/9 of the original area: +3/9. At step 2 we add 12 triangles with 1/81 of the area: +12/81 = +(3/9)·(4/9). Each step adds 4/9 of what the previous step added. The total added is a geometric series:

3/9 · (1 + 4/9 + (4/9)² + …) = (1/3) · 1/(1 − 4/9) = 3/5

So the finished snowflake has area 1 + 3/5 = 8/5 of the starting triangle, while its perimeter, multiplied by 4/3 at every step, grows without limit. A finite area is enclosed by an infinitely long boundary. You can watch this happen with the slider on the Self-similarity page.

Example 3 · Dimension, measured three ways

Way 1: counting self-similar copies

Cut a segment in half: 2 copies at scale 1/2. Cut a square into a 2×2 grid: 4 copies. A cube: 8 copies. In every case N = (1/s)D, where N is the number of copies, s the scale factor and D the dimension. Solve for D:

D = log N / log(1/s)
ShapeN1/sD = log N / log(1/s)
Cantor set23log 2 / log 3 = 0.6309
Koch curve43log 4 / log 3 = 1.2619
Sierpiński triangle32log 3 / log 2 = 1.5850
Sierpiński carpet83log 8 / log 3 = 1.8928
Menger sponge203log 20 / log 3 = 2.7268

Way 2: box counting

Cover the shape with a grid of boxes of side ε and count how many boxes N(ε) touch it. For the Sierpiński triangle drawn in a unit square:

Box size εBoxes N(ε)log N / log(1/ε)
1/231.585
1/491.585
1/8271.585
1/16811.585

Each halving of the box size triples the count, so the slope of log N against log(1/ε) is log 3 / log 2, the same answer as Way 1. For a real object the counts are not this tidy: you plot the points and fit a straight line through the middle range of scales.

Way 3: the ruler method (Richardson)

Walk a pair of dividers along a coastline. With a longer opening you skip the small bays; with a shorter one you follow them, so the measured length L grows as the ruler ε shrinks: L(ε) ≈ F·ε1−D.

Worked example (illustrative numbers)

Suppose a 100 km ruler gives a length of 2,800 km and a 10 km ruler gives 5,000 km. The ruler shrank by a factor of 10 and the length grew by 5000/2800 = 1.786. Then 1 − D = −log(1.786)/log(10) = −0.252, so D ≈ 1.25, the value Mandelbrot quoted for the west coast of Britain.

Example 4 · Iterating z² + c by hand

The Mandelbrot set is the set of numbers c for which the sequence 0, c, c² + c, … stays bounded. You can test points with nothing more than arithmetic.

cOrbit of 0Verdict
−10, −1, 0, −1, 0, …Cycles with period 2: inside
10, 1, 2, 5, 26, 677, …Explodes: outside
−20, −2, 2, 2, 2, …Stuck at 2: inside (the left tip)
i0, i, −1 + i, −i, −1 + i, −i, …Lands on a 2-cycle: inside, on the boundary
0.250, 0.25, 0.3125, 0.3477, … → 0.5Creeps towards 0.5: inside (the cusp)
0.30, 0.3, 0.39, 0.4521, 0.5044, … 1.0373, 1.3760, 2.1933Passes 2 at step 12: outside
How to square a complex number

(−1 + i)² = 1 − 2i + i² = 1 − 2i − 1 = −2i. Adding c = i gives −i. Then (−i)² = −1, and adding i gives −1 + i again. The orbit is trapped in a loop, so i belongs to the set.

The last row shows why pictures need many iterations near the boundary: c = 0.3 is outside, but only a little, so it takes twelve steps to reveal it. Points closer to the boundary take hundreds or millions. Once |z| exceeds 2 the orbit is guaranteed to escape, which is the stopping rule every Mandelbrot program uses. Try these values on the Julia sets page: c = −1 gives the “basilica”, c = i a dendrite.

Example 5 · Building a fern from four rules

An iterated function system is a short list of maps that each shrink the plane. Michael Barnsley’s fern uses four affine maps of the form (x, y) → (a·x + b·y + e, c·x + d·y + f):

MapabcdefChanceDraws
10000.16001%the stem
20.850.04−0.040.8501.685%ever smaller copies up the frond
30.20−0.260.230.2201.67%the left leaflet
4−0.150.280.260.2400.447%the right leaflet
Three steps by hand

Start at (0, 0). Roll map 2: (0.85·0 + 0.04·0, −0.04·0 + 0.85·0 + 1.6) = (0, 1.6). Roll map 2 again: (0.04·1.6, 0.85·1.6 + 1.6) = (0.064, 2.96). Roll map 3: (0.2·0.064 − 0.26·2.96, 0.23·0.064 + 0.22·2.96 + 1.6) = (−0.757, 2.266). Each point is plotted; after tens of thousands of them the fern appears.

Twenty-four numbers describe a fern that would otherwise need millions of pixels. This is the idea behind the chaos game and behind fractal image compression.

Example 6 · Growing a curve from a string

An L-system rewrites every symbol of a string at once. For the Koch curve: start with F; the rule is F → F+F−−F+F; F means “draw forward”, + and − mean “turn 60°”.

StepStringSymbols F
0F1
1F+F−−F+F4
2F+F−−F+F+F+F−−F+F−−F+F−−F+F+F+F−−F+F16

The number of segments is multiplied by 4 at every step, while each segment is drawn a third as long, so the drawing stays the same size and grows the familiar Koch bumps. Adding brackets, which save and restore the pen position, turns the same idea into branching plants; see the Fractal trees page.

Example 7 · A random mountain by hand

Natural fractals are rough in a statistical way. The midpoint displacement method produces such roughness with a coin and a ruler.

  1. Draw a horizontal segment with both ends at height 0.
  2. Move its midpoint up or down by a random amount between −1 and +1. Say the dice give +0.6.
  3. Now there are two segments. Move each of their midpoints by a random amount, but only half as large: between −0.5 and +0.5. Say −0.2 and +0.3, so the heights at the quarter points become 0.3 − 0.2 = 0.1 and 0.3 + 0.3 = 0.6.
  4. Repeat, halving the range of the random moves each time.

After eight or ten rounds you have a convincing mountain ridge. How fast you shrink the random moves controls the roughness: shrink them by a factor 2H each round and the profile has dimension D = 2 − H. Smaller H, rougher ridge. The thumbnail “Random fractals” on the Types of fractals page is drawn exactly like this.

Example 8 · Measuring a real object

You can estimate the fractal dimension of a real shape, such as a leaf outline, a crack or a coastline on a map, at home:

  1. Photograph or scan the shape in high contrast, so the outline is a thin dark line.
  2. Overlay grids with box sizes of, say, 64, 32, 16, 8 and 4 pixels, and count the boxes that contain part of the line.
  3. Plot log(count) against log(1/box size). Ignore the largest boxes (everything is touched) and the smallest (you are counting pixels, not the object).
  4. The slope of a straight line through the middle points is the box-counting dimension.
Typical results

A smooth circle gives about 1.0. A coastline map often gives values between 1.1 and 1.3. A tree silhouette or a lightning photograph can give 1.5 to 1.8. Two different photographers will get slightly different values: the method is an estimate, and the answer depends on the range of scales you trust.

Six common misconceptions

  1. “Fractals must be exactly self-similar.” Most fractals in nature, and the Mandelbrot set itself, are not. Statistical or approximate similarity is enough.
  2. “Any complicated picture is a fractal.” Complexity is not the point; consistent detail across scales is. A random scatter of points has no scaling law.
  3. “Natural fractals continue forever.” Real ones hold only over a range of scales, from millimetres to kilometres for a coastline. Below that, physics takes over.
  4. “Fractal dimension is always a fraction.” The boundary of the Mandelbrot set and the Hilbert curve both have dimension exactly 2. What matters is that it exceeds the topological dimension.
  5. “Fractals are just pretty pictures.” They are used in antenna design, medical imaging, materials science, finance and computer graphics; see the Applications section.
  6. “Mandelbrot invented fractals.” He named and unified them in 1975, but Cantor, Koch, Sierpiński, Hausdorff, Besicovitch, Julia and Fatou had studied the objects decades earlier; see the Biographies.

Summary table

ExampleRuleKey numberLesson
Cantor setRemove middle thirdsD ≈ 0.631Zero length, uncountably many points
Koch snowflakeBump on every middle thirdArea 8/5, perimeter ∞Finite area, infinite edge
Sierpiński triangleKeep 3 of 4 half-size trianglesD ≈ 1.585Three dimension methods agree
Mandelbrot setz → z² + c from z = 0Escape radius 2Bounded orbits draw the set
Barnsley fern4 affine maps, chosen at random24 numbersShort rules, rich shapes
Midpoint mountainRandom moves, halved each roundD = 2 − HStatistical self-similarity

Ready to go further? The free 21-lesson course turns these examples into a structured path with quizzes and a certificate.