Home page for accesible maths 5 Congruences

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

5.1 Introduction to congruences

We begin with the formal definition of the notion at the heart of this chapter.

Definition 5.1.1

Given a,ba,b\in\mathbb{Z} and mm\in\mathbb{N}, we say that aa is congruent to bb modulo mm if mm divides a-ba-b. In this case we write abmodma\equiv b\bmod m; otherwise we write abmodma\not\equiv b\bmod m.

A statement of the form ‘‘abmodma\equiv b\bmod m’’ is called a congruence; the number mm is called the modulus here.

Example 5.1.2
  1. (i)

    We have 72mod57\equiv 2\bmod 5 because 5|(7-2).5|(7-2).

  2. (ii)

    We have -108mod6-10\equiv 8\bmod 6 because 6|(-10-8).6|(-10-8).

  3. (iii)

    We have 200mod220\equiv 0\bmod 2 because 2|(20-0).2|(20-0).

  4. (iv)

    We have 38mod23\not\equiv 8\bmod 2 because 2|(3-8).2\!\!\!\!\;\not\!\!\!\;|\!\;(3-8).

The following result gives two alternative ways of expressing that abmodma\equiv b\bmod m.

Proposition 5.1.3

For a,ba,b\in\mathbb{Z} and mm\in\mathbb{N}, the following three conditions are equivalent:

  1. (a)

    abmodma\equiv b\bmod m;

  2. (b)

    a=qm+ba=qm+b for some qq\in\mathbb{Z};

  3. (c)

    aa and bb have the same remainder on division by mm.

Example 5.1.4

If a=28a=28, b=13b=13 and m=5m=5, then we have

  1. (a)

    2813mod528\equiv 13\bmod 5 because 5|(28-13);5|(28-13);

  2. (b)

    28=35+1328=3\cdot 5+13, so we can take q=3;q=3;

  3. (c)

    28=55+328=5\cdot 5+3 and 13=25+313=2\cdot 5+3, so 2828 and 1313 both have remainder 33 on division by 55.

Proof. We shall show that each condition implies the next (and the last implies the first).

‘‘(a)\Rightarrow(b)’’. If abmodma\equiv b\bmod m, then a-b=qma-b=qm for some qq\in\mathbb{Z}, and so a=qm+b.a=qm+b.

‘‘(b)\Rightarrow(c)’’. Suppose that a=qm+ba=qm+b, and let the remainder on dividing bb by mm be rr, so that b=sm+rb=sm+r for some ss\in\mathbb{Z}. Then we have

a=qm+(sm+r)=(q+s)m+ra=qm+(sm+r)=(q+s)m+r

which shows that the remainder on dividing aa by mm is also r.r.

‘‘(c)\Rightarrow(a)’’. If both aa and bb have remainder rr on division by mm, then we can write a=pm+ra=pm+r and b=qm+rb=qm+r for some p,qp,q\in\mathbb{Z}; thus

a-b=(pm+r)-(qm+r)=(p-q)m,a-b=(pm+r)-(qm+r)=(p-q)m,

and so m|(a-b).m|(a-b). \Box

Corollary 5.1.5

Let aa\in\mathbb{Z} and mm\in\mathbb{N}.

  1. (i)

    The numbers congruent to aa modulo mm are

    ,a-2m,a-m,a,a+m,a+2m,\dots,a-2m,a-m,a,a+m,a+2m,\dots
  2. (ii)

    If the remainder on dividing aa by mm is rr, then armodma\equiv r\bmod m, and rr is the only integer in {0,1,2,,m-1}\{0,1,2,\ldots,m-1\} which is congruent to aa modulo mm.

Example 5.1.6
  1. (i)

    The numbers congruent to 22 modulo 55 are

    ,-8,-3,2,7,12,\dots,-8,-3,2,7,12,\dots
  2. (ii)

    The remainder on dividing 2222 by 55 is 22, so that 222mod522\equiv 2\bmod 5, and 22 is clearly the only integer in {0,1,2,3,4}\{0,1,2,3,4\} which is congruent to 2222 modulo 55.

Proof. (i). This is clear from Proposition 5.1.3(b).

(ii). Proposition 5.1.3(c) shows that armodma\equiv r\bmod m. The uniqueness of rr follows from the uniqueness of the remainder in Theorem 4.1.8. \Box

The congruence abmodma\equiv b\bmod m looks a little like the equation a=ba=b, and we shall see that it behaves in a somewhat similar fashion.

Lemma 5.1.7

Let a,b,ca,b,c\in\mathbb{Z} and mm\in\mathbb{N}, and suppose that abmodma\equiv b\bmod m. Then

bamodm,  a+cb+cmodm  𝑎𝑛𝑑  acbcmodm.b\equiv a\bmod m,\qquad a+c\equiv b+c\bmod m\qquad\hbox{and}\qquad ac\equiv bc% \bmod m.
Example 5.1.8

Since -37mod5-3\equiv 7\bmod 5, we have 7-3mod57\equiv-3\bmod 5,

-1=-3+27+2=9mod5,-1=-3+2\equiv 7+2=9\bmod 5,

and -6=(-3)272=14mod5-6=(-3)2\equiv 7\cdot 2=14\bmod 5.

Proof. If mm divides a-ba-b, then mm also divides b-ab-a, (a+c)-(b+c)=a-b(a+c)-(b+c)=a-b and ac-bc=(a-b)c.ac-bc=(a-b)c. \Box

Lemma 5.1.9

Suppose that abmodma\equiv b\bmod m and bcmodmb\equiv c\bmod m, where a,b,ca,b,c\in\mathbb{Z} and mm\in\mathbb{N}. Then acmodma\equiv c\bmod m.

Example 5.1.10

Since -37mod5-3\equiv 7\bmod 5 and 72mod57\equiv 2\bmod 5, we have -32mod5-3\equiv 2\bmod 5.

Proof. By assumption, mm divides a-ba-b and b-cb-c, and so Lemma 4.2.13 implies that mm divides (a-b)+(b-c)=a-c.(a-b)+(b-c)=a-c. \Box