Tuesday, March 7, 2017

Coffee Cup Multiplication

Sometimes simple rules can lead to complex, beautiful patterns. An example of this is modulo multiplication on a circle. Each step is easy to describe, but the resulting image can be surprisingly intricate.

As you may recall, the modulo operation finds the remainder when one number is divided by another number. So \(a \equiv r \bmod n\) means that \(a\) divided by \(n\) leaves a remainder of \(r\).

Imagine that you have the numbers 0 through N-1 arranged on a clock, so that 0 was at the 12 o'clock position. For each position, multiply by some constant factor and find the remainder modulo N. Now draw a line between the position and the result of multiplying the position by the factor and finding the remainder modulo N.

As an example, if your constant factor is 3 and N is 10, then you would draw the following lines:

  • 0 to 0 (3*0 mod 10 = 0)
  • 1 to 3 (3*1 mod 10 = 3)
  • 2 to 6 (3*2 mod 10 = 6)
  • 3 to 9 (3*3 mod 10 = 9)
  • 4 to 2 (3*4 mod 10 = 2)
  • 5 to 5 (3*5 mod 10 = 5)
  • 6 to 8 (3*6 mod 10 = 8)
  • 7 to 1 (3*7 mod 10 = 1)
  • 8 to 4 (3*8 mod 10 = 4)
  • 9 to 7 (3*9 mod 10 = 7)

Burkard Polster does a much better job explaining the concept in one of his very fascinating Mathologer videos on YouTube.

I created this interactive visualization so that you can play around creating your own patterns. You can adjust the constant factor and the number of points along the circle. For the above example, the constant factor is 3 and the number of points is 10. This gives the equation \(y = (x * 3) \bmod 10\). Note that in the interactive visualization, 0 corresponds to the left most point, and points are numbered sequentially clockwise.

One of the interesting things about these patterns is that they can appear inside your coffee cup! (or any other cup for that matter).

If you have a light source on the edge of a cup, you get a cardioid shape, which is also the shape when the constant factor is 2 in the modulo multiplication.

If the light beams are parallel to the cup, you get a nephroid shape, which is the shape when the constant factor is 3.

The paper on this can be found here. What interesting patterns can you find?

No comments:

Post a Comment