Skip to content

第 7 章 递推关系和生成函数

EX1

Let f0,f1,f2,...,fn,..., denote the Fibonacci sequence. By evaluating each of the following expressions for small values of n, conjecture a general formula and then prove it, using mathematical induction and the Fibonacci recurrence:

(a) f1+f3++f2n1

(b) f0+f2++f2n

(c) f0f1+f2+(1)nfn

(d)f02+f12++fn2

EX1(a)(b)

先打表找规律,

打表程序
cpp
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int p = 0, q = 1;
    vector<int> fibList {p, q};
    for(int i = 0; i < 50; ++ i) {
        fibList.emplace_back(p+q);
        p = q;
        q = fibList.back();
    }

    int odd_total = 0, even_total = 0, alter_total = 0, square_total;
    int flag = 1;
    printf("idx \t sum_odd \t sum_total \t sum_alter \t sum_square \n");
    for(int i = 0; i < 10; ++ i) {
        odd_total += fibList[max(2*i-1, 0)];
        even_total += fibList[2*i];
        alter_total += flag * fibList[i];
        flag *= -1;
        square_total += fibList[i] * fibList[i];
        printf("%d \t %d \t %d \t %d \t %d\n", i, odd_total, even_total,
                alter_total, square_total);
    }
    return 0;
}

可以发现:f1+f3++f2n1=f2nf0+f2++f2n=f2n+11f0f1+f2+(1)nfn=1+(1)nfn1f02+f12++fn2=fnfn+1

数学归纳证明过程略。

EX1(c)

f0f1+f2+(1)nfn=1+(1)nfn1,(n1)

对于特殊的f0f0=0

EX1(d)

这个强调一下特殊的构造方法,辅助猜测递推公式,后面也会用到这个构造法。

i=0nfi=f02+i=1nfi2=f0f1+i=1nfi(fi+1fi1)=f0f1+(f1f2f1f0)+(f2f3f2f1)++(fnfn+1fnfn1)=fnfn+1

EX2

Prove that the nth Fibonacci number In is the integer that is closest to the number

15(1+52)n

a=15(1+52)n, 并且知道fn=15(1+52)n15(152)n,那么fn与 a 的距离为,

|fna|=|15(152)n|=15((51)(5+1)2(5+1))n=15(25+1)n1525+1=25+525

因此,fn是最接近15(1+52)n的整数。

EX3

Prove the following about the Fibonacci numbers:

(a) fn is even if and only if n is divisible by 3.

(b) fn is divisible by 3 if and only if n is divisible by 4.

(c) fn is divisible by 4 if and only if n is divisible by 6.

EX3(b)

f0=0,f1=f2=1,f3=2,f4=3,f0能被 3 整除,且 n=0 可被 4 整除。并且f1,f2,f3均不能被 3 整除,f4=3可被 3 整除,且 n=4 被 4 整除。

下面使用数学归纳法证明,当 n 被 4 整除时,fn一定被 3 整除。

f4m被 3 整除,且m1

fn=fn1+fn2=2fn2+f(n3)=3fn3+fn4

因此fnfn4模三同余,即fnfn4(mod 3),并且f0=0,f1=f2=1,f3=2,f4=3,因而fn被 3 整除当且仅当 n 可被 4 整除。

EX3PS

周期性的角度入手,验证了当n为 4 的倍数时fn可被 3 整除,并且当n不是 4 的倍数时,fn也一定不能被 3 整除。

EX4

Prove that the Fibonacci sequence is the solution of the recurrence relation

an=5an4+3an5,(n5),

where ao = 0, al = 1, a2 = 1, a3 = 2, and U4 = 3. Then use this formula to show that the Fibonacci numbers satisfy the condition that fn is divisible by 5 if and only if n is divisible by 5.

连续使用an=an1+an2进行代换,

an=an1+an2=2an2+an3=3an3+2an4=5an4+3an5

因此anan5模 5 同余,即anan5(mod 5)。并且由a0=0,a1=1,a2=1,a3=2,a4=3可知,当且仅当 n 被 5 整除时,fn mod 5=0

EX5

By examining the Fibonacci sequence, make a conjecture about when fn is divisible by 7 and then prove your conjecture.

