Math 312, Lecture 5 Zinovy Reichstein September 18, 2015

advertisement
Math 312, Lecture 5
Zinovy Reichstein
September 18, 2015
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0. Each subsequent step consists of
replacing (a, b) by (b, r ).
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0. Each subsequent step consists of
replacing (a, b) by (b, r ). This does not change the gcd,
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0. Each subsequent step consists of
replacing (a, b) by (b, r ). This does not change the gcd, and both a and b
become smaller.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0. Each subsequent step consists of
replacing (a, b) by (b, r ). This does not change the gcd, and both a and b
become smaller. Continue as long as the second number remains positive.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0. Each subsequent step consists of
replacing (a, b) by (b, r ). This does not change the gcd, and both a and b
become smaller. Continue as long as the second number remains positive.
Stop when r = 0.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm
Quick review from Lecture 4.
Lemma: gcd(a, b) = gcd(a + nb, b) for any integer n.
Proof: The common divisors of a and b are the same as the common
divisors of a + nb and b. (Check!) Thus the greatest common divisor is
the same.
Corollary: Let r be the remainder of division of a by b. That is,
a = bq + r . Then gcd(a, b) = gcd(b, r ).
Proof: Note that r = a − qb. Now apply the lemma with n = −q.
The Euclidean algorithm applies the above corollary recursively. We
arrange a, b so that a > b and b > 0. Each subsequent step consists of
replacing (a, b) by (b, r ). This does not change the gcd, and both a and b
become smaller. Continue as long as the second number remains positive.
Stop when r = 0. At this point gcd(b, r ) = gcd(b, 0) = b, and we are
done.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185.
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) = gcd(238, 189) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) = gcd(238, 189) =
gcd(189, 49) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) = gcd(238, 189) =
gcd(189, 49) = gcd(49, 42) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) = gcd(238, 189) =
gcd(189, 49) = gcd(49, 42) =
gcd(42, 7) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) = gcd(238, 189) =
gcd(189, 49) = gcd(49, 42) =
gcd(42, 7) = gcd(7, 0) =
Math 312, Lecture 5
September 18, 2015
The Euclidean algorithm in action
Example: a = 50771 b = 4326.
Step 1: Divide 50771 by 4326. 50771 = 11 · 4326 + 3185. Replace
(50771, 4326) by (4326, 3185).
Proceed recursively:
gcd(50771, 4326) = gcd(4326, 3185) =
gcd(3185, 1141) = gcd(1141, 903) =
gcd(903, 238) = gcd(238, 189) =
gcd(189, 49) = gcd(49, 42) =
gcd(42, 7) = gcd(7, 0) = 7.
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
a = bq + r , where 0 6 r 6 b − 1.
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
1
a = bq + r , where 0 6 r 6 b − 1. Then r < .
2
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
1
a = bq + r , where 0 6 r 6 b − 1. Then r < .
2
Proof: Consider two cases.
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
1
a = bq + r , where 0 6 r 6 b − 1. Then r < .
2
Proof: Consider two cases.
a
a
Case 1: b 6 . In this case r < b 6 , as desired.
2
2
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
1
a = bq + r , where 0 6 r 6 b − 1. Then r < .
2
Proof: Consider two cases.
a
a
Case 1: b 6 . In this case r < b 6 , as desired.
2
2
a
Case 2: b > . In this case q = 1 and
2
Math 312, Lecture 5
September 18, 2015
No. of steps in the Euclidean algorithm
Lemma: Let a > b > 0 be integers. Divide a by b with remainder:
1
a = bq + r , where 0 6 r 6 b − 1. Then r < .
2
Proof: Consider two cases.
a
a
Case 1: b 6 . In this case r < b 6 , as desired.
2
2
a
Case 2: b > . In this case q = 1 and
2
a
a
r = a − qb = a − b < a − = .
2
2
Math 312, Lecture 5
September 18, 2015
Number of steps in the Euclideal algorithm II
Corollary: Assume a > b > 0. Then the number of steps required to
compute gcd(a, b)
Math 312, Lecture 5
September 18, 2015
Number of steps in the Euclideal algorithm II
Corollary: Assume a > b > 0. Then the number of steps required to
compute gcd(a, b) by the Euclidean algorithm is at most 2 log2 (a).
Proof: By the lemma, the larger of the two numbers, (a, b) decreases by
at least a factor of 2 after two steps.
Math 312, Lecture 5
September 18, 2015
Number of steps in the Euclideal algorithm II
Corollary: Assume a > b > 0. Then the number of steps required to
compute gcd(a, b) by the Euclidean algorithm is at most 2 log2 (a).
Proof: By the lemma, the larger of the two numbers, (a, b) decreases by
at least a factor of 2 after two steps.
a
Thus after 2n steps this number will be < n .
2
Math 312, Lecture 5
September 18, 2015
Number of steps in the Euclideal algorithm II
Corollary: Assume a > b > 0. Then the number of steps required to
compute gcd(a, b) by the Euclidean algorithm is at most 2 log2 (a).
Proof: By the lemma, the larger of the two numbers, (a, b) decreases by
at least a factor of 2 after two steps.
a
Thus after 2n steps this number will be < n . Since this number is > 1,
2
the algorithm requires > 2n steps only if 2n < a, i.e., n < log2 (a).
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps,
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d,
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Let us compare our bound to Lamé’s. First of all, d < log10 (b).
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Let us compare our bound to Lamé’s. First of all, d < log10 (b). If we
denote the number of steps by N, then Lamé’s bound translates to
N 6 5 log10 (b) 6 5 log10 (a) .
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Let us compare our bound to Lamé’s. First of all, d < log10 (b). If we
denote the number of steps by N, then Lamé’s bound translates to
N 6 5 log10 (b) 6 5 log10 (a) .
Our bound is
N<
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Let us compare our bound to Lamé’s. First of all, d < log10 (b). If we
denote the number of steps by N, then Lamé’s bound translates to
N 6 5 log10 (b) 6 5 log10 (a) .
Our bound is
N < 2 log2 (a) =
2
log10 (a) =
log10 (2)
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Let us compare our bound to Lamé’s. First of all, d < log10 (b). If we
denote the number of steps by N, then Lamé’s bound translates to
N 6 5 log10 (b) 6 5 log10 (a) .
Our bound is
N < 2 log2 (a) =
2
log10 (a) = 6.64 log10 (a) .
log10 (2)
Math 312, Lecture 5
September 18, 2015
Lamé’s Theorem
The textbook proves a different estimate on the number of steps, due to
the 19th century French mathematician Gabriel Lamé.
Theorem: Suppose a > b > 0. Then the number of steps required to
compute gcd(a, b) using the Euclidean algorithm is at most 5d, where d is
the number of digits of b.
Let us compare our bound to Lamé’s. First of all, d < log10 (b). If we
denote the number of steps by N, then Lamé’s bound translates to
N 6 5 log10 (b) 6 5 log10 (a) .
Our bound is
N < 2 log2 (a) =
2
log10 (a) = 6.64 log10 (a) .
log10 (2)
Conclusion: Lamé’s estimate is a bit stronger.
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example,
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) =
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) =
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 =
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 = 2 log2 (4326) + 1 =
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 = 2 log2 (4326) + 1 = 25.2.
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 = 2 log2 (4326) + 1 = 25.2.
Lamé’s estimate is
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 = 2 log2 (4326) + 1 = 25.2.
Lamé’s estimate is N 6 5 · 4 = 20.
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 = 2 log2 (4326) + 1 = 25.2.
Lamé’s estimate is N 6 5 · 4 = 20.
The actual number of steps was
Math 312, Lecture 5
September 18, 2015
Back to our example
Check these estimates for our example, where we computed
gcd(50771, 4326).
Our estimate for the number of steps:
N 6 2 log2 (a) = 2 log2 (50771) = 31.3.
or, starting from the second step,
N 6 2 log2 (b) + 1 = 2 log2 (4326) + 1 = 25.2.
Lamé’s estimate is N 6 5 · 4 = 20.
The actual number of steps was 10.
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ).
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact,
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle,
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive,
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
We will now use the Euclidean algorithm to “quickly” find an integer
solution to this equation
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
We will now use the Euclidean algorithm to “quickly” find an integer
solution to this equation for any given pair of integers a > b > 0.
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
We will now use the Euclidean algorithm to “quickly” find an integer
solution to this equation for any given pair of integers a > b > 0.
Here, once again, “quickly” means
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
We will now use the Euclidean algorithm to “quickly” find an integer
solution to this equation for any given pair of integers a > b > 0.
Here, once again, “quickly” means “in logarithmic time”.
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
We will now use the Euclidean algorithm to “quickly” find an integer
solution to this equation for any given pair of integers a > b > 0.
Here, once again, “quickly” means “in logarithmic time”. That is, the
number of steps is at most Cd,
Math 312, Lecture 5
September 18, 2015
Back to the equation ax + by = gcd(a, b)
Last time we proved that the equation ax + by = d always has an integer
solution (x, y ). However, our proof of this fact, based on the well-ordering
principle, was non-constructive, i.e., it gave us no practical way of finding
an integer solution (x, y ).
We will now use the Euclidean algorithm to “quickly” find an integer
solution to this equation for any given pair of integers a > b > 0.
Here, once again, “quickly” means “in logarithmic time”. That is, the
number of steps is at most Cd, where C is an absolute constant and d is
the number of digits of a (or b).
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b.
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 .
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn ,
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn , using the second to last equation,
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn , using the second to last equation, gcd(a, b) = rn+1 = rn−1 − qn rn .
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn , using the second to last equation, gcd(a, b) = rn+1 = rn−1 − qn rn .
Now we use the next equation,
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn , using the second to last equation, gcd(a, b) = rn+1 = rn−1 − qn rn .
Now we use the next equation, rn = rn−2 − qn−1 rn−1 ,
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn , using the second to last equation, gcd(a, b) = rn+1 = rn−1 − qn rn .
Now we use the next equation, rn = rn−2 − qn−1 rn−1 , to eliminate rn and
express gcd(a, b) as a linear combination of rn−1 and rn−2 .
Math 312, Lecture 5
September 18, 2015
Solving ax + by = gcd(a, b) by back substitution
Set r0 = a, r1 = b. Euclidean algorithm:
r0 = q1 r1 + r2
r1 = q1 r2 + r3
rn−2 = qn−1 rn−1 + rn
............
rn−2 = qn−1 rn−1 + rn
rn−1 = qn rn + rn+1
rn = qn+1 rn+1 + 0.
Here gcd(a, b) = rn+1 . First we express it as a linear combination of rn−1
and rn , using the second to last equation, gcd(a, b) = rn+1 = rn−1 − qn rn .
Now we use the next equation, rn = rn−2 − qn−1 rn−1 , to eliminate rn and
express gcd(a, b) as a linear combination of rn−1 and rn−2 . Continue until
gcd(a, b) is expressed as a linear combination of r0 = a and r1 = b.
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35.
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Back substitution:
7 = 35−2·14 =
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Back substitution:
7 = 35−2·14 = 35−2·(154−4·35) =
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Back substitution:
7 = 35−2·14 = 35−2·(154−4·35) = 35−2·154+8·35 =
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Back substitution:
7 = 35−2·14 = 35−2·(154−4·35) = 35−2·154+8·35 = (−2)·154+9·35.
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Back substitution:
7 = 35−2·14 = 35−2·(154−4·35) = 35−2·154+8·35 = (−2)·154+9·35.
Integer solution to 154x + 35y = 7:
Math 312, Lecture 5
September 18, 2015
Example ax + by = gcd(a, b) by back substitution
Example: a = 154, b = 35. Euclidean algorithm:
154 = 4 · 35 + 14
35 = 2 · 14 + 7
14 = 2 · 7 + 0.
Back substitution:
7 = 35−2·14 = 35−2·(154−4·35) = 35−2·154+8·35 = (−2)·154+9·35.
Integer solution to 154x + 35y = 7:
x = −2, y = 9.
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327.
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4)
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4) = (−1 · 24) + (5 · 5)
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4) = (−1 · 24) + (5 · 5) = (5 · 101) + (−21 · 24)
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4) = (−1 · 24) + (5 · 5) = (5 · 101) + (−21 · 24)
= (−21·226)+(47·101)
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4) = (−1 · 24) + (5 · 5) = (5 · 101) + (−21 · 24)
= (−21·226)+(47·101) = (47·327)+(−68·226)
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4) = (−1 · 24) + (5 · 5) = (5 · 101) + (−21 · 24)
= (−21·226)+(47·101) = (47·327)+(−68·226) = (−68·553)+(115·327)
Math 312, Lecture 5
September 18, 2015
Another example:
Example: a = 553, b = 327. Euclidean algorithm:
553 = 1 · 327 + 226
327 = 1 · 226 + 101
226 = 2 · 101 + 24
101 = 4 · 24 + 5
24 = 4 · 5 + 4
5=1·4+1
4 = 1 · 4 + 0.
Solve 553x + 327y = 1 by back substitution:
1 = (1 · 5) + (−1 · 4) = (−1 · 24) + (5 · 5) = (5 · 101) + (−21 · 24)
= (−21·226)+(47·101) = (47·327)+(−68·226) = (−68·553)+(115·327)
Solution: x = −68, y = 115.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems. For example, if we only consider even numbers, then 6,
10, 30, 50 are all “prime”
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems. For example, if we only consider even numbers, then 6,
10, 30, 50 are all “prime” (i.e., none of them can be written as a product
of two even integers),
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems. For example, if we only consider even numbers, then 6,
10, 30, 50 are all “prime” (i.e., none of them can be written as a product
of two even integers), and
300 = 10 · 30 = 6 · 50
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems. For example, if we only consider even numbers, then 6,
10, 30, 50 are all “prime” (i.e., none of them can be written as a product
of two even integers), and
300 = 10 · 30 = 6 · 50
can be written as a product of “primes” in two different ways.
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems. For example, if we only consider even numbers, then 6,
10, 30, 50 are all “prime” (i.e., none of them can be written as a product
of two even integers), and
300 = 10 · 30 = 6 · 50
can be written as a product of “primes” in two different ways.
The point is: the fundamental theorem of arithmetic is not obvious,
Math 312, Lecture 5
September 18, 2015
The fundamental theorem of arithmetic
Every positive integer n > 1 can be written as a product of (not
necessarily distinct) primes, n = p1 . . . pr . Moreover, up to
reordering, the prime factors p1 , . . . , pr are uniquely determined by n.
Examples: 60 = 2 · 2 · 3 · 5.
724 = 2 · 2 · 181.
100375 = 5 · 5 · 5 · 11 · 73.
Remark: The fundamental theorem of arithmetic is not true in some other
number systems. For example, if we only consider even numbers, then 6,
10, 30, 50 are all “prime” (i.e., none of them can be written as a product
of two even integers), and
300 = 10 · 30 = 6 · 50
can be written as a product of “primes” in two different ways.
The point is: the fundamental theorem of arithmetic is not obvious, it
requires proof.
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr .
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Lemma: If a divides bc, and gcd(a, b) = 1, then a divides c.
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Lemma: If a divides bc, and gcd(a, b) = 1, then a divides c.
Proof: Since gcd(a, b) = 1,
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Lemma: If a divides bc, and gcd(a, b) = 1, then a divides c.
Proof: Since gcd(a, b) = 1, there exist integers x and y
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Lemma: If a divides bc, and gcd(a, b) = 1, then a divides c.
Proof: Since gcd(a, b) = 1, there exist integers x and y such that
ax + by = 1. Now multiply this equality by c:
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Lemma: If a divides bc, and gcd(a, b) = 1, then a divides c.
Proof: Since gcd(a, b) = 1, there exist integers x and y such that
ax + by = 1. Now multiply this equality by c:
acx + bcy = c .
Both terms on the left hand side are divisible by a. Hence, c is also
divisible by a.
Math 312, Lecture 5
September 18, 2015
Proof of the Fundamental Theorem of Arithmetic I
We have previously proved the existence of a prime decomposition
n = p1 . . . pr . To prove uniqueness, we will need the following
Lemma: If a divides bc, and gcd(a, b) = 1, then a divides c.
Proof: Since gcd(a, b) = 1, there exist integers x and y such that
ax + by = 1. Now multiply this equality by c:
acx + bcy = c .
Both terms on the left hand side are divisible by a. Hence, c is also
divisible by a.
Remark: Note that the lemma fails, if we do not assume that
gcd(a, b) = 1. For example, take a = 6, b = 3 and c = 4. Then 6 divides
3 · 4 = 12, but 6 does not divide 4.
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar .
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r ,
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic:
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic: Assume that some
integer n can be written as a product of primes
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic: Assume that some
integer n can be written as a product of primes in two different ways,
n = p1 . . . pr = q1 . . . qs
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic: Assume that some
integer n can be written as a product of primes in two different ways,
n = p1 . . . pr = q1 . . . qs
where p1 , . . . , pr , q1 , . . . , qs are primes. After cancelling all primes that
occur on both sides,
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic: Assume that some
integer n can be written as a product of primes in two different ways,
n = p1 . . . pr = q1 . . . qs
where p1 , . . . , pr , q1 , . . . , qs are primes. After cancelling all primes that
occur on both sides, we may assume pi 6= qj
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic: Assume that some
integer n can be written as a product of primes in two different ways,
n = p1 . . . pr = q1 . . . qs
where p1 , . . . , pr , q1 , . . . , qs are primes. After cancelling all primes that
occur on both sides, we may assume pi 6= qj for any i = 1, . . . , r and any
j = 1, . . . , s.
Math 312, Lecture 5
September 18, 2015
Conclusion of the proof
Corollary: Suppose a prime p divides the product a1 · a2 . . . ar . Then p
divides (at least) one of the integers a1 , . . . , ar .
Proof: Argue by induction on r , starting from r = 1.
Proof of the Fundamental Theorem of Arithmetic: Assume that some
integer n can be written as a product of primes in two different ways,
n = p1 . . . pr = q1 . . . qs
where p1 , . . . , pr , q1 , . . . , qs are primes. After cancelling all primes that
occur on both sides, we may assume pi 6= qj for any i = 1, . . . , r and any
j = 1, . . . , s. By the corollary, p1 divides one of the primes q1 , . . . , qs , a
contradiction.
Math 312, Lecture 5
September 18, 2015
Download