Jeffrey&Lynny

一个温馨小家庭的.Net生活

导航

Studying "Concrete Mathematics"

Chapter 1
Homework
10. 
When n=0, the Q(n)=0 is trivial.
To move Q(n), we need first transfer (n-1) disks from A to C. This moves are the same as R(n-1). After (n-1) disks, we may directly move the last disk from A to B. Finally, we may move (n-1) disks from C to B with clockwise, which requires the same moves as R(n-1). So Q(n)<=R(n-1)+1+R(n-1)=2R(n-1) + 1.

To move the last largest disk with the rule(from A to B), all the smaller n-1 disks should not on A or B, so all n-1 disks must be moved to C. This steps minimum requires R(n-1) steps. The largest disk moves from A to B requires 1 move. Finally, the n-1 disks move from C to B must go clockwise through A, so it minimum requires R(n-1).
=> Q(n)>=R(n-1)+1+R(n-1)=2*R(n-1)+1
=>Q(n) = 2*R(n-1)+1

When n=0, R(n)=0 is trivial
To move n disks on B to A, we may first moves the n-1 disks to A, this requires the same as R(n-1). Then, we may move the last largest disk to C. Then, we may move n-1 disks on A to the B, which requires Q(n-1). Then, we may move the last largest disk on C to A. Finally, we need R(n-1) to move n-1 disks from B to A.
R(n)<=R(n-1) + 1 + Q(n-1) + 1 + R(n-1)= 2*R(n-1) + 1 + Q(n-1)+ 1  using the first conclusion, we got
R(n)<=Q(n) + Q(n-1) +1

To move move the last largest disk clockwise from B to C, all the top n-1 disks must be on A, which minimum requires R(n-1) moves. The move the last largest disk, it minimum requires 1 move from B to C. To move the last largest disk from C to A, all the n-1 disks on A must be moved to B, which requires Q(n-1) in minimum. Also, the last disc minimum requires additional 1 move from C to A to reach A. Finally, the n-1 disks on B minimum requires R(n-1) to be moved to A.
So R(n)<=R(n-1) + 1 + Q(n-1) + 1 + R(n-1)= 2*R(n-1) + 1 + Q(n-1)+ 1 >= Q(n) + Q(n-1) +1

We got the conclusion R(n)=Q(n) + Q(n-1) +1

11.
Let's start from small cases: H(0)=0, H(2)=2, H(4)=6, H(6)= 6+2+6=14.
It looks like to move the last 2 largest disks, we may move the top 2n-2 disks to C, which requires H(2n-2). Then we may use another 2 moves to move the last 2 disks from A to B. Finally, we need another H(2n-2) moves to move 2n-2 disks from C to B.
So H(2n)<=H(2n-2) + 2 + H(2n-2) = 2* H(2n-2) +2

From another perspective, to move the last 2 disks to B, we have to move the 2n-2 top disks to C which minimum requires H(2n-2) moves. Then, to move the last 2 disks from A to B, it minimum requires 2 moves. Finally, we have to move 2n-2 disks on C to the B, which minimum requires H(2n-2) moves. So H(2n)>= H(2n-2) +2 + H(2n-2)

In all, H(2n)= 2* H(2n-2) +2. Let's T(2n)=H(2n) +2, so T(2n)=2*T(2n-2) => T(2n)=2^(n-1)*T(2)= 2^(n+1)  => H(2n)= 2^(n+1) -2

Chapter 2
Cool Repertoire Method: This method is used to resolve the general form "linear" recurrent. Due to the linear feature, we may express the solution as form R(n)=A(n)*a + B(n)*b + C(n)*c. Then, we may take some special cases to resolve of A(n), B(n) and C(n).
Key tips:
1. assign some very simple values for a, b and c, hope we can get a simple form of R(n). For example, we may use {a=1, b=0, c=0}, {a=0, b=1, c=0}, {a=0, b=0, c=1}, in which cases, R(n) will become A(n), B(n), and C(n). This is used in P25 in the book.
2. Sometimes, using the #1 simple a, b, c may lead to an unresolvable forms of R(n), such as the example in P14 of the book. Then, we may guess in reverse way. That is guessing a simple R(n) which may fit the fomular without any problem.(We may get the corresponding value of a, b, c from the guessing R(n)). See P14 in book as a good example.


