<<

Last time and

Euclidean and Diophantine Equations

SUAMI 2016 David Offner

June 3, 2016 Last time Euclid and Diophantus Modular Arithmetic Agenda

1 Last time

2 Euclid and Diophantus

3 Modular Arithmetic Last time Euclid and Diophantus Modular Arithmetic Last time

Substitution ciphers and frequency analysis Main questions of cryptography

Read by Friday: 1.1: Simple substitution ciphers 1.2: Divisibility and GCD 1.6: Crypto by hand (history) Read: 1.2b, 1.4b, 1.5, 1.38, 1.39, 1.40 Try for Friday: 1.6, 1.10a, 1.11a Hand in Monday: 1.2b, 1.4b, 1.38, 1.40 Last time Euclid and Diophantus Modular Arithmetic Problem 1.5

Last time we decided there were 26! possible substitution ciphers.

How many have no letters representing themselves?

The answer is asymptotically interesting if you consider alphabets with n letters. Last time Euclid and Diophantus Modular Arithmetic Divisibility

Definition Let a and b be with b 6= 0. We say b divides a, or a is divisible by b, if there exists an c such that

a = bc. E.g. 13 | 52 12 - 38 Proof. Part (c), second part (): Suppose a | b and a | c. Then there exist d1, d2 ∈ Z such that ad1 = b and ad2 = c. Thus b − c = ad1 − ad2 = a(d1 − d2). Since d1 − d2 ∈ Z, a | (b − c).

Last time Euclid and Diophantus Modular Arithmetic Divisibility

Proposition (Proposition 1.4) Let a, b, c ∈ Z be integers. (a) If a | b and b | c then a | c. (b) If a | b and b | a then a ± b. (c) If a | b and a | c then a | (b + c) and a | (b − c). Then there exist d1, d2 ∈ Z such that ad1 = b and ad2 = c. Thus b − c = ad1 − ad2 = a(d1 − d2). Since d1 − d2 ∈ Z, a | (b − c).

Last time Euclid and Diophantus Modular Arithmetic Divisibility

Proposition (Proposition 1.4) Let a, b, c ∈ Z be integers. (a) If a | b and b | c then a | c. (b) If a | b and b | a then a ± b. (c) If a | b and a | c then a | (b + c) and a | (b − c).

Proof. Part (c), second part (Distributive Property): Suppose a | b and a | c. Thus b − c = ad1 − ad2 = a(d1 − d2). Since d1 − d2 ∈ Z, a | (b − c).

Last time Euclid and Diophantus Modular Arithmetic Divisibility

Proposition (Proposition 1.4) Let a, b, c ∈ Z be integers. (a) If a | b and b | c then a | c. (b) If a | b and b | a then a ± b. (c) If a | b and a | c then a | (b + c) and a | (b − c).

Proof. Part (c), second part (Distributive Property): Suppose a | b and a | c. Then there exist d1, d2 ∈ Z such that ad1 = b and ad2 = c. Since d1 − d2 ∈ Z, a | (b − c).

Last time Euclid and Diophantus Modular Arithmetic Divisibility

Proposition (Proposition 1.4) Let a, b, c ∈ Z be integers. (a) If a | b and b | c then a | c. (b) If a | b and b | a then a ± b. (c) If a | b and a | c then a | (b + c) and a | (b − c).

Proof. Part (c), second part (Distributive Property): Suppose a | b and a | c. Then there exist d1, d2 ∈ Z such that ad1 = b and ad2 = c. Thus b − c = ad1 − ad2 = a(d1 − d2). Last time Euclid and Diophantus Modular Arithmetic Divisibility

Proposition (Proposition 1.4) Let a, b, c ∈ Z be integers. (a) If a | b and b | c then a | c. (b) If a | b and b | a then a ± b. (c) If a | b and a | c then a | (b + c) and a | (b − c).

Proof. Part (c), second part (Distributive Property): Suppose a | b and a | c. Then there exist d1, d2 ∈ Z such that ad1 = b and ad2 = c. Thus b − c = ad1 − ad2 = a(d1 − d2). Since d1 − d2 ∈ Z, a | (b − c). This quantity is denoted gcd(a, b) or (a, b). If a = b = 0 then gcd(a, b) is not defined.