对斐波那契数列fn能被 7 整除,当且仅当 n 能被 8 整除。

EX6 ⭐

* Let m and n be positive integers. Prove that if m is divisible by n, then fm is divisible by fn.

EX7 ⭐

* Let m and n be positive integers whose greatest common divisor is d. Prove that the greatest common divisor of the Fibonacci numbers fm and fn is the Fibonacci number fd.

EX8

Consider a 1-by-n chessboard. Suppose we color each square of the chessboard with one of the two colors red and blue. Let hn be the number of colorings in which no two squares that are colored red are adjacent. Find and verify a recurrence relation that hn satisfies. Then derive a formula for hn .

如果第一个方块着成红色,那么第二个方块只能着成蓝色,问题转化为1×(n2)棋盘着色问题;如果第一个方块着成蓝色,问题转化为1×(n1)棋盘着色问题;因此,hn=hn1+hn2

并且有初始项h0=1,h1=2,显然hn=fn+2

EX9

Let hn equal the number of different ways in which the squares of a 1-by-n chessboard can be colored, using the colors red, white, and blue so that no two squares that are colored red are adjacent. Find and verify a recurrence relation that hn satisfies. Then find a formula for hn.

考虑第一个方框放红色,那么第二个方块只能放白色或蓝色,问题转化为hn2;考虑第一个方块放白色或蓝色,那么问题转化为hn1

hn=2hn1+2hn2,h0=1,h1=3

求解方程x2=2x+2,对应hn的通解为hn=c1(1+3)n+c2(13)n

带入初始值h0=1,h1=3可以求出常系数c1=12+33,c2=1233

hn=3+236(1+3)n+3236(13)n,n=0,1,2,

EX10

Suppose that, in his problem, Fibonacci had placed two pairs of rabbits in the enclosure at the beginning of a year. Find the number of pairs of rabbits in the enclosure after one year. More generally, find the number of pairs of rabbits in the enclosure after n months.

设第 t 个月时有gt个兔子,满足gt=gt1+gt2,g0=0,g1=2,可以求出通解,

gt=25(1+52)t25(152)t=2ft

第一个月再过 n 个月是第 n+1 月,因此有gn+1对兔子。

提示

本题以 n 作为一个常量(n 个月后),为了区分就需要把未知量设为 t。

EX11

The Lucas numbers l0,l1,l2,,ln, are defined using the same recurrence relation defining the Fibonacci numbers, but with different initial conditions:

ln=ln1+ln2,(n2),l0=2,l1=1

Prove that

(a) ln=fn1+fn+1 for n1

(b) l02+l12++ln2=lnln+1+2 for n0

EX11(a)

Zn=fn1+fn+1ln,n1Z1=f0+f2l1=0+11=0Z2=f1+f3l2=1+23=0

又因为Zn=Zn1+Zn2,n3,所以Zn=0,n1。即有,

ln=fn1+fn+1,n1

EX11(b)

因为ln+1=ln+ln1,所以ln2=ln(ln+1ln1),n1

l02+l12++ln2=l02+i=1nli2=4+(l1l2l1l0)+(l2l3l2l1)++(lnln+1lnln1)=4+lnln+1l1l0=lnln+1+2

EX12

Let h0,h1,h2,,hn, be the sequence defined by

hn=n3,(n0)

Show that hn=hn1+3n23n+1 is the recurrence relation for the sequence.

带入hn1=(n1)3化简。

EX13

Determine the generating function for each of the following sequences:

(a) c0=1,c,c2,...,cn,...

(b) 1,1,1,1,...,(1)n,...

(c) (α0),(α1),(α2),...,(1)n(αn),..., (α is a real number)

(d) 1,11!,12!,...,1n!,...

(e) 1,11!,12!,...,(1)n1n!,...

无穷数列h0,h1,h2,,hn对应的生成函数为

g(x)=h0+h1x+h2x2++hnxn

EX13(a)

g(x)=1+cx+c2x2++cnxn+=1+(cx)+(cx)2++(cx)n+=11cx

EX13(b)

g(x)=1x+x2++(1)nxn+=1+(x)+(x)2++(x)n+=11+x

EX13(c)

