Books Number Theory

Greatest Common Divisors and Their Properties

Recall that we defined gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏) to be the greatest common divisor of integers 𝑎𝑎 and 𝑏𝑏, not both zero. Since 𝑎𝑎 and −𝑎-𝑎 have exactly the same set of factors, we may as well focus on the greatest common divisors of two nonnegative integers, for

gcd⁡(𝑎,𝑏)=gcd⁡(∣𝑎∣,∣𝑏∣).\gcd (𝑎,𝑏)=\gcd (|𝑎|,|𝑏|).

If we divide 𝑎𝑎 and 𝑏𝑏 by their greatest common divisor 𝑑=gcd⁡(𝑎,𝑏)𝑑=\gcd (𝑎,𝑏), we remove all their common factors. It is intuitive that the quotients 𝑎/𝑑𝑎/𝑑 and 𝑏/𝑑𝑏/𝑑 have no common factors other than ±1\pm 1, that is, they are coprime.

Theorem 3.1

Let 𝑎𝑎 and 𝑏𝑏 be integers, not both zero. We have

gcd⁡(𝑎/𝑑,𝑏/𝑑)=1\gcd (𝑎/𝑑,𝑏/𝑑)=1

where 𝑑=gcd⁡(𝑎,𝑏)𝑑=\gcd (𝑎,𝑏). That is, 𝑎/𝑑𝑎/𝑑 and 𝑏/𝑑𝑏/𝑑 are coprime.

Proof

Let 𝑎′=𝑎/𝑑{𝑎}^{\prime }=𝑎/𝑑 and 𝑏′=𝑏/𝑑{𝑏}^{\prime }=𝑏/𝑑, and let 𝑒=gcd⁡(𝑎′,𝑏′)𝑒=\gcd ({𝑎}^{\prime },{𝑏}^{\prime }). We want to show that 𝑒=1𝑒=1.

Since 𝑒∣𝑎′𝑒∣{𝑎}^{\prime }, we have 𝑒𝑑∣𝑎′𝑑=𝑎𝑒𝑑∣{𝑎}^{\prime }𝑑=𝑎. Similarly, 𝑒𝑑∣𝑏𝑒𝑑∣𝑏. Thus 𝑒𝑑𝑒𝑑 is a common divisor of 𝑎𝑎 and 𝑏𝑏. But 𝑑𝑑 is the greatest common divisor, so 𝑑𝑒≤𝑑𝑑𝑒\leq 𝑑. Dividing both sides by 𝑑𝑑, we obtain 𝑒≤1𝑒\leq 1, and hence 𝑒=1𝑒=1, since 𝑒𝑒 is positive.

The fraction 𝑝/𝑞𝑝/𝑞 is said to be in lowest terms or an irreducible fraction if gcd⁡(𝑝,𝑞)=1\gcd (𝑝,𝑞)=1. As a corollary of the preceding theorem, we may obtain an irreducible fraction from any two integers 𝑎𝑎 and 𝑏𝑏 (𝑏≠0𝑏\neq 0) by dividing them by their greatest common divisor.

Corollary 3.1

Let 𝑎,𝑏∈Z𝑎,𝑏\in \mathbb{Z} with 𝑏≠0𝑏\neq 0. Then there exist 𝑝,𝑞∈Z𝑝,𝑞\in \mathbb{Z} such that

𝑝𝑞=𝑎𝑏\frac{𝑝}{𝑞}=\frac{𝑎}{𝑏}

with gcd⁡(𝑝,𝑞)=1\gcd (𝑝,𝑞)=1.

Proof
The integers 𝑝=𝑎/gcd⁡(𝑎,𝑏)𝑝=𝑎/\gcd (𝑎,𝑏) and 𝑞=𝑏/gcd⁡(𝑎,𝑏)𝑞=𝑏/\gcd (𝑎,𝑏) are as desired.

Adding a multiple of one integer to the other does not change their greatest common divisor.

Theorem 3.2

Let 𝑎,𝑏,𝑐∈Z𝑎,𝑏,𝑐\in \mathbb{Z} and 𝑏≠0𝑏\neq 0. Then

gcd⁡(𝑎+𝑐𝑏,𝑏)=gcd⁡(𝑎,𝑏).\gcd (𝑎+𝑐𝑏,𝑏)=\gcd (𝑎,𝑏).
Proof

Let 𝑑=gcd⁡(𝑎,𝑏)𝑑=\gcd (𝑎,𝑏) and 𝑒=gcd⁡(𝑎+𝑐𝑏,𝑏)𝑒=\gcd (𝑎+𝑐𝑏,𝑏). We shall show that 𝑑=𝑒𝑑=𝑒 by showing both 𝑑≤𝑒𝑑\leq 𝑒 and 𝑒≤𝑑𝑒\leq 𝑑.

Since 𝑑∣𝑎𝑑∣𝑎 and 𝑑∣𝑏𝑑∣𝑏, by Proposition 1.11, 𝑑∣𝑎+𝑐𝑏𝑑∣𝑎+𝑐𝑏. Thus 𝑑𝑑 is a common divisor of 𝑎+𝑐𝑏𝑎+𝑐𝑏 and 𝑏𝑏. It then follows that 𝑑≤𝑒𝑑\leq 𝑒.

On the other hand, since 𝑒∣𝑎+𝑐𝑏𝑒∣𝑎+𝑐𝑏 and 𝑒∣𝑏𝑒∣𝑏, again by Proposition 1.11 we have 𝑒∣𝑎𝑒∣𝑎, since 𝑎=(𝑎+𝑐𝑏)−𝑐𝑏𝑎=(𝑎+𝑐𝑏)-𝑐𝑏. Therefore 𝑒𝑒 is a common divisor of 𝑎𝑎 and 𝑏𝑏, and hence 𝑒≤𝑑𝑒\leq 𝑑.

Therefore 𝑑=𝑒𝑑=𝑒.

Bézout’s Identity

Recall linear combinations of the integers 𝑎𝑎 and 𝑏𝑏: the integers of the form 𝑚𝑎+𝑛𝑏𝑚𝑎+𝑛𝑏. What is the smallest positive integer we can make by tuning the coefficients 𝑚𝑚 and 𝑛𝑛? The answer is gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏).

Theorem 3.3
The greatest common divisor of the integers 𝑎𝑎 and 𝑏𝑏, not both 00, is the least positive integer that is a linear combination of 𝑎𝑎 and 𝑏𝑏.
Proof

Let 𝑆𝑆 be the set of all positive linear combinations of 𝑎𝑎 and 𝑏𝑏, that is,

𝑆={𝑚𝑎+𝑛𝑏:𝑚,𝑛∈Z}∩Z+.𝑆=\{𝑚𝑎+𝑛𝑏:𝑚,𝑛\in \mathbb{Z}\}\cap {\mathbb{Z}}^{+}.

