Combinatorics - a fancy word for counting
For us, determining the size of some set. We define the things we want to count as the elemtns of some set and we want to determine the size of that set.
If a procedure has steps (step 1, step 2…, step ), we define the number of ways to execute the th step as . Then the number of ways to execute is
The number of ways of doing does not depend on the previous steps.
Ex: Ordering fast food meals
2 steps when ordering fast food
Step 1: Choose Coke or Beer
Step 2: Choose a meal
Different ways we can do this procedure
If generates elements from some set and
Then
Ex:
Our set is the set of meals
Less trivial example
A bitstring is a sequence of 0's and 1's
is equal to the set of all bitstrings of length (integers )
We can count the number of bit strings for any given using the product rule
# of ways to execute this prodcedure
This procedure is both onto and one-to-one so the cardinality of the set of every bitstring of length =
Let and be two sets.
Question: How many functions are there?
Example of one function mapping from
Procedure
Let be the elements of in some order
# of executions is
A function is one-to-one (injective) if for each
Not this
Question: How many one-to-one functions are there?
Answer is 0 if
What if ?
The procedure is similar
Answer =
We have books
We have a bookcase with shelves
We want to know how many ways can we place the books onto the shelves
Procedure
One possible ordering
As can be seen, the first book can go on any of the 4 shelves. The second book can go on any of the 4 shelves or to the right of the first book. The third book can go on any of the 4 shelves or to the right of the first or second book and this pattern continues.
Answer =
COMP2804
Combinatorics