Advanced Counting Techniques

Example: How many bit string of length do not contain two consecutive zeros?

To solve this problem, let be the number of such strings of length . An argument can be given that show that the sequence satisifies the recurrence relation and the initial condition and .

Review of the definition of recurrence relation

A recurrence relation for a sequence is an equation that expresses in terms of one or more previous elements of the sequence, for all .

A particular sequence, described non-recurisely, is said to solve the given recurrence relation if it is consistent with the definition of the recurence.

A given recurrence relation may have many solutions.

Some Examples

The Tower of Hanoi

image

Let represent the number of moves for a stack of disks.

And we will have such a strategy:

  • Move the top disks to spare peg, which is
  • Move the bottom disk, 1
  • Move the top disks to target reg, alos

So we will have

And .

The Number of Bit String

Find a recurence relation and give initial conditions for the number of bits strings of length that do not have two consecutive 0s. How many such bit strings are there of length five?

Let denote the number of bit strings of lenght ;

,as 0 and 1;

, as 01, 10 and 11;

and we have the two ways to construct the bit string, add to and add to , so we get the recurrence realtion .

Catalan Numbers

Find a recurrence relation for , the number of ways to parenthesize the product of numbers to specify the order of multiplication. For example since there are five ways to parenthesize to determine the order of multiplication: , ,, , .

Solving Recurrences

A linear homogeneous recurrence of degree wih constant coefficients , a.k.a k-LiHoReCoCo, is a recurence of the form

where the are all real and .

The solution is uniquely determined if initial conitions are provided.

Solving LiHoReCoCos

Basic idea: look for solutions of the form , where is a constant.

This requires the characterisitic equation:

The solutions, called as characteristic roots, can yield an explicit formula for the sequence.

Consider an arbitary 2-LiHoReCoCos:

It has the characteristic equation:

Theorem 1

If this CE has 2 roots , then for for some constants and .

Theorem 2

If this CE has only 1 root , then , for all , for some constants and .

Generating Functions

The generating function for the sequence is the infinite power series

Theroem 1

Let and , and we have:

Extended Binomail Coefficient

Let and , the extended binomail coeffcient is defined by

image

Extended Binomail Theroem

Let and let , then

As we have two theroems about generating functions, we give a list of some generating functions:

image