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
- Example 1 · The Cantor set, step by step
- Example 2 · The Koch snowflake in numbers
- Example 3 · Dimension, measured three ways
- Example 4 · Iterating z² + c by hand
- Example 5 · Building a fern from four rules
- Example 6 · Growing a curve from a string
- Example 7 · A random mountain by hand
- Example 8 · Measuring a real object
- Six common misconceptions
- Summary table
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:
- Detail at every scale. There is no zoom level at which the shape becomes smooth.
- Some kind of self-similarity. Small parts resemble the whole, either exactly (the Koch curve), approximately (the Mandelbrot set) or only statistically (a coastline).
- 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 n | Pieces 2ⁿ | Length of each 3⁻ⁿ | Total length (2/3)ⁿ |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 1 | 2 | 0.3333 | 0.6667 |
| 2 | 4 | 0.1111 | 0.4444 |
| 3 | 8 | 0.0370 | 0.2963 |
| 4 | 16 | 0.0123 | 0.1975 |
| 5 | 32 | 0.0041 | 0.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.
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 n | Sides 3·4ⁿ | Perimeter 3·(4/3)ⁿ | Area (original = 1) |
|---|---|---|---|
| 0 | 3 | 3.000 | 1.0000 |
| 1 | 12 | 4.000 | 1.3333 |
| 2 | 48 | 5.333 | 1.4815 |
| 3 | 192 | 7.111 | 1.5473 |
| 4 | 768 | 9.481 | 1.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:
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:
| Shape | N | 1/s | D = log N / log(1/s) |
|---|---|---|---|
| Cantor set | 2 | 3 | log 2 / log 3 = 0.6309 |
| Koch curve | 4 | 3 | log 4 / log 3 = 1.2619 |
| Sierpiński triangle | 3 | 2 | log 3 / log 2 = 1.5850 |
| Sierpiński carpet | 8 | 3 | log 8 / log 3 = 1.8928 |
| Menger sponge | 20 | 3 | log 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/2 | 3 | 1.585 |
| 1/4 | 9 | 1.585 |
| 1/8 | 27 | 1.585 |
| 1/16 | 81 | 1.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.
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.
| c | Orbit of 0 | Verdict |
|---|---|---|
| −1 | 0, −1, 0, −1, 0, … | Cycles with period 2: inside |
| 1 | 0, 1, 2, 5, 26, 677, … | Explodes: outside |
| −2 | 0, −2, 2, 2, 2, … | Stuck at 2: inside (the left tip) |
| i | 0, i, −1 + i, −i, −1 + i, −i, … | Lands on a 2-cycle: inside, on the boundary |
| 0.25 | 0, 0.25, 0.3125, 0.3477, … → 0.5 | Creeps towards 0.5: inside (the cusp) |
| 0.3 | 0, 0.3, 0.39, 0.4521, 0.5044, … 1.0373, 1.3760, 2.1933 | Passes 2 at step 12: outside |
(−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):
| Map | a | b | c | d | e | f | Chance | Draws |
|---|---|---|---|---|---|---|---|---|
| 1 | 0 | 0 | 0 | 0.16 | 0 | 0 | 1% | the stem |
| 2 | 0.85 | 0.04 | −0.04 | 0.85 | 0 | 1.6 | 85% | ever smaller copies up the frond |
| 3 | 0.20 | −0.26 | 0.23 | 0.22 | 0 | 1.6 | 7% | the left leaflet |
| 4 | −0.15 | 0.28 | 0.26 | 0.24 | 0 | 0.44 | 7% | the right leaflet |
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°”.
| Step | String | Symbols F |
|---|---|---|
| 0 | F | 1 |
| 1 | F+F−−F+F | 4 |
| 2 | F+F−−F+F+F+F−−F+F−−F+F−−F+F+F+F−−F+F | 16 |
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.
- Draw a horizontal segment with both ends at height 0.
- Move its midpoint up or down by a random amount between −1 and +1. Say the dice give +0.6.
- 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.
- 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:
- Photograph or scan the shape in high contrast, so the outline is a thin dark line.
- Overlay grids with box sizes of, say, 64, 32, 16, 8 and 4 pixels, and count the boxes that contain part of the line.
- 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).
- The slope of a straight line through the middle points is the box-counting dimension.
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
- “Fractals must be exactly self-similar.” Most fractals in nature, and the Mandelbrot set itself, are not. Statistical or approximate similarity is enough.
- “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.
- “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.
- “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.
- “Fractals are just pretty pictures.” They are used in antenna design, medical imaging, materials science, finance and computer graphics; see the Applications section.
- “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
| Example | Rule | Key number | Lesson |
|---|---|---|---|
| Cantor set | Remove middle thirds | D ≈ 0.631 | Zero length, uncountably many points |
| Koch snowflake | Bump on every middle third | Area 8/5, perimeter ∞ | Finite area, infinite edge |
| Sierpiński triangle | Keep 3 of 4 half-size triangles | D ≈ 1.585 | Three dimension methods agree |
| Mandelbrot set | z → z² + c from z = 0 | Escape radius 2 | Bounded orbits draw the set |
| Barnsley fern | 4 affine maps, chosen at random | 24 numbers | Short rules, rich shapes |
| Midpoint mountain | Random moves, halved each round | D = 2 − H | Statistical self-similarity |
Ready to go further? The free 21-lesson course turns these examples into a structured path with quizzes and a certificate.