Permutations r-permutation (AKA “ordered r-selection”) An ordered arrangement of r elements of a set of n distinct elements. permutation of a set of n.

Slides:



Advertisements
Similar presentations
Basic Permutations and Combinations
Advertisements

1 Section 4.3 Permutations & Combinations. 2 Permutation Set of distinct objects in an ordered arrangement An ordered arrangement of r members of a set.
Permutations and Combinations Rosen 4.3. Permutations A permutation of a set of distinct objects is an ordered arrangement these objects. An ordered arrangement.
Counting Chapter 6 With Question/Answer Animations.
Permutations and Combinations
THE BASIC OF COUNTING Discrete mathematics KNURE, Software department, Ph , N.V. Bilous.
Counting and Probability The outcome of a random process is sure to occur, but impossible to predict. Examples: fair coin tossing, rolling a pair of dice,
Counting Tools ● Enumeration ● Multiplication ● Addition ● Negation.
CSE115/ENGR160 Discrete Mathematics 04/17/12
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
4/5/05Tucker, Sec Applied Combinatorics, 4rth Ed. Alan Tucker Section 5.4 Distributions Prepared by Jo Ellis-Monaghan.
Counting Techniques: r-combinations with
1 More Counting Techniques Possibility trees Multiplication rule Permutations Combinations.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
1 Permutations and Combinations CS/APMA 202 Epp section 6.4 Aaron Bloomfield.
Permutations and Combinations
Chapter 1 Fundamental principles of counting 陳彥良 中央大學資管系.
4. Counting 4.1 The Basic of Counting Basic Counting Principles Example 1 suppose that either a member of the faculty or a student in the department is.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Combinatorics.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Review of 5.1, 5.3 and new Section 5.5: Generalized Permutations and Combinations.
1 Permutations and Combinations CS/APMA 202 Rosen section 4.3 Aaron Bloomfield.
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
The Basics of Counting Section 6.1.
Jessie Zhao Course page: 1.
Counting. Product Rule Example Sum Rule Pigeonhole principle If there are more pigeons than pigeonholes, then there must be at least one pigeonhole.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 6 Counting and Probability Instructor: Hayk Melikyan Today we will review sections 6.4,
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Generalized Permutations and Combinations
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Permutations and Combinations
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Chapter 3 Permutations and combinations
March 10, 2015Applied Discrete Mathematics Week 6: Counting 1 Permutations and Combinations How many different sets of 3 people can we pick from a group.
2 Permutations and Combinations Lesson 8 HAND OUT REFERENCE SHEET AND GO OVER IT.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
Simple Arrangements & Selections. Combinations & Permutations A permutation of n distinct objects is an arrangement, or ordering, of the n objects. An.
1 Lecture 4 (part 2) Combinatorics Reading: Epp Chp 6.
4.1.2 Pigeonhole principle:Strong Form  Theorem 4.2: Let q 1,q 2,…,q n be positive integers. If q 1 +q 2 +…+q n -n+1 objects are put into n boxes, then.
Module #15: Combinatorics Rosen 5 th ed., §§ & §6.5 Now we are moving on to Ch. 4 It is the study of arrangement of objects e.g. enumeration, counting.
Counting CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Permutations and Combinations Section 2.2 & 2.3 Finite Math.
Spatial Statistics and Spatial Knowledge Discovery First law of geography [Tobler]: Everything is related to everything, but nearby things are more related.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Counting Principles Multiplication rule Permutations Combinations.
Counting.
5.5 Generalized Permutations and Combinations
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Copyright © Peter Cappello 2011 Simple Arrangements & Selections.
Section The Pigeonhole Principle If a flock of 20 pigeons roosts in a set of 19 pigeonholes, one of the pigeonholes must have more than 1 pigeon.
Chapter 6 With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 5 Counting 歐亞書局.
Section The Product Rule  Example: How many different license plates can be made if each plate contains a sequence of three uppercase English letters.
11.1 CompSci 102© Michael Frank Today’s topics CountingCounting –Generalized Pigeonhole Principle –Permutations –Combinations –Binomial Coefficients –Writing.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Section 6.3. Section Summary Permutations Combinations.
Example A standard deck of 52 cards has 13 kinds of cards, with four cards of each of kind, one in each of the four suits, hearts, diamonds, spades, and.
Discrete Mathematics Counting.
CSE15 Discrete Mathematics 04/19/17
ICS 253: Discrete Structures I
Generalized Permutations and Combinations
COCS DISCRETE STRUCTURES
Permutations and Combinations
Permutations and Combinations
Permutations and Combinations
CS100: Discrete structures
Permutations and Combinations
Presentation transcript:

Permutations r-permutation (AKA “ordered r-selection”) An ordered arrangement of r elements of a set of n distinct elements. permutation of a set of n element = n-permutation on this set Example: S={J,K,Q}: (K,Q,J) is a permutation of S; (J,K) is a 2-permutation of S Note: Set is unordered, but permutation is ordered!, e.g. (K,Q)≠(Q,K) The number of r-permutations of n objects is: P(n,r) =n(n-1)(n-2)...(n-r+1) =n! / (n-r)! 0<=r<=n And the number of permutations of n objects is P(n,n)=n! (Proof:1 st object can be chosen in n ways, 2 nd in (n-1) ways, and so on (k th in n-k+1 ways) until the r th object is chosen in n-r+1 ways. Now, use the product rule to get the formula given for P(n,r).) Reminder: n! = n(n-1)(n-2)...1. “n factorial.” (n+1)! = (n+1)n! 0! = 1

Permutation Examples Q: A mailman needs to bring 8 packages to 8 cities. How many ways are there to visit the cities? A: Pick first city among 8, second city among 7, etc. Each route is a permutation of 8-element set: Answer = P(8)=8! Q: How many permutations of the letters “abcdefgh” contain “abc” as a block. A: Rename “abc” to B. Question becomes: Count permutations of blocks Bdefgh: A: It’s the # permutations in a 6-element set, i.e. P(6) = 6! Q: How many ways to pick three prizes (gold,silver,bronze) among 100 contestants? A: It’s the number of 3-permutations in a 100-element set: P(100,3) = 100! / (100-3)! = 100! / 97! = 100*99*98

Combinations r-combination (AKA “unordered r-selection”) An unordered selection of r elements, i.e. a subset of size r of a set of n elements. Example: S={A,J,Q,K}. {A,J,K}={K,A,J}={J,K,A} are all 3-combinations of set S. The total number of r-combinations of a set of size n is denoted C(n,r), and given by: C(n,r) = n! / (r! (n-r)!), for 0<=r<=n Two facts to observe: 1. C(n,r) = C(n,n-r) Why does this make sense? 2. C(n,r) = P(n,r) / r! Why? Each of the C(n,r) subsets of r objects can be ordered in r! ways, meaning that C(n,r) * r! = P(n,r)

Computing Combinations Computing C(n,r) as n! / [(n-r)!r!] is grossly inefficient and, as a practical matter, can lead to incorrect results (even using computers!). Choose to compute C(n,r) if r ≤ n/2 “and/or” C(n,n-r) if r >n/2. Then, assuming wlog we have the first case, compute C(n,r) as: n (n-1)(n-2)(n-3)(n-4) … (n-r+2)(n-r+1) r (r-1)(r-2) (r-3) (r-4) … (2) (1) Simplify as much as you can. The result is always an integer. !

Examples: Consider a department with n=20 people. Q: How many 3-member committees possible? A: C(20,3) = 20! / 17!*3! = 20*19*18 / 1*2*3 Q: How many 3-member ordered committees possible? A: P(20,3) = C(20,3) * 3! = 20*19*18 Q: How many 3-letter words in an 20-letter alphabet? A: 20 3 = 20*20*20[repetitions allowed] Q: How many committees possible if you need 3 from math (n math =20) and 2 from computer science (n cs =30)? A: C(20,3) x C(30,2) Why the individual factors? Why the multiplication?

