1.1.3. Euclidean algorithm

This section is based on parts of [BUR11, Sec. 2.3, Sec. 2.4, Sec. 2.5].

We begin with an auxiliary lemma.

Lemma 1.1.3.1.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. Then

gcd⁡(a,b)=gcd⁡(b,a−k⁢b),k∈ℤ.\gcd(a,b)=\gcd(b,a-kb),\qquad k\in\mathbb{Z}.
Proof.

Let k∈ℤ{k\in\mathbb{Z}} and set d≔gcd⁡(a,b){d\coloneqq\gcd(a,b)} and d′≔gcd⁡(b,a−k⁢b){d^{\prime}\coloneqq\gcd(b,a-kb)}. We prove that d=d′{d=d^{\prime}} by showing that d≤d′{d\leq d^{\prime}} and d′≤d{d^{\prime}\leq d}.

  • •
    ​

    By definition, d∣a{d\mid a} and d∣b{d\mid b}. Proposition 1.1.1.6(11) implies that d∣a−k⁢b{d\mid a-kb}. Thus, dd is a common divisor of bb and a−k⁢b{a-kb}. By the maximality of gcds,

    d≤d′=gcd⁡(b,a−k⁢b).d\leq d^{\prime}=\gcd(b,a-kb).
  • •
    ​

    By definition, d′∣b{d^{\prime}\mid b} and d′∣(a−k⁢b){d^{\prime}\mid(a-kb)}. Proposition 1.1.1.6(11) implies that

    d′∣((a−k⁢b)+k⁢b)=a.d^{\prime}\mid((a-kb)+kb)=a.

    Thus, d′d^{\prime} is a common divisor of aa and bb. By the maximality of gcds,

    d′≤d=gcd⁡(a,b).d^{\prime}\leq d=\gcd(a,b).

This finishes the proof. ∎

The following theorem gives an algorithmic procedure to compute the gcd of a pair of integers using the Division with Remainder Theorem (Theorem 1.1.1.8).

Theorem 1.1.3.2 (Euclidean algorithm).

Let a,b∈ℤ{a,b\in\mathbb{Z}} with b>0{b>0}.

  1. (1)
    ​

    If b∣a{b\mid a}, then gcd⁡(a,b)=b{\gcd(a,b)=b}.

  2. (2)
    ​

    If b∤a{b\nmid a}, set r−1≔a{r_{-1}\coloneqq a} and r0≔b{r_{0}\coloneqq b}. Then there exists a unique integer n≥1{n\geq 1}, unique integers q1,…,qn+1q_{1},\dots,q_{n+1}, and unique integers r1,…,rnr_{1},\dots,r_{n} such that

    a=r−1\displaystyle a=r_{-1} =q1⁢r0+r1\displaystyle=q_{1}r_{0}+r_{1} 0<r1<r0\displaystyle 0<r_{1}<r_{0}
    b=r0\displaystyle b=r_{0} =q2⁢r1+r2\displaystyle=q_{2}r_{1}+r_{2} 0<r2<r1\displaystyle 0<r_{2}<r_{1}
    r1\displaystyle r_{1} =q3⁢r2+r3\displaystyle=q_{3}r_{2}+r_{3} 0<r3<r2\displaystyle 0<r_{3}<r_{2}
    ⋮\displaystyle\vdots
    rn−2\displaystyle r_{n-2} =qn⁢rn−1+rn\displaystyle=q_{n}r_{n-1}+r_{n} 0<rn<rn−1\displaystyle 0<r_{n}<r_{n-1}
    rn−1\displaystyle r_{n-1} =qn+1⁢rn.\displaystyle=q_{n+1}r_{n}.

    Moreover, rn=gcd⁡(a,b){r_{n}=\gcd(a,b)}.

Proof.

(1) Clear from the definition of gcd and the fact that b∣b{b\mid b}.

(2) Applying the Division with Remainder Theorem (Theorem 1.1.1.8) successively yields unique quotient-remainder pairs qi,riq_{i},r_{i} (as in the statement of the theorem) such that

ri−2=qi⁢ri−1+ri,0<ri<ri−1,r_{i-2}=q_{i}r_{i-1}+r_{i},\qquad 0<r_{i}<r_{i-1},

