Chap6 - More Counting by Mapping
Chap6 - More Counting by Mapping
Chap6 - More Counting by Mapping
• Division rule
• Catalan number
2
Division Rule
then A k B
e.g.
So # of ears = 2 x # of people.
3
Example 3: Two Pairs
Double
Count!
and thus conclude that 2|A| = |B|. Then we compute |B| and then |A|. 4
Another Chess Problem
5
Another Chess Problem
A ::= all sequences (r(1),c(1),r(2),c(2)) with r(1) ≠ r(2) and c(1) ≠ c(2)
6
Another Chess Problem
A ::= all sequences (r(1),c(1),r(2),c(2)) with r(1) ≠ r(2) and c(1) ≠ c(2)
equivalent
8
Round Table
9
Round Table
4! 9!
13! A 4 !9 ! B
13 13!
So number of 4 element subsets is
::
4 4!9!
n n!
::
m m !(n m)!
13
MISSISSIPPI
There is a bijection between such walks and words with 5 N’s, 5 E’s, 5 S’s,
and 5 W’s.
15
Exercises
There are 12 people. How many ways to divide them into 3 teams, each
team with 4 people?
16
This Lecture
• Division rule
• Catalan number
17
Monotone Path
How many possible lower right monotone paths from (0,0) to (n,n)?
19
Monotone Path
How many possible lower right monotone paths from (0,0) to (n,n)?
We can still map a “right” move to an “x” and a “up” move to a “y”.
There is a bijection between (A) lower right monotone paths and
(B) words with n x’s and n y’s, with the additional constraint that
no initial segment of the string has more Y's than X's.
The set (B) is called the set of Dyck words.
There is a bijection, but both sets look difficult to count. 20
Parenthesis
21
Mountain Ranges
/\
/\ /\ /\/\ / \
/\/\/\, /\/ \, / \/\, / \, / \
But we can show that all these three problems have the same answer,
by showing that there are bijections between these sets.
22
Parenthesis and Monotone Paths
(()()()) ()()()()
xxyxyxyy xyxyxyxy
By “rotating” the images, we see that a path not crossing the diagonal
is just the same as a mountain not crossing the horizontal line.
26
Proof Plan
27
Proof
where n-1 of them are R (“right”) and n+1 of them are U (“up”).
In the original path, before the flipping point, we have one more U than R.
So, in the original path, after the flipping point, we have one more R than U.
In the new path, since we flip the latter part, we have two more U than R,
and thus it is a path from (0,0) to (n-1,n+1).
29
Bijection
The easiest way to see that this is a bijection is to define the inverse function.
Given a monotone path from (0,0) to (n-1,n+1), it must cross the diagonal.
Look at the first point and flip it, we get back the non-lower-right monotone
path from (0,0) to (n,n) that was mapped to it.
30
Catalan Number
There are other proofs and other applications of Catalan number (see wiki).
31
Quick Summary
The basic examples usually map a set into a properly defined binary strings.
32