Lecture 14
Proposition
Here are some properties of congruences, true for all integers:
We always have ;
If , then ;
If and , then ;
If and , then ;
If and , then ;
If and , then .
Proof
For (a):
Since , we have .
For (b):
If , we have . But then , which says , or in other words .
For (c):
As , we have ; similarly as , we have . But then which says that .
For (d):
As , we can write for some integer ; similarly, as , we can write for some integer .
As a result, so , so .
For (e):
As above, we can write , and . Then so , so .
For (f):
As , then we can write for some integer (since is a multiple of ). Similarly, as we can write .
But then , which says that .
I interpret all that as saying that, provided you’re careful and justify any unusual steps, the language of congruences behaves somewhat like equality. (In particular, our choice of notation, looking a bit like an overenthusiastic equals sign, wasn’t a bad choice). This philosophy will get heavy use from now on!
Back at school, you probably learned facts like “an odd number times an even number is an even number”. We can now give an systematic explanation of facts like these, using modular arithmetic.
If is odd and is even then and then (because we can multiply congruences) which says that is even.
Since we can add congruences, we can give similar explanations of addition facts (like “an odd number plus an even number is an odd number”).
The language of congruences gives us ways of writing down similar facts about other moduli.
For example, if , and , then .
We can use these ideas to make multiplication tables of congruences. For example, here’s a multiplication table modulo :
0 | 1 | 2 | 3 | 4 | |
---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 |
1 | 0 | 1 | 2 | 3 | 4 |
2 | 0 | 2 | 4 | 1 | 3 |
3 | 0 | 3 | 1 | 4 | 2 |
4 | 0 | 4 | 3 | 2 | 1 |
So, for example, this tells us that .
Notice that this shares some features with a usual multiplication table. For example, there is a column and a row of zeroes, because if you multiply something by something congruent to zero mod , you get something congruent to zero mod . Also, multiplying by doesn’t change anything.
Why do we only need to consider rows and columns numbered from to ? This is a consequence of division with remainder.
Proposition
Let and be integers, with . Then is congruent (modulo ) to a unique integer in the set
Proof
We’ll show that such a number exists, first, and then we’ll show that it’s unique.
By division with remainder, we can write for some integer and some integer with . But then that says that , and hence . That shows that is congruent to some number in that set.
Now, we’ll prove uniqueness. In fact we never proved that division with a unique remainder was possible, so let’s mend that now.
Suppose that and also . Then by subtracting, so .
But since and , we have So is a multiple of strictly between and : it must be zero, so , which proves uniqueness.
This proposition has a lot of consequences.
It means we can divide up the integers into sets, called congruence classes or residue classes, based on which number from they’re congruent to. So, for , we divide the integers into:
, all congruent to (mod );
, all congruent to (mod );
, all congruent to (mod );
, all congruent to (mod );
, all congruent to (mod ).
Many people, particularly those who like numerical calculations with integers (like computer programmers), use all this as an excuse to define a function, which in some languages is written “”, which gives the remainder upon division (so that is an integer between and ). So they say, for example, that .
This works fairly well for the computer programmers, but for us it’s a little unsatisfying. While it’s true that every number is congruent (modulo ) to a unique number from , there’s nothing much special about that set. It’s also true that every number is congruent (modulo ) to a unique number in the set . And it’s also true that every number is congruent (modulo ) to a unique number in the set . And, in fact, I can think of situations where all those facts are useful.
So it’s important we just think of the unique number in as just one out of many equally good ways of describing our number, up to congruence modulo .
Next semester, you’ll come to regard the integers, considered up to congruence modulo , as a system of numbers in its own right (and why not? We can add them and subtract them and multiply them, all considered only up to congruence modulo ). This system of numbers is commonly called (for reasons which will remain obscure at least for a year or two more).
So, for example, the system consists of two “numbers” which could be called “even” and “odd” (or 0 and 1), subject to the arithmetic laws you’d expect (like ).
This is novel in one important sense. In the past, every time we’ve introduced a new system of numbers, it’s contained the system we were thinking about before. We’ve built But doesn’t seem to work like this in this framework. It’s related to , but doesn’t really live inside it. Similarly, the set of “times of day” isn’t a subset of the set of times: for example, there’s no one special point of time in history called “2pm”, just many examples of 2pm on many different days.
In the case where , you’re probably comfortable with the fact that “odd” and “even” form something like a system of numbers (because you can add them and subtract them and multiply them), but while they’ve obviously got something to do with , there’s no one integer called “odd” and no one integer called “even”.
Modular arithmetic, to other moduli, is similar (we just don’t have clever names like “even” and “odd”).
Congruence equations
We’ve now laid the foundations of modular arithmetic, the study of congruences. After all that philosophy, we should do some sums.
The set of all solutions to seems like a perfectly explicit description of a class of numbers: it’s a congruence class modulo , the class of numbers of the form . So we can start listing them easily:
But what is the set of solutions to ?
That’s not a particularly satisfactory description of a set of numbers: it’s a pain to list them, so we should ask for better.
However, we can get a more satisfactory list just using techniques we already know. The condition says that , which in turn says that for some . Rearranging, that says that . But we know how to get a general solution for those!
Indeed, we find that , and as there are solutions. First we try to find a single one.
We can get a solution to (by guessing, or by using Euclid’s algorithm backwards) such as . This means (by tripling both sides) that a solution to is given by .
To find other solutions, we subtract from to get .
Hence , so . As and are coprime, this means that . So it’s equivalent to , which is a nice description!
We can regard linear equations in modular arithmetic as asking about division. After all, asking about solutions to the linear equation is asking “can we divide by ”? So the fact that might be regarded as saying that we can divide by (modulo ), and we get when we do so.
But division in modular arithmetic is more complicated than in the integers. Of course, integer division is unique where it exists. In other words, if I choose integers and (with nonzero) and ask about integer solutions to then two things can happen: either there is a unique solution (as with ), or there’s no solution at all (as with ).
That’s not true in modular arithmetic, as the following examples show:
How many residue classes of solutions are there to ?
None: the lhs is even and the rhs odd.
How many residue classes of solutions are there to ?
One: .
How many residue classes of solutions are there to ?
Two: and .
How many residue classes of solutions are there to ?
Four: .