Education Technology


Activity Overview

In this coding activity students discover how apparent chaos can turn to order. A FOR loop and three IF THEN statements, combined with the midpoint rule (two points) and we see randomly generated points forming what appears to be a Sierpinski triangle. Check it out!


Students use the midpoint rule in a program. The program is relatively straight forward, but the outcome is amazing. 


Mathematics Coding
  • Square-root
  • Midpoint
  • Weighted Av.
  • Sequence
  • For / Endfor
  • If / Then
  • List Creation
  • List Referencing

About the Lesson

Students start with a triangle drawn on the Cartesian plane. A point is placed at random inside the triangle. Students calculate the midpoint of this new point and one of the triangle's vertices. Another vertex is selected at random and a new midpoint created. What appears random and chaotic gradually turns to form, a Sierpinski triangle. Some very simple coding that interacts nicely with the Graphs application and a beautiful result, absolutely stunning!