as long as ri−1r_{i-1} does not divide ri−2r_{i-2}. Since

b=r0>r1>r2>⋯>0b=r_{0}>r_{1}>r_{2}>\cdots>0

is a strictly decreasing sequence of positive integers, this procedure must terminate. Therefore, there is a unique first integer n≥1{n\geq 1} such that rn∣rn−1{r_{n}\mid r_{n-1}}. Finally, using the equations

ri=ri−2−qi⁢ri−1,1≤i≤n,r_{i}=r_{i-2}-q_{i}r_{i-1},\qquad 1\leq i\leq n,

Lemma 1.1.3.1 yields

gcd⁡(ri−2,ri−1)=gcd⁡(ri−1,ri−2−qi⁢ri−1)=gcd⁡(ri−1,ri)\gcd(r_{i-2},r_{i-1})=\gcd(r_{i-1},r_{i-2}-q_{i}r_{i-1})=\gcd(r_{i-1},r_{i})

for 1≤i≤n{1\leq i\leq n}, and statement (1) (for the pair rn−1,rnr_{n-1},r_{n}) yields gcd⁡(rn−1,rn)=rn{\gcd(r_{n-1},r_{n})=r_{n}}. Combining these equations we obtain

gcd⁡(a,b)=gcd⁡(r−1,r0)=gcd⁡(r0,r1)=gcd⁡(r1,r2)=⋯=gcd⁡(rn−1,rn)=rn.∎\gcd(a,b)=\gcd(r_{-1},r_{0})=\gcd(r_{0},r_{1})=\gcd(r_{1},r_{2})=\cdots=\gcd(r% _{n-1},r_{n})=r_{n}.\qed
Example 1.1.3.3.

We compute gcd⁡(360,165)\gcd(360,165) using the Euclidean Algorithm (Theorem 1.1.3.2):

360\displaystyle 360 =2⋅165+30,\displaystyle=2\cdot 165+30,
165\displaystyle 165 =5⋅30+15,\displaystyle=5\cdot 30+15,
30\displaystyle 30 =2⋅15.\displaystyle=2\cdot 15.

Hence, gcd⁡(360,165)=15{\gcd(360,165)=15}.

Example 1.1.3.4.

Not covered in the lectureWe compute gcd⁡(195,154)\gcd(195,154) using the Euclidean Algorithm (Theorem 1.1.3.2):

195\displaystyle 195 =1⋅154+41,\displaystyle=1\cdot 154+41,
154\displaystyle 154 =3⋅41+31,\displaystyle=3\cdot 41+31,
41\displaystyle 41 =1⋅31+10,\displaystyle=1\cdot 31+10,
31\displaystyle 31 =3⋅10+1,\displaystyle=3\cdot 10+1,
10\displaystyle 10 =10⋅1.\displaystyle=10\cdot 1.

Hence, gcd⁡(195,154)=1{\gcd(195,154)=1}.

Definition 1.1.3.5.

Let nn and a1,…,aka_{1},\dots,a_{k} be integers. We say that nn is an integral linear combination of a1,…,aka_{1},\dots,a_{k} if there exist integers x1,…,xkx_{1},\dots,x_{k} such that

n=a1⁢x1+a2⁢x2+⋯+ak⁢xk.n=a_{1}x_{1}+a_{2}x_{2}+\cdots+a_{k}x_{k}.

The following theorem is a refinement of the Euclidean Algorithm (Theorem 1.1.3.2). With it, we can express the gcd of a pair of integers as an integral linear combination of the original pair; see Bézout’s Identity (Theorem 1.1.3.7).

Theorem 1.1.3.6 (Extended Euclidean algorithm).

Let a,b∈ℤ{a,b\in\mathbb{Z}} with b>0{b>0}. Suppose that b∤a{b\nmid a}. By the Euclidean Algorithm (Theorem 1.1.3.2), there are a unique integer n≥1{n\geq 1}, unique integers q1,…,qn+1q_{1},\dots,q_{n+1}, and unique integers r1,…,rnr_{1},\dots,r_{n} such that

