17 - Divisibility

Divisibility and Common Divisors

The division algorithm

!Screenshot 2023-10-18 at 12.43.02 AM.png

GCD

!Screenshot 2023-10-18 at 12.44.08 AM.png

In class practice

Def: A common divisor of two integers a,b is an integer c such that ca and cb

GCD switching theorem

GCD(39, 57) = ?
57 = 1(39) + 18
39 = 2(18) + 3
18 = 6(3) + 0
Once you get to zero, the last remainder is the GCD

So the GCD is 3

17.1g
n = -256, d = 25

-256 = -11(25) + 19

GCD(1855, 2345)
2345 = 1(1855) + 490
1855 = 3(490) + 385
490 = 1(385) + 105
385 = 3(105) + 70
105 = 1(70) + 35
70 = 2(35) + 0
GCD = 35

Theorem 17.13. Fix d>0. We work by induction to prove that
P(n): there are integers qn,rn such that n=qnd+rn and 0rn<d is true for each n0.

Sketch. Base case: P(0) is true because 0=0(d)+0

Inductive step.
Let kN{0}
Assume that P(k) is true



HW 17

Ben Finch

E 17.1
(a) q=3, r=2
(b) q=-3, r=3
(c) q=-4, r=3
(d) q=4, r=3
(e) q=10, r=6.
(f) q=-10, r=6
(g) q=-11, r=19
(h) q=11, r=19

E 17.2
a)
Proof.
Let nZ.
Fix d=2.
By the division algorithm, n=2q+r for some q,rZ. Thus n=2q+0(which would mean n is an even number) or n=2q+1 (which would mean n is an odd number). Hence all integers are even or odd.

b)
Proof.
Let nZ.
Assume by way of contradiction that n is both an odd and even number. Then n=2k+1 and n=2k for some kZ. We find

2k+1=2k1=0

Herein lies our contradiction. Thus n cannot be both and even and an odd number .

E 17.3
Divisors of 60: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60

Divisors of 42: 1, 2, 3, 6, 7, 14, 21, 42

Common divisors: 1, 2, 3, 6

GCD: 6

E 17.4
a) GCD(60, 42)
60 = 1(42) + 18
42 = 2(18) + 6
18 = 6(3) + 0
GCD = 6

b) GCD(667,851)
851 = 1(667) + 184
667 = 3(184) + 115
184 = 1(115) + 69
115 = 1(69) + 46
69 = 1(46) + 23
46 = 2(23) + 0
GCD = 23

c) GCD(1855, 2345)
2345 = 1(1855) + 490
1855 = 3(490) + 385
490 = 1(385) + 105
385 = 3(105) + 70
105 = 1(70) + 35
70 = 2(35) + 0
GCD = 35

d) GCD(589, 437)
589 = 1(437) + 152
437 = 2(152) + 128
152 = 1(128) + 24
128 = 5(24) + 8
24 = 3(8) + 0
GCD = 8

E 17.5
Proof.
Let

P(n):GCD(Fn+1,Fn)=1

Base Cases:
n = 1, GCD(F2,F1) = GCD(1, 1) = 1
n = 2, GCD(F3,F2) = GCD(2, 1) = 1
n =3, GCD(F4,F3) = GCD(3, 2) = 1

Inductive Step:
Assume that for k3, kN that GCD(Fk+1,Fk) = 1

We aim to show that GCD(Fk+2,Fk+1) = 1

By the definition of Fibonacci numbers: Fk+2=Fk+1+Fk

By the GCD-Switching Theorem:
GCD(a, b) = GCD(b, c) if a=xb+c. Fix x=1. We have a=b+c. now sub in a=Fk+2, b=Fk+1, c=Fk. By the inductive hypothesis, GCD(Fk+1,Fk) = 1 and thus GCD(Fk+2,Fk+1) = 1.

Hence by mathematical induction P(n) is true for all Fibonacci numbers.

E 17.6
Proof.
Let nZ. Apply the Euclidean algorithm to get the GCD(4n+2,2n+1):

4n+2=2(2n+1)+12n+1=2(n)+1

Thus the GCD is 1.

E 17.7
Proof.
Let nZ. Apply the Euclidian algorithm to get GCD(6n+2,12n+6):

12n+6=2(6n+2)+26n+2=6(n)+2

Thus the GCD is 2.

E 17.8

(a) Proof. Suppose n<0 and d>0. Applying the division theorem to n and d, we can write n=qd+r, where q and r are integers and 0r<d. Thus, we can write n=(q)dr.

If r=0, then n=(q)d and we have our representation. If r0, then we can adjust as follows: n=(q1)d+(dr). Since r<d, dr is in the interval [0,d), thereby providing the desired representation for n. Thus the theorem is proven for n<0 and d>0.

(b) Suppose d<0. Applying the already proven case of the theorem to n and d gives us n=q(d)+r, where q and r are integers and 0r<|d|. If we let q=q, then we can write this as n=qd+r, with 0r<|d|, as required.

Thus, we have proved the Division Algorithm for all integers n and nonzero integers d.