We want a least element of 𝑆𝑆. Note that 𝑎2+𝑏2{𝑎}^{2}+{𝑏}^{2} is a linear combination of 𝑎𝑎 and 𝑏𝑏, and 𝑎2+𝑏2>0{𝑎}^{2}+{𝑏}^{2}>0 since 𝑎𝑎 and 𝑏𝑏 are not both 00. Thus 𝑎2+𝑏2∈𝑆{𝑎}^{2}+{𝑏}^{2}\in 𝑆, so 𝑆≠∅𝑆\neq \emptyset . Since 𝑆𝑆 is a nonempty subset of Z+{\mathbb{Z}}^{+}, the well-ordering principle gives a least element 𝑑∈𝑆𝑑\in 𝑆. And 𝑑𝑑 can be written as 𝑑=𝑚𝑎+𝑛𝑏𝑑=𝑚𝑎+𝑛𝑏 for some 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z}.

Let 𝑑′=gcd⁡(𝑎,𝑏){𝑑}^{\prime }=\gcd (𝑎,𝑏). We want to show 𝑑=𝑑′𝑑={𝑑}^{\prime }.

Because 𝑑′∣𝑎{𝑑}^{\prime }∣𝑎 and 𝑑′∣𝑏{𝑑}^{\prime }∣𝑏, by Proposition 1.11 we have 𝑑′∣𝑚𝑎+𝑛𝑏=𝑑{𝑑}^{\prime }∣𝑚𝑎+𝑛𝑏=𝑑. Since 𝑑>0𝑑>0, we have 𝑑′≤𝑑{𝑑}^{\prime }\leq 𝑑.

For the other side of the inequality, we plan to show that 𝑑𝑑 divides both 𝑎𝑎 and 𝑏𝑏. By the division algorithm Theorem 1.5, we have

𝑎=𝑑𝑞+𝑟,𝑞,𝑟∈Z  with  0≤𝑟<𝑑.𝑎=𝑑𝑞+𝑟,\quad 𝑞,𝑟\in \mathbb{Z}\, \text{ with }\, 0\leq 𝑟<𝑑.

Substitute 𝑑=𝑚𝑎+𝑛𝑏𝑑=𝑚𝑎+𝑛𝑏:

𝑎=(𝑚𝑎+𝑛𝑏)𝑞+𝑟=(𝑚𝑞)𝑎+(𝑛𝑞)𝑏+𝑟.𝑎=(𝑚𝑎+𝑛𝑏)𝑞+𝑟=(𝑚𝑞)𝑎+(𝑛𝑞)𝑏+𝑟.

Rearrange:

(1−𝑚𝑞)𝑎+(−𝑛𝑞)𝑏=𝑟.(1-𝑚𝑞)𝑎+(-𝑛𝑞)𝑏=𝑟.

If 𝑟>0𝑟>0, then 𝑟∈𝑆𝑟\in 𝑆. That would contradict the fact that 𝑑𝑑 is the least element of 𝑆𝑆, since 𝑟<𝑑𝑟<𝑑. Therefore 𝑟=0𝑟=0, and hence 𝑑∣𝑎𝑑∣𝑎. The same argument shows that 𝑑∣𝑏𝑑∣𝑏. Thus 𝑑𝑑 is a common divisor of 𝑎𝑎 and 𝑏𝑏, so by definition 𝑑≤𝑑′𝑑\leq {𝑑}^{\prime }.

We have shown both 𝑑′≤𝑑{𝑑}^{\prime }\leq 𝑑 and 𝑑≤𝑑′𝑑\leq {𝑑}^{\prime }, and therefore 𝑑=𝑑′=gcd⁡(𝑎,𝑏)𝑑={𝑑}^{\prime }=\gcd (𝑎,𝑏).

Corollary 3.2Bézout's theorem
If 𝑎𝑎 and 𝑏𝑏 are integers, not both 00, then there exist 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z} such that 𝑚𝑎+𝑛𝑏=gcd⁡(𝑎,𝑏)𝑚𝑎+𝑛𝑏=\gcd (𝑎,𝑏).
Proof
By Theorem 3.3, gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏) is the least positive linear combination of 𝑎𝑎 and 𝑏𝑏, and hence gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏) can be written as 𝑚𝑎+𝑛𝑏𝑚𝑎+𝑛𝑏 for some integers 𝑚𝑚 and 𝑛𝑛.

gcd⁡(4,6)=2\gcd (4,6)=2. We have −4+6=2-4+6=2, and also 2⋅4−6=22\cdot 4-6=2. The solution of the equation

𝑚𝑎+𝑛𝑏=gcd⁡(𝑎,𝑏)𝑚𝑎+𝑛𝑏=\gcd (𝑎,𝑏)
(3.1)

is not unique. The equation is known as Bézout’s identity, and the integers 𝑚𝑚 and 𝑛𝑛 that satisfy it are called Bézout’s coefficients.

We think of the special case gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, and of being coprime.

Corollary 3.3
The integers 𝑎𝑎 and 𝑏𝑏 are relatively prime if and only if there exist 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z} such that 𝑚𝑎+𝑛𝑏=1𝑚𝑎+𝑛𝑏=1.
Proof

(⟹⟹). Suppose 𝑎𝑎 and 𝑏𝑏 are coprime. Then gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, so by Corollary 3.2 there exist 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z} such that 𝑚𝑎+𝑛𝑏=gcd⁡(𝑎,𝑏)=1𝑚𝑎+𝑛𝑏=\gcd (𝑎,𝑏)=1.

(⟸⟸). Suppose 𝑚𝑎+𝑛𝑏=1𝑚𝑎+𝑛𝑏=1. Clearly 𝑎𝑎 and 𝑏𝑏 are not both 00. Let 𝑆𝑆 be the set of all positive linear combinations of 𝑎𝑎 and 𝑏𝑏. We have 1∈𝑆1\in 𝑆. By Theorem 3.3, gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏) is the least element of 𝑆𝑆, and hence gcd⁡(𝑎,𝑏)≤1\gcd (𝑎,𝑏)\leq 1. Therefore gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1.

Consider a product 𝑏𝑐𝑏𝑐, and suppose that 𝑎∣𝑏𝑐𝑎∣𝑏𝑐 and gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1. Intuitively, 𝑏𝑏 has no irreducible factor in common with 𝑎𝑎, so every factor of 𝑎𝑎 must be contained in 𝑐𝑐, and hence 𝑎∣𝑐𝑎∣𝑐. This intuition is true, and we will formally state it in a later section on the unique factorization of integers. But we can still prove it now, with the tools we already have.

Proposition 3.1
If 𝑎∣𝑏𝑐𝑎∣𝑏𝑐 and gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, then 𝑎∣𝑐𝑎∣𝑐.
Proof

If 𝑎=0𝑎=0, then gcd⁡(0,𝑏)=1\gcd (0,𝑏)=1, so ∣𝑏∣=1|𝑏|=1 and 𝑏=±1𝑏=\pm 1. The hypothesis 0∣𝑏𝑐0∣𝑏𝑐 means 𝑏𝑐=0𝑏𝑐=0, hence 𝑐=0𝑐=0, and so 0∣𝑐0∣𝑐.