a=r−1\displaystyle a=r_{-1} =q1⁢r0+r1\displaystyle=q_{1}r_{0}+r_{1} 0<r1<r0\displaystyle 0<r_{1}<r_{0}
b=r0\displaystyle b=r_{0} =q2⁢r1+r2\displaystyle=q_{2}r_{1}+r_{2} 0<r2<r1\displaystyle 0<r_{2}<r_{1}
r1\displaystyle r_{1} =q3⁢r2+r3\displaystyle=q_{3}r_{2}+r_{3} 0<r3<r2\displaystyle 0<r_{3}<r_{2}
⋮\displaystyle\vdots
rn−2\displaystyle r_{n-2} =qn⁢rn−1+rn\displaystyle=q_{n}r_{n-1}+r_{n} 0<rn<rn−1\displaystyle 0<r_{n}<r_{n-1}
rn−1\displaystyle r_{n-1} =qn+1⁢rn.\displaystyle=q_{n+1}r_{n}.

Moreover, rn=gcd⁡(a,b){r_{n}=\gcd(a,b)}. Then

rn=a⁢xn+b⁢ynr_{n}=ax_{n}+by_{n}

where the integers xn,ynx_{n},y_{n} are computed recursively as follows: Set

x−1≔1,y−1≔0,x0≔0,y0≔1.x_{-1}\coloneqq 1,\ y_{-1}\coloneqq 0,\quad x_{0}\coloneqq 0,\ y_{0}\coloneqq 1.

Recursively, for 1≤k≤n{1\leq k\leq n},

xk≔xk−2−qk⁢xk−1andyk≔yk−2−qk⁢yk−1.x_{k}\coloneqq x_{k-2}-q_{k}x_{k-1}\qquad\text{and}\qquad y_{k}\coloneqq y_{k-% 2}-q_{k}y_{k-1}.
Proof.

By definition,

r−1=a=a⋅1+b⋅0=a⁢x−1+b⁢y−1r_{-1}=a=a\cdot 1+b\cdot 0=ax_{-1}+by_{-1}

and

r0=b=a⋅0+b⋅1=a⁢x0+b⁢y0.r_{0}=b=a\cdot 0+b\cdot 1=ax_{0}+by_{0}.

Consider the equations

rk=rk−2−qk⁢rk−1,1≤k≤n.r_{k}=r_{k-2}-q_{k}r_{k-1},\qquad 1\leq k\leq n.

Inductively, let 1≤k≤n{1\leq k\leq n} and suppose that

rk−2=a⁢xk−2+b⁢yk−2andrk−1=a⁢xk−1+b⁢yk−1.r_{k-2}=ax_{k-2}+by_{k-2}\qquad\text{and}\qquad r_{k-1}=ax_{k-1}+by_{k-1}.

Then

rk\displaystyle r_{k} =rk−2−qk⁢rk−1\displaystyle=r_{k-2}-q_{k}r_{k-1}
=(a⁢xk−2+b⁢yk−2)−qk⁢(a⁢xk−1+b⁢yk−1)\displaystyle=(ax_{k-2}+by_{k-2})-q_{k}(ax_{k-1}+by_{k-1})
=a⁢(xk−2−qk⁢xk−1)+b⁢(yk−2−qk⁢yk−1)\displaystyle=a(x_{k-2}-q_{k}x_{k-1})+b(y_{k-2}-q_{k}y_{k-1})
=a⁢xk+b⁢yk.\displaystyle=ax_{k}+by_{k}.

In particular,

rn=a⁢xn+b⁢yn.r_{n}=ax_{n}+by_{n}.

This finishes the proof. ∎

Theorem 1.1.3.7 (Bézout’s identity).

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. Then there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that

gcd⁡(a,b)=a⁢x+b⁢y.\gcd(a,b)=ax+by.

In other words, gcd⁡(a,b)\gcd(a,b) is an integral linear combination of aa and bb.

Proof.

Since the roles of aa and bb are symmetric, we may assume that b≠0{b\neq 0}. Also, without loss of generality, we may assume that b>0{b>0}. Indeed,

gcd⁡(a,b)=gcd⁡(a,−b)\gcd(a,b)=\gcd(a,-b)

(Proposition 1.1.2.5(4)) and a⁢x+b⁢y=a⁢x+(−b)⁢(−y){ax+by=ax+(-b)(-y)}. If b∣a{b\mid a}, then

