Vikas Nath, Artash Nath, Arushi Nath

Every year the Fields Institute in Toronto organises a public Symposium to celebrate the achievements of Fields Medallists. Fields Medals are the most prestigious awards given in mathematics (described as the Nobel Prize of Mathematics). They are awarded every four years to recognize outstanding mathematical achievement for existing work and for the promise of future achievement.

maryam with medal
Late Maryam Mirzakhani (2014 Fields Medal Winner)

The Symposium is followed by an event for students where young people get a chance to learn more about the work of Field Medalists and interact with them or those familiar with their works.

Artash and Arushi with Dr. Manjul Bhargava (2014 Field Medal Winner) at the 2016 Student Night event

We attended the 2016 student event featuring the 2014 Field Medal Winner Manjul Bhargava and the 2018 student event honoring the 2014 Fields Medal winner late Maryam Mirzakhani. The events are fun, informative and an opportunity for anyone to appreciate the world of mathematics. They encourage youths, adults, and families to have conversations on math and science in their daily lives.

Read the article Want to Cure Math Anxiety? Start with a Magic Trick by Siobhan Roberts about the 2016 Symposium by Manjul Bhargava and refers to our participation in it.

The 2014 Field Medal Winner: Maryam Mirzakhani

The 2018 Fields Medal Symposium was on the work of late Maryam Mirzakhani – an Iranian mathematician and a professor of mathematics at Stanford University. In 2014 she became the first woman and the first Iranian to be awarded a Fields Medal. The award was a recognition for “her outstanding contributions to the dynamics and geometry of Riemann surfaces and their moduli spaces.”

Maryam Mirzakhani was a master of curved spaces and surfaces. Her work blended dynamics with geometry and bridged several mathematical disciplines including hyperbolic geometry, complex analysis, and topology.

Unfortunately, Maryam died way too early on 14 July 2017 at the age of 40. But her contribution lives on – inspiring curious minds everywhere who are building upon her work. Our project takes inspiration from her work.

The 2018 Student Night: Flat Surfaces and Pentagon Billiards

The 2018 Student Night presentation on the work of Maryam Mirzakhani was delivered by Professor Diana Davis – visiting Assistant Professor at Swarthmore College, USA on 6 November 2018.

Intrigued by patterns made by billiards ball inside a pentagon at the 2018 Fields Medal Student Night

The topic of the event was “Flat Surfaces and Pentagon Billiards” to understand the mathematics behind patterns that are traced when a ball rolls and keeps bouncing from the sides of a pentagon-shaped flat billiards table. The table is assumed to be frictionless so the ball keeps on rolling without stopping.

If the billiards table was rectangular in shape and the ball was rolled perpendicularly from one of the sides, the ball will continue rolling back and forth – trapped in that simple periodic pattern (figure 1). The period here is 2 as the ball bounces twice before repeating the path.

making pattern 2
Figure 2: Ball trapped in a more complex periodic pattern

There could be more complex periodic patterns. See figure 2 whose period is 44. The ball bounces 44 times from the sides of the rectangle before repeating its path!

The same thing occurs in a regular pentagon-shaped billiards table where the ball with the right initial conditions can make periodic patterns (figure 3 and figure 4). Actually, for each periodic direction, there are actually two different periodic billiard paths, a short one and a long one.



Figure 3: Ball trapped in a periodic pattern within a regular pentagon. The ball remains locked in a repetitive pattern. Both figures (shorter path on the left and the longer path on the right) have a period of 5.

star inside pentago
Figure 4: Change in initial conditions transformed the star in figure 3 into a double star

Even the slightest changes in initial conditions – such as where the ball is placed on the billiards table and its trajectory leads to major changes in the path taken by the ball and the pattern formed. The pattern could be periodic where the ball ends up forever locked in a repeating pattern like an orbiting planet. Or it could keep going on endlessly without repeating the pattern exploring new paths. Two things may happen when it is forever exploring new paths – it may either cover the whole billiards table or keep bouncing chaotically only in one part of the table.

What is the mathematics behind it? What determines that the path is periodic or chaotic? And what determines if the ball will cover the entire table or remain in some parts only? These patterns have set into motion many minds looking for mathematical proofs to explain this behavior. One of them was Maryam Mirzakhani who studied billiards or rather the universe of all possible billiard tables.

Figure 5: Python Simulation of a ball bouncing in a flat regular pentagon billiard table

The Student Night event delivered by Professor Diana Davis was a very interesting hands-on event and elaborated on the work of Maryam Mirzakhani. See her paper: Billiards and Flat Surfaces. The talk started with each one of us being given a small wooden pentagon. Each pentagon had different patterns traced by the ball with different initial conditions.

The students got a chance to learn about golden ratios (approx equal to 1.618) and “optimal” billiards table which determine what pattern will be made by the ball. We very much enjoyed the lecture and the demonstration of beautiful art created through this seemingly simple experiment of flat surfaces and pentagon billiards.

Bringing together Maryam, Maths, and Music using Python Programming

