Docsity

Recurrence Relations and Catalan Numbers in Combinatorics and Graph Theory, Study notes of Mathematics

Toggle sidebar
bg1
MATH 681 Notes Combinatorics and Graph Theory I
1 Recurrence relations, continued yet again
One last lousy class of recurrences we should be able to solve:
1.1 Systems of recurrence relations
Sometimes multiple recurrences working in tandem are more effective than a single recurrence.
Let’s see how such a thing might be of assistance.
Question 1: Let anrepresent the number of strings from {0,1,2}of length nwith an even number
of 0s. Find a recurrence for an.
Answer 1: Note that recurrences are not actually the best way to solve this particular problem:
it would be a lot easier to do it with the exponential generating function ex+e−x
2exex=e3x+ex
2=
P∞
n=0 3n+1
2
xn
n!to get an=3n+1
2. But, armed with that knowledge, let’s look at how we might tackle
it as a recurrence
We introduce an auxiliary sequence bn, which counts the bitstrings of length nwith an odd number
of zeroes. Now, we know:
an= 2an−1+bn−1
bn=an−1+ 2bn−1
and a0= 1 and b0= 0. This uniquely determines an, but solving it might be tricky. We can have
recourse to either OGFs or EGFs to solve it, depending whether you prefer algebra or differential
equations.
Let’s suppose we use an OGF; letting f(x) = P∞
n=0 anxnand g(x) = P∞
n=0 bnxn. Then the first
equation in the recurrence can be simplified to f(x)−a0= 2xf(x) + xg(x); the second will become
g(x)−b0=xf(x)+2xg(x). Collecting terms, we’ll get the system:
f(x) = xg(x)+1
1−2x
g(x) = xf (x)
1−2x
so, solving for f(x)in terms of itself,
f(x) = xxf(x)
1−2x+ 1
1−2x=x2f(x)−2x+ 1
(1 −2x)2
and thus 1−x2
(1 −2x)2f(x) = 1−2x
(1 −2x)2
so f(x) = 1−2x
1−4x+3x2=1
2(1−x)+1
2(1−3x), which, expanded for coefficients, gives
f(x) = ∞
X
n=0
1+3n
2xn
If we were to use EGFs with the recurrence, then using f(x) = P∞
n=0 anxn
n!and g(x) = P∞
n=0 bnxn
n!,
we could interpret the system of recurrence relations as a system of differential equations:
f0(x)=2f(x) + g(x)
g0(x) = f(x)+2g(x)
Page 1 of 3 October 15, 2009
pf3

Partial preview of the text

Download Recurrence Relations and Catalan Numbers in Combinatorics and Graph Theory and more Study notes Mathematics in PDF only on Docsity!

1 Recurrence relations, continued yet again

One last lousy class of recurrences we should be able to solve:

1.1 Systems of recurrence relations

Sometimes multiple recurrences working in tandem are more effective than a single recurrence. Let’s see how such a thing might be of assistance.

Question 1: Let an represent the number of strings from { 0 , 1 , 2 } of length n with an even number of 0s. Find a recurrence for an.

Answer 1: Note that recurrences are not actually the best way to solve this particular problem: it would be a lot easier to do it with the exponential generating function e x+e−x 2 e

xex (^) = e^3 x+ex ∑∞^2 = n=

3 n+ 2

xn n! to get^ an^ =^

3 n+

  1. But, armed with that knowledge, let’s look at how we might tackle it as a recurrence

We introduce an auxiliary sequence bn, which counts the bitstrings of length n with an odd number of zeroes. Now, we know: an = 2an− 1 + bn− 1 bn = an− 1 + 2bn− 1

and a 0 = 1 and b 0 = 0. This uniquely determines an, but solving it might be tricky. We can have recourse to either OGFs or EGFs to solve it, depending whether you prefer algebra or differential equations.

Let’s suppose we use an OGF; letting f (x) =

n=0 anx n (^) and g(x) = ∑∞ n=0 bnx n. Then the first

