1.2.1. Congruence

This section is based largely on [BUR11, Sec. 4.2].

Definition 1.2.1.1.

Let n≥1{n\geq 1} be an integer. We say that a,b∈ℤ{a,b\in\mathbb{Z}} are congruent modulo nn if nn divides a−b{a-b}. In this case, we write

a≡b(modn).a\equiv b\pmod{n}.

In this context, nn is called the modulus.

Proposition 1.2.1.2.

Let n≥1{n\geq 1} and a,b∈ℤ{a,b\in\mathbb{Z}} be such that |a−b|<n{|a-b|<n}. Then

a≡b(modn)⟺a=b.a\equiv b\pmod{n}\quad\Longleftrightarrow\quad a=b.
Proof.

Suppose that a≡b(modn){a\equiv b\pmod{n}}. By definition, nn divides a−b{a-b} and hence nn divides |a−b|{|a-b|}. Since 0≤|a−b|<n{0\leq|a-b|<n} and |a−b|{|a-b|} is a multiple of nn, we must have |a−b|=0{|a-b|=0} or, equivalently, a=b{a=b}. The converse is trivial. ∎

Proposition 1.2.1.3.

Let n≥1{n\geq 1} be an integer and a,b∈ℤ{a,b\in\mathbb{Z}}. The following statements are equivalent:

  1. (1)
    ​

    a≡b(modn){a\equiv b\pmod{n}}.

  2. (2)
    ​

    By the Division with Remainder Theorem (Theorem 1.1.1.8), division by nn allows us to write

    a=q1⁢n+r1andb=q2⁢n+r2a=q_{1}n+r_{1}\qquad\text{and}\qquad b=q_{2}n+r_{2}

    with qi,ri∈ℤ{q_{i},r_{i}\in\mathbb{Z}} and 0≤ri<n{0\leq r_{i}<n}. Then the remainders are equal: r1=r2{r_{1}=r_{2}}.

Proof.

(1)⇒{\Rightarrow}(2) By definition, there exists k∈ℤ{k\in\mathbb{Z}} such that a−b=k⁢n{a-b=kn}. Then

r1−r2=(a−b)+(q2−q1)⁢n=k⁢n+(q2−q1)⁢n,r_{1}-r_{2}=(a-b)+(q_{2}-q_{1})n=kn+(q_{2}-q_{1})n,

so that r1≡r2(modn){r_{1}\equiv r_{2}{\pmod{n}}}. Since |r1−r2|<n{|r_{1}-r_{2}|<n}, Proposition 1.2.1.2 implies that r1=r2{r_{1}=r_{2}}.

(2)⇒{\Rightarrow}(1) Write

a=q1⁢n+randb=q2⁢n+ra=q_{1}n+r\qquad\text{and}\qquad b=q_{2}n+r

with qi,r∈ℤ{q_{i},r\in\mathbb{Z}} and 0≤r<n{0\leq r<n}. Then a−b=(q1−q2)⁢n{a-b=(q_{1}-q_{2})n} and nn divides a−b{a-b}. ∎

Corollary 1.2.1.4.

Let n≥1{n\geq 1} be an integer. For a∈ℤ{a\in\mathbb{Z}}, let 0≤ra<n{0\leq r_{a}<n} be the remainder obtained by dividing aa by the modulus nn. Then the function

r?:ℤ\displaystyle r_{?}\colon\mathbb{Z} ⟶{0,1,2,…,n−1}\displaystyle\longrightarrow\{0,1,2,\ldots,n-1\}
a\displaystyle a ⟼ra\displaystyle\longmapsto r_{a}

is surjective and, moreover, ra=rb{r_{a}=r_{b}} if and only if a≡b(modn){a\equiv b{\pmod{n}}}.

Proof.

Surjectivity is clear: if 0≤a<n{0\leq a<n}, then a=ra{a=r_{a}} is its own remainder. The second claim is a straightforward reformulation of Proposition 1.2.1.3. ∎

Example 1.2.1.5.

Not covered in the lecture Let n=14{n=14}, a=83{a=83}, and b=114{b=114}. We have 83=5⋅14+13{83=5\cdot 14+13} and 114=8⋅14+2{114=8\cdot 14+2}, and hence

83≡13(mod14)and114≡2(mod14).83\equiv 13{\pmod{14}}\qquad\text{and}\qquad 114\equiv 2{\pmod{14}}.
Proposition 1.2.1.6.