g(x)=(α0)(α1)x+(α2)x2++(1)n(αn)xn+=k=0(αk)(x)k=(1x)α

EX13(d)

g(x)=1+11!x+12!x2++1n!xn+=ex

EX13(e)

g(x)=111!x+12!x2+(1)n1n!xn+=ex

EX14

Let S be the multiset {e1,e2,e3,e4} Determine the generating function for the sequence h0,h1,h2,,hn,, where hn is the number of n-combinations of S with the following added restrictions:

(a) Each ei occurs an odd number of times.

(b) Each ei occurs a multiple-of-3 number of times.

(c) The element e1 does not occur, and e2 occurs at most once.

(d) The element e1 occurs 1,3, or 11 times, and the element e2 occurs 2,4, or 5 times.

(e) Each ei occurs at least 10 times.

EX14(a)

g(x)=(x+x3+x5+)(x+x3+x5+)(x+x3+x5+)(x+x3+x5+)=(x1x2)4

EX14(b)

g(x)=(1+x3+x6+)(1+x3+x6+)(1+x3+x6+)(1+x3+x6+)=1(1x3)4

EX14(c)

g(x)=(1)(1+x)(1+x+x2+x3+)(1+x+x2+x3+)=1+x(1x)2

EX14(d)

g(x)=(x+x3+x11)(x2+x4+x5)(1+x+x2+x3+)(1+x+x2+x3+)=(x+x3+x11)(x2+x4+x5)(1x)2

EX14(e)

g(x)=(x10+x11+)(x10+x11+)(x10+x11+)(x10+x11+)=x40(1+x2+x3+)(1+x2+x3+)(1+x2+x3+)(1+x2+x3+)=x40(1x)4

EX15

Determine the generating function for the sequence of cubes

0,1,8,,n3,

由第 5 章 EX20 知,

n3=6(n3)+6(n2)+(n1)g(x)=x+8x++n3x2+=n=0n3xk=n=06(n3)xn+n=06(n2)xn+n=0(n1)xn=6x3n=3(n3)xn3+6x2n=2(n2)xn2+xn=1(n1)xn1=6x3n=0(n+33)xn+6x2n=0(n+22)xn+xn=0(n+11)xn

由第 5 章 EX43 知,

1(1z)m=n=0(m+n1n)zn,|z|<1

因此,

g(x)=6x3n=0(n+33)xn+6x2n=0(n+22)xn+xn=0(n+11)xn=6x31(1x)4+6x21(1x)3+x1(1x)2=x(x2+4x+1)(1x)4

EX16

Formulate a combinatorial problem for which the generating function is

(1+x+x2)(1+x2+x4+x6)(1+x2+x4+)(x+x2+x3+)

果篮中苹果、香蕉、西瓜和桃子,求苹果不超过 2 个,香蕉为不超过 6 个且为偶数,西瓜是偶数个,桃子至少有 1 个的组合数。

EX17

Determine the generating function for the number hn of bags of fruit of apples, oranges, bananas, and pears in which there are an even number of apples, at most two oranges, a multiple of three number of bananas, and at most one pear. Then find a formula for hn from the generating function.

g(x)=(1+x2+x4+)(1+x+x2)(1+x3+x6+)(1+x)=1(1x)2=n=0(n+1)xn

因此hn=(n+1)

翻译错误

注意黑皮书题干中的翻译错误,英文原意是至多有两个橙子。

不管怎么描述,本题都是可解的。在做题时需要认真读清题目。

EX18

Determine the generating function for the number hn of nonnegative integral solutions of

2e1+5e2+e3+7e4=n

f1=2e1,f2=5e2,f3=e3,f4=7e4,所以有f1+f2+f3+f4=n,其中f1是 2 的倍数,f2是 5 的倍数,f3是 1 的倍数,f4是 7 的倍数。有生成函数,

g(x)=(1+x2+x4+)(1+x5+x10+)(1+x+x2+x3+)(1+x7+x14+)=11x211x511x11x7

EX19

Let h0,h1,h2,...,hn,... be the sequence defined by hn=(n2),(n0). Determine the generating function for the sequence.

g(x)=n=0hnxn=n=0(n2)xn=x2n=2(n2)xn2=x2n=0(n+22)xn=x2(1x)3