Last time Euclid and Diophantus Modular Arithmetic Common and GCD

Definition A common of two integers a and b is a positive integer d that divides both of them. The of a and b is the largest positive integer d such that d | a and d | b Last time Euclid and Diophantus Modular Arithmetic Common Divisors and GCD

Definition A common divisor of two integers a and b is a positive integer d that divides both of them. The greatest common divisor of a and b is the largest positive integer d such that d | a and d | b This quantity is denoted gcd(a, b) or (a, b). If a = b = 0 then gcd(a, b) is not defined. Well Ordering Property of N: Any nonempty subset of N has a smallest element. Let R = {r ≥ 0 : a = bq + r} (set of non-negative , nonempty since a ∈ R). WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. If r0 < b, done. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0.

Last time Euclid and Diophantus Modular Arithmetic with

Definition (/Division with Remainder) Let a and b be positive integers. Then a divided by b has q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Let R = {r ≥ 0 : a = bq + r} (set of non-negative remainders, nonempty since a ∈ R). WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. If r0 < b, done. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0.

Last time Euclid and Diophantus Modular Arithmetic Division with Remainder

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Well Ordering Property of N: Any nonempty subset of N has a smallest element. (set of non-negative remainders, nonempty since a ∈ R). WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. If r0 < b, done. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0.

Last time Euclid and Diophantus Modular Arithmetic Division with Remainder

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Well Ordering Property of N: Any nonempty subset of N has a smallest element. Let R = {r ≥ 0 : a = bq + r} WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. If r0 < b, done. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0.

Last time Euclid and Diophantus Modular Arithmetic Division with Remainder

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Well Ordering Property of N: Any nonempty subset of N has a smallest element. Let R = {r ≥ 0 : a = bq + r} (set of non-negative remainders, nonempty since a ∈ R). If r0 < b, done. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0.

Last time Euclid and Diophantus Modular Arithmetic Division with Remainder

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Well Ordering Property of N: Any nonempty subset of N has a smallest element. Let R = {r ≥ 0 : a = bq + r} (set of non-negative remainders, nonempty since a ∈ R). WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0.

Last time Euclid and Diophantus Modular Arithmetic Division with Remainder

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Well Ordering Property of N: Any nonempty subset of N has a smallest element. Let R = {r ≥ 0 : a = bq + r} (set of non-negative remainders, nonempty since a ∈ R). WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. If r0 < b, done. Last time Euclid and Diophantus Modular Arithmetic Division with Remainder

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Why? Well Ordering Property of N: Any nonempty subset of N has a smallest element. Let R = {r ≥ 0 : a = bq + r} (set of non-negative remainders, nonempty since a ∈ R). WOP ⇒ ∃ smallest r0 ∈ R, a = bq0 + r0. If r0 < b, done. Else a = b(q0 + 1) + (r0 − b), and 0 ≤ r0 − b < r0, contradicting minimality of r0. Last time Euclid and Diophantus Modular Arithmetic Division with Remainder and GCD

Definition (Division Algorithm/Division with Remainder) Let a and b be positive integers. Then a divided by b has quotient q and remainder r means that

a = b · q + r with 0 ≤ r < b.

the values of q and r are uniquely determined by a and b.

Note that Proposition 1.4 (c) implies that If d | a and d | b, then d | r. If e | b and e | r, then e | a. Common divisors of a and b = Common divisors of b and r. Thus gcd(a, b) = gcd(b, r). 183 = 5 · 33 + 18 33 = 1 · 18 + 15 18 = 1 · 15 + 3 15 = 5 · 3 + 0

gcd(216,183)= 3.

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm Example

216 = 1 · 183 + 33 33 = 1 · 18 + 15 18 = 1 · 15 + 3 15 = 5 · 3 + 0

gcd(216,183)= 3.

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm Example

216 = 1 · 183 + 33 183 = 5 · 33 + 18 18 = 1 · 15 + 3 15 = 5 · 3 + 0

