CSC-2259 Discrete Structures

Slides:



Advertisements
Similar presentations
Combinations A combination is a grouping of things ORDER DOES NOT MATTER.
Advertisements

Counting. Counting = Determining the number of elements of a finite set.
Quantitative Methods Session – Permutation & Combination Pranjoy Arup Das.
Counting Chapter 6 With Question/Answer Animations.
Multiplication Rule. A tree structure is a useful tool for keeping systematic track of all possibilities in situations in which events happen in order.
CSE115/ENGR160 Discrete Mathematics 04/17/12
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
Chapter 5 Section 5 Permutations and Combinations.
Unit 7: Probability Lesson 2 Tree Diagrams, fundamental counting principle, sample space lists and tables, permutation, combination, factorials.
Elementary Counting Techniques & Combinatorics Martina Litschmannová K210.
Elementary Counting Techniques & Combinatorics
Math 2 Honors - Santowski
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Lesson 1.9 Probability Objective: Solve probability problems.
Topics to be covered: Produce all combinations and permutations of sets. Calculate the number of combinations and permutations of sets of m items taken.
Generalized Permutations and Combinations
Number of Elements in a Finite Set. Notation : The number of the elements of the set A will be denoted by n(A) Examples (1): Let: Let: A = {a,b,c,d} B.
Data Structures and Algorithms Discrete Math Review.
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Elementary Combinatorics Combinatorics  Deals with enumeration (counting) techniques and related algebra.  Basis of counting XSet |X|No. of elements.
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.
Lecture # 3 Regular Expressions 1. Introduction In computing, a regular expression provides a concise and flexible means to "match" (specify and recognize)
CSE 221: Algorithms and Data Structures Lecture #10 Counting: Easy as 1, 2, C(3,1) Steve Wolfman 2009W1 1.
0 0 Correction: Problem 18 Alice and Bob have 2n+1 FAIR coins, each with probability of a head equal to 1/2.
Counting CSC-2259 Discrete Structures Konstantin Busch - LSU1.
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,
Discrete Mathematics Lecture # 25 Permutation & Combination.
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
Counting Techniques Tree Diagram Multiplication Rule Permutations Combinations.
Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures.
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.
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
1 Strings and Languages Lecture 2-3 Ref. Handout p12-17.
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.
Permutations. Permutation: The number of ways in which a subset of objects can be selected from a given set of objects, where order is important. Given.
Section 6.3. Section Summary Permutations Combinations.
Discrete Mathematics Counting.
Cardinality with Applications to Computability
Permutations and Combinations
L14: Permutations, Combinations and Some Review
The Pigeonhole Principle
9 Deductive Geometry 9.1 Introduction to Deductive Reasoning and Proofs 9.2 Deductive Proofs Related to Lines and Triangles 9.3 Deductive Proofs Related.
11.3 Notes Combinations.
Chapter 5, Section 5.1 The Basics of Counting
CSE 221: Algorithms and Data Structures Lecture #10 Counting: Easy as 1, 2, C(3,1) Steve Wolfman 2010W2.
Elementary Counting Techniques & Combinatorics
Generalized Permutations and Combinations
COCS DISCRETE STRUCTURES
Counting Principals, Permutations, and Combinations
Permutations and Combinations
Counting, Permutations, & Combinations
Inside of SQL Server Indexes
LANGUAGES Prepared by: Paridah Samsuri Dept. of Software Engineering
Permutations.
CS100: Discrete structures
COUNTING AND PROBABILITY
Pascal's Triangle This is the start of Pascal's triangle. It follows a pattern, do you know.
Binomial Expansion 2 L.O. All pupils can follow where the binomial expansion comes from All pupils understand binomial notation All pupils can use the.
Basic Counting.
COUNTING AND PROBABILITY
104- Ch. 11 part 1; 260- Ch. 5 pt. 2 master_prob_pc.pptx
CSE 321 Discrete Structures
Counting techniques Basic Counting Principles, Pigeonhole Principle, Permutations and Combinations.
Permutations and Combinations
Representations of Integers
10.5 Permutations and Combinations.
Presentation transcript:

CSC-2259 Discrete Structures Counting CSC-2259 Discrete Structures Konstantin Busch - LSU

Basic Counting Principles Product Rule: Suppose a procedure consists of 2 tasks ways to perform 1st task ways to perform 2nd task ways to perform procedure Konstantin Busch - LSU

How many ways to assign employees to offices? Example: 2 employees 10 offices How many ways to assign employees to offices? 1st employee has 10 office choices 2nd employee has 9 office choices Total office assignment ways: 10x9 = 90 Konstantin Busch - LSU