简评

本题可以算是 EX15 的一个子问题

EX20

Let h0,h1,h2,...,hn,... be the sequence defined by hn=(n3),(n0). Determine the generating function for the sequence.

g(x)=n=0hnxn=n=0(n3)xn=x3n=3(n3)xn3=x3n=0(n+33)xn=x3(1x)4

EX21 ⭐

* Let hn denote the number of regions into which a convex polygonal region with n + 2 sides is divided by its diagonals, assuming no three diagonals have a common point. Define h0 = 0. Show that

hn=hn1+(n+13)+n,(n1)

Then determine the generating function and obtain a formula for hn.

EX22

Determine the exponential generating function for the sequence of factorials: 0!,1!,2!,3!,...,n!,.

g(e)(x)=n=0hnxnn!=n=0n!xnn!=n=0xn=11x

EX23

Let α be a real number. Let the sequence h0,h1,h2,...,hn,... be defined by h0=1, and hn=α(α1)(αn+1),(n1). Determine the exponential generating function for the sequence.

g(e)(x)=n=0hnxnn!=n=0α(α1)(αn+1)xnn!=n=0(αn)xn=(1+x)α

EX24

Let S be the multiset {e1,e2,e3,,ek} Determine the exponential generating function for the sequence h0,h1,h2,,hn,, where h0=1 and, for n1,

(a) hn equals the number of n-permutations of S in which each object occurs an odd number of times.

(b) hn equals the number of n-permutations of S in which each object occurs at least four times.

(c) hn equals the number of n-permutations of S in which e1 occurs at least once, e2 occurs at least twice, ... , ek occurs at least k times.

(d) hn equals the number of n-permutations of S in which e1 occurs at most once, e2 occurs at most twice, ... , ek occurs at most k times.

EX24(a)

g(e)(x)=(x1!+x33!+x55!+)(x1!+x33!+x55!+)(x1!+x33!+x55!+)=(x1!+x33!+x55!+)k=(exex2)k

EX24(b)

G(e)(x)=x44!+x55!+x66!+=ex1xx22!x33!

并且指数生成函数为g(e)(x)=(G(e)(x))k

EX24(c)

Gk(e)(x)=xkk!+xk+1(k+1)!+xk+2(k+2)!+=exj=0k1xjj!

指数生成函数为g(e)(x)=G1(e)(x)G2(e)(x)Gk(e)(x)

EX24(d)

Gk(e)(x)=1+x1!+x22!++xkk!=j=0kxjj!

指数生成函数为g(e)(x)=G1(e)(x)G2(e)(x)Gk(e)(x)

EX25

Let hn denote the number of ways to color the squares of a 1-by-n board with the colors red, white, blue, and green in such a way that the number of squares colored red is even and the number of squares colored white is odd. Determine the exponential generating function for the sequence h0,h1,h2,,hn,, and then find a simple formula for hn.

g(e)(x)=(1+x22!+x44!+)(x1!+x33!+x55!+)(1+x1!+x22!+)(1+x1!+x22!+)=ex+ex2exex2exex=e2xe2xe2x4=e4x14=14(4x+(4x)22!+)=n=14n1xnn!

因此hn=4n1,(n1),当 n=0 时,h0=1

EX26

Determine the number of ways to color the squares of a 1-by-n chessboard, using the colors red, blue, green, and orange if an even number of squares is to be colored red and an even number is to be colored green.

g(e)(x)=(1+x22!+x44!+)(1+x22!+x44!+)(1+x1!+x22!+)(1+x1!+x22!+)=ex+ex2ex+ex2exex=e2xe2x+e2x+24=e4x+2e2x+14=14(1+(4+2×2)x+(42+2×22)x22!+)=14+n=1(4n1+2n1)xnn!

因此hn=4n1+2n1,(n1),当 n=0 时,h0=1

EX27

Determine the number of n-digit numbers with all digits odd, such that 1 and 3 each occur a nonzero, even number of times.

问题等价于{1,3,5,7,9}的多重集合 n 排列数,

G1(e)(x)=G3(e)(x)=x22!+x44!+=ex+ex21G5(e)(x)=G7(e)(x)=G9(e)(x)=ex