gcd(216,183)= 3.

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm Example

216 = 1 · 183 + 33 183 = 5 · 33 + 18 33 = 1 · 18 + 15 15 = 5 · 3 + 0

gcd(216,183)= 3.

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm Example

216 = 1 · 183 + 33 183 = 5 · 33 + 18 33 = 1 · 18 + 15 18 = 1 · 15 + 3 gcd(216,183)= 3.

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm Example

216 = 1 · 183 + 33 183 = 5 · 33 + 18 33 = 1 · 18 + 15 18 = 1 · 15 + 3 15 = 5 · 3 + 0 Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm Example

216 = 1 · 183 + 33 183 = 5 · 33 + 18 33 = 1 · 18 + 15 18 = 1 · 15 + 3 15 = 5 · 3 + 0

gcd(216,183)= 3. Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Theorem (Theorem 1.7) Let a and b be positive integers with a ≥ b. The following algorithm computes gcd(a, b) in a finite of steps.

1 Let r0 = a and r1 = b. 2 Set i = 1.

3 Divide ri−1 by ri to get a quotient qi and remainder ri+1,

ri−1 = ri · qi + ri+1 with 0 ≤ ri+1 < ri .

4 If the remainder ri+1 = 0, then ri = gcd(a, b) and the algorithm terminates.

5 Otherwise, ri+1 > 0, so set i = i + 1 and go to Step 3.

The division step (Step 3) is executed at most 2 log2(b) + 1 times. Remainders are strictly decreasing (and WOP) Why does it give the gcd? By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1).

Why does it terminate in at most 2 log2(b) + 1 steps? 1 For all i ≥ 0, ri+2 < 2 ri . k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Why does it give the gcd? By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1).

Why does it terminate in at most 2 log2(b) + 1 steps? 1 For all i ≥ 0, ri+2 < 2 ri . k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Remainders are strictly decreasing (and WOP) By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1).

Why does it terminate in at most 2 log2(b) + 1 steps? 1 For all i ≥ 0, ri+2 < 2 ri . k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Remainders are strictly decreasing (and WOP) Why does it give the gcd? Why does it terminate in at most 2 log2(b) + 1 steps? 1 For all i ≥ 0, ri+2 < 2 ri . k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Remainders are strictly decreasing (and WOP) Why does it give the gcd? By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1). 1 For all i ≥ 0, ri+2 < 2 ri . k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Remainders are strictly decreasing (and WOP) Why does it give the gcd? By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1).

Why does it terminate in at most 2 log2(b) + 1 steps? k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k

Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Remainders are strictly decreasing (and WOP) Why does it give the gcd? By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1).

Why does it terminate in at most 2 log2(b) + 1 steps? 1 For all i ≥ 0, ri+2 < 2 ri . Last time Euclid and Diophantus Modular Arithmetic Euclidean Algorithm

Proof of Theorem 1.7. Why does the algorithm terminate? Remainders are strictly decreasing (and WOP) Why does it give the gcd? By induction, since gcd(ri−1, ri ) = gcd(ri , ri+1).

Why does it terminate in at most 2 log2(b) + 1 steps? 1 For all i ≥ 0, ri+2 < 2 ri . k Thus if b = r1 < 2 , then after 2k steps (if algorithm hasn’t already terminated)

b r < < 1. 2k+1 2k Last time Euclid and Diophantus Modular Arithmetic Running Time (Computational Complexity)

The hardness of a problem corresponds to how quickly the number of computations grows as a function of the input size. The Euclidean algorithm on input (a, b) requires at most 2 log(b) + 1 divisions. A naive algorithm for computing gcd(a, b) might require √ √ ( a + b) divisions.

Question: Given N ∈ N, What is the smallest a such that the Euclidean algorithm takes N steps to compute gcd(a, b) for some b ≤ a? If n = 2, yes! In fact there are an infinite number of Pythagorean triples a2 + b2 = c2. (E.g. (2st, s2 − t2, s2 + t2)) If n ≥ 3, no! (Fermat’s Last Theorem)

Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Definition A is an equation where only integer solutions are allowed.

