Math & ModelingIntermediateExperiment simulation~20 min

Fractals and Recursive Patterns

A rule you could write on a sticky note — square a number and add a constant — produces the Mandelbrot set, a shape with endless detail no matter how far you zoom. Fractals show how simple rules repeated over and over create complex structure, and they describe coastlines, ferns, blood vessels and lightning far better than circles and squares. Zoom, morph, build and grow five classic fractals.

200

More iterations sharpen the boundary, especially when zoomed in, but take longer.

Colouring

Drag to pan (two fingers on a touch screen), double-click, pinch or Ctrl + scroll to zoom. Tap the Mandelbrot or a Julia set to trace a point’s sequence. Start: Mandelbrot zooms into Seahorse Valley, Julia sweeps c around a circle, the others build step by step.

—
—
—
—
—
—
—
—
—
—
—
—

How to use this simulator

  1. Choose a fractal. Drag to pan (two fingers on a touch screen), and double-click, pinch or Ctrl + scroll to zoom. Reset view returns to the start.
  2. Mandelbrot: tap any point to trace its sequence z₀, z₁, z₂, … and see whether it escapes. Try the place buttons, raise the iterations when you zoom deep, and press Start to fly into Seahorse Valley.
  3. Julia: drag c on the small Mandelbrot map or use the sliders and presets. Keep up to three pictures to compare. Start sweeps c around a circle.
  4. Sierpinski and Koch: press Step or Start to add one iteration at a time; switch the Sierpinski triangle to the random chaos game.
  5. Fern: press Start to plot points, change the lean of map f₂, and colour points by the map that made them.

Learning objectives

  • Describe fractals in terms of self-similarity, iteration and recursion.
  • Iterate z → z² + c with complex numbers and decide whether a sequence escapes.
  • Explain how the Mandelbrot set and Julia sets are defined and how they are related.
  • Build the Sierpinski triangle and Koch snowflake and calculate how their areas and perimeters change.
  • Distinguish deterministic constructions from randomised ones such as the chaos game.
  • Calculate a similarity dimension and explain why different fractals have different dimensions.

What a fractal is

A fractal is a shape with detail at every scale. Many fractals are self-similar: parts of them look like smaller copies of the whole, exactly (the Sierpinski triangle) or approximately (the Mandelbrot set). They are usually made by iteration, repeating a rule on its own output, or by recursion, defining a shape in terms of smaller copies of itself. Their roughness is measured by a fractal dimensionthat need not be a whole number.

Complex numbers in brief

A complex number z = x + yi has a real part x and an imaginary part y, where i² = −1. We draw it as the point (x, y) in the complex plane. Its size (modulus) is |z| = √(x² + y²). Squaring follows ordinary algebra: (x + yi)² = x² − y² + 2xyi. So the rule z → z² + c, with c = a + bi, becomesx → x² − y² + a and y → 2xy + b.

The Mandelbrot set

For each complex number c, start at z₀ = 0 and repeat zₙ₊₁ = zₙ² + c. TheMandelbrot set is the set of all c for which this sequence stays bounded. A key fact makes it computable: if ever |zₙ| > 2, the sequence is certain to escape to infinity. So the computer iterates each point up to a limit; points that pass |z| = 2 are outside and are coloured by how quickly they escaped, and points that never pass it are drawn black.

Its edge contains spirals, seahorses, lightning bolts and endless miniature copies of the whole set, joined by thin filaments. The set itself is connected: it is all one piece.

Julia sets

A Julia set uses the same rule, but now c is fixed and the starting point z₀ varies over the plane. The filled Julia set is all z₀ whose sequences stay bounded; the Julia set is its boundary. Every c gives a different picture. The Mandelbrot set is a map of them: the Julia set for c is connected exactly when c belongs to the Mandelbrot set. For c outside the Mandelbrot set it breaks up into infinitely many separate points, a “Cantor dust”. Near the edge of the Mandelbrot set, Julia sets often look like the nearby part of the Mandelbrot set itself.

Recursive constructions

  • Sierpinski triangle: start with a filled triangle; at each step, remove the middle triangle from every remaining triangle. After n steps there are 3ⁿ triangles and (3/4)ⁿ of the area is left, which tends to zero.
  • Koch snowflake: start with an equilateral triangle; at each step, replace the middle third of every edge with two sides of a small outward triangle. The number of edges becomes 3·4ⁿ, each 1/3ⁿ long, so the perimeter is 3·(4/3)ⁿ and grows without limit, while the area approaches 8/5 of the starting triangle.

These constructions are deterministic: the same rule always produces exactly the same picture.

The chaos game and the Barnsley fern

An iterated function system is a set of contracting maps. Repeatedly applying them to any shape converges to one unique shape, the attractor. The chaos game draws it using randomness: start anywhere, pick one of the maps at random, apply it, plot the point, and repeat. For the Sierpinski triangle, each map is “jump halfway towards one of the three corners”.

