Chapter 4 Congruences
For this section, it is helpful if you keep "clock arithmetic" in mind. That is \(14:00\) hours is \(2\) o'clock. This will be considered doing arithmetic modulo \(12.\) We will just consider an \(n\) hour clock.
Definition 4.0.1.
Let \(n\in\mathbb{N}.\) Two integers \(a\) and \(b\) are said to be congruent modulo \(n,\) written
provided \(n\vert (a-b).\)
The canonical example of a congruence comes from the division algorithm.
Example 4.0.2.
Let \(a\in\mathbb{Z}\) and \(n\in\mathbb{N}.\) Given the division algorithm we know that there exists unique \(q, r\in\mathbb{Z}\) with \(0\leq r\lt n,\) such that
The definition of congruence gives
Definition 4.0.3.
If \(a, b\in\mathbb{Z}\) and \(a\equiv b\pmod{n}\) we say that \(a\) is a residue of \(b\) modulo \(n.\)
Remark 4.0.4.
The above examples tells us that modulo \(n\) any integer \(a\) is congruent to one of
These integers are called the least nonnegative residues modulo \(n\).
Definition 4.0.5.
The set of integers \(\{a_0, a_1,..., a_n-1\}\) is called a complete residue system modulo \(n\) provided
\(a_i \not\equiv a_j\pmod{n},\) whenever \(i\neq j\)
for each integer \(k\) there corresponds an \(a_i\) such that \(k\equiv a_i\pmod{n}.\)
Theorem 4.0.6.
The set \(\{0, 1, 2,...,n-1\}\) is a complete residue system modulo \(n.\)
Proof.
This is a direct consequence of the Division Algorithm.
Theorem 4.0.7.
Let \(a, b\in\mathbb{Z},\) then \(a \equiv b\pmod{n}\) if and only if \(a\) and \(b\) have the same nonnegative remainder when divided by \(n.\)
Proof.
Let \(a, b\in\mathbb{Z}.\) Suppose \(a \equiv b\pmod{n}.\) Then by definition \(n\vert (a-b).\) Now by the Division Algorithm there are \(q, q', r, r'\in\mathbb{Z}\) with \(>0\leq r, r' \lt n\) so that \(a = qn + r\) and \(b = q'n + r'.\) Now \(n\vert (n(q-q')+(r-r')),\) which says that \(n\vert (r-r').\) Since both \(r, r'\lt n\) this gives \(r-r'=0,\) so that \(r=r'.\)
Suppose that \(a\) and \(b\) have the same nonnegative remainder when divided by \(n,\) say \(r.\) So
which gives \(n\vert(a-b)\) and so \(a\equiv b\pmod{n}.\)
Theorem 4.0.8.
Let \(n\in\mathbb{N}\) and \(a, b\in\mathbb{Z}.\) Then
\(a \equiv a\pmod{n} \hspace{5mm}\) (reflexive)
if \(a \equiv b\pmod{n},\) then \(b \equiv a\pmod{n} \hspace{5mm} \) (symmetric)
if \(a \equiv b\pmod{n}\) and \(b \equiv c\pmod{n},\) then \(a \equiv c\pmod{n} \hspace{5mm} \) (transitive)
Proof.
Let \(n\in\mathbb{N}\) and \(a, b\in\mathbb{Z}.\) Now for \((i)\) we simply note that \(n\vert 0\) so that \(n\vert (a-a)\) and \(a \equiv a\pmod{n}.\) For \((ii),\) if \(a \equiv b\pmod{n},\) then \(n\vert (a-b)\) so that there is a \(k\in\mathbb{Z}\) such that \(kn = (a-b).\) Thus \((-k)n = (b-a),\) so \(n\vert (b-a)\) and we have that \(b \equiv a\pmod{n}.\) For \((iii),\) if \(a \equiv b\pmod{n}\) and \(b \equiv c\pmod{n},\) we have that \(n\vert (a-b)\) and \(n\vert (b-c)\) so that \(n\vert[(a-b)+(b-c)]\) which gives \(n\vert (a-c).\) Thus \(a \equiv c\pmod{n}.\)
Definition 4.0.9.
If a relation has the properties that it is reflexive, symmetric, and transitive, then we call it an equivalence relation.
Thus "\(\equiv\)" to the modulus \(n\) is an equivalence relation, as seen in the previous theorem.
Theorem 4.0.10.
Let \(n\in\mathbb{N}\) and \(a, b\in\mathbb{Z}.\)
if \(a \equiv b\pmod{n}\) and \(c \equiv d\pmod{n},\) then \(a+c \equiv b+d\pmod{n}\) and \(ac \equiv bd\pmod{n}\)
if \(a \equiv b\pmod{n},\) \(a+c \equiv b+c\pmod{n}\) and \(ac \equiv bc\pmod{n}\)
if \(a \equiv b\pmod{n},\) then \(a^k \equiv b^k\pmod{n}\) for any \(k\in\mathbb{N}\)
Proof.
Note that \((ii)\) and \((iii)\) are special cases of \((i),\) so that we will only prove \((i).\) Thus let \(n\in\mathbb{N}\) and \(a, b, c, d \in\mathbb{Z}.\) By a previous theorem we know that both \(a\) and \(b\) have the same remainder when divided by \(n,\) say \(r,\) and \(c\) and \(d\) have the same remainder when divided by \(n,\) say \(r'.\) So there exist \(q, s, q', s'\in\mathbb{Z}\) so that
Using this we have that
so that \(a + c \equiv b + d\pmod{n}.\) Also we have
so that \(ac \equiv bd\pmod{n}.\)
Remark 4.0.11.
The arithmetic, "\(+, -, \cdot\)" with congruences is the same as the arithmetic "\(+, -, \cdot\)" in integers. But here we are only interested in remainders.
Example 4.0.12.
We have
Definition 4.0.13.
The set \(\mathbb{Z}_n := \{0, 1, 2,..., n-1\}\) equipped with addition and multiplication modulo \(n\) is called the ring of integers modulo \(n.\)
Note that every element in \(a\in\mathbb{Z}_n\) has an additive inverse (there is an element \(b\) such that \(a + b \equiv 0\pmod{n}),\) but not every element has a multiplicative inverse (an element \(b\) such that \(ab\equiv 1\pmod{n}\)). As an example let \(n = 10\) and \(a = 2.\) Then the additive inverse of \(5\) is \(5\) since
But \(5\) does not have a multiplicative inverse. This can be seen just by exhausting the possibilities.
A consequence of this is that part \((ii)\) of the preceding theorem is not an "if and only if" statement. The first part of the statement does have a true converse. We see this in the following theorem.
Theorem 4.0.14.
Let \(n\in\mathbb{N}\) and \(a, b, c\in\mathbb{Z}.\) If \(a + c \equiv b + c\pmod{n},\) then \(a \equiv b \pmod{n}.\)
Proof.
Let \(n\in\mathbb{N}\) and \(a, b, c\in\mathbb{Z}.\) Suppose \(a + c \equiv b + c\pmod{n}.\) Now we know that \(-c \equiv -c\pmod{n}\) by the reflexive property. Thus we have
and so \(a \equiv b \pmod{n}.\)
There is a kind of limited converse for the second part of the statement. First we need to see when \(a\) has an inverse in \(\mathbb{Z}_n.\) This is the same as asking if the linear equivalence
has a solution. This is the same as asking if there are \(x\) and \(y\) such that
has a solution \(x, y,\) and this is true if and only if \(\gcd(a, n) = 1.\) This yields the following theorem.
Theorem 4.0.15.
If \(\gcd(a, n) = 1,\) then a has a multiplicative inverse in \(\mathbb{Z}_n.\)
Corollary 4.0.16.
Let \(n\in\mathbb{N},\) \(a,b,c\in\mathbb{Z}\) and \(\gcd(c,n)=1.\) If \(ac\equiv bc\pmod{n},\) then \(a\equiv b\pmod{n}.\)
Proof.
Let \(n\in\mathbb{N},\) \(a,b,c\in\mathbb{Z}\) and \(\gcd(c,n)=1.\) Suppose \(ac\equiv bc\pmod{n},\) then
where the last line comes by Euclid's lemma. Thus \(a \equiv b\pmod{n}.\)
Corollary 4.0.17.
Let \(p\) be a prime. If \(ac\equiv bc\pmod{p}\) and \(p\nmid c,\) then \(a\equiv b\pmod{p}.\)