指数生成函数为,

g(e)(x)=G1e(x)G3e(x)G9e(x)=(ex+ex22)2e3x=e5x4e4x+6e3x4e2x+ex4

因此hn=5n4×4n+6×3n4×2n+14

EX28

Determine the number of n-digit numbers with all digits at least 4, such that 4 and 6 each occur an even number of times, and 5 and 7 each occur at least once, there being no restriction on the digits 8 and 9.

问题等价于{4,5,6,7,8,9}的多重集合 n 排列数。

G4(e)(x)=G6(e)(x)=1+x22!+x44!+=ex+ex2G5(e)(x)=G7(e)(x)=ex1

指数生成函数为,

g(e)(x)=G4e(x)G5e(x)G9e(x)=(ex+ex2)2(ex1)2e2x=e6x2e5x+3e4x4e3x+3e2x2ex+14

因此hn=6n2×5n+3×4n4×3n+3×2n24,(n0)h0=0

强调

需要根据题目的意义来决定初始项h0, 本题h0是 0 位数中满足性质的个数,而 0 位数不可能满足5 和 7 至少出现一次

EX29

We have used exponential generating functions to show that the number hn of n-digit numbers with each digit odd, where the digits 1 and 3 occur an even number of times, satisfies the formula

hn=5n+2×3n+14,(n0)

Obtain an laternative derivation of this formula.

根据 n 位数中 1 和 3 出现数量的奇偶性可以分类,

种类1 的数量3 的数量
an奇数奇数
bn奇数偶数
cn偶数奇数
hn偶数偶数

对于an考虑移除最低位的数字,可以划分为三种情况:移除的数字为 1,问题变为cn1;移除的数字为 3,问题变为bn1,移除的数字是 5、7 或 9,问题变为3an1。 即有an=cn1+bn1+3an1。此外所有的可能总数是5n。可以得到方程组,

