Unit 2
Unit 2
(21MAB302T, UNIT-II)
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Outline
1 Combinatorics
2 Permutation and Combination
4 Pigeonhole Principle
6 Divisibility
7 Prime Numbers
8 Prime Factorization
9 GCD
11 LCM
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
What is Combinatorics?
Permutation
Definition
An ordered arrangement of r elements of a set containing n distinct elements is called
an r-permutation of n elements (r ≤ n).
n
The r-permutation of n elements is denoted by P (n, r ) or and
Pr
n n!
P (n, r ) = P r = .
(n −r )!
Example
How many ways are there to select a first-prize winner, a second-prize winner, and a
third-prize winner from 30 different people who have entered a contest?
Answer: Because it matters which person wins which prize, the number of ways to
pick the three prize winners is the number of ordered selections of three elements from
a set of 30 elements, that is, the number of 3-permutations of a set of 30 elements.
Consequently, the answer is
30! 30!
P (30, 3) = 30 P 3 = = = 30 · 29 · 28 = 24360.
(30 −3)! 27!
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Combination
Definition
An unordered selection of r elements of a set containing n distinct elements is
called an r-combination of n elements (r ≤ n).
n n
The r-combination of n elements is denoted by C ( n , r ) or C r or r and
n n n!
C (n, r ) = Cr = = .
r r !(n −r )!
Example
How many ways are there to select 11 players from a 23-member football squad for a
final match?
Addition Rule
Addition Rule: If a task can be done either in one of n 1 ways or in one of n 2 ways,
where none of the set of n 1 ways is the same as any of the set of n 2 ways, then there
are n 1 + n 2 ways to do the task.
Extension of Addition Rule: Suppose that a task can be done in one of n 1 ways, or
in one of n 2 ways, · · · ,or in one of n m ways, where none of the set of n i ways of doing
the task is the same as any of the set of n j ways, for all pairs i and j with
1 ≤ i < j ≤ m. Then the number of ways to do the task is n 1 + n 2 + · · · + n m .
Theorem
When repetition of n elements contained in the set is permitted in r-permutations, then
the number of r-permutations is n r .
Theorem
The number of different permutations of n objects which include n 1 identical objects of
type I , n 2 identical objects of type I I , · · · and n k identical objects of type k is equal to
n!
,
n 1 !n 2 ! · · · n k !
where n 1 + n 2 + · · · + n k = n .
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Example
Example
Suppose that either a member of the mathematics faculty or a student who is a
mathematics major is chosen as a representative to a university committee. How many
different choices are there for this representative if there are 37 members of the
mathematics faculty and 83 mathematics majors and no one is both a faculty member
and a student?
Answer: There are 37 ways to choose a member of the mathematics faculty and there
are 83 ways to choose a student who is a mathematics major.
Choosing a member of the mathematics faculty is never the same as choosing a
student who is a mathematics major because no one is both a faculty member and a
student.
By the sum rule it follows that there are 37 + 83 = 120 possible ways to pick this
representative.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Example
Example
A student can choose a computer project from one of three lists. The
three lists contain 23, 15, and 19 possible projects, respectively. No
project is on more than one list. How many possible projects are
there to choose from?
Example
Example
How many positive integers n can be formed using the digits 3, 4, 4, 5, 5, 6, 7, if n has
to exceed 50,00,000?
Answer: In order that n may be greater than 50,00,000, the first place must be
occupied by 5, 6 or 7.
When 5 occupies the first place, the remaining 6 places are to be occupied by the digits
3, 4, 4, 5, 6, 7. Thus, number of such numbers= 6!/2! = 360 (since the digit 4 occurs
twice).
When 6 occupies the first place, the remaining 6 places are to be occupied by the digits
3, 4, 4, 5, 5, 7. Thus, number of such numbers= 6!/(2!2!) = 180 (since 4 and 5 each
occurs twice).
When 7 occupies the first place, the remaining 6 places are to be occupied by the digits
3, 4, 4, 5, 5, 6. Thus, number of such numbers= 6!/(2!2!) = 180 (since 4 and 5 each
occurs twice).
Therefore, by using addition rule, the number of numbers exceeding 50,00,000 is
360 + 180 + 180 = 720.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Product Rule
Product Rule: Suppose that a procedure can be broken down into a sequence of two
tasks. If there are n 1 ways to do the first task and for each of these ways of doing the
first task, there are n 2 ways to do the second task, then there are n 1 n 2 ways to do the
procedure.
Example
A new company with just two employees, Sanchez and Patel, rents a floor of a building
with 12 offices. How many ways are there to assign different offices to these two
employees?
Example
Example
From a club consisting of 6 men and 7 women, in how many ways can we select a
committee of
(i) 3 men and 4 women?
(ii) 4 persons which has at least 1 women?
Therefore, by using product rule, the committee of 3 men and 4 women can be
selected by
6 C × 7 C = 20 ×35 = 700.
3 4
Answer of (ii): For the committee to have at least 1 woman, we have to select 3 men
and 1 woman or 2 men and 2 women or 1 man and 3 women or no man and 4 women.
Pigeonhole Principle
Pigeonhole Principle: If n pigeons are accommodated in m pigeonholes and n > m
then at least one pigeonhole will contain two or more pigeons.
Equivalently, if n objects are put in m boxes and n > m, then at least one box will
contain two or more objects.
Among any group of 367 people, there must be at least two with the same
birthday, because there are only 366 possible birthdays.
Pigeon = 367 people
Pigeonholes = 366 birthdays.
Note: Is there a pair of you with the same birthday date? YES, since there are
more than 366 of you.
In any group of 27 English words, there must be at least two that begin with the
same letter, because there are 26 letters in the English alphabet.
Pigeon = 27 words,
Pigeonholes = 26 alphabet.
Is it true that within a group of 700 people, there must be 2 who have the same
first and last initials?
Note that, there are 26 2 = 676 different sets of first and last initials and we have
700 people.
Pigeon = 700 people,
Pigeonholes = 676 different sets of first and last initials.
Answer: YES.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
If there are 105 of you, are there at least 3 of you with the same birthday week?
Note that, there are 52 weeks in a year.
Pigeon (n) = 105 people,
Pigeonholes (m)= 52 week.
By using Generalization of the Pigeonhole Principle, we can say at least
, ,
105 −1
+ 1 = 3 people is having same birthday week.
52
Answer: YES.
What is the minimum number of students required in a Discrete Mathematics
class to be sure that at least six will receive the same grade, if there are five
possible grades, A, B, C, D, and F?
Answer: Suppose, there is N number of students in the Discrete Mathematics
class.
Pigeon (n) = N students,
Pigeonholes (m)= 5 grades.
By using Generalization of the Pigeonhole Principle, we can write
, , , ,
N − N −1 N −1
+ 1= 6⇒ = 5⇒5≤ < 6 ⇒ 26 ≤ N < 31.
1 5 5 5
Therefore, at least N = 26 students required in a Discrete Mathematics class to
be sure that at least six will receive the same grade, if there are five possible
grades, A, B, C, D, and F.
Example
If we select 10 points in the interior of an equilateral triangle of side 1, show that
there must be at least two points whose distance apart is less than 31 .
Let ADG be the given equilateral triangle. The pairs of points B, C ; E , F and H,
I are the points of trisection of the sides AD, DG and GA respectively. We have
divided the triangle ADG into 9 equilateral triangles each of side 13 .
The 9 sub-triangles may be regarded as 9 pigeon-holes and 10 interior points may
be regarded as 10 pigeons. Then by the pigeonhole principle, at least one sub
triangle must contain 2 interior points. The distance between any two interior
points of any sub triangle cannot exceed the length of the side, namely, 31 .
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Example
Example
How many binary strings of length 8 either start with a “1” bit or end with two bits “00”?
Answer: If the binary string starts with “1”, then, there are 7 characters left which can
be filled in 2 7 = 128 ways.
If the binary string ends with “00” then 6 characters can be filled in 2 6 = 64 ways.
Now, if we add the above sets of ways and conclude that it is the final answer, then it
would be wrong.
This is because there are binary strings, start with “1” and end with “00” both, and
since they satisfy both criteria they are counted twice.
Solution:
S={Students who have taken Spanish}, |S| = 1232.
F ={Students who have taken French}, |F | = 879.
R={Students who have taken Russian}, |R| = 114.
|S ∩ F | = 103, |S ∩ R| = 23, |F ∩ R| = 14, and |S ∪ F ∪ R| = 2092.
To find the number of students have taken in all languages means find |S ∩ F ∩ R|.
By using the Principle of Inclusion and Exclusion for three sets, we get
|S ∩ F ∩ R| = |S ∪ F ∪ R| − |S| − |F | − |R| + |S ∩ F | + |F ∩ R| + |S ∩ R|
= 2092 − 1232 − 879 − 114 + 103 + 23 + 14
|S ∩ F ∩ R| = 7.
Therefore, the number of students have taken all languages is 7.
Problem: 2
Suppose U is a set containing 75 elements and A1 , A2 , A3 , A4 are subsets of U with
the following properties: Each subset contain 26 elements; the intersection of any
two of the subsets contains 11 elements; the intersection of any three of the subsets
contains 3 elements; the intersection of all four subsets contains 1 element.
1 How many elements belong to none of the four subsets?
2 How many elements belong to exactly one of the four subsets?
Solution: Given that |U| = 75, |Ai | = 26, for all i = 1, 2, 3, 4, |Ai ∩ Aj | = 11 for
i ̸= j, |Ai ∩ Aj ∩ Ak | = 3, for i ̸= j ̸= k, and |A1 ∩ A2 ∩ A3 ∩ A4 | = 1.
1 (A1 ∪ A2 ∪ A3 ∪ A4 ) or (A1 ∪ A2 ∪ A3 ∪ A4 )c is the collection of elements
belong to none of the four subsets. First, to find (A1 ∪ A2 ∪ A3 ∪ A4 ) by
using Principle of Inclusion Exclusion for four sets, we get
X4 X
|A1 ∪ A2 ∪ A3 ∪ A4 | = |Ai | − |Ai ∩ Aj |
i=1 1≤i<j≤4
X
+ |Ai ∩ Aj ∩ Ak | − |A1 ∩ A2 ∩ A3 ∩ A4 |
1≤i<j<k≤4
|A1 ∪ A2 ∪ A3 ∪ A4 | = (4 × 26) − (4C2 × 11) + (4C3 × 3) − (1)
= 104 − 66 + 12 − 1
|A1 ∪ A2 ∪ A3 ∪ A4 | = 49.
Solution: Let A, B, C , D be the sets of integers that lie between 1 and 250 and
that are divisible by 2, 3, 5, and 7 respectively.
250 250 250 250
|A| = = 125, |B| = = 83, |C | = = 50, |D| = = 35.
2 3 5 7
The set of integers between 1 and 250 which are divisible by 2 and 3. A ∩ B is the
same as that which is divisible by 6, since 2 and 3 are relatively prime numbers.
250
∴ |A ∩ B| = = 41.
6
Similarly, we get
250 250 250
|A ∩ C | = = 25; |A ∩ D| = = 17; |B ∩ C | = = 16;
10 14 15
250 250 250
|B ∩ D| = = 11; |C ∩ D| = = 7; |A ∩ B ∩ C | = = 8;
21 35 30
250 250
|A ∩ B ∩ D| = = 5; |A ∩ C ∩ D| = = 3;
42 70
250 250
|B ∩ C ∩ D| = = 2; |A ∩ B ∩ C ∩ D| = = 1.
105 210
By the Principle of Inclusion-Exclusion, the number of integers between 1 and 250
that are divisible by at least one of 2, 3, 5 and 7 is given by
|A ∪ B ∪ C ∪ D| = {|A| + |B| + |C | + |D|} − {|A ∩ B| + |A ∩ C | + |A ∩ D|
+ |B ∩ C | + |B ∩ D| + |C ∩ D|} + {|A ∩ B ∩ C |
+|A ∩ C ∩ D| + |B ∩ C ∩ D| + |A ∩ B ∩ D|}
−|A ∩ B ∩ C ∩ D|
= (125 + 83 + 50 + 35) − (41 + 25 + 17 + 16 + 11 + 7)
+(8 + 5 + 3 + 2) − 1
|A ∪ B ∪ C ∪ D| = 193.
∴ Numbers of integers between 1 and 250 that are not divisible by any of the
integers 2, 3, 5 and 7
= Total no.of integers − |A ∪ B ∪ C ∪ D|
= 250 − 193 = 57.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Divisibility
Definition
When a and b are two integers with a =/ 0, a is said to divide b (i.e., we
can say that a divides bor bis divisible by a), if there is an integer c
such that b= ac and it is denoted by the notation a | b.
Note
i) When a divides b, then −a also divides b, since b= ac can be
written as b= (−a)(−c).
ii) If a does not divide b, then it is denoted by a ‡b.
iii) The relation ”a divides b” is a reflexive and transitive in the set of
positive integers but not symmetric.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Theorem
Let a, b, c∈ z , the set of integers. Then
(i) If a | b and a | c, then a | (b + c).
(ii) If a | b and b | c, then a | c.
(iii) If a | b, then a | mb, for any integer m.
(iv) If a | band a | c, then a | (mb + nc), for any integers m and n.
Proof:
(i) Since a | band a | c, it follows, from definition of divisibility, that
b= ma and c = na, where m and n are integers.
Hence b + c = (m + n)a.
This means that a divides (b + c) or a | (b + c).
(ii) Since a | band b | c, we have b = ma and c = nb, where m and n
are integers.
Hence c = n(ma) = (mn)a.
This means that a divides c or a | c.
(iii) Since a | b, we have b = na.
Hence mb = (mn)a, where m and n are integers. This means that a
divides mb or a | mb.
(iv) We can prove by using (i) and (iii).
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Prime numbers
Definition
A positive integer p > 1 is called prime, if the only positive factors of p
are 1 and p. A positive integer > 1 and is not prime is called
composite.
Note
i) The positive integer 1 is neither prime nor composite.
ii) The positive integer n is composite, if there exists positive
integers a and bsuch that n = ab, where 1 < a, b< n.
iii) A number that is not a prime is divisible by prime.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Theorem
Every integer n > 1 can be written uniquely as a product of prime
numbers.
Proof
We shall prove the theorem by introduction.
Let n = 2.
Since 2 is prime, n ( = 2) is a product of primes (as a product may
consist of a single factor).
Let n > 2.
If n is prime, it is a product of primes, i.e., a single factor product.
If n is not prime, i.e., composite, let us assume that the theorem holds
good for positive integers less than n and that n = ab. Since a, b< n,
each of a and bcan be expressed as the product of primes (by the
assumption).
Hence, n = ab is also a product of primes.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Theorem
For prime p and integers a and b, if p | ab, then either p | a or p | b.
Hint: If p | ab but p ‡a, then p | b.
Theorem
If p is a prime and p | a 1 a 2 ···a n , then either p | a1 or p | a2 or ···or
p | an .
Proof: We will prove this by mathematical induction.
For n = 2 the above statement is true (by previous theorem).
For n > 2, let a = a1 and b= a 2 a 3 ···a n , then either p | a ( = a 1 ) or
p | b ( = a2 a3 ···an ).
If p ‡a1, then similarly we will get either p | a2 or p | a 3 a 4 ···a n .
Finally we can conclude that if p | a 1 a 2 ···a n , then either p | a1 or
p | a2 or ···or p | an .
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Prime factorization
The unique expression for the integer n > 1 as a product of primes is
called the prime factorization or prime decomposition of n.
Note
If there be k i prime factors of n, each equal to p i , where 1 ≤ i ≤ r,
then n can be written as
n = p1k 1 ·pk2 2 ···prk r .
Example
If n = 120, then 120 = 23 × 31 × 51. Here p1 = 2, p2 = 3 and p3 = 5;
k 1 = 3, k 2 = 1 and k 3 = 1.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Example
Find the prime factorization of 7007.
Solution: To find the prime factorization of 7007, first perform
divisions of 7007 by successive primes, beginning with 2. None of the
primes 2, 3, and 5 divides 7007. However, 7 divides 7007, with
7007/7 = 1001. Next, divide 1001 by successive primes, beginning
with 7.
It is immediately seen that 7 also divides 1001, because
1001/7 = 143. Continue by dividing 143 by successive primes,
beginning with 7. Although 7 does not divide 143, 11 does divide 143,
and 143/11 = 13. Because 13 is prime, the procedure is completed. It
follows that
7007 = 7 ·1001 = 7 ·7 ·143 = 7 ·7 ·11 ·13. Consequently, the prime
factorization of 7007 is 7 ·7 ·11 ·13 = 72 ·11 ·13.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Theorem
The number of prime numbers is infinite.
Proof: We will prove this theorem using a proof by contradiction. We
assume that there are only finitely many primes, p1, p 2, . . ., p n .
Let Q = p1p2 . . . p n + 1. By the fundamental theorem of arithmetic, Q
is prime or else it can be written as the product of two or more
primes. However, none of the primes p j divides Q, for if p j |Q, then p j
divides Q − p1p2 . . . p n + 1. Hence, there is a prime not in the list p1,
p2, . . . , p n . This prime is either Q, if it is prime, or a prime factor of Q.
This is a contradiction because we assumed that we have listed all
the primes. Consequently, there are infinitely many primes.
Theorem
√
If n > 1 is a composite integer and p is a prime factor of n, then p ≤ n.
Proof.
Since n > 1 is a composite integer,
√ n can √ be expressed√ as n = ab,√where 1 < a ≤
b < n.√We√will show that a ≤ n or b ≤ n. If a > n and b > n then
ab > n · n = n which is contraction. Because √both a and b are divisors of n, we
see that n has a positive divisor not exceeding n. This divisor is either prime or,
by the fundamental theorem of arithmetic, has a prime√divisor less than itself. In
either case, n has a prime divisor less than or equal to n. Note to test if a given
integer n is √
prime, it is enough to see that it is not divisible by any prime less than
or equal to n.
Example
If a = 46, b = 13, then q = 3 and r = 7. Here 46 = 13(3) + 7.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
GCD
Definition
Let a and bbe integers, not both zero. The largest integer d such that
d | a and d | bis called the greatest common divisor of a and b. The
greatest common divisor of a and bis denoted by gcd(a, b).
The greatest common divisor of two integers, not both zero, exists
because the set of common divisors of these integers is nonempty
and finite. One way to find the greatest common divisor of two
integers is to find all the positive common divisors of both integers
and then take the largest divisor.
Example
What is the greatest common divisor of 24 and 36?
Solution: The positive common divisors of 24 and 36 are 1, 2, 3, 4,
6, and 12. Hence, gcd(24, 36) = 12.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Definition
The integers a and bare relatively prime if their greatest common
divisor is 1.
It follows from the definition that the integers 17 and 22 are relatively
prime, because gcd(17, 22) = 1.
Lemma
Let a = bq + r, where a, b, q, and r are integers. Then
gcd(a, b) = gcd(b, r ).
Example
Find the greatest common divisor of 414 and 662 using the Euclidean
algorithm.
Solution: Successive uses of the division algorithm give:
662 = 414 ·1 + 248
414 = 248 ·1 + 166
248 = 166 ·1 + 82
166 = 82 ·2 + 2
82 = 2 ·41. Hence, gcd(414, 662) = 2, because 2 is the last nonzero
remainder.
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Theorem
gcd(a, b) can be expressed as an integral linear combination of a and
b. i.e., gcd(a, b) = ma + nb, where m and n are integers.
Example
For example, we consider the steps we used to find the gcd(414, 662)
that are given below: 662 = 414 ·1 + 248
414 = 248 ·1 + 166
248 = 166 ·1 + 82
166 = 82 ·2 + 2
From the last equation we have
2 = 166 − 82 ·2
= 166 − (248 − 166 ·1) ·2
= 166 ·3 − 248 ·2
= (414 − 248) ·3 − 248 ·2
= 414 ·3 − 248 ·5
= 414 ·3 − (662 − 414 ·1) ·5
= 414 ·8 − 662 ·5
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Properties of gcd
LCM
Definition
The least common multiple of the positive integers a and bis the
smallest positive integer that is divisible by both a and b. The least
common multiple of a and b is denoted by lcm(a, b).
The least common multiple exists because the set of integers divisible
by both a and bis nonempty (because ab belongs to this set, for
instance), and every nonempty set of positive integers has a least
element. Suppose that the prime factorizations of a and b are as
before. Then the least common multiple of a and b is given by
lcm(a, b) = p 1 max(a 1 , b1 ) p ma x( a 2 , b2 )
2 ···p n m a x ( a n , bn),
Theorem
Let a and bbe positive integers. Then ab = gcd(a, b) ·lcm(a, b).
Proof: Let the prime factorization of a and bbe
a = p 1 a 1 p 2 a 2 ···p n a n and b= p1b1 p2b2 ···p n b n .
Then gcd(a, b) = p 1 min(a 1 , b1 ) p 2 min( a 2 , b2 ) ···p n m i n ( a n , b n )
and lcm(a, b) = p 1 max(a 1 , b1 ) p 2 ma x( a 2 , b2 ) ···p n m a x ( a n , b n )
We observed that if min(a i, bi) is a i (or bi) then max(ai, bi) is bi (or a i ),
i = 1, 2, . . . , n.
Hence,
gcd(a, b) ×lcm(a, b)
= p 1 m i n ( a 1 ,b 1 ) + m a x ( a 1 ,b 1 ) · p 2 m i n ( a 2 ,b 2 ) + m a x ( a 2 ,b 2 ) · · · p n m i n ( a n , b n ) + m a x ( a n , b n )
= p1 ( a 1 + b1 ) · p2 ( a 2 + b2 ) · · · pn ( a n + bn )
= (p1 a 1 p2 a 2 · · · pn a n ) (p1 b1 p2 b2 · · · pn bn )
= ab
Combinatorics Permutation and Combination Addition and Product Rules Pigeonhole Principle Principle of Inclusion and Exclusion Divisibility Prime Nu
Example
Using prime factorization, find the gcd and lcm of (231, 1575) verify
also that gcd(m, n)·lcm(m, n) = mn.
Solution: 231 = 31 ·50 ·71 ·111, 1575 = 32 ·52 ·71 ·110
Now
Example
Use Euclidean algorithm to find gcd(1819, 3587) and express the gcd as a linear
combination of the given numbers.
Solution: By division algorithm,
3587 = 1 · 1819 + 1768
1819 = 1 · 1768 + 51
1768 = 34 · 51 + 34
51 = 1 · 34 + 17
34 = 2 · 17 + 0
Since the last non-zero remainder is 17, gcd(1819, 3587) = 17.
Now
17 = 51 −1 · 34
= 51 −1 · (1768 −34 · 51)
= 35 · 51 −1 · 1768
= 35 · (1819 −1 · 1768) −1 · 1768
= 35 · 1819 −36 · 1768
= 35 · 1819 −36 · (3587 −1 · 1819)
= 71 · 1819 −36 · 3587
Example: 2
Solve for integers m and n such that 28844m + 15712n = 4 using Euclidean
algorithm.
Solution: From the given equation, we infer that 4 is the gcd(28844, 15712).
Hence, there will exist integers m and n so that the given equality holds. By using
Euclidean algorithm, we get
4 = 28 − (3 × 8)
= 28 − 3(232 − 8 × 28)
= (25 × 28) − (3 × 232)
= 25(2580 − 11 × 232) − (3 × 232)
= (25 × 2580) − (278 × 232)
= (25 × 2580) − 278(13132 − 5 × 2580)
= (1415 × 2580) − (278 × 13132)
= 1415(15712 − 13132) − (278 × 13132)
= (1415 × 15712) − (1693 × 13132)
= (1415 × 15712) − 1693(28844 − 15712)
= (3108 × 15712) − (1693 × 28844)