If 𝑎<0𝑎<0, then gcd⁡(∣𝑎∣,𝑏)=1\gcd (|𝑎|,𝑏)=1, and 𝑎∣𝑏𝑐𝑎∣𝑏𝑐 if and only if ∣𝑎∣∣𝑏𝑐|𝑎|∣𝑏𝑐. The case of a positive first argument, applied to ∣𝑎∣|𝑎|, gives ∣𝑎∣∣𝑐|𝑎|∣𝑐, and hence 𝑎∣𝑐𝑎∣𝑐. We may therefore assume that 𝑎>0𝑎>0.

By Theorem 1.5, we can write

𝑐=𝑎𝑞+𝑟𝑐=𝑎𝑞+𝑟

for some 𝑞,𝑟∈Z𝑞,𝑟\in \mathbb{Z} with 0≤𝑟<𝑎0\leq 𝑟<𝑎. Then

𝑏𝑐=𝑎𝑏𝑞+𝑏𝑟.𝑏𝑐=𝑎𝑏𝑞+𝑏𝑟.

Since 𝑎∣𝑏𝑐𝑎∣𝑏𝑐 and 𝑎∣𝑎𝑏𝑞𝑎∣𝑎𝑏𝑞, we have 𝑎∣𝑏𝑟𝑎∣𝑏𝑟.

Because gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, by Corollary 3.3 there exist 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z} such that 𝑚𝑎+𝑛𝑏=1𝑚𝑎+𝑛𝑏=1. Multiplying through by 𝑟𝑟 gives

𝑚𝑎𝑟+𝑛𝑏𝑟=𝑟.𝑚𝑎𝑟+𝑛𝑏𝑟=𝑟.

Note that 𝑎∣𝑚𝑎𝑟𝑎∣𝑚𝑎𝑟 and 𝑎∣𝑛𝑏𝑟𝑎∣𝑛𝑏𝑟. It then follows that 𝑎∣𝑟𝑎∣𝑟. But 0≤𝑟<𝑎0\leq 𝑟<𝑎, so 𝑟=0𝑟=0, which means that 𝑎∣𝑐𝑎∣𝑐.

It will turn out that this proposition is very useful in proofs.

Sometimes we write Bézout’s identity as

𝑎𝑥+𝑏𝑦=gcd⁡(𝑎,𝑏),𝑎𝑥+𝑏𝑦=\gcd (𝑎,𝑏),
(3.2)

where we use the letters 𝑥𝑥 and 𝑦𝑦 to emphasize that they are coefficients, and variables. Previously we said that the solution is not unique. Here we discuss the precise form of the solution.

When one of 𝑎𝑎 and 𝑏𝑏 is 00, the solution is degenerate, and not interesting. If 𝑎=𝑏=0𝑎=𝑏=0, then gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏) is not defined, so (3.2) does not arise. If 𝑎≠0𝑎\neq 0 and 𝑏=0𝑏=0, then 𝑎𝑥=∣𝑎∣𝑎𝑥=|𝑎|. In this case 𝑥=1𝑥=1 if 𝑎>0𝑎>0, and 𝑥=−1𝑥=-1 if 𝑎<0𝑎<0. The integer 𝑦𝑦 can be anything.

Looking first at (3.2), we note that it is precisely the equation of a line in the plane. And by Corollary 3.2, we already have one particular solution, say (𝑥0,𝑦0)({𝑥}_{0},{𝑦}_{0}). Using parametric equations, we write

𝑥=𝑥0+𝑏𝑡,𝑦=𝑦0−𝑎𝑡,\begin{aligned}𝑥 & ={𝑥}_{0}+𝑏𝑡, \\ 𝑦 & ={𝑦}_{0}-𝑎𝑡,\end{aligned}

where the parameter 𝑡∈Z𝑡\in \mathbb{Z}. Substituting into (3.2), we see that such 𝑥𝑥 and 𝑦𝑦 do solve the equation. But are these the only solutions?

Start with the special case gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1.

Proposition 3.2

Let 𝑎,𝑏∈Z𝑎,𝑏\in \mathbb{Z} with gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, and with 𝑎𝑎 and 𝑏𝑏 both nonzero. The solutions of

𝑎𝑥+𝑏𝑦=1𝑎𝑥+𝑏𝑦=1
(3.3)

are of the form

𝑥=𝑥0+𝑏𝑡,𝑦=𝑦0−𝑎𝑡,\begin{aligned}𝑥 & ={𝑥}_{0}+𝑏𝑡, \\ 𝑦 & ={𝑦}_{0}-𝑎𝑡,\end{aligned}

where (𝑥0,𝑦0)({𝑥}_{0},{𝑦}_{0}) is a particular solution of (3.3) and 𝑡∈Z𝑡\in \mathbb{Z}.

Proof

It is easy to verify that 𝑥=𝑥0+𝑏𝑡𝑥={𝑥}_{0}+𝑏𝑡 and 𝑦=𝑦0−𝑎𝑡𝑦={𝑦}_{0}-𝑎𝑡 do solve (3.3).

Conversely, suppose that (𝑥,𝑦)(𝑥,𝑦) is a solution of (3.3). We have

𝑎𝑥+𝑏𝑦=1,𝑎𝑥0+𝑏𝑦0=1.\begin{aligned}𝑎𝑥+𝑏𝑦 & =1, \\ 𝑎{𝑥}_{0}+𝑏{𝑦}_{0} & =1.\end{aligned}

Subtracting these equations yields

𝑎(𝑥−𝑥0)+𝑏(𝑦−𝑦0)=0.𝑎(𝑥-{𝑥}_{0})+𝑏(𝑦-{𝑦}_{0})=0.

Note that 𝑏∣𝑎(𝑥−𝑥0)𝑏∣𝑎(𝑥-{𝑥}_{0}), because 𝑏∣0𝑏∣0 and 𝑏∣𝑏(𝑦−𝑦0)𝑏∣𝑏(𝑦-{𝑦}_{0}). Since gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, by Proposition 3.1 we have 𝑏∣𝑥−𝑥0𝑏∣𝑥-{𝑥}_{0}. Then there exists 𝑡∈Z𝑡\in \mathbb{Z} such that 𝑥−𝑥0=𝑏𝑡𝑥-{𝑥}_{0}=𝑏𝑡. Substitute into the subtracted equation:

𝑎(𝑏𝑡)+𝑏(𝑦−𝑦0)=0.𝑎(𝑏𝑡)+𝑏(𝑦-{𝑦}_{0})=0.

Since 𝑏≠0𝑏\neq 0, we obtain 𝑦−𝑦0=−𝑎𝑡𝑦-{𝑦}_{0}=-𝑎𝑡. Therefore 𝑥=𝑥0+𝑏𝑡𝑥={𝑥}_{0}+𝑏𝑡 and 𝑦=𝑦0−𝑎𝑡𝑦={𝑦}_{0}-𝑎𝑡.