gcd⁡(a,b)=b=a⋅0+b⋅1.\gcd(a,b)=b=a\cdot 0+b\cdot 1.

If b∤a{b\nmid a}, then the claim is immediate from the Extended Euclidean Algorithm (Theorem 1.1.3.6). ∎

Definition 1.1.3.8.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. The pairs of integers x,y∈ℤ{x,y\in\mathbb{Z}} such that gcd⁡(a,b)=a⁢x+b⁢y{\gcd(a,b)=ax+by} are called Bézout coefficients.

Warning 1.1.3.9.

Bézout coefficients always exist by Bézout’s Identity (Theorem 1.1.3.7) but are not unique (see Theorem 1.1.3.23). Here is an example: Let a=3{a=3} and b=2{b=2}, so that gcd⁡(a,b)=1{\gcd(a,b)=1}. Then

1=3⋅1+2⋅(−1)=3⋅(−1)+2⋅2.1=3\cdot 1+2\cdot(-1)=3\cdot(-1)+2\cdot 2.
Example 1.1.3.10.

We compute Bézout coefficients for gcd⁡(360,165)\gcd(360,165) using the Extended Euclidean Algorithm (Theorem 1.1.3.6):

x−1\displaystyle x_{-1} =1,\displaystyle=1, y−1\displaystyle y_{-1} =0\displaystyle=0
x0\displaystyle x_{0} =0,\displaystyle=0, y0\displaystyle y_{0} =1\displaystyle=1
360\displaystyle 360 =2⋅165+30,\displaystyle=2\cdot 165+30, q1\displaystyle q_{1} =2,\displaystyle=2, x1\displaystyle x_{1} =1,\displaystyle=1, y1\displaystyle y_{1} =−2\displaystyle=-2
165\displaystyle 165 =5⋅30+15,\displaystyle=5\cdot 30+15, q2\displaystyle q_{2} =5,\displaystyle=5, x2\displaystyle x_{2} =−5,\displaystyle=-5, y2\displaystyle y_{2} =11\displaystyle=11
30\displaystyle 30 =2⋅15.\displaystyle=2\cdot 15.

We have r2=gcd⁡(360,165)=15{r_{2}=\gcd(360,165)=15} and Bézout coefficients x2=−5{x_{2}=-5} and y2=11{y_{2}=11}. Indeed,

360⋅(−5)+165⋅11=−1800+1815=15.360\cdot(-5)+165\cdot 11=-1800+1815=15.
Example 1.1.3.11.

Not covered in the lectureWe compute Bézout coefficients for gcd⁡(195,154)\gcd(195,154) using the Extended Euclidean Algorithm (Theorem 1.1.3.6):

x−1\displaystyle x_{-1} =1,\displaystyle=1, y−1\displaystyle y_{-1} =0\displaystyle=0
x0\displaystyle x_{0} =0,\displaystyle=0, y0\displaystyle y_{0} =1\displaystyle=1
195\displaystyle 195 =1⋅154+41,\displaystyle=1\cdot 154+41, q1\displaystyle q_{1} =1,\displaystyle=1, x1\displaystyle x_{1} =1,\displaystyle=1, y1\displaystyle y_{1} =−1\displaystyle=-1
154\displaystyle 154 =3⋅41+31,\displaystyle=3\cdot 41+31, q2\displaystyle q_{2} =3,\displaystyle=3, x2\displaystyle x_{2} =−3,\displaystyle=-3, y2\displaystyle y_{2} =4\displaystyle=4
41\displaystyle 41 =1⋅31+10,\displaystyle=1\cdot 31+10, q3\displaystyle q_{3} =1,\displaystyle=1, x3\displaystyle x_{3} =4,\displaystyle=4, y3\displaystyle y_{3} =−5\displaystyle=-5
31\displaystyle 31 =3⋅10+1,\displaystyle=3\cdot 10+1, q4\displaystyle q_{4} =3,\displaystyle=3, x4\displaystyle x_{4} =−15,\displaystyle=-15, y4\displaystyle y_{4} =19\displaystyle=19
10\displaystyle 10 =10⋅1.\displaystyle=10\cdot 1.

Hence, r4=gcd⁡(195,154)=1{r_{4}=\gcd(195,154)=1} with Bézout coefficients x4=−15{x_{4}=-15} and y4=19{y_{4}=19}. Indeed,