E.g. Given n ∈ N, does the equation

an + bn = cn

have any nontrivial integer solutions? (E.g. (2st, s2 − t2, s2 + t2)) If n ≥ 3, no! (Fermat’s Last Theorem)

Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Definition A Diophantine equation is an equation where only integer solutions are allowed.

E.g. Given n ∈ N, does the equation

an + bn = cn

have any nontrivial integer solutions? If n = 2, yes! In fact there are an infinite number of Pythagorean triples a2 + b2 = c2. If n ≥ 3, no! (Fermat’s Last Theorem)

Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Definition A Diophantine equation is an equation where only integer solutions are allowed.

E.g. Given n ∈ N, does the equation

an + bn = cn

have any nontrivial integer solutions? If n = 2, yes! In fact there are an infinite number of Pythagorean triples a2 + b2 = c2. (E.g. (2st, s2 − t2, s2 + t2)) Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Definition A Diophantine equation is an equation where only integer solutions are allowed.

E.g. Given n ∈ N, does the equation

an + bn = cn

have any nontrivial integer solutions? If n = 2, yes! In fact there are an infinite number of Pythagorean triples a2 + b2 = c2. (E.g. (2st, s2 − t2, s2 + t2)) If n ≥ 3, no! (Fermat’s Last Theorem) (Can c be expressed as an integer of a and b?)

Answer: The answer is yes if and only if gcd(a, b) | c.

Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Question: Given a, b, c ∈ Z, does the equation

au + bv = c

have integer solutions? Answer: The answer is yes if and only if gcd(a, b) | c.

Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Question: Given a, b, c ∈ Z, does the equation

au + bv = c

have integer solutions?

(Can c be expressed as an integer linear combination of a and b?) Last time Euclid and Diophantus Modular Arithmetic Diophantine equations

Question: Given a, b, c ∈ Z, does the equation

au + bv = c

have integer solutions?

(Can c be expressed as an integer linear combination of a and b?)

Answer: The answer is yes if and only if gcd(a, b) | c. 1 6 7 13 72 1 5 6 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 0

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. 1 6 7 13 72 1 5 6 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 0

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. 1 6 7 13 72 1 5 6 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 0 6 7 13 72 5 6 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 1 0 1 7 13 72 6 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 6 1 0 1 5 13 72 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 6 7 1 0 1 5 6 72 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 6 7 13 1 0 1 5 6 11 72 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 6 7 13 1 0 1 5 6 11 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1

Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 6 7 13 72 1 0 1 5 6 11 61 Last time Euclid and Diophantus Modular Arithmetic Example: Extended Euclidean Algorithm

Find integers u and v such that 216u + 183v = 3. Equivalent: Find integers u and v such that

72u + 61v = 1. Extended Euclidean Algorithm (“Magic Box”)

1 5 1 1 5 0 1 1 6 7 13 72 1 0 1 5 6 11 61 u = −11, v = 13: 72 · (−11) + 61 · 13 = 1 Last time Euclid and Diophantus Modular Arithmetic Extended Euclidean Algorithm

Theorem (Theorem 1.11) Let a and b be positive integers. Then the equation

au + bv = gcd(a, b)

always has a solution in integers u and v. If (u0, v0) is any solution, then every solution has the form b · k a · k u = u + and v = v + 0 gcd(a, b) 0 gcd(a, b)

for some k ∈ Z. The “Magic Box” is just a simple way of organizing the back substitution. If gcd(a, b) - c, then no solution exists: Use Proposition 1.4 (c): If g | a and g | b, then g | au + bv.

Remainder of proof: Problem 1.11.

Last time Euclid and Diophantus Modular Arithmetic Extended Euclidean Algorithm

The equation au + bv = c has integer solutions if and only if gcd(a, b) | c. Proof. If gcd(a, b) | c, then a solution exists: Back substitution. If gcd(a, b) - c, then no solution exists: Use Proposition 1.4 (c): If g | a and g | b, then g | au + bv.

Remainder of proof: Problem 1.11.

Last time Euclid and Diophantus Modular Arithmetic Extended Euclidean Algorithm