Now, to generalize to any integers 𝑎𝑎 and 𝑏𝑏, the proof is simple: divide by the greatest common divisor, and reduce to two relatively prime integers.

Proposition 3.3

Let 𝑎,𝑏∈Z𝑎,𝑏\in \mathbb{Z}, both nonzero, and let 𝑑=gcd⁡(𝑎,𝑏)𝑑=\gcd (𝑎,𝑏). The solutions of

𝑎𝑥+𝑏𝑦=𝑑𝑎𝑥+𝑏𝑦=𝑑
(3.4)

are of the form

𝑥=𝑥0+(𝑏𝑑)𝑡,𝑦=𝑦0−(𝑎𝑑)𝑡,\begin{aligned}𝑥 & ={𝑥}_{0}+\left(\frac{𝑏}{𝑑}\right)𝑡, \\ 𝑦 & ={𝑦}_{0}-\left(\frac{𝑎}{𝑑}\right)𝑡,\end{aligned}

where (𝑥0,𝑦0)({𝑥}_{0},{𝑦}_{0}) is a particular solution of (3.4) and 𝑡∈Z𝑡\in \mathbb{Z}.

Proof

Let 𝑎′=𝑎/𝑑{𝑎}^{\prime }=𝑎/𝑑 and 𝑏′=𝑏/𝑑{𝑏}^{\prime }=𝑏/𝑑. We have gcd⁡(𝑎′,𝑏′)=1\gcd ({𝑎}^{\prime },{𝑏}^{\prime })=1, and neither 𝑎′{𝑎}^{\prime } nor 𝑏′{𝑏}^{\prime } is 00.

Since 𝑎=𝑎′𝑑𝑎={𝑎}^{\prime }𝑑 and 𝑏=𝑏′𝑑𝑏={𝑏}^{\prime }𝑑, the equation (3.4) is 𝑑(𝑎′𝑥+𝑏′𝑦)=𝑑𝑑({𝑎}^{\prime }𝑥+{𝑏}^{\prime }𝑦)=𝑑. As 𝑑≠0𝑑\neq 0, this is equivalent to 𝑎′𝑥+𝑏′𝑦=1{𝑎}^{\prime }𝑥+{𝑏}^{\prime }𝑦=1. Thus the solutions of (3.4) are precisely the solutions of 𝑎′𝑥+𝑏′𝑦=1{𝑎}^{\prime }𝑥+{𝑏}^{\prime }𝑦=1.

Let (𝑥0,𝑦0)({𝑥}_{0},{𝑦}_{0}) be a particular solution of (3.4). Then it is a particular solution of 𝑎′𝑥+𝑏′𝑦=1{𝑎}^{\prime }𝑥+{𝑏}^{\prime }𝑦=1. By Proposition 3.2, the solutions are

𝑥=𝑥0+𝑏′𝑡,𝑦=𝑦0−𝑎′𝑡,\begin{aligned}𝑥 & ={𝑥}_{0}+{𝑏}^{\prime }𝑡, \\ 𝑦 & ={𝑦}_{0}-{𝑎}^{\prime }𝑡,\end{aligned}

where 𝑡∈Z𝑡\in \mathbb{Z}. Since 𝑏′=𝑏𝑑{𝑏}^{\prime }=\frac{𝑏}{𝑑} and 𝑎′=𝑎𝑑{𝑎}^{\prime }=\frac{𝑎}{𝑑}, this is

𝑥=𝑥0+(𝑏𝑑)𝑡,𝑦=𝑦0−(𝑎𝑑)𝑡.\begin{aligned}𝑥 & ={𝑥}_{0}+\left(\frac{𝑏}{𝑑}\right)𝑡, \\ 𝑦 & ={𝑦}_{0}-\left(\frac{𝑎}{𝑑}\right)𝑡.\end{aligned}

Theorem 3.3 gives us a different perspective on the greatest common divisor, and an alternative way of viewing it. Besides being the greatest integer in the set of common divisors of 𝑎𝑎 and 𝑏𝑏, it is equivalently the least positive linear combination of 𝑎𝑎 and 𝑏𝑏. Different perspectives are usually useful in a proof: we may choose the one that suits best.

Theorem 3.4
Let 𝑎,𝑏∈Z+𝑎,𝑏\in {\mathbb{Z}}^{+}. The set of linear combinations of 𝑎𝑎 and 𝑏𝑏, 𝑎Z+𝑏Z𝑎\mathbb{Z}+𝑏\mathbb{Z}, is the set of integer multiples of gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏), gcd⁡(𝑎,𝑏)Z\gcd (𝑎,𝑏)\mathbb{Z}.
Proof

We first show that 𝑎Z+𝑏Z⊆gcd⁡(𝑎,𝑏)Z𝑎\mathbb{Z}+𝑏\mathbb{Z}\subseteq \gcd (𝑎,𝑏)\mathbb{Z}. Let 𝑑∈𝑎Z+𝑏Z𝑑\in 𝑎\mathbb{Z}+𝑏\mathbb{Z}. Then 𝑑=𝑚𝑎+𝑛𝑏𝑑=𝑚𝑎+𝑛𝑏 for some 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z}. We have 𝑎=𝑎′gcd⁡(𝑎,𝑏)𝑎={𝑎}^{\prime }\gcd (𝑎,𝑏) and 𝑏=𝑏′gcd⁡(𝑎,𝑏)𝑏={𝑏}^{\prime }\gcd (𝑎,𝑏) for some 𝑎′,𝑏′∈Z{𝑎}^{\prime },{𝑏}^{\prime }\in \mathbb{Z}. Thus 𝑑=(𝑚𝑎′+𝑛𝑏′)gcd⁡(𝑎,𝑏)𝑑=(𝑚{𝑎}^{\prime }+𝑛{𝑏}^{\prime })\gcd (𝑎,𝑏), and hence 𝑑∈gcd⁡(𝑎,𝑏)Z𝑑\in \gcd (𝑎,𝑏)\mathbb{Z}. Therefore 𝑎Z+𝑏Z⊆gcd⁡(𝑎,𝑏)Z𝑎\mathbb{Z}+𝑏\mathbb{Z}\subseteq \gcd (𝑎,𝑏)\mathbb{Z}.

Next we show that gcd⁡(𝑎,𝑏)Z⊆𝑎Z+𝑏Z\gcd (𝑎,𝑏)\mathbb{Z}\subseteq 𝑎\mathbb{Z}+𝑏\mathbb{Z}. For any 𝑑∈gcd⁡(𝑎,𝑏)Z𝑑\in \gcd (𝑎,𝑏)\mathbb{Z}, we have 𝑑=𝑘gcd⁡(𝑎,𝑏)𝑑=𝑘\gcd (𝑎,𝑏). By Theorem 3.3, gcd⁡(𝑎,𝑏)∈𝑎Z+𝑏Z\gcd (𝑎,𝑏)\in 𝑎\mathbb{Z}+𝑏\mathbb{Z}, and hence gcd⁡(𝑎,𝑏)=𝑚𝑎+𝑛𝑏\gcd (𝑎,𝑏)=𝑚𝑎+𝑛𝑏 for some 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z}. Therefore 𝑑=𝑘𝑚𝑎+𝑘𝑛𝑏∈𝑎Z+𝑏Z𝑑=𝑘𝑚𝑎+𝑘𝑛𝑏\in 𝑎\mathbb{Z}+𝑏\mathbb{Z}, and hence gcd⁡(𝑎,𝑏)Z⊆𝑎Z+𝑏Z\gcd (𝑎,𝑏)\mathbb{Z}\subseteq 𝑎\mathbb{Z}+𝑏\mathbb{Z}.

