Mathwords logoMathwords

Chaos Game — Definition, Formula & Examples

The Chaos Game is a method for drawing fractals by repeatedly plotting points that jump a fixed fraction of the distance toward a randomly chosen vertex of a polygon. After many iterations, a fractal pattern like the Sierpinski triangle emerges from what seems like a random process.

The Chaos Game is an iterative algorithm in which a point is updated by moving a fixed ratio rr of the distance from its current position toward one of nn vertices selected uniformly at random. For three vertices and r=12r = \frac{1}{2}, the attractor of this iterated function system is the Sierpinski triangle.

Key Formula

Pn+1=Pn+r(VkPn)P_{n+1} = P_n + r\,(V_k - P_n)
Where:
  • PnP_n = Current point position
  • Pn+1P_{n+1} = Next point position
  • VkV_k = Randomly chosen vertex
  • rr = Jump ratio (e.g., 1/2 for the classic Sierpinski game)

How It Works

Start by labeling the vertices of a regular polygon (typically an equilateral triangle). Pick any starting point inside or on the polygon. Roll a die or use a random number generator to choose one of the vertices. Plot a new point exactly halfway between your current point and the chosen vertex. Move to that new point and repeat. After discarding the first few points, the dots converge onto a fractal. With a triangle and the halfway rule, you get the Sierpinski triangle; changing the polygon or the fraction produces different fractals.

Worked Example

Problem: Play the Chaos Game on a triangle with vertices A=(0,0)A = (0, 0), B=(4,0)B = (4, 0), and C=(2,4)C = (2, 4). Start at P0=(1,1)P_0 = (1, 1) and use r=12r = \frac{1}{2}. Compute the next two points if you randomly choose vertex CC, then vertex AA.
Step 1: Move halfway from P0P_0 toward vertex CC.
P1=(1,1)+12((2,4)(1,1))=(1,1)+(0.5,1.5)=(1.5,2.5)P_1 = (1,1) + \tfrac{1}{2}\bigl((2,4)-(1,1)\bigr) = (1,1) + (0.5,\,1.5) = (1.5,\,2.5)
Step 2: Move halfway from P1P_1 toward vertex AA.
P2=(1.5,2.5)+12((0,0)(1.5,2.5))=(1.5,2.5)+(0.75,1.25)=(0.75,1.25)P_2 = (1.5,\,2.5) + \tfrac{1}{2}\bigl((0,0)-(1.5,\,2.5)\bigr) = (1.5,\,2.5) + (-0.75,\,-1.25) = (0.75,\,1.25)
Answer: After two iterations the plotted points are P1=(1.5,2.5)P_1 = (1.5,\,2.5) and P2=(0.75,1.25)P_2 = (0.75,\,1.25). Repeating this process thousands of times fills in the Sierpinski triangle.

Why It Matters

The Chaos Game demonstrates that simple random rules can produce highly ordered structures, a core idea in chaos theory and dynamical systems. It also provides an accessible entry point for programming: students can code the algorithm in Python or JavaScript and watch a fractal appear in real time. Understanding iterated function systems like this one is foundational in computer graphics, data compression, and the study of natural patterns.

Common Mistakes

Mistake: Expecting the first few plotted points to look like a fractal.
Correction: The early points are transient and may fall anywhere. Discard roughly the first 10–20 points; the fractal pattern only becomes visible after hundreds or thousands of iterations.

Related Terms