- writing a number in base
*b*. - strong induction
- divisibility
- Euclid's gcd algorithm.

**Note**: weak induction is the technique that we called "induction" in previous lectures.

To prove a claim ∀ *n* ∈ N, *P*(*n*) using strong induction, you must:

- prove
*P*(0) - For an arbitrary
*n*, prove*P*(*n*) while assuming*P*(0),*P*(1), ...,*P*(*n*− 1).

More formally, the inductive hypothesis for strong induction is ∀ *k* < *n*, *P*(*k*) whereas the inductive hypothesis for weak induction is *P*(*n* − 1).

**Fact**: strong induction is equivalent to weak induction: there is nothing you can prove using strong induction that you can't prove using weak induction.

**Theorem**: for any *n* ≥ 1 and *b* ≥ 2, you can write *n* in base *b*. That is, there are digits *a*_{0}, *a*_{1}, ..., *a*_{k} such that (*a*_{k}*a*_{k − 1}. . . *a*_{2}*a*_{1}*a*_{0})_{b} = *n*.

**Note**: as with the division algorithm, the proof of this theorem contains the algorithm used to construct the base-b representation.

**Proof**: by strong induction on *n*. In the base case, we can choose *a*_{0} = 1. Then since *b* > 1, *b* > *a*_{0}, and *n* = *a*_{0} = (*a*_{0})_{b}.

For the inductive step, assume that any number *k* < *n* can be written in base *b*. We wish to write *n* in base *b*. To do so, use Euclidean division to write *n* = *q**b* + *r*. Let *a*_{0} = *r*. By the inductive hypothesis, we can write *q* in base *b*: *q* = (*a*_{l}ʹ*a*_{l − 1}ʹ. . . *a*_{2}ʹ*a*_{1}ʹ*a*_{0}ʹ) (we have to check that *q* < *n*, but this is true).

It turns out that these digits of *q* are also the higher digits of *n*. That is, *a*_{1} = *a*ʹ_{0} and *a*_{2} = *a*ʹ_{1} and so on. To check this, we know:

*q* = ∑ _{i = 0}^{l}*a*_{i}ʹ*b*^{i}

We also know that *n* = *q**b* + *r*, so

*n* = *q**b* + *r* = *b*(∑ _{i = 0}^{l}*a*_{i}ʹ*b*^{i}) + *r* = *a*_{0} + ∑ _{i = 0}^{l}*a*_{i}ʹ*b*^{i + 1} = *a*_{0} + ∑ _{i = 0}^{l}*a*_{i + 1}*b*^{i + 1}

By changing *i* to *k* − 1 in the summation this becomes

*n* = *a*_{0} + ∑ _{k = 1}^{l + 1}*a*_{k}*b*^{k} = ∑ _{k = 0}^{l + 1}*a*_{k}*b*^{k}

which shows that (*a*_{i}) is the base *b* representation of *n*.

**Note**: it turns out base *b* representation is unique (just as quotient and remainder are), this is a good exercise.

Definition: for two integers *a* and *b*, we say *a* **divides** *b* (written *a*∣*b*) if there exists some integer *k* such that *a**k* = *b*.

As a technical tool in the coming lectures, we will need to compute the greatest common divisor of two numbers. Here we write down the algorithm and the property that it needs to satisfy, we will prove that it does satisfy that property in the next lecture.

Given *a* ≥ 0 and *b* ≥ 0, Euclid's algorithm defines *g*(*a*, *b*) as follows:

- If
*b*= 0, then*g*(*a*,*b*) is defined to be*a*. - If
*b*≤*a*, then*g*(*a*,*b*) is defined as follows: first, use Euclidean division to write*a*=*q**b*+*r*. Then*g*(*a*,*b*) is defined to be*g*(*b*,*r*). - If
*b*>*a*, then*g*(*a*,*b*) is defined to be*g*(*b*,*a*).

Does this even define a function? It's not clear, because *g* is defined in terms of itself. For example, if I said "define *f* by *f*(*x*) = *f*(*x*), this doesn't actually define a function.

This is an example of an inductive (or recursive) definition. Notice that whenever we define *g*(*a*, *b*) in terms of *g*(*x*, *y*), *y* is always smaller than *b*. That means we can only possibly need to compute *b* other values of *g* before needing *g*(*a*ʹ, 0) for some *a*ʹ, and this is well defined.

I claim that *g* computes the common divisor of *a* and *b*. What does this mean?

*g*(*a*,*b*) must be a common divisor of*a*and*b*:*g*(*a*,*b*)∣*a*and*g*(*a*,*b*)∣*b*.*g*(*a*,*b*) must be bigger than all other common divisors: if*c*∣*a*and*c*∣*b*then*g*(*a*,*b*) ≥*c*. We will in fact prove that*c*∣*g*(*a*,*b*) (which clearly can only happen if*c*≤*g*(*a*,*b*).