Let n≥1{n\geq 1} be an integer and a,b,c,d∈ℤ{a,b,c,d\in\mathbb{Z}}. The following statements hold:

  1. (1)
    ​

    a≡a(modn){a\equiv a\pmod{n}}.

  2. (2)
    ​

    a≡b(modn){a\equiv b\pmod{n}} if and only if b≡a(modn){b\equiv a\pmod{n}}.

  3. (3)
    ​

    If a≡b(modn){a\equiv b\pmod{n}} and b≡c(modn){b\equiv c\pmod{n}}, then a≡c(modn){a\equiv c\pmod{n}}.

  4. (4)
    ​

    If a≡b(modn){a\equiv b\pmod{n}}, then

    a+c≡b+c(modn)anda⁢c≡b⁢c(modn).a+c\equiv b+c\pmod{n}\qquad\text{and}\qquad ac\equiv bc\pmod{n}.
  5. (5)
    ​

    If a≡b(modn){a\equiv b\pmod{n}} and c≡d(modn){c\equiv d\pmod{n}}, then

    a+c≡b+d(modn)anda⁢c≡b⁢d(modn).a+c\equiv b+d\pmod{n}\qquad\text{and}\qquad ac\equiv bd\pmod{n}.
  6. (6)
    ​

    If a≡b(modn){a\equiv b\pmod{n}}, then ak≡bk(modn){a^{k}\equiv b^{k}\pmod{n}} for each integer k≥0{k\geq 0}.

Proof.

Everything follows from Proposition 1.1.1.6. We provide a proof of all statements for the sake of completeness.

(1) Clearly, nn divides a−a=0{a-a=0}.

(2) Using Proposition 1.1.1.6(7) we obtain: a≡b(modn){a\equiv b\pmod{n}} if and only if nn divides a−b{a-b} if and only if nn divides b−a{b-a} if and only if b≡a(modn){b\equiv a\pmod{n}}.

(3) By assumption, n∣(a−b){n\mid(a-b)} and n∣(b−c){n\mid(b-c)}. Proposition 1.1.1.6(11) implies that nn divides (a−b)+(b−c)=a−c{(a-b)+(b-c)=a-c}. Therefore, a≡c(modn){a\equiv c\pmod{n}}.

(4) By assumption, n∣(a−b){n\mid(a-b)} and nn also divides c−c=0{c-c=0}. Proposition 1.1.1.6(11) implies that nn divides

(a−b)+(c−c)=(a+c)−(b+c).(a-b)+(c-c)=(a+c)-(b+c).

Therefore, a+c≡b+c(modn){a+c\equiv b+c\pmod{n}}. Similarly, since 1∣c{1\mid c}, Proposition 1.1.1.6(10) implies that nn divides (a−b)⁢c=a⁢c−b⁢c{(a-b)c=ac-bc}. Hence, a⁢c≡b⁢c(modn){ac\equiv bc\pmod{n}}.

(5) Using statement (4), we have

a+c≡b+c(modn)andb+c≡b+d(modn).a+c\equiv b+c\pmod{n}\qquad\text{and}\qquad b+c\equiv b+d\pmod{n}.

By statement (3), we have a+c≡b+d(modn){a+c\equiv b+d\pmod{n}}. Similarly, using statement (4), we have

a⁢c≡b⁢c(modn)andb⁢c≡b⁢d(modn).ac\equiv bc\pmod{n}\qquad\text{and}\qquad bc\equiv bd\pmod{n}.

By statement (3), we have a⁢c≡b⁢d(modn){ac\equiv bd\pmod{n}}.

(6) We prove the claim by induction on k≥0{k\geq 0}. For k=0{k=0}, we have a0=b0=1{a^{0}=b^{0}=1} and the claim is clear. Inductively, if k≥0{k\geq 0} and ak≡bk(modn){a^{k}\equiv b^{k}\pmod{n}}, statement (5) implies that

a⁢ak≡b⁢bk(modn),aa^{k}\equiv bb^{k}\pmod{n},

that is, ak+1≡bk+1(modn){a^{k+1}\equiv b^{k+1}\pmod{n}}. The claim follows. ∎

Remark 1.2.1.7.

In Proposition 1.2.1.6, statements (1), (2) and (3) say that being ‘congruent modulo nn’ defines an equivalence relation on the set ℤ\mathbb{Z} of integers. Indeed, these statements show that the congruence relation modulo nn is reflexive, symmetric and transitive.

Proposition 1.2.1.8.

Let n≥1{n\geq 1} be an integer and a,b,c∈ℤ{a,b,c\in\mathbb{Z}}. Set d≔gcd⁡(c,n){d\coloneqq\gcd(c,n)} so that n/d≥1{n/d\geq 1} is an integer. Then a⁢c≡b⁢c(modn){ac\equiv bc\pmod{n}} if and only if a≡b(modn/d){a\equiv b\pmod{n/d}}.

Proof.

By Bézout’s Identity (Theorem 1.1.3.7), there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that d=c⁢x+n⁢y{d=cx+ny}. Then

(a−b)⁢d=(a−b)⁢(c⁢x+n⁢y)=(a⁢c−b⁢c)⁢x+(a−b)⁢y⁢n.(a-b)d=(a-b)(cx+ny)=(ac-bc)x+(a-b)yn.

