Presentation is loading. Please wait.

Presentation is loading. Please wait.

From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers.

Similar presentations


Presentation on theme: "From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers."— Presentation transcript:

1 From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers. It is the positive common divisor of a and b which is divisible by every common divisor.

2 Consider now positive integers Z+ = {1, 2, 3, …}.
Any positive integer n >1 has at least two dividers, 1 and n . An integer p >1, that does not have any other dividers except 1 and itself, is called a prime. An integer n >1, that is not a prime, is composite. Theorem. Any composite integer n Z+ has a prime factor. Proof by contradiction. Assume there exists some positive integer, that has no prime factors. Then the set of such integers S  and we can find the smallest element n S  Z+. Since n is composite, n = k  m, with 1< k, m < n, so k, m S , so they are either primes or have prime factors. In either case n has a prime factor.

3 The first primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, … Does this sequence has an end? This question is not as trivial as it seems! Theorem (Euclid) There are infinitely many primes. Proof. Suppose there were only a finite number of primes p1, p2, …pk. Then form a number n = p1 p2  …  pk +1=2357…  pk +1. n is not divisible by 2, for then both n and 2357…  pk would be divisible by 2, and therefore their difference would be divisible by 2. This difference is 1, and is not divisible by 2. In the same way, n is not divisible by 3 or by 5 or … or pk. But n is either a prime or has a prime factor. In any case it is divisible by some prime p that is not among the list 2, 3, 5,…pk. It implies that there is a prime distinct from 2, 3, 5…pk, and so greater then pk. Consequently, the list of primes can never end.

4 Fundamental Theorem of Arithmetic.
Any integer n > 1 can be written as a product of prime numbers. Further, this product is unique except for rearrangement of factors. For example, take number 666. It is not a prime, because it has a factor 2, so we get 666=2333. Now 333 has an obvious factor 3, so 333=2111. Again 111 has a factor 3, and 111=337, hence: 666=23337 is a representation of the composite number 666 as a product of primes. Other examples: 12=223=223; 120 = 22235=23 3 5; But is there any another representation of 666 as a product of primes (we don’t distinguish different orders of factors)?

5 Proof that a prime factorization exists for any integer n >1.
Prove by strong induction on n >1. Basis. n =2 is prime itself, so the proposition is true. Inductive Hypothesis. Assume that for some k >1 there exists prime factorization for all integers 1<nk. Inductive Step Consider n=k+1. We can have two cases: either n is a prime, or n is composite. In the first case we have nothing to prove. In the second case n = m1 m2 and 1< m1 , m2 <n. By IH both m1 , m2 have prime factorization, so n has a prime factorization as well.

6 Lemma 1. If a prime p divides the product of two numbers,
p | ab, it must divide at least one of them. Proof. Assume p | ab to prove that p | a or p | b. If p | a we are done, so consider the case p | a What can be implied about gcd(p, a)? gcd(p, a)=1 Then the only common factor of p and a is 1. It implies that there exist integers x0 and y0 such that p x0 +ay0=1 Then b =b(px0 +ay0) = p (b x0)+(ba) y0 is divisible by p because both p(b x0) and (ba) y0 are divisible by p. Suppose now that some number c divides the product ab, c | ab. Can we imply that c divides either a or b ?

7 Proof of the uniqueness of the prime factorization
Prove it by contradiction. For this assume that there exists some integer that has non-unique prime factorization. By Well-Ordering Principle we can find the smallest such integer, let it be n. So we have n =p1 p2…pk = q1 q2… qs , where all pi, qj are primes.

8 Note that p1 divides q1(q2… qs), so it either divides q1 or (q2… qs).
If p1| q1 then p1= q1 , both are primes. If p1| (q2… qs), we repeat the argument, and ultimately reach the conclusion, that p1 equals one of the primes q1, q2,… qs . Then we can cancel the common prime from the two representations and find another integer n/p1 <n that has non-unique prime factorization in contradiction with assumption, that n is the smallest one.

9 Now we can find another form for gcd(a, b).
Suppose that the prime factorizations of the integers a and b are: (ai, bi 0 ) where all primes occurring in either factorization are included in both factorizations with zero exponent if necessary. Then This integer does divide both a and b. No larger integer can divide both a and b. The least common multiple of two integers:

10 Lemma. For any two integers x and y we have:
x + y = max(x, y)+min(x, y) Theorem. For any two integers a and b ab= gcd (a, b) lcm(a, b)

11 Example. Find gcd(120, 500) using prime factorization.
We have 120=23 3 5 and 500=22 53 , then gcd(120, 500)= 2min(3, 2) 3min(1, 0) 5min(1, 3) =22 30 51=20. The same value can be found from Euclid Algorithm as follows: 500 = 1204 + 20 120 =206 So, the last nonzero remainder is 20. What is the lcm(120, 500)? 120500 = 60,000 = gcd(120, 500) lcm(120, 500) =20 lcm(120, 500) lcm(120,500)= 3000

12 Given an integer n how can we decide is it a prime or not?
How many factors we need to check? Obviously we don’t need to check factors above n. But there exists better restriction. Theorem. If n is a composite integer, it has a prime factor less than or equal to Proof. If n is composite, it has a factor a with 0<a<n. Hence, n = ab, where both a and b are positive integers greater then 1. So, either a or b , since otherwise ab > Hence, n has a divisor less or equal It may be either prime or composite, but in any case n has a prime factor less or equal . The contrapositive of this theorem: If an integer n does not have a prime factor less or equal to , then n is prime.

13 Sieve of Eratosthenes We need to consider only primes less or equal 10: 2, 3, 5, 7

14 Example. Show that 101 is a prime.
The only primes not exceeding are : 2, 3, 5, 7. So we check that 101 is not divisible by 2, not divisible by 3, by 5 and by 7. So, 101 is prime.


Download ppt "From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers."

Similar presentations


Ads by Google