stronginduction. catalannumbers.agame stronginduction anothergame catalannumbers p.11 anothergame...
TRANSCRIPT
Strong Induction.Catalan Numbers.
A game
Strong Induction
Another game
Catalan Numbers
p. 2
A game
The game starts with a stack of n coins. In each move, you divideone stack into two nonempty stacks.
||||| → |||+ ||→ |||+ |+ |→ ||+ |+ |+ |→ |+ |+ |+ |+ |
If the new stacks have height a and b, then you score ab points forthe move.
||||| → |||+ || you get 3 · 2= 6 points
What is the maximum score you can get?
A game
Strong Induction
Another game
Catalan Numbers
p. 3
A game
10 coins
5
3
2
1 1
1
2
1 1
5
4
2
1 1
2
1 1
1
The total score: 25+ 6+ 4+ 2+ 1+ 4+ 1+ 1+ 1= 45 points.
Can we find a better strategy?
A game
Strong Induction
Another game
Catalan Numbers
p. 4
A game
Theorem. Every way of unstacking n coins gives a score of
S(n) =n(n− 1)
2points.
And we want to prove it by induction.
Let P(n) be the proposition that every way of unstacking n coinsgives a score of S(n).
In the inductive step we have to show that
S(n) = S(k) + S(n− k) + k(n− k) =n(n− 1)
2.
We would like to have something a little “stronger” than ordinaryinduction.
A game
Strong Induction
Another game
Catalan Numbers
p. 5
A game
Theorem. Every way of unstacking n coins gives a score of
S(n) =n(n− 1)
2points.
And we want to prove it by induction.
Let P(n) be the proposition that every way of unstacking n coinsgives a score of S(n).
In the inductive step we have to show that
S(n) = S(k) + S(n− k) + k(n− k) =n(n− 1)
2.
We would like to have something a little “stronger” than ordinaryinduction.
A game
Strong Induction
Another game
Catalan Numbers
p. 6
A game
Theorem. Every way of unstacking n coins gives a score of
S(n) =n(n− 1)
2points.
And we want to prove it by induction.
Let P(n) be the proposition that every way of unstacking n coinsgives a score of S(n).
In the inductive step we have to show that
S(n) = S(k) + S(n− k) + k(n− k) =n(n− 1)
2.
We would like to have something a little “stronger” than ordinaryinduction.
A game
Strong Induction
Another game
Catalan Numbers
p. 7
Strong induction
Principle of Strong Induction. Let P(n) be a predicate. If
• P(0) is true, and
• for all n ∈ N, P(0), P(1), . . . , P(n) imply P(n+ 1),
then P(n) is true for all n ∈ N.
Strong induction allows you to assume P(0), . . . , P(n) in the induc-tive step, whereas in ordinary induction, you assume P(n) only.
A game
Strong Induction
Another game
Catalan Numbers
p. 8
Strong induction
Strong induction is no more powerful than ordinary induction.
Consider a predicate
Q(n) = ∀k�
0≤ k ≤ n→ P(k)�
Q(n) says that P(k) is true for all 0≤ k ≤ n.
Ordinary induction on the predicate Q(n) is equivalent to stronginduction on P(n).
Any theorem that can be proved with strong induction can also beproved with ordinary induction. However, an apeal to the stronginduction principle can make some proofs a bit simpler.
A game
Strong Induction
Another game
Catalan Numbers
p. 9
Unstacking n coins
Theorem. Every way of unstacking n coins gives a score of
S(n) =n(n− 1)
2points.
Proof. By strong induction. Let P(n) be the proposition that everyway of unstacking n coins gives a score S(n).
The base case:When n = 1, no moves is possible, so the score is S(1) = 0. Theformula works, so P(1) is true.
The inductive step:
S(n) = S(k) + S(n− k) + k(n− k)
=k(k− 1)
2+(n− k)(n− k− 1)
2+ k(n− k)
=12(k2 − k+ n2 − nk− n− nk+ k2 + k+ 2kn− 2k2) =
n(n− 1)2
.
A game
Strong Induction
Another game
Catalan Numbers
p. 10
Another game
Consider a game in which two players take turns removing anypositive number of matches they want from one of two piles ofmatches.
The player who removes the last match wins the game.
Show that if the two piles contain the same number of matchesinitially, the second player can always guarantee a win.
A game
Strong Induction
Another game
Catalan Numbers
p. 11
Another game
Let P(n) be the proposition that the second player has a winningstrategy if each pile contains n matches.
The base case:P(1) is true, because if each pile contains just 1 match, there is anobvious strategy for the second player.
The inductive step: When n> 1.If the first player removes n matches from the first pile, the secondplayer removes n matches from the other pile and wins.
Otherwise, if the first player removes k < n from the first pile, thesecond player is doing the same, removing k matches from the otherpile, so there are n − k matches remain in both piles. And now, bythe inductive hypothesis, for n − k matches the second player has awinning strategy.
A game
Strong Induction
Another game
Catalan Numbers
p. 12
Another game
Let P(n) be the proposition that the second player has a winningstrategy if each pile contains n matches.
The base case:P(1) is true, because if each pile contains just 1 match, there is anobvious strategy for the second player.
The inductive step: When n> 1.If the first player removes n matches from the first pile, the secondplayer removes n matches from the other pile and wins.
Otherwise, if the first player removes k < n from the first pile,the second player is doing the same, removing k matches from theother pile, so there are n−k matches remain in both piles. And now,by the inductive hypothesis, for n−k matches the second player hasa winning strategy.
A game
Strong Induction
Another game
Catalan Numbers
p. 13
Count the number of good paths, Cn
Paths should go entirely below the diagonal line
The number of such paths, Cn, is the nth Catalan number.
A game
Strong Induction
Another game
Catalan Numbers
p. 14
Count the number of good paths, Cn
The cases when n is small: 0, 1, 2.
C0 = 1 C1 = 1 C2 = 2
A game
Strong Induction
Another game
Catalan Numbers
p. 15
Recurrent formula
Cn is the number of paths that go below the diagonal (or touchthe diagonal).
Introduce Dn, the number of paths that don’t touch the diagonalin the middle points of the path.
Dn = Cn−1
A game
Strong Induction
Another game
Catalan Numbers
p. 16
Recurrent formula
Cn is the number of paths that go below the diagonal (or touchthe diagonal).
Introduce Dn, the number of paths that don’t touch the diagonalin the middle points of the path.
Dn = Cn−1
A game
Strong Induction
Another game
Catalan Numbers
p. 17
Recurrent formula
(k, k) be the first point of the given path that is on the diagonaland k 6= 0.
Given (k, k), the number of paths is DkCn−k
A game
Strong Induction
Another game
Catalan Numbers
p. 18
Recurrent formula
The diagonal point can be anywhere: (1, 1), (2, 2), . . . , (n, n)
So, to count the total number of paths, we add up these n cases:
Cn = D1Cn−1 + D2Cn−2 + . . .+ DnC0 =n∑
k=1
DkCn−k
since Dk = Ck−1, we get Cn =n∑
k=1
Ck−1Cn−k
A game
Strong Induction
Another game
Catalan Numbers
p. 19
Recurrent formula
The diagonal point can be anywhere: (1, 1), (2, 2), . . . , (n, n)
So, to count the total number of paths, we add up these n cases:
Cn = D1Cn−1 + D2Cn−2 + . . .+ DnC0 =n∑
k=1
DkCn−k
since Dk = Ck−1, we get Cn =n∑
k=1
Ck−1Cn−k
A game
Strong Induction
Another game
Catalan Numbers
p. 20
Recurrent formula
Cn =n∑
k=1
Ck−1Cn−k
A game
Strong Induction
Another game
Catalan Numbers
p. 21
Closed form formula
We already know that the number of paths from the bottom-left tothe top-right corner is Bn =
�2nn
�
Let’s try to count the number of paths that cross the diagonal,there is Bn − Cn of them.
A game
Strong Induction
Another game
Catalan Numbers
p. 22
Closed form formula
Consider a bad path that crosses the diagonal.
Lets say that the point P = (k, k+ 1) is the first point above thediagonal. We mirror the remaining part of the path (shown inblue).
We can construct such new path for any invalid path.
A game
Strong Induction
Another game
Catalan Numbers
p. 23
Closed form formula
Since we mirror the path starting at P = (k, k+ 1), the remainingpart of the path consisted of (n− k, n− k− 1) horizontal andvertical moves. Once reflected, it contains (n− k−1, n− k) moves.
So, the resulting path ends up at the pointZ = (k+ n− k− 1, k+ 1+ n− k) = (n− 1, n+ 1).It does not depend on k.
A game
Strong Induction
Another game
Catalan Numbers
p. 24
Closed form formula
Every invalid paths becomes a path with (n− 1, n+ 1) horizontaland vertical moves.
So there is
Bn − Cn =�
n− 1+ n+ 1n+ 1
�
=�
2nn+ 1
�
of them.
A game
Strong Induction
Another game
Catalan Numbers
p. 25
Closed form formula
Cn = Bn −�
2nn+ 1
�
Therefore,
Cn =�
2nn
�
−�
2nn+ 1
�
=�
2n2
�
−n
n+ 1
�
2nn
�
=1
n+ 1
�
2nn
�
A game
Strong Induction
Another game
Catalan Numbers
p. 26
Three formulas for Cn
Cn =n∑
k=1
Ck−1Cn−k
Cn =�
2nn
�
−�
2nn+ 1
�
Cn =1
n+ 1
�
2nn
�
A game
Strong Induction
Another game
Catalan Numbers
p. 27
Catalan numbers aremore than that
The number of ways to triangulate convex polygons:1, 2, 5, 14, . . .
A game
Strong Induction
Another game
Catalan Numbers
p. 28
Catalan numbers aremore than that
Let’s encode the path with bits, {0, 1}.If every move to the right is 1, and and every move up is 0:
1110001010
Well, not particularly interesting . . .
A game
Strong Induction
Another game
Catalan Numbers
p. 29
Catalan numbers aremore than that
Let’s encode the path with parentheses, {(, )}.If every move to the right is (, and and every move up is ):
( ( ( ) ) ) ( ) ( )
Wyg
A game
Strong Induction
Another game
Catalan Numbers
p. 30
Catalan numbers aremore than that
( ( ( ) ) ) ( ) ( )
Cn is the number of strings made of n pairs of correctly balancedparentheses.
A game
Strong Induction
Another game
Catalan Numbers
p. 31
Catalan numbers aremore than that
C2 = 2
C3 = 5
C4 = 14
Cn is the number of full binary trees with n+ 1 leaves:2, 5, 14, . . .
(A rooted binary tree is full if every internal node has twochildren)