Introduction and Motivation
The Sierpiński triangle is a classic self-similar fractal obtained from an equilateral triangle by repeatedly removing the central inverted triangle. The pattern can also be produced by the ‘chaos game’: starting from any point inside the triangle, repeatedly choose one of the three vertices at random and move halfway toward it; the set of visited points converges to the fractal.
Wacław Sierpiński (1882–1969) was a Polish mathematician and one of the founders of modern set theory and topology. He taught for decades at the University of Warsaw and was a prolific scholar, publishing over 700 papers and more than 50 books. Sierpiński’s research covered set theory, number theory, and topology, and his work profoundly influenced 20th‑century mathematics. He was a leading figure in the Polish Mathematical School alongside Stefan Mazurkiewicz and Kazimierz Kuratowski. Sierpiński’s geometric constructions—including the Sierpiński triangle (1915), the Sierpiński carpet (1916), and the Sierpiński curve—were early examples of recursive, self‑similar structures that anticipated later developments in fractal geometry. His name endures in numerous mathematical concepts such as Sierpiński sets, Sierpiński numbers, and Sierpiński spaces.
Building the Triangle
- Pick three corners. The program starts with an equilateral triangle, storing the coordinates of its three corners (A, B, and C).
- Drop a single dot inside. A random point (the ‘walker’) starts somewhere inside the triangle.
- Play the halfway game. Over and over, the code randomly picks one of the three corners and moves the dot halfway toward it. Each time it moves, MATLAB plots the dot’s new position.
- Skip a quick warm‑up. The first few jumps are ignored (called ‘burn‑in’), because the dot is still settling into the pattern. After that, every point is plotted.
- No lines—just points. The triangle appears because the dot’s possible landing spots naturally avoid the central regions. When plotted thousands of times, the points trace the famous self‑repeating pattern known as the Sierpiński triangle.
- Why a triangle appears. Each halfway jump keeps the dot inside one of the corner sub‑triangles and away from the middle. Repeating this forever means you land only in corners‑of‑corners, creating the intricate lace‑like design.
- Color version (optional). In the colored version of the code, MATLAB assigns a different color depending on which of the three big corners the dot is in, so you can see the regions blend together.
- Turning it into a movie. MATLAB captures frames of the plot as more points appear, using the getframe and writeVideo functions. When all frames are written and close(vw) is called, the MP4 is finalized.
https://github.com/demarcoj9497/randomness.git
Early Fractals in Art Before Sierpiński
Long before Sierpiński formalized self‑similar sets, artists and architects produced designs that repeat shapes across scales. These works aren’t ‘fractals’ in the modern, mathematical sense, but they demonstrate the same core idea: patterns that echo themselves at progressively smaller sizes (visual recursion or scale invariance). The examples below illustrate this intuition in pre‑20th‑century art.
Islamic Tilework and Girih Geometry
From Persia to Al‑Andalus (e.g., the Alhambra in Granada), craftsmen used polygonal tiles and strapwork to create interlaced stars and rosettes. Motifs recur across scales, and local patches mirror global layouts—a visual cousin of self‑similar tilings.

Bou Inania Madrasa, Fes, Morocco, originally c. 1350, with geometric patterns in zellij tilework. By Robert Prazeres – Own work, CC BY-SA 4.0
Gothic Rose Windows
Medieval rose windows use radial symmetry and nested tracery. The same lobed shapes subdivide into smaller lobes, giving a recursive feel as you move from the large circle to the smaller rings around it
Interior of the rose at Strasbourg Cathedral
By Clostridium – Own work, Public Domain

Hokusai’s Waves and Japanese Woodblock Prints
In popular prints such as *The Great Wave off Kanagawa* (1830s), nested wavelets repeat the geometry of the larger crest. This motif of ‘small waves within big waves’ gives an intuitive sense of self‑similar scaling.

The Great Wave off Kanagawa, By Katsushika Hokusai – Metropolitan Museum of Art: entry 45434, Public Domain




Leave a comment