Examples: Q: How many bit-strings of size 10 contain exactly four 1’s? A: We need to place four 1’s in 10 slots: C(10,4). Q: How many decimal-strings of size 10 contain exactly four 1’s? A: C(10,4) x 9 6 Q: How many 10-digit strings have four 1’s and no other repeats? A: C(10,4) x P(9,6) = C(10,4) x 9*8*7*6*5*4 Q: How many 10-digit strings have (exactly) four 1’s and three 2’s? A: C(10,4) x C(6,3) x 8 3 = C(10,7) x C(7,4) x 8 3

Counting Like 2 n, C(n,r) and P(n,r), n! etc. grow very fast with n. C(12,r) P(12,r) r  rr Behavior of C(n,r) and P(n,r) for fixed n=12 and growing r.

Binomial Coefficients Q: What is the coefficient of x 12 y 13 in the expansion of (x+y) 25 ? A: We need to pick 12 x’s from 25 terms: C(25,12) = C(25,13). What is the coefficient of x 12 y 13 in (2x-3y) 25 ? First replace a=2x and b=-3y. The coefficient of a 12 b 13 in (a+b) 25 is C(25,12). Since C(25,12) a 12 b 13 = C(25,12) 2 12 x 12 (-3) 13 y 13 the coefficient we want must be C(25,12) 2 12 ∙(-3) 13 Notation:

Binomial Theorem How does this relate to |P(S)| = |2 S | = 2 |S| ? Some consequences:

Pascal’s Identity aS T j C(n, j) = C(n-1, j-1) + C(n-1, j) aS T j-1 =+ C(n,j) = C(n-1,j-1) + C(n-1,j) if 1 ≤ j ≤ n-1 [Note that C(n,n)=C(n,0)=1 for all n] aS T j You can select j objects from n in one of the following ways: 1.Take the first object and select j-1 from the last n-1 objects OR 2. Omit the first object and select j from the last n-1 objects.

Pascal’s Triangle C(5,2)=C(4,1)+C(4,2) C(0,0) C(1,0), C(1,1) C(2,0), C(2,1), C(2,2) C(3,0), C(3,1), C(3,2), C(3,3) C(4,0),C(4,1),C(4,2),C(4,3),C(4,4) C(5,0),C(5,1),C(5,2),C(5,3),C(5,4),C(5,5)

VanderMonde’s identity Proof: Let S m be a set with m elements; S n, a set with n different elements. Both sides of the equation equal |{A  S m  S n | |A|=r }|, the number of subsets of S m  S n which have r elements. remove r m n C(m+n,r) = C(m,j)C(n,r-j) 0 ≤ r ≤ m,n m n 0 r 1 r-1 2 r-2 = … C(2n,n) = C(n,j) 2 0 ≤ j ≤ n Special case, m=n, using the fact that C(n,n-j)=C(n,j):

Another fact: C(n+1,r+1) = C(j,r) Example: C(6,4) = C(5+1,3+1) = C(3,3) + C(4,3) + C(5,3) [r=3,n=5] Proof: Follows from Pascal’s identity: C(n+1,r+1)= C(n,r) + C(n,r+1) = C(n,r) + ( C(n-1,r) + C(n-1,r+1) ) = C(n,r) + C(n-1,r) + ( C(n-2,r) + C(n-2,r+1) ) = C(n,r) + C(n-1,r) + C(n-2,r) + ( C(n-3,r) + C(n-3,r+1) ) … = C(n,r) + C(n-1,r) + C(n-2,r) + C(n-3,r) + … + C(r,r)