1. Take care of this form, see the disucssion in the book answer.
2. |x|
3.
a0+a1+a2+a3+a4+a5
Since k must be an integer, k^2 can only be 0, 1, 4. So k=0, 1, -1, 2, -2. => a4+a1+a0+a1+a4
4. 
Please look the answer of this problem to understand its meaning clearly.
((a123+a124)+134)+a234

5. In the second equation, the increasing of j has nothing to do with the increasing of k, so it is incorrect to substitute j with k and believe they are increasing at the same time. 

                 j<1 or j>n: 0  
6. f(j, n)={ 1<=j<=n:  n-j+1

12. First, let's prove: given an integer n, we can find a k, so that p(k)=n. Since n+c and n-c will be odd or even the same time, if n+c/n-c is odd, we define k=n+c, so p(n+c) = n. If n+c/n-c is even, we define k=n-c, so p(n-c)=n.

Then, let's prove: for any integer n, there is only one k so that p(k)=n. If not, let's assume p(k1)=p(k2). => k1- k2= ((-1)^k1 + (-1)^k2)*c. If k1 and k2 are both even or odd, we will get k1=k2. So k1 and k2 will have different parity. => k1-k2 = (-) 2*c. => k1-k2 is even. However, if k1 and k2 have different parity, k1-k2 will be odd. We have confliction here. So there is only one k so that p(k)=n.

We have proved there is one to one mapping from p(k) to integer set.

14. First, let's prove this rewriting is legal. sigma(k=1..n)k*2^k =sigma(k=1...n)sigma(j=1...k)2^k = sigma(1<=j<=k<=n)2^k
Ok, then let's calculate this double sum now. The first try should be trying to sum on one variable. Because [1<=j<=k<=n] = [1<=j<=n][j<=k<=n]        =>    
sigma(1<=j<=k<=n)2^k = sigma(j=1...n)sigma(k=j...n)2^k 
                                      = sigma(j=1...n)(2^(n+1) - 2^j)
                                      = n*2^(n+1) - sigma(j=1...n)2^j
                                      = n*2^(n+1) - (2^(n+1) - 2)
                                      = (n-1)*2^(n+1) +2


Homework exercises
19.
Mutiple both sides with s(n): 2*s(n)*T(n)=n*s(n)*T(n) + 3*s(n)*n!
So we have the equation 2*s(n-1)=n*s(n)
=> s(n) = 2/n * s(n-1)
=> s(n) = 2^2/n*(n-1) *s(n-2)
=> s(n) = 2^n/ n! * s(0)
Let's set s(0)=1, so s(n)=2^n/n!. The original recurrent is 2^(n+1)/n! * T(n) = 2^n/(n-1)!* T(n-1) + 3*2^n
By setting S(n) = 2^(n+1)/n!*T(n), we have S(n) = S(n-1) + 3*2^n,  S(0) = 2*T(0) = 10
=> S(n) = 3*(2^n + 2^(n-1) +2^(n-2) + ... 2^1) + S(0)
             = 3* (2^(n+1) - 2) + 10 
             = 3* 2^(n+1) + 4
=> T(n) = n!*(3 + 1/2^(n-1))

20. Let's define S(n) = sigma(k=0, n)kH(k). We have S(n) + (n+1)*H(n+1) = sigma(k=0, n)(k+1)H(k+1)

 Right side: sigma(k=0, n)(k+1)H(k+1)= sigma(k=0, n)kH(k+1) + sigma(k=0, n)H(k+1)
                                                           = sigma(k=0, n)k*(H(k)+1/(k+1)) + sigma(k=0, n)H(k+1)
                                                           = S(n) + sigma(k=0, n)(k/(k+1)) + sigma(k=0, n)H(k+1)

=> S(n) + (n+1)*H(n+1)= S(n) + sigma(k=0, n)(k/(k+1)) + sigma(k=0, n)H(k+1)
=> sigma(k=0, n)H(k+1) = (n+1)*H(n+1) - sigma(k=0, n)(1-1/(k+1))
                                       = (n+1)*H(n+1) - (n+1) + H(n+1)

Substracting both sides with H(n+1) => sigma(k=0, n)H(k) = (n+1)*H(n+1) - (n+1)

21. Using perturbation method, we have S(n) + (-1)^(n- (n+1)) = (-1)^(n-0) + sigma(k=0..n)(k+1)*(-1)^(n-(k+1))
=> S(n) - 1= (-1)^n - S(n)
=> S(n) = ((-1)^n +1)/2

T(n) +

posted on 2007-06-26 15:13  比尔盖房  阅读(319)  评论(0编辑  收藏  举报