How many different variable names with 2 symbols? Example: How many different variable names with 2 symbols? (e.g. A1, A2, AA) 1st symbol letter 26 choices 2nd symbol alphanumeric 26+10 = 36 choices Total variable name choices: 26x36 = 936 Konstantin Busch - LSU

Generalized Product Rule: Suppose a procedure consists of tasks ways to perform 1st task ways to perform 2nd task ways to perform th task ways to perform procedure Konstantin Busch - LSU

How many different variable names with exactly symbols? Example: How many different variable names with exactly symbols? (e.g. D1B…6) 1st symbol letter 26 choices Remaining symbols alphanumeric 36 choices for each Total choices: Konstantin Busch - LSU

Suppose a procedure can be performed Sum Rule: Suppose a procedure can be performed with either of 2 different methods ways to perform 1st method ways to perform 2nd method ways to perform procedure Konstantin Busch - LSU

Number of variable names with 1 or 2 symbols Example: Number of variable names with 1 or 2 symbols Variables with 1 symbol: 26 Variables with 2 symbols: 936 Total number of variables: 26+936=962 Konstantin Busch - LSU

Principle of Inclusion-Exclusion: Suppose a procedure can be performed with either of 2 different methods ways to perform 1st method ways to perform 2nd method common ways in both methods ways to perform procedure Konstantin Busch - LSU

Number of binary strings of length 8 Example: Number of binary strings of length 8 that either start with 1 or end with 0 Strings that start with 1: 128 choices Strings that end with 0: 128 choices Common strings: 64 choices Total strings: 128+128-64=192 Konstantin Busch - LSU

Pigeonhole Principle 3 pigeons 2 pigeonholes Konstantin Busch - LSU

One pigeonhole contains 2 pigeons 2 pigeonholes Konstantin Busch - LSU

k+1 pigeons k pigeonholes Konstantin Busch - LSU

At least one pigeonhole contains 2 pigeons k+1 pigeons k pigeonholes Konstantin Busch - LSU

Pigeonhole Principle: If k+1 objects are placed into k boxes, then at least one box contains 2 objects Examples: Among 367 people at least 2 have the same birthday (366 different birthdays) Among 27 English words at least 2 start with same letter (26 different letters) Konstantin Busch - LSU

Generalized Pigeonhole Principle: If objects are placed into boxes, then at least one box contains objects Proof: If each box contains less than objects: contradiction End of Proof Konstantin Busch - LSU

have birthday in same month Example: Among people, at least have birthday in same month people (objects) months (boxes) Konstantin Busch - LSU

How many students do we need to have so that Example: How many students do we need to have so that at least six receive same grade (A,B,C,D,F)? students (objects) grades (boxes) at least six students receive same grade Konstantin Busch - LSU

is smallest integer with Konstantin Busch - LSU

We need at least 26 students For our example: students We need at least 26 students Konstantin Busch - LSU

In any sequence of numbers there is a sorted subsequence of length An elegant example: In any sequence of numbers there is a sorted subsequence of length (ascending or descending) Ascending subsequence 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 Descending subsequence 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 Konstantin Busch - LSU

In any sequence of numbers there is a sorted subsequence of length Theorem: In any sequence of numbers there is a sorted subsequence of length (ascending or descending) Proof: Sequence Length of longest ascending subsequence starting from Length of longest descending subsequence starting from Konstantin Busch - LSU

Longest ascending subsequence from 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 For example: Longest ascending subsequence from 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 Longest descending subsequence from 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 Konstantin Busch - LSU

Longest ascending subsequence from 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 For example: Longest ascending subsequence from 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 Longest descending subsequence from 8, 11, 9, 1, 4, 6, 12, 10, 5, 7 Konstantin Busch - LSU

Assume (for sake of contradiction) that for every : We want to prove that there is a with: or Assume (for sake of contradiction) that for every : and Konstantin Busch - LSU

Number of unique pairs of form with and : choices choices unique pairs For example: Konstantin Busch - LSU

there are exactly pairs of form unique pairs of form Since has elements there are exactly pairs of form From pigeonhole principle, there are two equal pairs and Konstantin Busch - LSU

Case : Ascending subsequence with elements Ascending subsequence Contradiction, since longest ascending subsequence from has length Konstantin Busch - LSU

Case : Descending subsequence with elements Descending subsequence Contradiction, since longest descending subsequence from has length Konstantin Busch - LSU

Therefore, it is not true the assumption that for every : and Therefore, there is a with: or End of Proof Konstantin Busch - LSU

Permutations Permutation: An ordered arrangement of objects Example: Objects: a,b,c Permutations: a,b,c a,c,b b,a,c b,c,a c,a,b c,b,a Konstantin Busch - LSU

An ordered arrangement of r objects r-permutation: An ordered arrangement of r objects Example: Objects: a,b,c,d 2-permutations: a,b a,c a,d b,a b,c b,d c,a c,b c,d d,a d,b d,c Konstantin Busch - LSU