Selecting r items from n objects/classes If Order matters: When items not replaced (r-permutation): P(n,r) = n!/(n-r)! When items are replaced: n r If Order does not matter: When items not replaced (r-combination): C(n,r) C(n,r) = n!/(n-r)!r! = P(n,r)/r! When items are replaced: C(n+r-1,r) C(n+r-1,r) = C(n+r-1,n-1) = (n+r-1)!/(n-1)!r! Proof: Each such selection can be arranged so that all repetitions of the first (class of) object are followed by all repetions of the second (class of) object, followed by …, with n-1 barriers separating the non-identical (classes of) objects. Thus, we have r+n-1 slots each containing a barrier or an object. (What type of object is determined by how many barriers come before it.) We simply count the number of ways the n-1 barriers can be selected.

Permutations of Indistinguishable Objects Thrm: n objects s.t.: n 1 indistinguishable of type 1, n 2 indistinguishable of type 2, …, n k indistinguishable of type k. Number of different permutations of these n objects: n!/(n 1 ! n 2 ! … n k !) Proof: Correct for duplication in n! or compute that this value is the same as C(n,n 1 )C(n-n 1,n 2 )C(n-n 1 -n 2,n 3 )…C(n-n 1 -n 2 -…- n k-1,n k ) n!/(n 1 ! n 2 ! … n k !) is also the number of ways to distribute n distinguishable objects into k distinguishable containers where each container i gets n i objects. Proof: We are simply permuting the (indistinguishable) box assignments (n 1 to box 1, n 2 to box 2, …, n k to box k) among the n distinguishable objects.

Counting Examples, 1 Q: How many ways are there to select 5 bills from a cash box containing $1, $2, $5, $10, $20, $50, and $100 bills, assuming that there are at least 5 bills of each type and that the order of selection doesn’t matter? A: Unordered selection with replacement: C(5+7-1,7-1) = _______ Q: A cookie shop has 4 kinds of cookies. They are sold 6 to a bag. How many kinds of bags are there? A: Unordered selection with replacement: C(6+4-1,4-1) = _______

Counting Examples, 2 Q: How many integer solutions to x+y+z=11 with 0≤x,y,z? A: Make 11 selections with replacement from among 3 boxes (x,y,z). (Or simply look again at the proof of the formula for unordered selection with replacement.) C(11+3-1,3-1) = _______ Q: How many integer solutions to x+y+z=11 with 0<x,y,z ? A: This is the same as having 0≤x-1,y-1,z-1 saitisfying (x-1)+(y-1)+(z-1)=11-3=8. C(8+3-1,3-1) = _______ Q: How many integer solutions to x+y+z ≤11 with 0≤x,y,z ? A: This is the same as asking how many integer solutions to x+y+z+w=11 with 0≤x,y,z,w? C(11+4-1,4-1) = _______

Counting Examples, 3 Q: Distribute 10 (identical) candy bars among 8 friends? A: Unordered selection with replacement: C(10+8-1,8-1) _______ Q: How many different “words” can we create by reordering “SUCCESS”? A: 7 letters, including 3 S’s and 2 C’s with the rest unique: 7!/(3!∙2!) Q: How many 5 card hands can one get from a deck of 52 cards? A: C(52,5) = _______ Now suppose you need to deal 3 such hands for 3 different players. Q: How many ways can this be done if it matters who gets what hand? A: 52!/(5!∙5!∙5!∙37!) Q: How many ways if it doesn’t matter who gets what hand? A: 52!/(3!∙5!∙5!∙5!∙37!)

Counting Examples, 4 A math teacher has 40 different issues of a journal to pack into 4 boxes, 10 issues each. Q: How many ways can this be done if the boxes are numbered? A: 40!/(10!) 4 Q: How many ways can this be done if the boxes are not numbered? A: 40!/(4!∙(10!) 4 ) Q: How many ways can one put n books on k shelves assuming each shelf can hold at least n books? A: Put them in order (n! ways) and then decide where the k-1 shelf-breaks go (C(n+k-1,k-1) ways). n!∙C(n+k-1,k-1) = (n+k-1)!/(k-1)!