# FA18:Lecture 13 strong induction and euclidean division

We introduced strong induction and used it to complete our proof that Every natural number is a product of primes. We then started our discussion of number theory with the euclidean division algorithm.

# Notation: sequences

In this lecture, we will use a bit of shorthand for representing (finite) sequences:

We often want to prove that there exists a sequence of values , all in , satisfying some property. Formally, we would say "there exists and values such that ".

This takes a lot of writing, and also requires us to introduce the variable (which often just adds complexity). So, we will abbreviate this to "there exists such that ".

We will also abbreviate sums and products of all the values: denotes the sum of the and denotes their product. We won't worry too much about the indices; unless otherwise specified, we just mean add (or multiply) all of them.

Note: there is ambiguity in this notation about whether we allow finite or infinite sequences. I will only use this notation for finite sequences.

# Strong induction

In the last lecture, we tried to prove that every natural number has a prime factorization.

We begin this lecture by showing how to modify that proof by strengthening the inductive hypothesis, and then we introduce the general technique of strong induction.

## Strengthing the inductive hypothesis

Sometimes, when doing an inductive proof, the inductive hypothesis doesn't quite say enough to be useful in the inductive step. In this situation, it can sometimes (ironically) be 'easier' to prove a stronger result than the original claim. Although this means you will have more to prove, it also means you will have more facts that you can use inside your inductive step.

For example, Here is a corrected version of the proof that Every natural number has a prime factorization wherein we strengthen the inductive hypothesis. You may find it useful to read them side by side to understand the differences.

There is a lot of technicality involved in this proof that doesn't really help explain what's going on; it is much clearer to write essentially the same proof using strong induction. This is an example to demonstrate that you can always rewrite a strong induction proof using weak induction.

The key idea is that, instead of proving that every number has a prime factorization, we prove that, for any given , every number has a prime factorization. Of course, this means that itself has a prime factorization, but by proving even more, we allow our inductive step to go through.

For all , if then there exists prime numbers with .
We will prove the claim using weak induction, but with a strengthened induction hypothesis. Let be the statement "for all with , there exists prime numbers with . We will prove and assuming .

In the base case, when , we will choose an arbitrary between and ; we see that must be 2. 2 is prime. Therefore, we can choose ; clearly .

For the inductive step, we assume ; our goal is to show , in other words that every has a prime factorization.

Choose an arbitrary . Since and are natural numbers, we see that either or . If , then we can apply to find a prime factorization for . Thus, the only remaining case is when .

There are two cases: could be prime or composite. If is prime, we can proceed as in the base case: simply choose .

If, on the other hand, is composite, then we know that for some natural numbers and .

If we knew that and had prime factorizations, then we could combine them to form a prime factorization of . But now we do know that! Since and , we see that ; similarly . Therefore we can apply to conclude that and have prime factorizations.

We can therefore finish the proof: Let be the prime factorization of , and let be the prime factorization of . If we let be the sequence starting with the and ending with the s (in other words, ). Then clearly .

## Strong induction

Strengthening the inductive hypothesis in this way (from to ) is so common that it has some specialized terminology: we refer to such proofs as proofs by strong induction:Strong induction is similar to weak induction, except that you make additional assumptions in the inductive step.

To prove "for all , P(n)" by strong induction, you must

More concisely, the inductive step requires you to prove assuming for all .

The difference between strong induction and weak induction is only the set of assumptions made in the inductive step.

The intuition for why strong induction works is the same reason as that for weak induction: in order to prove , for example, I would first use the base case to conclude . Next, I would use the inductive step to prove ; this inductive step may use but that's ok, because we've already proved . I would then use the inductive step to conclude ; this may use both and , but that's okay because we've already proved and . Next, I would again use the inductive step to conclude ; as before, this may use , , or , but this is not a problem since we have already proved those three facts. Similarly, we can use the inductive step to conclude P(4), P(5), etc.