{an=cn1+bn1+3an1bn=hn1+an1+3bn1cn=an1+hn1+3cn1hn=bn1+cn1+3hn1an+bn+cn+hn=5n

初始条件,a0=b0=c0=0,h0=1。由对称性知bn=cn,可得an+2bn+hn=5n,hn3hn1=2bn1,用后式消去前式中的bnan+hn+12hn=5n

写出该式子的下一项an1+hn2hn1=5n,递推一项做差并且调整hn为最高次,进而得到hn4hn1+3hn2=2×5n2

解方程略,可得其次递推关系的解Hn=c13n+c2,非齐次递推关系的特解为Hn=xn4

所以通解为hn=c13n+c2+5n4

对于 1 位数,h1=3。带入h0=1,h1=3,解得c1=12,c2=14。进而求出,

hn=5n+2×3n+14

EX30

We have used exponential generating functions to show that the number hn of ways to color the squares of a 1-by-n board with the colors red, white, and blue, where the number of red squares is even and there is at least one blue square, satisfies the formula

hn=3n2n+12,(n1)

with h0=0. Obtain an alternative derivation of this formula by finding a recurrence relation satisfied by hn and then solving the recurrence relation.

种类红色蓝色
an奇数无限制
bn偶数=0
hn偶数1

an为例,考虑删除第一格。如果第一格为蓝色或白色,问题变为2an1; 如果第一格为红色,问题转化为从剩余 n-1 格中选出偶数个红格,总染色方案数为3n1, 其中红色为奇数的方案是an1, 所以有3n1an1种方案选出偶数个红格。 所以有an=2an1+3n1an1=an1+3n1

对于bn,如果第一格为白色,问题转化为bn1, 如果第一格为红色,同上有2n1bn1, 因此得bn=2n1

an+bn+hn为总方案数3n,可以递推做差得hnhn1=3n12n1。解方程过程略。

初始值h0=1

提示

  1. 利用好奇偶两种对立状态。
  2. 题目强调要写出hn的递推式,实际上容易先求出an,然后带入an+bn+hn=3n求出hn,但这样不满足题目要求的解法。

EX31

Solve the recurrence relation hn=4hn2,(n2) with initial values h0=0 and h1=1.

hn=c12n+c2(2)n

带入初始值解得,hn=2n(2)n4,(n0)

EX32

Solve the recurrence relation hn=(n+2)hn1,(n1) with initial value h0=2.

hn=hnhn1hn1hn2h1h0h0=(n+2)×(n+1)××(1+2)×2=(n+2)!n0

EX33

Solve the recurrence relation hn=hn1+9hn29hn3,(n3) with initial values h0=0,h1=1, and h2=2.

方程x3=x2+9x9=0的解为x1=3,x3=3,x3=1

hn=c13n+c2(3)n+c3,带入初始值有hn=3n1+(3)n1414,(n0)

EX34

Solve the recurrence relation hn=8hn116hn2,(n2) with initial values h0=1 and h1=0.

hn=c14n+c2n4n,带入初始值有hn=(n1)4n,(n0)

EX35

Solve the recurrence relation hn=3hn22hn3,(n3) with initial values h0=1,h1=0, and h2=0.

hn=(c1+c2n)+c3(2)n,带入初始值有hn=(892n3)+(2)n9,(n0)

EX36

Solve the recurrence relation hn=5hn16hn24hn3+8hn4,(n4) with initial values h0=0,h1=1,h2=1, and h3=2.

方程x4=5x36x24x+8的解为x1=x2=x3=2,x4=1

hn=(c1n2+c2n+c3)2n+c4(1)n,带入初始值有hn=(n224+7n72+827)2n8(1)n27,(n0)

简评

分解方程和求解四元一次方程组的计算量很大。

EX37

Determine a recurrence relation for the number an of ternary strings (made up of 0s, 1s, and 2s) of length n that do not contain two consecutive 0s or two consecutive 1s. Then find a formula for an.

对长度为 n 且符合题目要求的字符串Tn进行切片,按照前两个字符是否相同进行分类;如果前两个字符相同,那么只能切出 22 和Tn2,如果前两个字符不同,每一个字符(0、1 或 2)都有两种符合题意的Tn1

因此得到递推公式:an=an2+2an1,(n2),容易知道初始值a0=1,a1=3

因此求出an=(1+2)n+12+(12)n+12,(n0)

联想 💡

对比 EX37、EX40 和 EX9

EX38 👻

Solve the following recurrence relations by examining the first few values for a formula and then proving your conjectured formula by induction.

(a) hn=3hn1,(n1);h0=1

(b) hn=hn1n+3,(n1);h0=2

(c) hn=hn1+1,(n1);h0=0

(d) hn=hn1+2,(n1);h0=1

(e) hn=2hn1+1,(n1);h0=1

以 EX38(b) 为例,先求出通项,再用数学归纳法验证,其余同理。

EX38(b)

先求其次递推关系的解,Hn=c1(1)n,后面的非齐次部分是一次多项式,同时隐含也是以 1 为底的指数。因此设Hn=(An+B)n

带入递推关系求出A=12,B=52,带入初始量得hn=4+5nn22

数学归纳法证明过程略。

EX39

Let hn denote the number of ways to perfectly cover a 1-by-n board with monominoes and dominoes in such a way that no two dominoes are consecutive. Find, but do not solve, a recurrence relation and initial conditions satisfied by hn.

容易验证初始值h0=h1=1,h2=2,当n3时,如果第一块为单牌,问题变为hn1,如果第一块为多米诺骨牌(1×2牌),那么临界的块只能是单牌,问题转化为hn3

综上有,

hn=hn1+hn3
简评

头一次看到专门强调只推出关系不求解的题目。

EX40

Let an equal the number of ternary strings of length n made up of Os, ls, and 2s, such that the substrings 00, 01, 10, and 11 never occur. Prove that

an=an1+2an2,(n2),

with a0=1 and a1=3. Then find a formula for an.

按照第一字符是否为 2 进行划分,由题意,长度为 n 的串第一个字符是 2,问题变为an1; 如果第一个字符不是 2,那么只能是 0 或 1,如果为 0,则第二个字符只能是 2(因为不存在 00 和 01), 同理第一格字符如果为 1,则第二个字符只能为 2,因此问题转化为2an2。综上有,

an=an1+2an2

长度为 0 的串,长度为 1 的串显然都不含有 00、01、10 和 11,a0=1,a1=3

EX41

* Let 2n equally spaced points be chosen on a circle. Let hn denote the number of ways to join these points in pairs so that the resulting line segments do not intersect. Establish a recurrence relation for hn.

EX41

选择一端固定在 1 上的线段为基线,另一端指向 2k,圆上的 2n 个点被分为两组,一组有 2k-2 个, 另一组有 2n-2k 个,同时问题hn被划分为hk1hnk。所以有,

hn=k=1hk1hnk,n1,h0=h1=1

显然hn与卡特兰数Cn有相同的递推关系和初始项,因此,

hn=1n+1(2nn)

EX42 👻

Solve the monhomogeneous recurrence realtion

hn=4hn1+4n,(n1)h0=3

其次递推关系的解为Hn=c14n,因此设特解为Hn=An4n,求出A=1,带入初始项求出,

hn=(n+3)4n,n0

简评

虽然参考答案秀了技巧,把非齐次方程转化为hn8hn1+16hn2=0。 但着实没有必要,按照非齐次的模板解题速度一样很快。

EX43 👻

Solve the monhomogeneous recurrence realtion

hn=4hn1+3×2n,(n1)h0=1

略。

EX44 👻

Solve the monhomogeneous recurrence realtion

hn=3hn12,(n1)h0=1

EX45 👻

Solve the monhomogeneous recurrence realtion

hn=2hn1+n,(n1)h0=1

EX46 👻

Solve the monhomogeneous recurrence realtion

hn=6hn19hn2+2n,(n2)h0=1h1=0

EX47 👻

Solve the monhomogeneous recurrence realtion

hn=4hn14hn2+3n+1,(n2)h0=1h1=2

EX48 👻

Solve the following recurrence relations by using the method of generating functions as described in Section 7.4:

(a) hn=4hn2,(n2);h0=0,h1=1

(b) hn=hn1+hn2,(n2);h0=1,h1=3

(c) hn=hn1+9hn29hn3,(n3);h0=0,h1=1,h2=2

(d) hn=8hn116hn2,(n2);h0=1,h1=0

(e) hn=3hn22hn3,(n3);h0=1,h1=0,h2=0

(f) hn=5hn16hn24hn3+8hn4,(n4);h0=0,h1=1,h2=1,h3=2

以 EX48(b) 和 EX48(f) 为例,其余题目略。

EX48(b)

设生成函数为g(x)=h0+h1x+h2x2+,分别用xx2乘以 g(x) 得到,

xg(x)=h0xh1x2h2x3x2g(x)=h0x2h1x3h2x4

两边求和化简得,

(1xx2)g(x)=h0+(h0h1)x+(h2h1h0)x2++(hnhn1hn2)xn+

再由hnhn1hn2=0,(n2)知,

g(x)=1+2x1xx2=r1rx+s1sx=(r+s)2rsx1(r+s)x+rsx2=n=0(rn+1+sn+1)xn

其中,r=1+52,s=152,r+s=1,rs=1

因此,hn=rn+1+sn+1,(n0)

EX48(f)

设生成函数为g(x)=h0+h1x+h2x2+,分别用5x6x24x38x4乘以 g(x) 化简得到,

g(x)=x4x2+3x315x+6x2+4x38x4=x4x2+3x3(12x)3(1+x)=ax2+bx+c(12x)3+d1+x=(a8d)x3+(a+b+12d)x2+(b+c6d)x+(c+d)(12x)3(1+x)

因此可以得到方程组,

{a8d=3a+b+12d=4b+c6d=1c+d=0

解得,a=1727,b=2927,c=827,d=827

g(x)=12717x229x8(12x)3+8(1+x)

提示

从上面的过程可以看出使用生成函数求解的计算量极大,因此如果题目不是强调使用该方法,不要考虑使用它。

EX49

(q-binomial theorem) Prove that

(x+y)(x+qy)(x+q2y)(x+qn1y)=k=0n(nk)qxnkyk,

where

n!q=Πj=1n(1qj)(1q)n

is the q-factorial (cf. Theorem 7.2.1 replacing q in (7.14) with x) and

(nk)q=n!qk!q(nk)!q

is the q-binomial coefficient.

采用数学归纳法证明,当 n=1 时,左边等于(x+y), 右边等于k=01(1k)qx1kyk=(10)qx+(11)qy=x+y, 左右两边相等,成立。

假设取 n 时等式成立,那么取 n+1 时,左右两边同时乘(x+qny)有,

k=0n(nk)qxnkyk(x+qny)=k=0n(nk)qxn+1kyk+qnk=0n(nk)qxnkyk+1=k=0n(nk)qxn+1kyk+qnk=1n+1(nk1)qxn+1kyk=(n0)qxn+1+k=1n((nk)q+qn(nk1)q)xn+1kyk+(nn)qyn+1=(n+10)qxn+1+k=1n((nk)q+qn(nk1)q)xn+1kyk+(n+1n+1)qyn+1=k=0n+1(n+1k)qxn+1kyk

即取 n+1 时等式仍成立,综上,证毕。

EX49PS

下面验证,

(n+1k)q=(nk)q+qn(nk1)q

EX49 参考

q-binomial coefficients

EX50

Call a subset S of the integers {1, 2, ... ,n} extmordinary provided its smallest integer equals its size:

min{x:xS}=|S|

For example, S = {3,7,8}, is extraordinary. Let gn be the number of extraordinary subsets of {1, 2, ..., n}. Prove that

gn=gn1+gn2(n3),

with g1=1 and g2=1.

如果子集 S 是非凡的 k 子集,那么 S 中的最小元素是 k,其余 k-1 个元素均比 k 大,因此非凡 k 子集的个数为(nkk1)个,那么集合{1, 2, 3, ..., n}的所有非凡集为,

gn=k=1n(nkk1)=k=1n(nk1k1)+k=1n(nk1k2)=k=1n((n1)kk1)+k=1n((n2)k1(k1)1)=k=1n((n1)kk1)+h=1n((n2)hh1)=k=1n1((n1)kk1)+h=1n2((n2)hh1)=gn1+gn2

由题意容易求出{1}的非凡集为{1},{1, 2}的非凡集为{1},因此g1=g2=1

EX51

Solve the recurrence relation

hn=3hn14n,(n1)h0=2

from Section 7.6 using generating functions.

要求使用生成函数求解非齐次递推关系。生成函数为g(x)=h0+h1x+h2x2++hnxn+,计算

g(x)3xg(x)=h0+(h13h0)x++(hnhn1)xn+=2+(4)x+(8)x2++(4n)xn+=24(x+2x2++nxn+)=24xn=0(n+1)xn=24x(1x)2g(x)=213x4x(13x)(1x)2=213x(A13x+Bx+C(1x)2)=213x(313x+x3(1x)2)=113x+3x(1x)2=n=0(3x)n+3n=0(n+1)xnn=0nxn=n=0(2n+33n)xn

所以hn=2n+33n,(n0)

EX52 👻

Solve the following two recurrence relations:

(a) hn=2hn1+5n,(n1) with h0=3

(a) hn=5hn1+5n,(n1) with h0=3

非齐次递推关系求解,略。

EX53

Suppose you deposit $500 in a bank account -that pays 6% interest at the end of each year (compounded annually). Thereafter, at the beginning of each year you deposit $100. Let hn be the amount in your account after n years (so h_0 = $500). Determine the generating function g(x)=h0+h1x+...+hnxn+... and then a formula for hn.

hn=1.06hn1+100,n1,h0=500g(x)=h0+h1x+h2x2+(11.06x)g(x)=h0+(h11.06h0)x++(hnhn1)xn+=500+100x+100x2++100xn+=500+100(x+x2+)()=500+100x1xg(x)=50011.06x+100x(1x)(11.06x)=50011.06x+1000.06(111.06x11x)=(500+1000.06)111.06x1000.0611x=(500+1000.06)n=0(1.06x)n100.0.6xn=[(500+1000.06)(1.06)n1000.06]xn

因此,

hn=500(1.06)n+1000.06((1.06)n1)

提示

(*) 式不留常数凑成x1x的形式方便下面的分解。

EX53 另解 💡

hn=500(1.06)n+k=0n1100(1.06)k=500(1.06)n+100(1.06)n10.06