195⋅(−15)+154⋅19=−2925+2926=1.195\cdot(-15)+154\cdot 19=-2925+2926=1.

Below we list a number of important corollaries of Bézout’s Identity (Theorem 1.1.3.7).

Corollary 1.1.3.12.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero and set d≔gcd⁡(a,b){d\coloneqq\gcd(a,b)}. Then

{n∈ℤ:d∣n}={n∈ℤ:∃k,ℓ∈ℤ,n=a⁢k+b⁢ℓ}.\{n\in\mathbb{Z}\colon{d\mid n}\}=\{n\in\mathbb{Z}\colon{\exists k,\ell\in% \mathbb{Z},\ n=ak+b\ell}\}.
Proof.

By Bézout’s Identity (Theorem 1.1.3.7), there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that d=a⁢x+b⁢y{d=ax+by}.

Let n∈ℤ{n\in\mathbb{Z}} be such that d∣n{d\mid n}. Then there exists k∈ℤ{k\in\mathbb{Z}} such that n=k⁢d{n=kd} and, therefore,

n=k⁢d=k⁢(a⁢x+b⁢y⏟=d)=a⁢(k⁢x)+b⁢(k⁢y).n=kd=k(\underbrace{ax+by}_{=d})=a(kx)+b(ky).

Conversely, let k,ℓ∈ℤ{k,\ell\in\mathbb{Z}} and set n=a⁢k+b⁢ℓ{n=ak+b\ell}. Since dd divides both aa and bb, there exist r,s∈ℤ{r,s\in\mathbb{Z}} such that a=r⁢d{a=rd} and b=s⁢d{b=sd}. Then

n=a⁢k+b⁢ℓ=(r⁢d)⁢k+(s⁢d)⁢ℓ=(r⁢k+s⁢ℓ)⁢d,n=ak+b\ell=(rd)k+(sd)\ell=(rk+s\ell)d,

so that dd divides nn. ∎

Corollary 1.1.3.13.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. Then gcd⁡(a,b)=1{\gcd(a,b)=1} if and only if there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that a⁢x+b⁢y=1{ax+by=1}.

Proof.

Suppose that there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that

a⁢x+b⁢y=1ax+by=1

and let d=gcd⁡(a,b){d=\gcd(a,b)}. By Corollary 1.1.3.12, the number 11 is a multiple of dd, and hence d=1{d=1} (recall from Remark 1.1.2.6 that the gcd is always positive). The converse is a particular case of Bézout’s Identity (Theorem 1.1.3.7). ∎

Corollary 1.1.3.14.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero and set d≔gcd⁡(a,b){d\coloneqq\gcd(a,b)}, so that d∣a{d\mid a} and d∣b{d\mid b}. Then gcd⁡(ad,bd)=1{\gcd(\tfrac{a}{d},\tfrac{b}{d})=1}.

Proof.

By Bézout’s Identity (Theorem 1.1.3.7), there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that d=a⁢x+b⁢y{d=ax+by}. Then

1=(ad)⁢x+(bd)⁢y.1=\Big{(}\frac{a}{d}\Big{)}x+\Big{(}\frac{b}{d}\Big{)}y.

Using Corollary 1.1.3.13, we conclude that gcd⁡(ad,bd)=1{\gcd(\tfrac{a}{d},\tfrac{b}{d})=1}. ∎

Example 1.1.3.15.

Not covered in the lectureRecall from Example 1.1.3.3 that gcd⁡(360,165)=15{\gcd(360,165)=15}. Since 360/15=24{360/15=24} and 165/15=11{165/15=11}, Corollary 1.1.3.14 yields gcd⁡(24,11)=1{\gcd(24,11)=1}. Indeed, the only positive divisors of 1111 are 11 and 1111, and 1111 does not divide 2424.

Corollary 1.1.3.16.

Let a,b,c∈ℤ{a,b,c\in\mathbb{Z}} be integers such that gcd⁡(a,b⁢c)\gcd(a,bc), gcd⁡(a,b)\gcd(a,b) and gcd⁡(a,c)\gcd(a,c) are defined. Then