We defined the greatest common divisor by the notion of order. We can also define it without that notion. This characterization, free of order, is generalized in algebraic number theory, where it applies to algebraic number fields.

In mathematics we often meet this way of working. We define a concept while learning one particular field, and later find that a wider field has a concept of the same kind, so I want to generalize it. But this also makes a great trouble for learning. In many books written from a high viewpoint, the definitions are abstract and hard to follow, because they were made for the wider field. They run against intuition and against the path of learning, and they are no place to begin.

Theorem 3.5

If 𝑎𝑎 and 𝑏𝑏 are integers, not both 00, then a positive integer 𝑑𝑑 is the greatest common divisor of 𝑎𝑎 and 𝑏𝑏 if and only if

  1. 𝑑∣𝑎𝑑∣𝑎 and 𝑑∣𝑏𝑑∣𝑏,
  2. if 𝑐𝑐 is an integer with 𝑐∣𝑎𝑐∣𝑎 and 𝑐∣𝑏𝑐∣𝑏, then 𝑐∣𝑑𝑐∣𝑑.
Proof

(⟹⟹). Let 𝑑=gcd⁡(𝑎,𝑏)𝑑=\gcd (𝑎,𝑏). The first property holds by definition. Let 𝑐∈Z𝑐\in \mathbb{Z} be such that 𝑐∣𝑎𝑐∣𝑎 and 𝑐∣𝑏𝑐∣𝑏. By Theorem 3.3, there exist 𝑚,𝑛∈Z𝑚,𝑛\in \mathbb{Z} such that 𝑑=𝑚𝑎+𝑛𝑏𝑑=𝑚𝑎+𝑛𝑏. Then, by Proposition 1.11, 𝑐∣𝑚𝑎+𝑛𝑏=𝑑𝑐∣𝑚𝑎+𝑛𝑏=𝑑. Thus the second property holds.

(⟸⟸). Let 𝑑′=gcd⁡(𝑎,𝑏){𝑑}^{\prime }=\gcd (𝑎,𝑏). By the property of 𝑑𝑑, we have 𝑑′∣𝑑{𝑑}^{\prime }∣𝑑. Thus 𝑑𝑑 can be written as 𝑑=𝑑′𝑘𝑑={𝑑}^{\prime }𝑘 for some 𝑘∈Z+𝑘\in {\mathbb{Z}}^{+}. (𝑑>0𝑑>0.) Meanwhile, since 𝑑𝑑 is a common divisor of 𝑎𝑎 and 𝑏𝑏, we have 𝑑≤𝑑′𝑑\leq {𝑑}^{\prime }. It then follows that 𝑘≤1𝑘\leq 1, and hence 𝑘=1𝑘=1. Therefore 𝑑′=𝑑{𝑑}^{\prime }=𝑑.

Theorem 3.5 tells us that gcd⁡(𝑎,𝑏)\gcd (𝑎,𝑏) is divisible by all other common divisors of 𝑎𝑎 and 𝑏𝑏.

The Greatest Common Divisor of Multiple Integers

We can also define the greatest common divisor of multiple integers.

Definition 3.1
Let 𝑎1,𝑎2,…,𝑎𝑛∈Z{𝑎}_{1},{𝑎}_{2},\ldots ,{𝑎}_{𝑛}\in \mathbb{Z}, not all 00. The greatest common divisor of them is the largest integer in the set of their common divisors. It is denoted by gcd⁡(𝑎1,…,𝑎𝑛)\gcd ({𝑎}_{1},\ldots ,{𝑎}_{𝑛}).

Clearly, the order of the 𝑎𝑖{𝑎}_{𝑖} in gcd⁡(𝑎1,…,𝑎𝑛)\gcd ({𝑎}_{1},\ldots ,{𝑎}_{𝑛}) does not matter. That is,

gcd⁡(𝑎𝑘1,…,𝑎𝑘𝑛)=gcd⁡(𝑎1,…,𝑎𝑛),\gcd ({𝑎}_{{𝑘}_{1}},\ldots ,{𝑎}_{{𝑘}_{𝑛}})=\gcd ({𝑎}_{1},\ldots ,{𝑎}_{𝑛}),

where 𝑘1,…,𝑘𝑛{𝑘}_{1},\ldots ,{𝑘}_{𝑛} is a permutation of 1,…,𝑛1,\ldots ,𝑛.

We can find the greatest common divisor of multiple integers by first finding the gcd of two of them, and then repeating this step.

Lemma 3.1

If 𝑎1,𝑎2,…,𝑎𝑛∈Z{𝑎}_{1},{𝑎}_{2},\ldots ,{𝑎}_{𝑛}\in \mathbb{Z}, not all 00, then

gcd⁡(𝑎1,…,𝑎𝑛)=gcd⁡(𝑎1,…,gcd⁡(𝑎𝑛−1,𝑎𝑛)).\gcd ({𝑎}_{1},\ldots ,{𝑎}_{𝑛})=\gcd ({𝑎}_{1},\ldots ,\gcd ({𝑎}_{𝑛-1},{𝑎}_{𝑛})).
Proof

Let 𝑑=gcd⁡(𝑎1,…,𝑎𝑛)𝑑=\gcd ({𝑎}_{1},\ldots ,{𝑎}_{𝑛}) and 𝑑′=gcd⁡(𝑎1,…,gcd⁡(𝑎𝑛−1,𝑎𝑛)){𝑑}^{\prime }=\gcd ({𝑎}_{1},\ldots ,\gcd ({𝑎}_{𝑛-1},{𝑎}_{𝑛})).

Since 𝑑∣𝑎𝑛−1𝑑∣{𝑎}_{𝑛-1} and 𝑑∣𝑎𝑛𝑑∣{𝑎}_{𝑛}, by Theorem 3.5 we have 𝑑∣gcd⁡(𝑎𝑛−1,𝑎𝑛)𝑑∣\gcd ({𝑎}_{𝑛-1},{𝑎}_{𝑛}). Hence 𝑑𝑑 is a common divisor of 𝑎1,𝑎2,…,gcd⁡(𝑎𝑛−1,𝑎𝑛){𝑎}_{1},{𝑎}_{2},\ldots ,\gcd ({𝑎}_{𝑛-1},{𝑎}_{𝑛}). It then follows that 𝑑≤𝑑′𝑑\leq {𝑑}^{\prime }.

