taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.8-21

Exercise 1.2.8-21

not stated yet in Lean solution written

RatingM25
MarkersM (mathematical)
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.8 of Volume 1. Companion chapter: Fibonacci numbers

The task

Find a closed form of the polynomial ∑k=0nFkxk\sum_{k=0}^nF_kx^k.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Let SS be the sum. Compute (1−x−x2)S(1 - x - x^2)S and look at the coefficient of each power of xx.

Hint 2

Most coefficients vanish by the Fibonacci rule. Only the first and last powers survive.

Solution

Show the solution

Let S=∑k=0nFkxkS = \sum_{k=0}^nF_kx^k and take n≥1n \ge 1. Then

(1−x−x2)S=∑k=0nFkxk−∑k=1n+1Fk−1xk−∑k=2n+2Fk−2xk.(1 - x - x^2)S = \sum_{k=0}^nF_kx^k - \sum_{k=1}^{n+1}F_{k-1}x^k - \sum_{k=2}^{n+2}F_{k-2}x^k.

The coefficient of xkx^k is as follows.

  • For k=0k = 0 it is F0=0F_0 = 0.
  • For k=1k = 1 it is F1−F0=1F_1 - F_0 = 1.
  • For 2≤k≤n2 \le k \le n it is Fk−Fk−1−Fk−2=0F_k - F_{k-1} - F_{k-2} = 0.
  • For k=n+1k = n+1 it is −Fn−Fn−1=−Fn+1-F_n - F_{n-1} = -F_{n+1}.
  • For k=n+2k = n+2 it is −Fn-F_n.

Therefore (1−x−x2)S=x−Fn+1xn+1−Fnxn+2(1 - x - x^2)S = x - F_{n+1}x^{n+1} - F_nx^{n+2}, and

∑k=0nFkxk=x−Fn+1xn+1−Fnxn+21−x−x2,\sum_{k=0}^nF_kx^k = \frac{x - F_{n+1}x^{n+1} - F_nx^{n+2}}{1 - x - x^2},

as an identity of polynomials, and as a number when 1−x−x2≠01 - x - x^2 \ne 0. For n=0n = 0 the right side is (x−x)/(1−x−x2)=0(x - x)/(1 - x - x^2) = 0, which also holds.

Check

For n=3n = 3 and x=2x = 2: the sum is 0+2+4+16=220 + 2 + 4 + 16 = 22, and the formula gives (2−3⋅16−2⋅32)/(1−2−4)=−110/(−5)=22(2 - 3 \cdot 16 - 2 \cdot 32)/(1 - 2 - 4) = -110/(-5) = 22.

Remarks

For ∣x∣<1/ϕ|x| < 1/\phi and n→∞n \to \infty the formula tends to x/(1−x−x2)x/(1 - x - x^2), the generating function of eq. (11) of the section. The denominator is zero at x=1/ϕx = 1/\phi and at x=−ϕx = -\phi, the two roots of 1−x−x21 - x - x^2. There the numerator is zero too, and the sum is the limit, which is (n+1−xnFn+1)/(2x+1)(n + 1 - x^nF_{n+1})/(2x + 1). For x=1/ϕx = 1/\phi and n=2n = 2 it gives (3−2/ϕ2)/5=1(3 - 2/\phi^2)/\sqrt5 = 1, and the sum is 0+1/ϕ+1/ϕ2=10 + 1/\phi + 1/\phi^2 = 1.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

not stated yet The exercise is not stated in Lean yet.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.