Modular Arithmetic: Clocks and Circles
Modular Arithmetic: Clocks and Circles
Modular Arithmetic: Clocks and Circles
Those of you who have had a course in either number theory or abstract algebra will find this
material familiar. On the other hand, this may be the first time those of you from an applied
mathematics, physics, or engineering background will have seen these ideas.
Put into your mind a picture of the face of an ordinary, 12-hour clock. What is 10 (that is, 10
o’clock) plus 4 hours? The answer is 2 (that is, 2 o’clock). In the world of the clock, we seem to
have “10 + 4 = 2”. I know of two formal mathematical notations for this concept. One notation
is that normally used in a number theory or algebra course:
The other notation is a little more algorithmic; in fact, it is used in computer programming
languages and computer spreadsheets:
a|b (2.3)
[An aside: Z is the usual name for the set of all integers, positive, negative, or zero. Let’s see:
“R” is for “real”, “C” is for “complex”, “Q” (the rationals) is for “quotient”, but what does “Z”
stand for? The answer is that these letters were chosen in German, not English. For the three
words given above, the German word is very close to the English word and has the same initial,
but the German word for “numbers” is Zahlen.]
We’re not going to restrict the numbers a and b in this definition to being just integers, although
we will insist that a 6= 0. As examples: 6 | 30, 6 | −12, 6 | 0, π | 2π, but 6 - 15 and 1 - π.
Notational definition:
9
Notational definition: Suppose c > 0. Then
In other words, mod (a, c) is the unique non-negative remainder left over after you divide a by
c. Examplesinclude mod (30, 6) = 0, mod (6, 30) = 6, mod (−3, 12) = 9, mod (1.46, 1) = .46,
8π 2π
and mod , 2π = .
3 3
Notational definition: Throughout this course, a function whose domain is continuous (the
real numbers or an interval in the real numbers, or the circle TP as defined below) will be written
with its argument in regular parentheses: for instance, f (x). A function whose domain is discrete
(the integers or one of the polygons PN defined below) will be written with its argument in square
brackets: for instance, f [n]. A function with a discrete domain is also known as a sequence. I adopt
this convention from a textbook written by David Kammler.
Let f (x) be a function defined everywhere on R and let P be a positive real number. What
does it mean to say that f is periodic of period P ? It means that for all x ∈ R, f (x + P ) = f (x).
By mathematical induction and by reversing the equation, it follows that ∀ x ∈ R and ∀ k ∈
Z, f (x + kP ) = f (x). The language we have established above gives us another way to say this:
Proposition:
This is not just a definition and a proposition, it’s an attitude. It’s the attitude that lets us
say, when we are discussing a function periodic of period 2π, that “2π is really the same point
3π π
as 0, and could also be called − .” You’ve seen this notion before, in trigonometry, with the
2 2
picture of the line wrapping around the unit circle. Now suppose we have a function f (x) on R that
is periodic of period P. Take the real line and wrap it around a circle of circumference P. Many
different points from the line all get wrapped on top of the same point of the circle – but if two
points x and y land on the same spot of the circle, then x and y must have been a whole number
of circumferences of the circle apart, which is the same thing as saying x ≡ y (mod P ). But since
f is periodic of period P, for such x and y, f (x) = f (y). For each point on the circle there is an
single, unambiguous value of f associated with that point. This gives us an alternative point of
view: instead of calling it a periodic function whose domain is R, we consider it a function whose
domain is a circle of circumference P. We have a name for this circle: TP . (The “T” actually stands
for “torus”; please don’t ask why.)
It is most convenient to name the elements of TP by parameterizing it with an interval of real
numbers of length P. The most standard choice would be the interval [0, P ), but any other interval
of length P would do just as well. Given this parameterization, there is a perfectly good arithmetic
defined on TP : we are willing to say that x + y = z in the context of TP provided that x ≡ y
(mod P ).
The sequences you are used to are functions whose domain is the positive integers. Usually in
this course, when we say “sequence”, we will mean double-ended sequence; that is, a function whose
10
domain is all of Z. A double-ended sequence f [n] can be a periodic sequence, just as a function of
a continuous variable can be periodic. For instance, the sequence (−1)n is periodic of period 2. Of
course, the period had better be an integer (and by convention, a positive integer). Now suppose
we have a sequence f [n] which is periodic of period N. As in (2.6), this means that f [n] = f [m]
whenever n ≡ m (mod N ). For periodic functions on the line, we wrapped the line around a circle.
In exactly the same way, for periodic functions on the integers, we wrap the integers around –
around what? Instead of just looking at a string, look at beads placed at regular intervals along
that string. When we wrap this around, each bead lands in the same place as the bead N before
it, in one of N possible locations that form the vertices of a regular polygon.
Just as we did with continuous domain functions, we can now regard a sequence that is periodic
of period N to be a function whose domain is the set of points that make up a regular N -sided
polygon. Kammler calls this domain PN . (“P” is for “polygon”.) On the other hand, it is also one
of the most familiar objects in the study of algebra: the cyclic group of order N. Other common
notations include ZN and Z/N Z.
Another name for Fourier analysis is Euclidean harmonic analysis. Euclidean harmonic analysis
restricts its attention to functions whose domains are one of the groups R, Z, TP , or PN , or Cartesian
products of these groups. Discrete Fourier analysis, which is all that one can really do on a
computer, is restricted to PN .
2.5. Exercises
2.1. Let N be a positive integer and let ζ = e2πi/N be the principal N ’th root of unity.
2.2. [Draw a picture that illuminates problem 2.1(c).] Let N = 6. Sketch a picture of the six sixth
roots of 1. Now draw 5 more pictures, one each for k = 1, 2, 3, 4, and 5. Find on each of these
five graphs the locations of e2πikn/N (that is, ζ kn ) for n = 0, 1, 2, 3, 4, and 5. Connect each of
these locations to the origin, like the spokes of a wheel. If you’ve done it right, it should be
geometrically clear why in each case the six complex numbers add up to zero.
Discuss what would be different about the picture for k = 0 or k = 6.
2.3. 15 stepping stones are arranged in a circle. If you walk around the circle stepping on each
stone in turn, then you will eventually step on every stone.
(a) If you step on every other stone (every 2nd stone), and keep walking around and around
forever, will you eventually step on every stone? Which stones will you step on?
(b) Repeat part (a) for stepping on every third stone, every fourth stone, and so on up to
every 14th stone.
11