gcd⁡(a,b⁢c)=1⟺gcd⁡(a,b)=1⁢ and ⁢gcd⁡(a,c)=1.\gcd(a,bc)=1\quad\Longleftrightarrow\quad\gcd(a,b)=1\text{ and }\gcd(a,c)=1.
Proof.

Suppose that gcd⁡(a,b⁢c)=1{\gcd(a,bc)=1}. By Bézout’s Identity (Theorem 1.1.3.7), there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that

1=a⁢x+(b⁢c)⁢y=a⁢x+b⁢(c⁢y)=a⁢x+c⁢(b⁢y).1=ax+(bc)y=ax+b(cy)=ax+c(by).

Corollary 1.1.3.13 implies that gcd⁡(a,b)=1{\gcd(a,b)=1} and gcd⁡(a,c)=1{\gcd(a,c)=1}.

Conversely, suppose that gcd⁡(a,b)=1{\gcd(a,b)=1} and gcd⁡(a,c)=1{\gcd(a,c)=1}. By Bézout’s Identity (Theorem 1.1.3.7), there exist u,v,x,y∈ℤ{u,v,x,y\in\mathbb{Z}} such that

a⁢u+b⁢v=1anda⁢x+c⁢y=1.au+bv=1\qquad\text{and}\qquad ax+cy=1.

Then

1\displaystyle 1 =(a⁢u+b⁢v⏟=1)⁢(a⁢x+c⁢y⏟=1)\displaystyle=(\underbrace{au+bv}_{=1})(\underbrace{ax+cy}_{=1})
=a2⁢u⁢x+a⁢u⁢c⁢y+b⁢v⁢a⁢x+b⁢v⁢c⁢y\displaystyle=a^{2}ux+aucy+bvax+bvcy
=a⁢(a⁢u⁢x+u⁢c⁢y+b⁢v⁢x)+b⁢c⁢(v⁢y).\displaystyle=a(aux+ucy+bvx)+bc(vy).

Corollary 1.1.3.13 implies that gcd⁡(a,b⁢c)=1{\gcd(a,bc)=1}. ∎

Corollary 1.1.3.17.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero and such that gcd⁡(a,b)=1{\gcd(a,b)=1}. For c∈ℤ{c\in\mathbb{Z}}, if a∣c{a\mid c} and b∣c{b\mid c}, then a⁢b∣c{ab\mid c}.

Proof.

By Bézout’s Identity (Theorem 1.1.3.7), there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that

1=gcd⁡(a,b)=a⁢x+b⁢y.1=\gcd(a,b)=ax+by.

By assumption, there exist k,ℓ∈ℤ{k,\ell\in\mathbb{Z}} such that c=k⁢a{c=ka} and c=ℓ⁢b{c=\ell b}. Then

c=c⁢(a⁢x+b⁢y⏟=1)=c⁢a⁢x+c⁢b⁢y=(ℓ⁢b)⁢(a⁢x)+(k⁢a)⁢(b⁢y)=(ℓ⁢x+k⁢y)⁢a⁢b,c=c(\underbrace{ax+by}_{=1})=cax+cby=(\ell b)(ax)+(ka)(by)=(\ell x+ky)ab,

so that a⁢bab divides cc. ∎

Corollary 1.1.3.18.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero and such that gcd⁡(a,b)=1{\gcd(a,b)=1}. For c∈ℤ{c\in\mathbb{Z}}, if a∣b⁢c{a\mid bc}, then a∣c{a\mid c}.

Proof.

By Bézout’s Identity (Theorem 1.1.3.7), there exist x,y∈ℤ{x,y\in\mathbb{Z}} such that

1=gcd⁡(a,b)=a⁢x+b⁢y.1=\gcd(a,b)=ax+by.

By assumption, there exists k∈ℤ{k\in\mathbb{Z}} such that b⁢c=k⁢a{bc=ka}. Then

c=c⁢(a⁢x+b⁢y⏟=1)=c⁢x⁢a+c⁢b⁢y=c⁢x⁢a+(k⁢a)⁢y=(c⁢x+k⁢y)⁢a,c=c(\underbrace{ax+by}_{=1})=cxa+cby=cxa+(ka)y=(cx+ky)a,

so that a∣c{a\mid c}. ∎

The following definition plays a guiding role in Part 1, as we can interpret many of our results in these terms (Example 1.1.3.21).

