Lecture 8
Elementary number theory
Now we have language to do so, the rest of this course will be concerned with beginning a study of the sets of numbers we have discussed earlier: , , and .
We’re going to spend two-thirds of that time (or thereabouts) laying the foundations for elementary number theory: the study of and .
This used to be a beautiful, isolated and useless subject, until the 20th century came along. Now it is beautiful, well-connected and vitally important.
In the sense that mathematicians use the word, “elementary” doesn’t mean “easy”: it means “using no deep theory” (we’re only four weeks into your first semester, so haven’t had time to develop any deep theory). It can still be difficult, and in fact it can still be deep.
Divisibility and primes
The most obvious way to start investigating properties of and is to ask about division. We remarked a while ago that it’s not always possible to do division inside or : that suggests there’s something interesting going on!
Here’s the basic definition:
Definition: Let and be integers. We say that divides if there exists an integer such that .
We also might say that is a multiple of , or that is a divisor of , or that is a factor of , or that goes into .
In symbols, we write to say that divides , and write to say that does not divide .
For example, , so we have . Also, , so we have . Also, , so we have .
However, cannot be written as an integer multiple of , so we have .
What does it mean to say that does not divide ? Well, it means:
there does not exist any integer , such that ,
or (equivalently)
for all , we have .
It’s worth sorting out the trivial cases:
When do we have ?
Always (since for all ).
When do we have ?
When .
When do we have ?
When .
When do we have ?
Always (since for all ).
For the next few lectures, we’ll be studying the integers from the point of view of divisibility.
The following definition is a natural one:
Definition: An integer is said to be prime if it has no positive factors except for and itself.
Primes are clearly a good thing to study: they’re the numbers with no complicated factors.
It’s good to have a word meaning roughly the same thing as “not prime”:
Definition: An integer is said to be composite if it is not prime: that is, if it does have positive factors other than and .
Notice that we have chosen our definitions so that will be neither prime nor composite. This was a choice, and it seems a bit mysterious at first.
Indeed, until the late 19th century, mathematicians treated as prime. But it was found to be so much simpler to do it this way that nobody considers to be prime any more.
The main thing about primes is that all other positive integers are built from them by multiplication.
Before we get to that, it’s worth explaining something about multiplication.
You’re all used to the fact that the sum of an empty list of numbers is zero. I want to persuade you that the product of an empty list of numbers is one.
Suppose I’m trying to find .
One way of doing this would be to ask one person to find and another to find , and then multiply the results: I could split the work up in other ways: What if I give all the numbers to the first person? For the right answer, the product of no numbers must be 1.
Theorem
Every positive integer can be written as a product of primes (in at least one way).
Proof
We’ll prove this by strong induction on .
For our base case, we observe that when , we can write as the product of no primes.
So now we have to do our induction step: let be a positive integer. We assume that every positive integer with can be written as a product of primes, and we try to prove that can.
Now, either is prime, or it is composite. If it is prime, then is the product of just one prime (namely, itself).
If, however, is composite, then it has a positive integer factor which is not nor itself: in other words, we have , where both and are between and . By the induction hypothesis, and can both be written as products of primes, say: But then , which proves it for . That completes the induction step (and the proof).
Later on, we’ll prove a stronger result, that every number can be written as a product of primes in exactly one way (rearranging the factors doesn’t count). That’s much, much harder.
Because of this we can be sure that primes are reasonably important. The first few are:
What are sensible questions to ask? Here are some obvious examples:
How many primes are there?
There’s quite a lot of primes between and . Do they tend to get rarer as we go on?
Other than and , all primes must end in , , or . Is there a bias: do more end in than in , for example?
There seem to be several pairs of small primes which differ by (eg and , and and , and and ). How many such pairs are there?
Are there quick ways of testing if a number is prime?
Are there quick ways of finding large primes?
Some of these have had well-known answers for more than a century, some are still unsolved, and some are currently the focus of tremendous interest.
We’ll start off by giving the answer to that first question, which was known to the ancient Greeks:
Theorem
[Euclid’s theorem] There are infinitely many prime numbers.
Here’s the proof, the way I prefer to think of it:
Proof
We’ll construct a sequence of different primes by induction (so, the statement we’re doing induction on is, “there are at least different primes”).
For our base case we take , and then take , which is a prime.
For our induction step we suppose we have primes , and our job is to show that there’s another prime.
Consider the natural number obtained by multiplying all our primes so far and adding .
This number is not a multiple of , because is: so leaves a remainder of when you divide by .
Similarly, it’s not a multiple of for any , because is, and so leaves a remainder of upon division by .
But this number has at least one prime factor: we can take our next prime to be one such prime factor, and that completes the induction step.
Here’s pretty much exactly the same proof, phrased in a slightly different way.
Proof
[Proof (of the same theorem again)] We prove this by contradiction: we show that it’s true by showing that the negation is absurd.
Indeed, suppose there were only finitely many primes, . Then consider (as before) the natural number This isn’t divisible by any of the primes (since it leaves a remainder of upon division by any of them). But that’s absurd, since we were assuming those were all the primes, and that every number can be written as a product of primes.
Some people find proof by contradiction slightly startling when they see it first.
In fact, it’s perfectly familiar in daily life. When you find someone who disagrees with you, you show that you are right by pointing out that if you were wrong, then that would contradict something well-known to be correct.
From a logical perspective, it’s all to do with the . Suppose is some result we desperately want to prove, for example and something we know is true, for example (That was Theorem ).
Now, we proved that if there are only finitely many primes, then some number doesn’t have a prime factor. That’s exactly . But that means that its contrapositive is true. And once we know that, then, since we know is true, we also know is true.
The second form above, the proof by contradiction, is a more standard form. It appears in the majority of textbooks (and maybe the majority of mathematicians’ minds).
This makes me sad, because it’s not as good. The proof by contradiction spends all its time making fun of the idea that there might not be infinitely many primes; the first one just goes and builds them.
There are (quite a lot of) other proofs of Euclid’s theorem, but Euclid himself probably only knew the way we’ve discussed.
That means that you can actually use the first proof to construct primes:
We start with .
We find that is prime, so we take .
In fact, is also prime, so we take .
Further, is also prime, so we take .
Now, . It turns out that’s not prime: in fact, . So we could take to be either or …
This is genuinely a way of producing primes. Admittedly, it’s not a very intelligent one.
If you have to find primes, it’s probably better to use this method, which works well in practice:
Algorithm
[The Sieve of Eratosthenes] The Sieve of Eratosthenes proceeds by writing down the natural numbers from up to (for some ) in a convenient form. We repeat the following steps:
Find the first untouched number and mark it as a prime.
Mark all its multiples as being composite.
The Sieve of Eratosthenes doesn’t prove that there are infinitely many primes: it just finds them. Unless we’d found a proof of Euclid’s theorem, we could have nightmares that one day we’ll find ourself crossing off all the remaining natural numbers and not finding any more primes.