The reflection of light rays in a cup of coffee
by Simon Plouffe
the curves obtained with b^n mod p
based on works done in the years 1974-79
Keywords Congruences, light rays, primitive roots, trigonometric
sums, hypocycloids, epicycloids, binary expansion, n-ary expansion of 1/p.
Take a circle centered at (0,0), divide it into p parts and take 2^n
mod p, if 2 is a primitive root of p then you will have this nice drawing
of a cardioïd. That same figure can be obtained by a source at (1,0)
that projects p rays at the p equally spaced points on the circumference.
If the rays are reflected once then we obtain the curve. You may obtain
the same curve by looking at a cup of coffee when you are under the sun
during day, a thing that does not happen often in Vancouver (!). The following
6 images are the 5 first reflections of a source of light (the sun at point
=infinity) that hits the side of a ideal cup of coffee and rebounds on
the side 5 times. The number of rays are 257 in this case.
Figures obtained by reflecting a light source 5 times
on the side of a cup of coffee with 257 rays
Other templates, see the whole here : bluecircles.html
Most of these drawing were done by hand first using a ruler and compass,
I took 257 because it is easy to construct a polygon with 256 sides (relatively
speaking). When apple's became more available, I could at least experiment
more...For many values taking 257 instead of 256 do not change the figure
that much, if you plot it using a computer screen and all the reflections
it does matter.
The second figure is a cardioïd and can also be generated with a circle
divided into p (prime) parts and by taking 2^n mod p, 2 being a
primitive root of p (so that there are p-1 residues). For doing
the figure take the successive residues (mod p) and join them with
By plotting the residues mod p joined by lines it is the same as representing
1/p in base 2 by considering the binary expansion of that number (which
has a period of p-1 since 2 is a primitive root). For this we map the
number x in [0,1] to x -> exp(2*Pi*i*x).
If we plot 1/257 in base 10 or equivalently if we plot the residues
of 10^n mod 257 we obtain a strange figure with 9 cusps and many other
structures AND it is also the 57th reflection of the light hitting
the side of a cup of coffee... This fact (as far as I know) is not easily
explained. If you ever find an explanation please let me know ! send email
See image #3 of this template.
The number of different figures obtained with a prime p are (p-1)/2 + 1
, the figures are eventually repeating after a number of reflections.
The number of principal cusps are b-1 when b is a primitive root of p and
b relatively small. It is difficult to come with a general formula. For
3^n mod 257 , see below, we have (as expected), that rule is no longer
valid when b gets larger, I have no explanation for the general case. See
below the other templates.
With lots of experiments, I came with this formula, it explains many
cases like 10^n mod 257 which has 23 secondary cusps, not all. For
any p and any b there are no (not known to me) other formulas.
Reflections 6 to 11
Reflections 12 to 17
Reflections 18 to 23
Reflections 24 to 29
Reflections 30 to 35
Reflections 36 to 41
Reflections 42 to 47
Reflections 48 to 53
Reflections 54 to 59 ...figure of 10^n mod 257
Reflections 60 to 65 ...figure of 5^n mod 257.
Reflections 66 to 71
Reflections 72 to 77
Reflections 78 to 83
Reflections 84 to 89
Reflections 90 to 95
Reflections 96 to 101
Reflections 102 to 107
Reflections 108 to 113
Reflections 114 to 119
Reflections 120 to 125
Reflections 126 to 131 ...figures are repeating
from that point after 128 reflections: (p-1)/2. =128, also the figure of
3^n mod 257.