10.2 Two-variable examples

Example 10.6.

Consider selecting r integers from n such that no two are successive. Let these be x1<…<xr. Then x1≥1, xi−xi−1≥2,2≤i≤r. Setting y1=x1,yi=xi−xi−1−1, yr+1=n−xr+1, we have that y1,…,yr+1 form a partition of n−r+2. Thus the number of solutions are (n−r+1r).

We now give a generating function approach. It is a 2-parameter problem. Let a⁢(r,n) denote the number of solutions. Set a⁢(0,0)=1. Divide the solutions into x1=1 and x1>1. If x1=1, then x2≥3 and the rest of the sequence is from 3,…,n satisfying original condition. So there are a⁢(r−1,n−2) many solutions with x1=1. Now if x1>1, then xi−1’s form a solution for r,n−1. Thus such solutions are a⁢(r,n−1). So

a⁢(r,n)=a⁢(r,n−1)+a⁢(r−1,n−2),n≥2.

Easy to derive solution from this recursion too. But what about generating functions ?

Set f⁢(x,y)=∑n=0∑r=0a⁢(r,n)⁢xn⁢yr. Trivially a⁢(0,1)=a⁢(1,1)=1 and a⁢(r,n)=0 if r>n and even r=n if n≥2. Also set a⁢(r,n)=0 if r<0 or n<0. Thus,

f⁢(x,y) =1+x+x⁢y+∑n=2∑r=0a⁢(r,n−1)⁢xn⁢yr+∑n=2∑r=0a⁢(r−1,n−2)⁢xn⁢yr
=1+x+x⁢y+x⁢∑n=2∑r=0a⁢(r,n−1)⁢xn−1⁢yr+x2⁢y⁢∑n=2∑r=0a⁢(r−1,n−2)⁢xn−2⁢yr−1
=1+x+x⁢y+x⁢(f⁢(x,y)−1)+x2⁢y⁢f⁢(x,y).

This gives that f⁢(x,y)=1+x⁢y1−x−x2⁢y.

Example 10.7.

Let an be the number of horizontally convex (HC) polyominoes of area n. This consists of layers of squares such that successive layers overlap with n squares in total. Let an be the number of n-HC polyominoes.

Let a⁢(m,n) be number of HC polyominoes with m cells at the bottom. Then a⁢(n,n)=1, a⁢(m,n)=0 for n<m and a⁢(m,0)=0. Suppose there are l cells in the second layer, there are (m+l−1)-ways in which these cells can be placed on top of the first layer such that they overlap. This reasoning gives rise to the following recursion.

a⁢(m,n)=∑l=1∞(m+l−1)⁢a⁢(l,n−m),n>m.

Define F⁢(x,y)=∑m,nam,n⁢xn⁢ym. Then F⁢(x,1)=f⁢(x). Set g⁢(x)=∑m,nm⁢am,n⁢xn=(∂F∂y)y=1. Thus we derive that

∑n>m,ll⁢a⁢(l,n−m)⁢xn⁢ym =∑m(x⁢y)m⁢∑n,ll⁢al,n−m⁢xn−m=x⁢y1−x⁢y⁢g⁢(x);
∑n>m,l(m−1)⁢a⁢(l,n−m)⁢xn⁢ym =∑m(m−1)⁢(x⁢y)m⁢∑n,ll⁢al,n−m⁢xn−m=∑m(m−1)⁢(x⁢y)m⁢f⁢(x)=(x⁢y)2(1−x⁢y)2⁢f⁢(x)

So

F⁢(x,y)=∑nan,n⁢(x⁢y)n+∑n>man,m⁢xn⁢ym=x⁢y1−x⁢y+(x⁢y)2(1−x⁢y)2⁢f⁢(x)+x⁢y1−x⁢y⁢g⁢(x).

Differentiating w.r.t. y and taking y=1 gives,

g⁢(x)=x(1−x)2+2⁢x2(1−x)3⁢f⁢(x)+x(1−x)2⁢g⁢(x).

Find g⁢(x) and substitute in F⁢(x,y) and set y=1. Then we derive that

f⁢(x)=x⁢(1−x)31−5⁢x+7⁢x2−4⁢x3.

Thus (1−5⁢x+7⁢x2−4⁢x3)⁢f⁢(x)=x⁢(1−x)3. Matching up coefficients of xn for n≥5 on both sides, we have

an−5⁢an−1+7⁢an−2−4⁢an−3=0.