Note that you can always use strong induction instead of weak induction. Using weak induction is just a matter of style: by avoiding unneeded assumptions, you reduce the complexity of your proof, and clearly indicate to the reader what assumptions you are actually planning to use. I often start inductive proofs by not specifying whether they are proofs by strong or weak induction; once I know which inductive hypothesis I actually need, I go back and fill in the beginning of my inductive step.

Here is a simplified version of the proof that every natural number has a prime factorization.

We use strong induction to avoid the notational overhead of strengthening the inductive hypothesis. This proof has the simplicity of the incorrect weak induction proof, but it actually works. You should compare the three versions of the proofs to understand the differences.

For all , if then there exists prime numbers with .
Proof: using strong induction
We will prove the claim using strong induction. Let be the statement that "there exists prime numbers with . We will prove and assuming .

In the base case, when we see that 2 is prime. Therefore, we can choose ; clearly .

For the inductive step, we assume (or in other words, we strong induction for all ; our goal is to show , in other words that has a prime factorization.

There are two cases: could be prime or composite. If is prime, we can proceed as in the base case: simply choose .

If, on the other hand, is composite, then we know that for some natural numbers and .

Since and must be less than , we can apply and to conclude that both and have prime factorizations.

Let be the prime factorization of , and let be the prime factorization of . If we let be the sequence starting with the and ending with the s (in other words, ). Then clearly .

# Euclidean division

With these basic techniques (weak induction and strong induction) under our belt, we can begin the study of number theory.

For our purposes, refers to the study of the natural numbers and the integers. We will also introduce and study a closely related class of objects, the modular numbers.

Number theory is useful in several areas of computer science, including number representations, digital logic, information theory, and cryptography.

While studying number theory, we will be primarily interested in the properties of the integers and natural numbers. This means that if we want to write something like "", we'll have to be very careful to check that divides . This makes everything very complicated, so instead, we'll avoid dividing natural numbers.

We can, however, do division with remainder. The Euclidean division algorithm is just a fancy way of saying this:

For all and all , there exists numbers and such that

Here and are the quotient and remainder of over :

Definition: Quotient
We say is a quotient of over if for some with . We write (note that quot is a well defined function).
Definition: Remainder
We say is a remainder of over if for some and . We write (note that rem is a well defined function).

Note that all this is a theorem, it is called the "Euclidean division algorithm" because its proof contains an algorithm.

Proof:
We prove this by weak induction on . Let be the statement "for all , there exists satisfying (1) and (2) above." We will show and assuming .

Base case: We want to show P(0). Let . Then and since .

Inductive step: Assume ; we want to show . By , we know that there exists numbers and such that . We want to show that there exists numbers and such that .

Since , we know that either or . In the former case, we can let and . Then (and clearly ).

In the latter case, we can let and . Then . Again it is clear that .

In either case, we have shown that there exist and satisfying (1) and (2), as required.

## Proofs and algorithms

Most proofs that something exists give you instructions for finding it. For example, inside the proof that the quotient and remainder exist, is an algorithm for finding them: If , follow the instructions in the base case; if , then first find the quotient q' and remainder r' for and , then follow the instructions in the inductive step. Of course, while we are finding and , we may need to also find the quotient and remainder of and , and so on.

We will cover several examples of such algorithms/proofs:

In fact, there are whole programming languages where instead of writing a program, you write a proof; after the computer checks your proof, it extracts a program for you (which is guaranteed to be correct!).

## Uniqueness of euclidean division

In order to justify calling quotients and remainders "the quotient" or "the remainder", we should check that they are unique. This is justified by the following claim:

For any and , if and are a quotient and remainder of and (that is, if and ), and if and are also a quotient and remainder of over , then and .
Proof:
Assume that and and that both and are between 0 and . We want to show that and .

We have , so . This means that is a multiple of ; it could be any of . However, since we have and , we have . Thus, the only possible value of is 0, so .

Plugging this back in to the equation shows that either or . Since we have defined the quotient and remainder by , we must have , so and thus .