Suppose that a⁢c≡b⁢c(modn){ac\equiv bc{\pmod{n}}} or, equivalently, a⁢c−b⁢c≡0(modn){ac-bc\equiv 0{\pmod{n}}}. Since (a−b)⁢y⁢n≡0(modn){(a-b)yn\equiv 0{\pmod{n}}}, Proposition 1.2.1.6(5) implies that

(a⁢c−b⁢c)⁢x+(a−b)⁢y⁢n≡0(modn).(ac-bc)x+(a-b)yn\equiv 0{\pmod{n}}.

Consequently, nn divides (a−b)⁢d{(a-b)d}. Therefore, there exists k∈ℤ{k\in\mathbb{Z}} such that

(a−b)⁢d=k⁢n.(a-b)d=kn.

Since d≥1{d\geq 1} and d∣n{d\mid n}, dividing by dd we obtain a−b=k⁢nd{a-b=k\frac{n}{d}}. This shows that a≡b(modn/d){a\equiv b\pmod{n/d}}.

Conversely, if a≡b(modn/d){a\equiv b\pmod{n/d}}, then b=a+k⋅nd{b=a+k\cdot\tfrac{n}{d}} for some k∈ℤ{k\in\mathbb{Z}}. Multiplying by cc and using that d∣c{d\mid c}, we obtain

b⁢c=a⁢c+(k⋅cd)⋅nbc=ac+(k\cdot\tfrac{c}{d})\cdot n

and therefore b⁢c≡a⁢c(modn){bc\equiv ac{\pmod{n}}}. ∎

Corollary 1.2.1.9.

Let n≥1{n\geq 1} be an integer and a,b,c∈ℤ{a,b,c\in\mathbb{Z}} be such that

gcd⁡(c,n)=1.\gcd(c,n)=1.

Then a⁢c≡b⁢c(modn){ac\equiv bc\pmod{n}} if and only if a≡b(modn){a\equiv b\pmod{n}}.

Proof.

This is a special case of Proposition 1.2.1.8. ∎

Example 1.2.1.10.

Not covered in the lectureConsider the integer

114=57⋅2.114=57\cdot 2.

We know from Example 1.2.1.5 that 57⋅2≡1⋅2(mod14){57\cdot 2\equiv 1\cdot 2{\pmod{14}}}. By Proposition 1.2.1.8 for n=14{n=14} and d=gcd⁡(2,14)=2{d=\gcd(2,14)=2}, we must have

57≡1(mod7).57\equiv 1{\pmod{7}}.

Indeed,

57=8⋅7+1=4⋅14+1,57=8\cdot 7+1=4\cdot 14+1,

so that, in fact, already 57≡1(mod14){57\equiv 1{\pmod{14}}}. Therefore, in special cases, the conclusion of Corollary 1.2.1.9 might still hold even if gcd⁡(c,n)≠1{\gcd(c,n)\neq 1}.

Corollary 1.2.1.11.

Let pp be a prime and a,b,c∈ℤ{a,b,c\in\mathbb{Z}} be such that p∤c{p\nmid c}. Then a⁢c≡b⁢c(modp){ac\equiv bc\pmod{p}} if and only if a≡b(modp){a\equiv b\pmod{p}}.

Proof.

Since pp is prime, its only positive divisors are 11 and pp. Hence, p∤c{p\nmid c} implies gcd⁡(c,p)=1{\gcd(c,p)=1}. The claim now follows from Corollary 1.2.1.9. ∎

We illustrate Proposition 1.2.1.6 by establishing the following criterion for an integer to be divisible by 33.

Proposition 1.2.1.12.

Let n≥0{n\geq 0} be an integer. Write n=∑k=0tak⋅10k{n=\sum_{k=0}^{t}a_{k}\cdot 10^{k}} with t≥0{t\geq 0}, so that the aka_{k} are the digits of nn in base 1010. Then

n≡0(mod3)⟺∑k=0tak≡0(mod3).n\equiv 0{\pmod{3}}\quad\Longleftrightarrow\quad\sum_{k=0}^{t}a_{k}\equiv 0{% \pmod{3}}.
Proof.

Notice that 10≡1(mod3){10\equiv 1{\pmod{3}}}. By Proposition 1.2.1.6(6), we have 10k≡1(mod3){10^{k}\equiv 1{\pmod{3}}} for all integers k≥0{k\geq 0}. Inductive application of Proposition 1.2.1.6(5) yields the congruence

∑k=0tak⋅10k≡∑k=0tak(mod3).\sum_{k=0}^{t}a_{k}\cdot 10^{k}\equiv\sum_{k=0}^{t}a_{k}{\pmod{3}}.

The claim readily follows. ∎

Example 1.2.1.13.

Not covered in the lectureLet n=45⁢738{n=45~{}738}. Since 4+5+7+3+8=27{4+5+7+3+8=27} is divisible by 33, Proposition 1.2.1.12 implies that nn itself is divisible by 33. Indeed,

45⁢738=2⋅33⋅7⋅112.45~{}738=2\cdot 3^{3}\cdot 7\cdot 11^{2}.