How many ways to arrange 5 students in line? 1st position in line: 5 student choices 2nd position in line: 4 student choices 3rd position in line: 3 student choices 4th position in line: 2 student choices 5th position in line: 1 student choices Total permutations: 5x4x3x2x1=120 Konstantin Busch - LSU

How many ways to arrange 3 students in line out of a group of 5 students? 1st position in line: 5 student choices 2nd position in line: 4 student choices 3rd position in line: 3 student choices Total 3-permutations: 5x4x3=60 Konstantin Busch - LSU

Given objects the number of -permutations is denoted Examples: Konstantin Busch - LSU

Theorem: Proof: 1st position object choices 2nd position object 3rd position object choices rth position object choices Konstantin Busch - LSU

Multiply and divide with same product End of Proof Konstantin Busch - LSU

How many different ways to order gold, silver, and bronze medalists Example: How many different ways to order gold, silver, and bronze medalists out of 8 athletes? Konstantin Busch - LSU

Combinations r-combination: An unordered arrangement of r objects Example: Objects: a,b,c,d 2-combinations: a,b a,c a,d b,c b,d c,d 3-combinations: a,b,c a,b,d a,c,d b,c,d Konstantin Busch - LSU

Given objects the number of -combinations is denoted or Also known as binomial coefficient Examples: Konstantin Busch - LSU

Combinations can be used to find permutations a,b,c a,b,d a,c,d b,c,d Objects: a,b,c,d Konstantin Busch - LSU

Combinations can be used to find permutations a,b,c a,b,d a,c,d b,c,d a,c,b a,d,b a,d,c b,d,c b,a,c b,a,d c,a,d c,b,d b,c,a b,d,a c,d,a c,d,b c,a,b d,a,b d,a,c d,b,c c,b,a d,b,a d,c,a d,c,b 3-permutations Objects: a,b,c,d Konstantin Busch - LSU

Combinations can be used to find permutations Total permutations: 3-combinations a,b,c a,b,d a,c,d b,c,d a,c,b a,d,b a,d,c b,d,c b,a,c b,a,d c,a,d c,b,d b,c,a b,d,a c,d,a c,d,b c,a,b d,a,b d,a,c d,b,c c,b,a d,b,a d,c,a d,c,b 3-permutations Objects: a,b,c,d Konstantin Busch - LSU

Theorem: Proof: End of Proof Konstantin Busch - LSU

Different ways to choose 5 cards out of 52 cards Example: Different ways to choose 5 cards out of 52 cards Konstantin Busch - LSU

Observation: Example: Konstantin Busch - LSU

Binomial Coefficients Konstantin Busch - LSU

Possible ways to obtain product of terms of and terms of Konstantin Busch - LSU

times Possible ways to obtain product of terms of and terms of Konstantin Busch - LSU

Observation: Konstantin Busch - LSU

Observation: Konstantin Busch - LSU

Observation: Konstantin Busch - LSU

even odd Konstantin Busch - LSU

Pascal’s Identity: Proof: set with elements element of Konstantin Busch - LSU

number of subsets of with size subsets that contain subsets that do not contain Konstantin Busch - LSU

:subsets of with size that contain Each has form: elements from Total ways for constructing : Konstantin Busch - LSU

:subsets of with size that do not contain Each has form: elements from Total ways for constructing : Konstantin Busch - LSU

End of Proof Konstantin Busch - LSU

Pascal’s Triangle Konstantin Busch - LSU

Generalized Permutations and Combinations Permutations with repetition for: a,b,c aaa aab aba abb aac aca acc abc acb bbb bba bab baa bbc bcb bcc bac bca ccc cca cac caa ccb cbc cbb cab cba 3 ways to chose each symbol Total permutations with repetition: 3x3x3 = 27 Konstantin Busch - LSU

Permutations with repetition: #ways to arrange in line objects chosen from a collection of objects: Example: Strings of length from English alphabet: aaaaa, aaaab, aaaba, aaabb, aabab,… Konstantin Busch - LSU

Combinations with repetition for: a,b,c aaa aab aba abb aac aca acc abc acb bbb bba bab baa bbc bcb bcc bac bca ccc cca cac caa ccb cbc cbb cab cba After removing redundant permutations aaa aab abb aac acc abc bbb bbc bcc ccc Total combinations with repetition: 10 Konstantin Busch - LSU

Encoding for combinations with repetitions: a | b | c * * * 1st letter choice 2nd letter choice 3rd letter choice abc = a|b|c = *|*|* acc = a||cc = *||** aab = aa|b|= **|*| bcc =|b|cc = |*|** Konstantin Busch - LSU