equation in the recurrence can be simplified to f (x) − a 0 = 2xf (x) + xg(x); the second will become g(x) − b 0 = xf (x) + 2xg(x). Collecting terms, we’ll get the system:

f (x) = xg(x) + 1 1 − 2 x g(x) =

xf (x) 1 − 2 x

so, solving for f (x) in terms of itself,

f (x) =

x xf 1 −^ ( 2 xx) + 1 1 − 2 x

x^2 f (x) − 2 x + 1 (1 − 2 x)^2

and thus (^) (

1 − x^2 (1 − 2 x)^2

f (x) = 1 − 2 x (1 − 2 x)^2

so f (x) = (^1) −^14 −x+3^2 xx 2 = (^) 2(1^1 −x) + (^) 2(1−^13 x) , which, expanded for coefficients, gives

f (x) =

∑^ ∞

n=

1 + 3n 2

xn

If we were to use EGFs with the recurrence, then using f (x) =

n=0 an

xn n! and^ g(x) =^

n=0 bn

xn n! , we could interpret the system of recurrence relations as a system of differential equations:

f ′(x) = 2f (x) + g(x) g′(x) = f (x) + 2g(x)

or, if we let the vector ~v be

[

f (x) g(x)

]

, we have the equation ~v′^ =

[

]

~v. The general solution to a

system ~v′^ = A~v will be ~v =

kieλix^ v~i, where λi and v~i are the eigenvalues and eigenvectors of A. In this particular case, the matrix has eigenvalues 3 and 1 with respective vectors (1, 1) and (1, −1), so

~v = k 1 e^3 x

[

]

  • k 2 e^1 x

[

]

[

k 1 e^3 x^ + k 2 ex k 1 e^3 x^ − k 2 ex

]

so an = k 13 n^ + k 2 and bn = k 13 n^ − k 2 ; the initial values will let us solve for k 1 and k 2.

Both the OGF and EGF methods will work for any system of two linear simultaneous recurrences; with three or more, both can work but the EGF method (with a linear algebra computer system to calculate eigenvectors) is the most effective.

1.2 Catalan numbers

Before we depart from recurrences entirely, we’ll address one last specific recurrence, which is not of a form we’ve seen before.

Recall that in the first week we noticed that there were 5 ways to build a binary tree with 3 nodes, 5 ways to nest 3 pairs of parentheses, and 5 ways to arrange 3 up-steps and 3 down-steps in a way that never drops below the initial point; we furthermore saw that all these structures would have identical counts, thanks to bijections between the different structures. Let us denote the number of ways to put n nodes in a binary tree, or nest n pairs of parentheses, or climb up n steps and down n without dropping below the starting point, as the Catalan number Cn.

We just saw that C 3 = 5; fairly easy exhaustive counting can tell us that C 0 = 1, C 1 = 1, and C 2 = 2. We might want to see how to get further:

Question 2: What is C 4? And is there a non-brute force way to get it?

Answer 2: Let us consider the number of ways to arrange 4 nodes in a binary tree. One node is the root node, and off to the left and right of it are two (possibly empty) trees with 3 nodes among them. There will be 4 simple cases, which we can enumerate easily:

If the left tree is empty (0 nodes), all 3 nodes are on the right. The left tree can only be arranged one way, while the right tree can be arranged in C 3 = 5 ways.

If the left tree has a single node, it can be arranged exactly one way, while the right tree has 2 nodes and can thus be arranged in C 2 = 2 ways.

Finally, we have two cases which are the mirror image of the above, accounting for 2 and 5 ar- rangements. We thus have C 0 C 3 + C 1 C 2 + C 2 C 1 + C 3 C 0 = 14 possible arrangements.

The above is easily generalized to give a simple recurrence relation defining Cn:

Cn+1 =

∑^ n

i=

CiCn−i C 0 = 1

from which we can compute Catalan numbers fairly easily (e.g. C 5 = 42, C 6 = 132).

But this isn’t a closed form, and since it isn’t a standard recurrence-relation form, we don’t have the means to turn it into one. But from this recurrence we can acquire some valuable information.

Question 3: What is the ordinary generating function f (x) =

n=0 Cnx n?