The equation au + bv = c has integer solutions if and only if gcd(a, b) | c. Proof. If gcd(a, b) | c, then a solution exists: Back substitution. The “Magic Box” is just a simple way of organizing the back substitution. Use Proposition 1.4 (c): If g | a and g | b, then g | au + bv.

Remainder of proof: Problem 1.11.

Last time Euclid and Diophantus Modular Arithmetic Extended Euclidean Algorithm

The equation au + bv = c has integer solutions if and only if gcd(a, b) | c. Proof. If gcd(a, b) | c, then a solution exists: Back substitution. The “Magic Box” is just a simple way of organizing the back substitution. If gcd(a, b) - c, then no solution exists: Last time Euclid and Diophantus Modular Arithmetic Extended Euclidean Algorithm

The equation au + bv = c has integer solutions if and only if gcd(a, b) | c. Proof. If gcd(a, b) | c, then a solution exists: Back substitution. The “Magic Box” is just a simple way of organizing the back substitution. If gcd(a, b) - c, then no solution exists: Use Proposition 1.4 (c): If g | a and g | b, then g | au + bv.

Remainder of proof: Problem 1.11. (Can c be expressed as a non-negative integer linear combination of a and b?)

Given an infinite supply of 5 and 8 cent coins, what quantites of money can be made?

Last time Euclid and Diophantus Modular Arithmetic Frobenius Coin Problem

Question: Given a, b, c ∈ Z, does the equation

au + bv = c

have non-negative integer solutions? Last time Euclid and Diophantus Modular Arithmetic Frobenius Coin Problem

Question: Given a, b, c ∈ Z, does the equation

au + bv = c

have non-negative integer solutions?

(Can c be expressed as a non-negative integer linear combination of a and b?)

Given an infinite supply of 5 and 8 cent coins, what quantites of money can be made? Last time Euclid and Diophantus Modular Arithmetic Continued and Convergents

The in the Euclidean Algorithm give the entries in the continued for a/b. The successive quotients in the Magic Box for (a, b) are the convergents of the for a/b. E.g. The convergents for 216/183 = 72/61 are

1/1, 6/5, 7/6, 13/11, 72/61.

Theorem If p/q is a convergent for a/b, then

a p 1 − < . b q q2 Problem: Prove Pick’s theorem (induction on triangulations)

Pick’s theorem relates to a visualization of goodness of approximation.

E.g. The triangle with vertices at (0, 0), (11, 13) and (72, 61) has no interior points, hence area 1/2. So the parallelogram defined by the vertices (11, 13) and (72, 61) has area 1.

Last time Euclid and Diophantus Modular Arithmetic Convergents and Pick’s Theorem

Pick’s theorem: If a lattice polygon has i interior points and b boundary points, then its area is given by

A = i + b/2 − 1. Pick’s theorem relates to a visualization of goodness of approximation.

E.g. The triangle with vertices at (0, 0), (11, 13) and (72, 61) has no interior points, hence area 1/2. So the parallelogram defined by the vertices (11, 13) and (72, 61) has area 1.

Last time Euclid and Diophantus Modular Arithmetic Convergents and Pick’s Theorem

Pick’s theorem: If a lattice polygon has i interior points and b boundary points, then its area is given by

A = i + b/2 − 1. Problem: Prove Pick’s theorem (induction on triangulations) Last time Euclid and Diophantus Modular Arithmetic Convergents and Pick’s Theorem

Pick’s theorem: If a lattice polygon has i interior points and b boundary points, then its area is given by

A = i + b/2 − 1. Problem: Prove Pick’s theorem (induction on triangulations)

Pick’s theorem relates to a visualization of goodness of approximation.

E.g. The triangle with vertices at (0, 0), (11, 13) and (72, 61) has no interior points, hence area 1/2. So the parallelogram defined by the vertices (11, 13) and (72, 61) has area 1. Last time Euclid and Diophantus Modular Arithmetic For Monday

Read by Monday: 1.3: Modular Arithmetic Try for Monday: 1.14, 1.15, 1.16b,e, 1.25a Hand in Monday: 1.2b, 1.4b, 1.38, 1.40