On the other hand, since 𝑑′∣gcd⁡(𝑎𝑛−1,𝑎𝑛){𝑑}^{\prime }∣\gcd ({𝑎}_{𝑛-1},{𝑎}_{𝑛}), and gcd⁡(𝑎𝑛−1,𝑎𝑛)\gcd ({𝑎}_{𝑛-1},{𝑎}_{𝑛}) divides both 𝑎𝑛−1{𝑎}_{𝑛-1} and 𝑎𝑛{𝑎}_{𝑛}, transitivity gives that 𝑑′{𝑑}^{\prime } divides both 𝑎𝑛−1{𝑎}_{𝑛-1} and 𝑎𝑛{𝑎}_{𝑛}. Thus 𝑑′{𝑑}^{\prime } is a common divisor of 𝑎1,…,𝑎𝑛{𝑎}_{1},\ldots ,{𝑎}_{𝑛}, and hence 𝑑′≤𝑑{𝑑}^{\prime }\leq 𝑑.

Therefore 𝑑=𝑑′𝑑={𝑑}^{\prime }.

Definition 3.2
We say that the integers 𝑎1,…,𝑎𝑛{𝑎}_{1},\ldots ,{𝑎}_{𝑛} are mutually relatively prime if gcd⁡(𝑎1,…,𝑎𝑛)=1\gcd ({𝑎}_{1},\ldots ,{𝑎}_{𝑛})=1. And we say they are pairwise relatively prime if gcd⁡(𝑎𝑖,𝑎𝑗)=1\gcd ({𝑎}_{𝑖},{𝑎}_{𝑗})=1 for every 𝑖≠𝑗𝑖\neq 𝑗.

Clearly, pairwise relatively prime implies mutually relatively prime.

Farey Sequences

Definition 3.3
A Farey sequence 𝔉𝑛{𝔉}_{𝑛} of order 𝑛𝑛, named after John Farey, is a finite sequence of irreducible fractions h/𝑘h/𝑘, where 0≤h≤𝑘≤𝑛0\leq h\leq 𝑘\leq 𝑛, in increasing order.

The first eight are

𝔉1={01,11},𝔉2={01,12,11},𝔉3={01,13,12,23,11},𝔉4={01,14,13,12,23,34,11},𝔉5={01,15,14,13,25,12,35,23,34,45,11},𝔉6={01,16,15,14,13,25,12,35,23,34,45,56,11},𝔉7={01,17,16,15,14,27,13,25,37,12,47,35,23,57,34,45,56,67,11},𝔉8={01,18,17,16,15,14,27,13,38,25,37,12,47,35,58,23,57,34,45,56,67,78,11}.\begin{aligned}{𝔉}_{1} & =\left\{\frac{0}{1},\frac{1}{1}\right\}, \\ {𝔉}_{2} & =\left\{\frac{0}{1},\frac{1}{2},\frac{1}{1}\right\}, \\ {𝔉}_{3} & =\left\{\frac{0}{1},\frac{1}{3},\frac{1}{2},\frac{2}{3},\frac{1}{1}\right\}, \\ {𝔉}_{4} & =\left\{\frac{0}{1},\frac{1}{4},\frac{1}{3},\frac{1}{2},\frac{2}{3},\frac{3}{4},\frac{1}{1}\right\}, \\ {𝔉}_{5} & =\left\{\frac{0}{1},\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{2}{5},\frac{1}{2},\frac{3}{5},\frac{2}{3},\frac{3}{4},\frac{4}{5},\frac{1}{1}\right\}, \\ {𝔉}_{6} & =\left\{\frac{0}{1},\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{2}{5},\frac{1}{2},\frac{3}{5},\frac{2}{3},\frac{3}{4},\frac{4}{5},\frac{5}{6},\frac{1}{1}\right\}, \\ {𝔉}_{7} & =\left\{\frac{0}{1},\frac{1}{7},\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{2}{7},\frac{1}{3},\frac{2}{5},\frac{3}{7},\frac{1}{2},\frac{4}{7},\frac{3}{5},\frac{2}{3},\frac{5}{7},\frac{3}{4},\frac{4}{5},\frac{5}{6},\frac{6}{7},\frac{1}{1}\right\}, \\ {𝔉}_{8} & =\left\{\frac{0}{1},\frac{1}{8},\frac{1}{7},\frac{1}{6},\frac{1}{5},\frac{1}{4},\frac{2}{7},\frac{1}{3},\frac{3}{8},\frac{2}{5},\frac{3}{7},\frac{1}{2}\right., \\ & \left.\frac{4}{7},\frac{3}{5},\frac{5}{8},\frac{2}{3},\frac{5}{7},\frac{3}{4},\frac{4}{5},\frac{5}{6},\frac{6}{7},\frac{7}{8},\frac{1}{1}\right\}.\end{aligned}

For a fraction 𝑎/𝑏<1𝑎/𝑏<1 in a Farey sequence, the following lemma finds a fraction after 𝑎/𝑏𝑎/𝑏 with certain properties. In fact, we will see that it is precisely the term consecutive to 𝑎/𝑏𝑎/𝑏.

Lemma 3.2

Let 𝑎/𝑏<1𝑎/𝑏<1 be a term in a Farey sequence 𝔉𝑛{𝔉}_{𝑛} of order 𝑛𝑛. We can always find a term 𝑝/𝑞𝑝/𝑞 in 𝔉𝑛{𝔉}_{𝑛} such that

  1. 𝑎/𝑏<𝑝/𝑞𝑎/𝑏<𝑝/𝑞,
  2. 𝑎𝑞−𝑏𝑝=−1𝑎𝑞-𝑏𝑝=-1, and
  3. 𝑏+𝑞>𝑛𝑏+𝑞>𝑛.

The second property can be memorized using the determinant

∣𝑎𝑝𝑏𝑞∣=−1.\begin{vmatrix}𝑎 & 𝑝 \\ 𝑏 & 𝑞\end{vmatrix}=-1.
Proof

Because gcd⁡(𝑎,𝑏)=1\gcd (𝑎,𝑏)=1, a small tweak of the solutions in Bézout’s identity Proposition 3.2 gives the solutions of

𝑎𝑥−𝑏𝑦=−1𝑎𝑥-𝑏𝑦=-1

as

𝑥=𝑥0+𝑏𝑡,𝑦=𝑦0+𝑎𝑡,\begin{aligned}𝑥 & ={𝑥}_{0}+𝑏𝑡, \\ 𝑦 & ={𝑦}_{0}+𝑎𝑡,\end{aligned}

where (𝑥0,𝑦0)({𝑥}_{0},{𝑦}_{0}) is a particular solution and 𝑡∈Z𝑡\in \mathbb{Z}.

Note

In a draft paper, we want 𝑥𝑥, which will be the desired 𝑞𝑞, to satisfy

𝑥≤𝑛and𝑏+𝑥>𝑛.𝑥\leq 𝑛\quad \text{and}\quad 𝑏+𝑥>𝑛.