All possible combinations with repetitions for objects a,b,c: aaa: ***|| aab: **|*| aac: **||* abb: *|**| abc: *|*|* acc: *||** bbb: |***| bbc: |**|* bcc: |*|** ccc: ||*** Equivalent to finding all possible ways to arrange *** and || Konstantin Busch - LSU

All possible ways to arrange *** and || : equivalent to all possible ways to select 3 objects out of 5: 5 total positions in a string 3 positions are dedicated for * Konstantin Busch - LSU

2-combinations with repetition for: a,b,c aa ab ac bb bc cc Total = 6 Each combination can be encoded with ** and || : ab = a|b| = *|*| ac = a||c = *||* Konstantin Busch - LSU

All possible 2-combinations with repetitions for objects a,b,c: aa: **|| ab: *|*| ac: *||* bb: |**| bc: |*|* cc: ||** Equivalent to finding all possible ways to arrange ** and || Konstantin Busch - LSU

All possible ways to arrange ** and || : equivalent to all possible ways to select 2 objects out of 4: 4 total positions in a string 2 positions are dedicated for * Konstantin Busch - LSU

4-combinations with repetition for: a,b,c aaaa aaab aaac aabb aabc aacc abbb abbc abcc accc bbbb bbbc bbcc bccc cccc Total = 15 Each combination can be encoded with **** and || : aabb = aa|bb| = **|**| abcc = a|b|cc = *|*|** Konstantin Busch - LSU

All possible ways to arrange **** and || : equivalent to all possible ways to select 4 objects out of 6: 6 total positions in a string 4 positions are dedicated for * Konstantin Busch - LSU

r-combinations with repetition: Number of ways to select objects out of : Proof: Each of the objects corresponds to a * The original objects create of | Konstantin Busch - LSU

The | separate the original objects obj 1|obj 2|obj 3|…|obj(n-1)|obj n The * represent the selected objects *|***|*||*|…|* 1st selected object 2nd selected object rth selected object Konstantin Busch - LSU

Each -combination can be encoded with a unique string formed with **…* and ||…| : *|***|*||*|…|* String length: Example 3-combinations of 5 objects a,b,c,d,e: abc = a|b|c|| = *|*|*|| cde = ||c|d|e = ||*|*|* Konstantin Busch - LSU

All possible strings made of **…* and ||…| : Equivalent to all possible ways to select objects out of : total positions in a string positions are dedicated for * End of Proof Konstantin Busch - LSU

How many ways to select r=6 cookies from Example: How many ways to select r=6 cookies from a collection of n=4 different kinds of cookies? Equivalent to combinations with repetition: Konstantin Busch - LSU

How many integer solutions does the equation have? Example: How many integer solutions does the equation have? Konstantin Busch - LSU

Equivalent to selecting r=11 items (ones) from n=3 kinds (variables) Konstantin Busch - LSU

Permutations of indistinguishable objects SUCCESS How many different strings are made by reordering the letters in the string? SUSCCES, USCSECS, CESUSSC,… Konstantin Busch - LSU

Total possible strings: SUCCESS SUCCESS SUCCESS SUCCESS available positions for 3 S available positions for 2 C available positions for 1 U available positions for 1 E Total possible strings: Konstantin Busch - LSU

Permutations of indistinguishable objects: indistinguishable objects of type 1 indistinguishable objects of type 2 indistinguishable objects of type k Total permutations for the objects: Konstantin Busch - LSU

Proof: Available positions for objects of type 1 Available positions of type k Konstantin Busch - LSU

Total possible permutations: End of Proof Konstantin Busch - LSU

Distributing objects into boxes distinguishable objects: a, b, c, d, e distinguishable boxes: Box1: holds 2 objects Box2: holds 1 object Box3: holds 2 objects How many ways to distribute the objects into the boxes? (position inside box doesn’t matter) a e c d b Box 1 Box 2 Box 3 Konstantin Busch - LSU

Problem is equivalent to finding all permutations with indistinguishable objects distinct positions: a b c d e a b c d e a b c d e a b c d e positions for Box 1 positions for Box 2 positions for Box 3 c d a e b Konstantin Busch - LSU

Total arrangements of objects into boxes: Same as permutations of indistinguishable objects Konstantin Busch - LSU

… In general: distinguishable objects distinguishable boxes: Box1: holds objects Box2: holds objects … Boxk: holds objects Total arrangements: Konstantin Busch - LSU

… …… Distributing indistinguishable objects into distinguishable boxes Box n Konstantin Busch - LSU

…… Problem is same with finding the number of solutions to equation: Box 1 Box 2 Box n number of objects in Box Konstantin Busch - LSU

Total number of solutions: Is equal to number of ways to distribute the indistinguishable objects into the boxes Konstantin Busch - LSU