Section 4.1 Introduction to Congruence
ΒΆLet's start by a little calculation. What is the remainder of 25 when divided by 6?xxxxxxxxxx
25 % 6
x % m
computes βx modulo mβ, which is to say the remainder of x when you divide by m.
An alternate way to do this is with the command mod(x,m)
.
xxxxxxxxxx
mod(25,6)
r = x % m
), then 0β€r<m, which is very important. However, lots and lots of different numbers can have the same remainder:
xxxxxxxxxx
[ x % 6 for x in [1, 7, 13, 19, 25, -5, -11, 6001, -17]]
Definition 4.1.1. Congruence.
We say that a number a is congruent to b another number, or
precisely if nβ£(aβb). We call n the modulus. The noun form of the relationship is called congruence.
Lemma 4.1.2. Congruence-Remainder.
Saying aβ‘b (mod n) is exactly the same thing as saying a and b leave the same remainder when divided by n.
Proof.
We can sketch the proof. It is a good exercise (see Exercise 4.7.15) to fill in the details.
Write \(a=nq+r\) and \(b=nq'+r'\text{.}\) (Why is this possible, what are the various symbols?) Then there are two steps (why do they suffice?)
First, if \(r=r'\) then there is a \(k\) such that \(a-b=nk\text{,}\) which means \(a\equiv b\) (mod \(n\)). (Why?)
The other direction is showing if \(a-b=nk\) for some \(k\in\mathbb{Z}\text{,}\) then \(r=r'\text{.}\) This is a little harder; try thinking about getting the remainders on one side, and what \(r\neq r'\) would imply with respect to \(n\text{.}\)
Example 4.1.3.
In our case, saying 25β‘1β‘β5 (mod 6) is the same as saying 25=4β 6+1 and 1=0β 6+1 and β5=β1β 6+1.
Example 4.1.4.
Recall the fact about remainders when dividing by four, Proposition 2.1.4. This is just saying that the only possibilities are
Could you try to use this idea to think of possible last (decimal) digits of a perfect square? Which modulus would be helpful? (See Exercise 4.7.11.)
What about cubes; what remainders are possible modulo 4? What last digits are possible?