Modular Arithmetic

Prepared by:

Joseph Malkevitch
Department of Mathematics and Computing
York College (CUNY)
Jamaica, New York 11451-0001


web page:

Perhaps the most astonishing thing about some of the most important ideas mankind has developed and that have proved so important in the development of new discoveries in particular areas of knowledge or for new technologies is how simple the ideas actually are.

A case in point is a collection of ideas pioneered by the German mathematician Karl Fredrich Gauss. The name Gauss within mathematics commands the same level of respect that Shakespeare's name does in the world of literature. His myriad contributions to all corners of mathematics have molded the shape of mathematics well over a hundred years after he did his work.

The idea here is the development of a notation for and approach to the divisibility of integers.

Following Gauss we will use the congruence symbol: for a simple arithmetic idea.

We will write a b mod m (where m is a positive integer which is at least 2) to mean that b - a is exactly divisible by m with remainder zero. (Alternatively we can say that a and b leave the same remainder when divided by m.)

By way of example let us fix m to be 5 for the moment. When one divides by 5 one can only have the remainders 0, 1, 2, 3, or 4. Thus, any integer will will be congruent to one of these number mod (modulo) m.

We would write such congruences as:

81 1 mod 5

17 2 mod 5

19 4 mod 5

23 3 mod 5

To check that say the very last of these is correct we need to verify that 3-23 is divisible by 5 with remainder 0. This is certainly true since 5x4 is 20.

It takes a while to get used to what happens for one or both of the numbers on opposite sides of the congruence symbol to be negative.

For example:

22 -3 mod 5

Here is the check: -3 - 22 = -25 which is divisible by 5.

However, how does one see this from the remainder point of view? When we divide 5 into -3 we can write -3 = (-1)(5) +2. Thus, the remainder is 2 when we divide 5 into -3 just as the remainder is +2 when we divide 5 into 22.

Notice that every integer is congruent to one of the numbers 0, 1, 2, 3, or 4 modulo 5. This is clear for positive integers, and for negative integers follows from reasoning similar to that above with negative numbers. Here is another example:

-11 4 mod 5 (since 4 - (-11) = 15 which leaves 0 as the remainder when divided by 5.

What symbol does the congruence symbol remind you? Almost certainly the equal sign. Does similarity to the equal sign have anything to do with why Gauss used this notation? Yes, the congruence symbol shares many of the properties of the equal sign.

Thus, (remember we are fixing the modulus m in the discussion below):

we have a = b implies b = a and also a b implies b a.

a = b and b = c implies a =c and also a b and b c implies a c.

a = b and c = d implies a + c = b + d and also a b and c d implies a + c b + c.

More examples:

31 1 mod 6

83 17 mod 2