
Using matrices to make fractals
We start with a triangle ABC, with coordinates 𝐴(0,0) , 𝐵(1,0) , 𝐶( 0,1) as shown above. We can this triangle F_0 and we then write this as the following matrix:

We then have the following algorithm to generate the next triangle F_1.

In effect this means that the triangle F_1 is made by combining the coordinates from F_1a, F_1b and F_1c. So we now need to know how to make these. F_1a is given by:

This is a transformation which takes the original coordinate points and enlarges them by a scale factor of 1/2 centered at the origin.
F_1b is given by:

This is a transformation which takes the original coordinate points and enlarges them by a scale factor of 1/2 centered at the origin and then translates them to the right by 1/2.
F_1c is given by:

This is a transformation which takes the original coordinate points and enlarges them by a scale factor of 1/2 centered at the origin and then translates them down by 1/2.
So this tells us the 9 coordinates of the new triangle:

Plotting this then gives:

We notice that we have 3 copies of our F_0 image.
The next iteration
We can continue this process. F_2 is given by:

Where F_2a follows the same pattern as before:

We take all the previous 9 coordinates and scale them by a factor of 1/2 centred the origin.
And F_2b, F_2c also follow the same pattern:


Plotting the next iteration

This now gives 27 coordinates which we plot above. We can already start to see the fractal nature of the design appear.
We can see that we now have 3 copies of our previous F_1 image. Continuing this would then create a fractal design similar to the Sierpinski triangle. The Sierpinski triangle is based on a equilateral triangle rather than a right angled triangle and is shown below:

You can explore the Python code needed to generate this image – and run your own versions here. (You need to click run and then click on the graph png).
IB teacher? Please visit my new site http://www.intermathematics.com ! Hundreds of IB worksheets, unit tests, mock exams, treasure hunt activities, paper 3 activities, coursework support and more. Take some time to explore!
Please visit the site shop: http://www.ibmathsresources.com/shop to find lots of great resources to support IB students and teachers – including the brand new May 2025 prediction papers.