Mathematics comes in many shapes, sizes, and forms and it is up to those who are intrigued by it to appreciate its complexity/simplicity and express it in their own ways. The work of Maryam on pentagon billiards excited us, made us think, and challenged us. We did not forget about it and even after many months of attending the Student Night event, the topic came up in many of our everyday conversations on science and art. We wanted to preserve the mathematics but express the work of Maryam and Diana in our own way using maths, arts and music.

Artash worked hard for several days to build up Python program for simulating billiard in a n-sided pentagon and provide visualisation, bounce data, and convert it into music

So we decided to merge the work of Maryam with music by applying our elementary mathematics, programming, and piano-playing skills. The idea was to generate music based on the patterns created by the ball.

We wrote a program in Python to simulate the path of the ball on any n-sided billiards table. The program allows the user to create a regular pentagon (or any polygon) of any size and then choose the initial conditions for rolling the ball. This means one could choose the starting point for rolling the ball within the pentagon and set the trajectory of the ball. The ball could then be kept on rolling as long as the user wanted to. The program is centered around the fundamental law of physics that the billiards ball must obey, ie when the billiard ball strikes an edge of the table, then the angle of incidence and the angle of reflection must be equal.

5 minutes
Figure 6: Simulating Bouncing Ball using our Python program for 5 minutes.

Simulations were carried out for number of billiard trajectories within a pentagon. We were able to achieve some simple periodic patterns through maths and skills. It was easier to get non-periodic patterns that were very complex and were fun to watch. See for instance, figure 5 for simulation of one of the non-periodic pattern. How that pattern emerged over time is given in snapshots provided in Figure 6, 7 and 8.

20 minutes

Figure 7: Simulating Bouncing Ball using our Python program for 25 minutes

Figure 8: Simulating Bouncing Ball using our Python program for 3 days! The ball still left out some small spaces it did not traverse.

Artash worked hard to merge music and maths using his Python programming skills. In addition to matplotlib, processing P5 was used to do the calculations and for visualisation of simulation.

Snapshot of the Python program made to simulate the path of the ball bouncing on a pentagon billiards table

At every instance, the program keeps track of the location (in Cartesian coordinates) of the ball and the distance it has to cover before it bounces from a side. A bounce function was created which creates a list of all the distances the ball has to cover between the bounces. These distances are the seed for unique musical tones associated with patterns generated by the bouncing ball.

bouncing function
Figure 9: The Bounce function that calculates the distances between 2 consecutive bounces of the ball and plots it. This plot represents bounce data for a non-periodic pattern of Figure 7
Figure 10: The Bounce function representing Periodic pattern created by ball in a pentagon billiards for Figure 12.

Creating Music from Pentagon Billiards

We then wrote another Python program to convert these distances into 80 musical notes of a piano ranging from C3 (midi 48) to G9 (midi 128), roughly 6 octaves. The greatest distance the ball has to traverse between two bounces is set to the highest note and distances for other notes are proportioned accordingly. A function maps all the distances between the bounces to their corresponding notes to create music! The greater the distance the ball has to cover between 2 bounces, the lower the notes (ie lower pitch) and shorter the distance between 2 bounces, the higher the pitch. We are now able to generate a musical pattern solely based on the path traced by the ball – merging math with music.

In cases where the ball follows a periodic pattern, the musical notes end up repeating. Whereas in cases there is no periodic pattern, the music continues without repeating. For instance, for figure 2, the musical pattern will repeat after 44 notes. For figure 3 too, the musical pattern will repeat but the notes will be the same as the ball is traversing the same distance between any two bounces.

We experimented with different musical forms, including inverting the music where longer the distance between 2 bounces, higher the pitch, and shorter the distances, lower the pitch.

Listen to Music (Non-Repeating Pattern)

20 minutes
Figure 11: Non-repeating pattern

Music created from the simulation of a non-periodic pattern in a pentagon billiards.

Music 1 : (Faster pace): Lower pitch represents the lower distance between 2 bounces

Music 2 : (Slower pace): Lower pitch represents the lower distance between 2 bounces)

Music 3 Inverted: (Faster pace): Lower pitch represents greater distance between 2 bounces)

Music 4 Inverted: (Slower pace): Lower pitch represents greater distance between 2 bounces)

This was a very interesting project for us as we had to combine our knowledge of math (geometry, ratio, and proportion, trigonometry, irrational numbers, slope), music (octaves, midi files) and Python (matplotlib, p5, pygames) to create this project. It took us over 4 weeks to complete this project in the summer months of 2019!

We look forward to being back at 2019 Field Medal Symposium and learning new things.

Listen to Music (Repeating Pattern)

Figure 12: Repeating Pattern

Music created from simulation of a periodic pattern in a pentagon billiards. The music is run at a fast pace and the greater the distance between 2 bounces the lower the pitch.




Billiards and Flat Surfaces

Maryam Mirzakhani’s Pioneering Mathematical Legacy

New Shapes Solve Infinite Pool-Table Problem


Artash and Arushi – summer of Maths project- merging Maths and Music

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s