Definition 1.1.3.19.

A Diophantine equation is an equation f=0{f=0} defined by a non-zero polynomial ff with integer coefficients for which one is only interested in its solutions in the integers. The degree of such an equation is the degree of the polynomial ff that defines it.

Remark 1.1.3.20.

Often, it can be more natural to present a Diophantine equation as an equality between two polynomials with integer coefficients.

Example 1.1.3.21.

Not covered in the lecture Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. Then a⁢x+b⁢y=1{ax+by=1} can be regarded as a linear Diophantine equation in the indeterminates xx and yy.

Example 1.1.3.22.

Not covered in the lectureThe equation x2+y2=1{x^{2}+y^{2}=1} can be regarded as a quadratic Diophantine equation in the indeterminates xx and yy. While the pairs (x0,y0)∈ℝ2{(x_{0},y_{0})\in\mathbb{R}^{2}} that give a solution to this equation are the points that lie on the unit circle, the only solutions in the integers are the pairs (±1,0){(\pm 1,0)} and (0,±1){(0,\pm 1)}.

End of Lecture 2

The following theorem is a refinement of Bézout’s Identity (Theorem 1.1.3.7).

Theorem 1.1.3.23.

Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. Set d≔gcd⁡(a,b){d\coloneqq\gcd(a,b)}, so that ad,bd∈ℤ{\tfrac{a}{d},\tfrac{b}{d}\in\mathbb{Z}}. Given c∈ℤ{c\in\mathbb{Z}}, consider the linear Diophantine equation a⁢x+b⁢y=c{ax+by=c}, in which xx and yy are indeterminates. The following statements hold:

  1. (1)
    ​

    The equation

    a⁢x+b⁢y=c{ax+by=c}

    has a solution in the integers if and only if dd divides cc. In symbols:

    ∃x0,y0∈ℤ⁢ such that ⁢a⁢x0+b⁢y0=c⟺d∣c.\exists x_{0},y_{0}\in\mathbb{Z}\text{ such that }ax_{0}+by_{0}=c\quad% \Longleftrightarrow\quad d\mid{c}.
  2. (2)
    ​

    Suppose that x0,y0∈ℤ{x_{0},y_{0}\in\mathbb{Z}} are such that a⁢x0+b⁢y0=c{ax_{0}+by_{0}=c}. Then k,ℓ∈ℤ{k,\ell\in\mathbb{Z}} satisfy a⁢k+b⁢ℓ=c{ak+b\ell=c} if and only if there exists t∈ℤ{t\in\mathbb{Z}} such that

    k=x0+t⋅bdandℓ=y0−t⋅ad.k=x_{0}+t\cdot\frac{b}{d}\qquad\text{and}\qquad\ell=y_{0}-t\cdot\frac{a}{d}.
Proof.

Since a,ba,b are not both zero, interchanging aa and bb if necessary (and also xx and yy), we may assume that b≠0{b\neq 0}.

(1) This is precisely Corollary 1.1.3.12.

(2) Let t∈ℤ{t\in\mathbb{Z}} and set

k≔x0+t⋅bdandℓ≔y0−t⋅ad.k\coloneqq x_{0}+t\cdot\frac{b}{d}\qquad\text{and}\qquad\ell\coloneqq y_{0}-t% \cdot\frac{a}{d}.

Then

a⁢k+b⁢ℓ\displaystyle ak+b\ell =a⁢(x0+t⋅bd)+b⁢(y0−t⋅ad)\displaystyle=a\Big{(}x_{0}+t\cdot\frac{b}{d}\Big{)}+b\Big{(}y_{0}-t\cdot\frac% {a}{d}\Big{)}
=a⁢x0+b⁢y0⏟=c+t⋅(a⁢bd−a⁢bd)⏟=0=c.\displaystyle=\underbrace{ax_{0}+by_{0}}_{=c}+t\cdot\underbrace{\Big{(}\frac{% ab}{d}-\frac{ab}{d}\Big{)}}_{=0}=c.

Conversely, let k,ℓ∈ℤ{k,\ell\in\mathbb{Z}} be such that a⁢k+b⁢ℓ=c{ak+b\ell=c}. Since