It then follows that

𝑥0+𝑏𝑡≤𝑛𝑥0+𝑏𝑡+𝑏>𝑛.\begin{aligned}{𝑥}_{0}+𝑏𝑡 & \leq 𝑛 \\ {𝑥}_{0}+𝑏𝑡+𝑏 & >𝑛.\end{aligned}

Together,

𝑛−𝑏<𝑥0+𝑏𝑡≤𝑛.𝑛-𝑏<{𝑥}_{0}+𝑏𝑡\leq 𝑛.

Then

𝑛−𝑏−𝑥0𝑏<𝑡≤𝑛−𝑥0𝑏.\frac{𝑛-𝑏-{𝑥}_{0}}{𝑏}<𝑡\leq \frac{𝑛-{𝑥}_{0}}{𝑏}.

Rearrange:

𝑡≤𝑛−𝑥0𝑏<𝑡+1,𝑡\leq \frac{𝑛-{𝑥}_{0}}{𝑏}<𝑡+1,

which says 𝑡=⌊(𝑛−𝑥0)/𝑏⌋𝑡=\lfloor (𝑛-{𝑥}_{0})/𝑏\rfloor . In the proof, we can start from this value of 𝑡𝑡.

Let 𝑡=⌊(𝑛−𝑥0)/𝑏⌋𝑡=\lfloor (𝑛-{𝑥}_{0})/𝑏\rfloor and 𝑞=𝑥0+𝑏𝑡𝑞={𝑥}_{0}+𝑏𝑡, and let 𝑝𝑝 be determined accordingly. We will show that 𝑝𝑝 and 𝑞𝑞 are as desired.

We have

𝑡≤𝑛−𝑥0𝑏<𝑡+1.𝑡\leq \frac{𝑛-{𝑥}_{0}}{𝑏}<𝑡+1.

Rearrange:

𝑛−𝑏<𝑥0+𝑏𝑡≤𝑛.𝑛-𝑏<{𝑥}_{0}+𝑏𝑡\leq 𝑛.

It then follows that

𝑞=𝑥0+𝑏𝑡≤𝑛𝑏+𝑞=𝑥0+𝑏𝑡+𝑏>𝑛.\begin{aligned}𝑞={𝑥}_{0}+𝑏𝑡 & \leq 𝑛 \\ 𝑏+𝑞={𝑥}_{0}+𝑏𝑡+𝑏 & >𝑛.\end{aligned}

Thus 𝑞≤𝑛𝑞\leq 𝑛, as the definition of a Farey sequence requires, and 𝑏+𝑞>𝑛𝑏+𝑞>𝑛, which is the third property.

Recall that

𝑎𝑞−𝑏𝑝=−1.𝑎𝑞-𝑏𝑝=-1.
(3.5)

This is exactly the second property. We still need 𝑝𝑝 to be valid. We have

𝑝=𝑎𝑞+1𝑏=(𝑎𝑏)𝑞+1𝑏<𝑞+1𝑏.𝑝=\frac{𝑎𝑞+1}{𝑏}=\left(\frac{𝑎}{𝑏}\right)𝑞+\frac{1}{𝑏}<𝑞+\frac{1}{𝑏}.

Here 𝑎/𝑏<1𝑎/𝑏<1 is the given condition, so 𝑝≤𝑞𝑝\leq 𝑞. And from (3.5),

𝑎𝑞−𝑏𝑝=−1<0.𝑎𝑞-𝑏𝑝=-1<0.

Then 𝑎𝑞<𝑏𝑝𝑎𝑞<𝑏𝑝, and hence 𝑎/𝑏<𝑝/𝑞𝑎/𝑏<𝑝/𝑞. (Both 𝑏𝑏 and 𝑞𝑞 are greater than 00, as we know.) This shows that the first property holds, and also that 𝑝≥0𝑝\geq 0, so 𝑝/𝑞𝑝/𝑞 is indeed a term of 𝔉𝑛{𝔉}_{𝑛}.

Thus all three properties hold, and 𝑝/𝑞𝑝/𝑞 lies in 𝔉𝑛{𝔉}_{𝑛}.

Lemma 3.2 finds a fraction after 𝑎/𝑏𝑎/𝑏. It does not yet say that this fraction is the next term: something might still sit between them. The next lemma says that nothing does.

Lemma 3.3
Let 𝑎/𝑏<1𝑎/𝑏<1 be a term in a Farey sequence 𝔉𝑛{𝔉}_{𝑛} of order 𝑛𝑛, and let 𝑝/𝑞𝑝/𝑞 be the term found in Lemma 3.2 with all those properties. Then 𝑝/𝑞𝑝/𝑞 is the term consecutive to 𝑎/𝑏𝑎/𝑏 in 𝔉𝑛{𝔉}_{𝑛}. In other words, if 𝑎/𝑏𝑎/𝑏 and 𝑐/𝑑𝑐/𝑑 are consecutive terms in 𝔉𝑛{𝔉}_{𝑛}, then 𝑐/𝑑=𝑝/𝑞𝑐/𝑑=𝑝/𝑞.
Proof

We prove by contradiction. Assume that 𝑐/𝑑𝑐/𝑑 is the term consecutive to 𝑎/𝑏𝑎/𝑏, and that it is not 𝑝/𝑞𝑝/𝑞. Then 𝑐/𝑑𝑐/𝑑 sits strictly between the fraction we started with and the fraction we built:

𝑎𝑏<𝑐𝑑<𝑝𝑞.\frac{𝑎}{𝑏}<\frac{𝑐}{𝑑}<\frac{𝑝}{𝑞}.

A strict inequality of two fractions with positive denominators is a positive cross-difference, and a positive integer is at least 11. The first inequality implies 𝑎𝑑<𝑏𝑐𝑎𝑑<𝑏𝑐, so 𝑏𝑐−𝑎𝑑>0𝑏𝑐-𝑎𝑑>0. The difference is an integer, so 𝑏𝑐−𝑎𝑑≥1𝑏𝑐-𝑎𝑑\geq 1. The same argument, from 𝑐/𝑑<𝑝/𝑞𝑐/𝑑<𝑝/𝑞, gives 𝑑𝑝−𝑐𝑞≥1𝑑𝑝-𝑐𝑞\geq 1.

The two gaps are now integers we can weight. Multiply the first by 𝑞𝑞 and the second by 𝑏𝑏, and add. This is the step the argument turns on. The terms 𝑏𝑐𝑞𝑏𝑐𝑞 cancel, and the second property of Lemma 3.2 turns what remains into exactly 𝑑𝑑:

𝑞(𝑏𝑐−𝑎𝑑)+𝑏(𝑑𝑝−𝑐𝑞)=𝑏𝑐𝑞−𝑎𝑑𝑞+𝑏𝑑𝑝−𝑏𝑐𝑞=𝑑(𝑏𝑝−𝑎𝑞)=𝑑,\begin{aligned}𝑞(𝑏𝑐-𝑎𝑑)+𝑏(𝑑𝑝-𝑐𝑞) & =𝑏𝑐𝑞-𝑎𝑑𝑞+𝑏𝑑𝑝-𝑏𝑐𝑞 \\ & =𝑑(𝑏𝑝-𝑎𝑞) \\ & =𝑑,\end{aligned}