Barnsley’s fern uses four affine maps (x, y) → (ax + by + e, cx + dy + f), chosen with probabilities 1%, 85%, 7% and 7%: one draws the stem, one shrinks and slightly rotates the whole fern to make its upper part, and two make the lowest left and right leaflets. The random choices only affect the order in which points appear; the maps alone determine the shape. This makes the method probabilistic, unlike the recursive constructions above, even though the final shape is the same every time.

Fractal dimension

Scale a line by 1/2 and you need 2 copies to rebuild it (dimension 1); a square needs 4 = 2² copies (dimension 2); a cube needs 8 = 2³ (dimension 3). In general, if a shape is made of N copies of itself each scaled by r, itssimilarity dimension is D = log N / log(1/r).

FractalDimension
Koch curve (4 copies, scale 1/3)log 4 / log 3 ≈ 1.262
Sierpinski triangle (3 copies, scale 1/2)log 3 / log 2 ≈ 1.585
Boundary of the Mandelbrot set2 (proved by Mitsuhiro Shishikura in 1998)
Julia setsBetween 1 and 2, depending on c
Barnsley fernNot given by a simple formula; numerical estimates lie between 1 and 2

Shapes that are not exactly self-similar need other definitions, such as the box-counting or Hausdorff dimension, but the idea is the same: how detail grows as you look more closely.

Formula reference

FormulaMeaning
zₙ₊₁ = zₙ² + c, z₀ = 0Mandelbrot iteration; c varies over the plane
zₙ₊₁ = zₙ² + c, c fixedJulia iteration; the starting point z₀ varies
|z| = √(x² + y²) > 2Escape test: the sequence will go to infinity
(x + yi)² = x² − y² + 2xyiSquaring a complex number
3ⁿ triangles, area (3/4)ⁿSierpinski triangle after n steps
3·4ⁿ edges, perimeter 3·(4/3)ⁿKoch snowflake after n steps (side 1)
Area → (8/5) × originalLimit of the Koch snowflake’s area
D = log N / log(1/r)Similarity dimension of N copies scaled by r

What the computer can and cannot show

The lab iterates each point only up to the maximum you choose. Escaping points are certain to be outside, but a point that has not escaped yet might still escape later, so black means “probably in the set”. The pictures are therefore approximations that improve with more iterations. Numbers are stored with about 16 significant digits, so the lab stops zooming when the view is about 10⁻¹² wide; deeper zooms need special high-precision arithmetic. Recursive fractals are drawn to a finite depth, and the true fractal is the limit of infinitely many steps.

Real-world applications

  • Nature: coastlines, river networks, ferns, broccoli, lungs and blood vessels have fractal-like branching that packs huge surface area into small spaces.
  • Computer graphics: fractal noise generates realistic mountains, clouds and textures in films and games.
  • Engineering: fractal antennas in phones receive many frequencies in a small space.
  • Science: fractal dimension describes rough surfaces, porous rocks, turbulence and the structure of galaxies.
  • Medicine: the fractal dimension of tissue images can help detect abnormal growth.

Interesting facts

  • Benoit Mandelbrot coined the word “fractal” in 1975, from the Latin fractus, “broken”.
  • Gaston Julia and Pierre Fatou studied Julia sets around 1918, decades before computers could draw them.
  • The coastline paradox: the measured length of a coastline keeps growing as the ruler gets shorter.
  • Whether the Mandelbrot set is “locally connected” (the MLC conjecture) is still an open problem.

Common misconceptions

  • “All fractals have the same dimension.” The Koch curve has about 1.26, the Sierpinski triangle about 1.58.
  • “Black points are definitely in the Mandelbrot set.” They have not escaped yet within the iteration limit.
  • “The Mandelbrot set repeats exactly when you zoom in.” Mini copies appear, but they are distorted and surrounded by new detail.
  • “Random methods give random shapes.” The chaos game always converges to the same attractor.
  • “Infinite perimeter means infinite area.” The Koch snowflake has infinite perimeter but finite area.

Important terms

Fractal
A shape with detail at every scale, often self-similar, with a fractal dimension.
Self-similarity
Parts of a shape look like smaller copies of the whole.
Iteration
Repeatedly applying a rule to its own output.
Recursion
Defining something in terms of smaller versions of itself.
Complex number
A number x + yi with i² = −1, drawn as a point in the plane.
Bounded sequence
A sequence whose values never grow beyond some fixed size.
Attractor
The shape that an iterated function system converges to.
Fractal dimension
A measure of how detail grows with magnification; it need not be a whole number.

Key takeaways

  • Simple rules, repeated, create complex patterns.
  • The Mandelbrot set is the set of c for which z → z² + c, from 0, stays bounded; escaping |z| = 2 means divergence.
  • Each c gives a Julia set, connected exactly when c is in the Mandelbrot set.
  • Recursive fractals are deterministic; the chaos game uses randomness but reaches the same shape.
  • Different fractals have different, often non-integer, dimensions.