a⁢k+b⁢ℓ=c=a⁢x0+b⁢y0,ak+b\ell=c=ax_{0}+by_{0},

we have

a⁢(k−x0)=b⁢(y0−ℓ).a(k-x_{0})=b(y_{0}-\ell).

Dividing by d=gcd⁡(a,b){d=\gcd(a,b)} yields

ad⋅(k−x0)=bd⋅(y0−ℓ)\frac{a}{d}\cdot(k-x_{0})=\frac{b}{d}\cdot(y_{0}-\ell)

with ad,bd∈ℤ{\frac{a}{d},\frac{b}{d}\in\mathbb{Z}} and gcd⁡(ad,bd)=1{\gcd(\frac{a}{d},\frac{b}{d})=1} (Corollary 1.1.3.14). Since bd\tfrac{b}{d} divides the left-hand side of the equation, Corollary 1.1.3.18 implies that bd\frac{b}{d} divides k−x0{k-x_{0}}. Therefore, there exists t∈ℤ{t\in\mathbb{Z}} such that

k−x0=t⋅bd.k-x_{0}=t\cdot\frac{b}{d}.

Equivalently,

k=x0+t⋅bd.k=x_{0}+t\cdot\frac{b}{d}.

We then also have

bd⋅(y0−ℓ)=ad⋅(k−x0)=ad⋅(t⋅bd).\frac{b}{d}\cdot(y_{0}-\ell)=\frac{a}{d}\cdot(k-x_{0})=\frac{a}{d}\cdot\Big{(}% t\cdot\frac{b}{d}\Big{)}.

Since bd≠0{\frac{b}{d}\neq 0}, we may cancel it on both sides to obtain

y0−ℓ=t⋅ad.y_{0}-\ell=t\cdot\frac{a}{d}.

Equivalently,

ℓ=y0−t⋅ad.\ell=y_{0}-t\cdot\frac{a}{d}.

This finishes the proof. ∎

Remark 1.1.3.24.

Not covered in the lecture Let a,b∈ℤ{a,b\in\mathbb{Z}} be not both zero. Set d≔gcd⁡(a,b){d\coloneqq\gcd(a,b)}. Given c∈ℤ{c\in\mathbb{Z}}, consider the linear Diophantine equation a⁢x+b⁢y=c{ax+by=c}, in which xx and yy are indeterminates. Suppose that d∣c{d\mid c}, so that the equation admits an integer solution (Theorem 1.1.3.23). A solution can be found algorithmically as follows:

  • •
    ​

    Compute Bézout coefficients x0,y0∈ℤ{x_{0},y_{0}\in\mathbb{Z}} for d=gcd⁡(a,b){d=\gcd(a,b)} using the procedure in the proof of Bézout’s Identity (Theorem 1.1.3.7). Thus, a⁢x0+b⁢y0=d{ax_{0}+by_{0}=d}.

  • •
    ​

    Write c=k⁢d{c=kd} with k∈ℤ{k\in\mathbb{Z}}.

  • •
    ​

    The integers x1≔k⁢x0{x_{1}\coloneqq kx_{0}} and y1≔k⁢y0{y_{1}\coloneqq ky_{0}} give a solution to the linear Diophantine equation a⁢x+b⁢y=c{ax+by=c}.

Example 1.1.3.25.

Not covered in the lectureWe use the notation in Remark 1.1.3.24. Let a=360{a=360}, b=165{b=165} and c=75{c=75}. From Example 1.1.3.3 we know that

gcd⁡(360,165)=15.\gcd(360,165)=15.

Since 75=5⋅15{75=5\cdot 15}, the linear Diophantine equation 360⁢x+165⁢y=75{360x+165y=75} admits an integer solution. From Example 1.1.3.10 we know that x0=−5{x_{0}=-5} and y0=11{y_{0}=11} are Bézout coefficients for gcd⁡(360,165)=15{\gcd(360,165)=15}. Therefore, given that k=5{k=5},

x1=5⋅(−5)=−25andy1=5⋅11=55x_{1}=5\cdot(-5)=-25\qquad\text{and}\qquad y_{1}=5\cdot 11=55

give a solution to the equation. Indeed,

360⋅(−25)+165⋅55=−9000+9075=75.360\cdot(-25)+165\cdot 55=-9000+9075=75.