where the last equality follows from 𝑎𝑞−𝑏𝑝=−1𝑎𝑞-𝑏𝑝=-1.

The same sum is large for a different reason. Each gap is at least 11, and the third property of Lemma 3.2 says 𝑏+𝑞>𝑛𝑏+𝑞>𝑛, so

𝑞(𝑏𝑐−𝑎𝑑)+𝑏(𝑑𝑝−𝑐𝑞)≥𝑞+𝑏>𝑛.𝑞(𝑏𝑐-𝑎𝑑)+𝑏(𝑑𝑝-𝑐𝑞)\geq 𝑞+𝑏>𝑛.

The left side equals 𝑑𝑑, so 𝑑>𝑛𝑑>𝑛. Then 𝑐/𝑑𝑐/𝑑 cannot be a term in 𝔉𝑛{𝔉}_{𝑛}: a contradiction. Therefore the original assumption is false, and 𝑐/𝑑=𝑝/𝑞𝑐/𝑑=𝑝/𝑞.

Both extra properties of Lemma 3.2 are spent once, and neither is decorative. 𝑎𝑞−𝑏𝑝=−1𝑎𝑞-𝑏𝑝=-1 is what collapses the weighted gaps to 𝑑𝑑, rather than to some larger multiple of 𝑑𝑑. 𝑏+𝑞>𝑛𝑏+𝑞>𝑛 is what makes that 𝑑𝑑 too big for 𝔉𝑛{𝔉}_{𝑛}.

The consecutive term is the fraction Lemma 3.2 already built. The two properties we used to single it out are therefore properties of any consecutive pair. We only have to rename.

Theorem 3.6

If 𝑎/𝑏𝑎/𝑏 and 𝑐/𝑑𝑐/𝑑 are two consecutive terms in 𝔉𝑛{𝔉}_{𝑛}, then

  1. 𝑎𝑑−𝑏𝑐=−1𝑎𝑑-𝑏𝑐=-1, and
  2. 𝑏+𝑑>𝑛𝑏+𝑑>𝑛.
Proof
Since 𝑎/𝑏<1𝑎/𝑏<1, by Lemma 3.2 we may construct 𝑝/𝑞𝑝/𝑞 in 𝔉𝑛{𝔉}_{𝑛}, larger than 𝑎/𝑏𝑎/𝑏, such that 𝑎𝑞−𝑏𝑝=−1𝑎𝑞-𝑏𝑝=-1 and 𝑏+𝑞>𝑛𝑏+𝑞>𝑛. Then, by Lemma 3.3, we must have 𝑐/𝑑=𝑝/𝑞𝑐/𝑑=𝑝/𝑞. Both fractions are irreducible, so an equality of fractions is an equality of numerators and of denominators: 𝑐=𝑝𝑐=𝑝 and 𝑑=𝑞𝑑=𝑞.
Example 3.1

Consider:

𝔉3={01,13,12,23,11},𝔉5={01,15,14,13,25,12,35,23,34,45,11}.\begin{aligned}{𝔉}_{3} & =\left\{\frac{0}{1},\frac{1}{3},\frac{1}{2},\frac{2}{3},\frac{1}{1}\right\}, \\ {𝔉}_{5} & =\left\{\frac{0}{1},\frac{1}{5},\frac{1}{4},\frac{1}{3},\frac{2}{5},\frac{1}{2},\frac{3}{5},\frac{2}{3},\frac{3}{4},\frac{4}{5},\frac{1}{1}\right\}.\end{aligned}

In 𝔉5{𝔉}_{5}, the terms 1/31/3 and 2/52/5 are consecutive. With 𝑎/𝑏=1/3𝑎/𝑏=1/3 and 𝑐/𝑑=2/5𝑐/𝑑=2/5,

𝑎𝑑−𝑏𝑐=1⋅5−3⋅2=−1,𝑎𝑑-𝑏𝑐=1\cdot 5-3\cdot 2=-1,

and 𝑏+𝑑=3+5=8>5𝑏+𝑑=3+5=8>5. Both properties hold, and the list shows that 2/52/5 is the term consecutive to 1/31/3, which is what Lemma 3.3 asserts.

The same two fractions 1/31/3 and 1/21/2 are consecutive in 𝔉3{𝔉}_{3}:

1⋅2−3⋅1=−1,1\cdot 2-3\cdot 1=-1,

and 3+2=5>33+2=5>3. In 𝔉5{𝔉}_{5} they are no longer consecutive, since 2/52/5 sits between them, and 3+2=53+2=5 is not greater than 55.

There is another pleasing property. If you look at three consecutive terms, add the numerators of the first and the third, add their denominators, and divide, then, of all things, the quotient is the middle term.

For instance, 1/31/3, 2/52/5, and 1/21/2 are consecutive in 𝔉5{𝔉}_{5}, and

1+13+2=25.\frac{1+1}{3+2}=\frac{2}{5}.
Proposition 3.4

If 𝑎/𝑏𝑎/𝑏, 𝑐/𝑑𝑐/𝑑, and 𝑒/𝑓𝑒/𝑓 are three consecutive terms in a Farey sequence, then

𝑐𝑑=𝑎+𝑒𝑏+𝑓.\frac{𝑐}{𝑑}=\frac{𝑎+𝑒}{𝑏+𝑓}.
Proof

By Theorem 3.6, we have

𝑎𝑑−𝑏𝑐=−1𝑐𝑓−𝑑𝑒=−1.\begin{aligned}𝑎𝑑-𝑏𝑐 & =-1 \\ 𝑐𝑓-𝑑𝑒 & =-1.\end{aligned}
Note
At this point we should be quite confident that we can finish the proof. Regard 𝑎𝑎, 𝑏𝑏, 𝑒𝑒, and 𝑓𝑓 as known. What we actually want is the missing 𝑐𝑐 and 𝑑𝑑. Surely this is just two equations in two unknowns.

We may solve for 𝑐𝑐 and 𝑑𝑑 in terms of 𝑎𝑎, 𝑏𝑏, 𝑒𝑒, and 𝑓𝑓. We have

𝑐=𝑎+𝑒𝑏𝑒−𝑎𝑓𝑑=𝑏+𝑓𝑏𝑒−𝑎𝑓.\begin{aligned}𝑐 & =\frac{𝑎+𝑒}{𝑏𝑒-𝑎𝑓} \\ 𝑑 & =\frac{𝑏+𝑓}{𝑏𝑒-𝑎𝑓}.\end{aligned}

Divide, and we are done:

𝑐𝑑=𝑎+𝑒𝑏+𝑓.\frac{𝑐}{𝑑}=\frac{𝑎+𝑒}{𝑏+𝑓}.