Knowledge check

Fractals and Recursive Patterns: test your understanding

Answer each question to get instant feedback and an explanation. Use the simulator to check your thinking.

10 questions2 basic5 intermediate3 advanced

0 of 10 answered

  1. Q1BasicFor the Mandelbrot set, z starts at 0 and repeats z → z² + c. What are the first three values of z for c = 1?
    Show answer

    Answer: A. 0, 1, 2

    z₀ = 0, z₁ = 0² + 1 = 1, z₂ = 1² + 1 = 2, then z₃ = 5, 26, … The sequence grows without limit, so c = 1 is not in the set.

  2. Q2IntermediateOnce some zₙ has |zₙ| > 2, what can we conclude about c?
    Show answer

    Answer: C. The sequence will escape to infinity, so c is not in the set

    It can be proved that once |z| exceeds 2 the values grow without bound. That is why the lab stops a point as soon as it passes |z| = 2.

  3. Q3IntermediateIn the lab a point stays black after 200 iterations. Does that prove it is in the Mandelbrot set?
    Show answer

    Answer: B. No: it only shows the sequence stayed bounded so far; it might escape after more iterations

    A finite iteration limit can confirm escape but never membership. Points near the boundary may need thousands of iterations to escape, which is why deep zooms need a higher limit.

  4. Q4BasicHow is a Julia set different from the Mandelbrot set?
    Show answer

    Answer: D. For a Julia set, c is fixed and the starting value z₀ varies; for the Mandelbrot set, z₀ = 0 and c varies

    Both use z → z² + c. Each value of c has its own Julia set, while the Mandelbrot set is a map of all the c values.

  5. Q5IntermediateIn the lab you drag c from inside the black Mandelbrot set to outside it. What happens to the Julia set?
    Show answer

    Answer: A. It changes from one connected piece to scattered “dust”

    A Julia set is connected exactly when c is in the Mandelbrot set; for c outside it, the Julia set is a totally disconnected Cantor dust.

  6. Q6IntermediateWhat fraction of the original area of the Sierpinski triangle remains after 3 steps?
    Show answer

    Answer: C. 27/64

    Each step keeps 3 of 4 equal triangles, so (3/4)³ = 27/64 ≈ 0.42 remains. As the steps continue the area tends to 0.

  7. Q7AdvancedEach step of the Koch snowflake multiplies the perimeter by 4/3. What happens to the perimeter and the area as the steps continue?
    Show answer

    Answer: D. The perimeter grows without limit while the area approaches 8/5 of the original triangle

    (4/3)ⁿ grows forever, but each new set of bumps adds less and less area, so the area converges. An infinitely long curve encloses a finite region.

  8. Q8AdvancedThe Sierpinski triangle is made of 3 copies of itself, each scaled by 1/2. What is its similarity dimension?
    Show answer

    Answer: B. log 3 / log 2 ≈ 1.585

    For N copies scaled by r, D = log N / log(1/r) = log 3 / log 2 ≈ 1.585. The Koch curve, with 4 copies scaled by 1/3, has D = log 4 / log 3 ≈ 1.262: fractals do not all share the same dimension.

  9. Q9AdvancedThe chaos game picks corners at random, yet always draws the same Sierpinski triangle. Why?
    Show answer

    Answer: A. Every jump halves the distance to the triangle, so points are pulled onto it whatever the random choices; randomness only changes the order

    The three “jump halfway to a corner” maps have the Sierpinski triangle as their unique attractor. The random choices decide which points appear and when, not the final shape.

  10. Q10IntermediateIn the lab you change the lean of map f₂ of the Barnsley fern. Why does the whole fern curl, not just one part?
    Show answer

    Answer: B. Because every leaflet is a smaller copy of the whole fern made by repeatedly applying the maps, so changing one map changes every scale

    f₂ maps the whole fern onto its slightly smaller upper part and is used about 85% of the time. Self-similarity means a change to it appears at every level of detail.

References and further reading

  1. Mandelbrot, B. B. (1982). The Fractal Geometry of Nature. W. H. Freeman.
  2. Peitgen, H.-O., Jürgens, H., & Saupe, D. (2004). Chaos and Fractals: New Frontiers of Science (2nd ed.). Springer.
  3. Barnsley, M. F. (1988). Fractals Everywhere. Academic Press.
  4. Shishikura, M. (1998). The Hausdorff dimension of the boundary of the Mandelbrot set and Julia sets. Annals of Mathematics, 147(2), 225–267.
  5. Falconer, K. (2014). Fractal Geometry: Mathematical Foundations and Applications (3rd ed.). Wiley.

This simulator is a simplified educational model. Found an error? Let us know. See our educational disclaimer.