Loading [MathJax]/jax/output/HTML-CSS/jax.js

Lecture 31: GCD, Definition of modular numbers

Modular numbers

The next several lectures will explore the arithmetic of remainders. Usually these results are presented as a set of equations about congruence mod m or about remainders when divided by m (MCS does both).

Instead, we will raise the level of abstraction a bit. We will define a new kind of object (the modular number), and redefine operations like + and for these objects. This is not a new process: you already have several kinds of things you know how to add and multiply: natural numbers, integer, rationals, reals, complex numbers, vectors, matrices, and random variables, to name a few. Each of these kinds of objects has a different algorithm for doing arithmetic on them; but because they all have a common interface, you have built up lots of intuition about how to manipulate them.

Definition: a is congruent to b (mod m), (written ab (mod m) or amb). if m|ba.

Note: It is easy to misinterpret this as a(b mod m); this interpretation leads to confusion. Think of the "mod m" as a big note on the side of your equations or proofs, not as part of your equations.

Note: m is an equivalence relation (proof left as a review exercise).

Definition: The set Zn of modular numbers is defined by Zn=Z/m.

Recall that Z/m is the set of equivalence classes of integers by the relation m: Zm={,[2]m,[1]m,[0]m,[1]m,[2]m,}, where [a]m={bbma}. When the m is clear from context, we will simply write [a].

Note that [1]=[m1] (because m|m1(1) so 1mm1), and [2]=[m2], and [m]=[0] and [m+1]=[1], etc. In general, [a]=[rem(a,m)], so Zm can always be written as

Zm={[0]m,[1]m,[2]m,,[m1]m}

Key facts: the following are equivalent:

  1. [a]=[b] (mod m)
  2. ab (mod m)
  3. m|ba
  4. rem(a,m)=rem(b,m)

This follows from the definitions, with the exception of the equivalence of (3) and (4). To see that (3) implies (4), assume m|ba. If we write a=qam+ra and b=qbm+rb, we see that km=(qbqa)m+rbra. This means that rbra is a multiple of m. Since rb and ra are both less than m, we have m<rbra<m; since 0 is the only multiple of m satisfying this property, rbra=0.