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-42

Exercise 1.2.8-42

not stated yet in Lean solution written

RatingM26
MarkersM (mathematical)
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.8 of Volume 1. Companion chapter: Fibonacci numbers

The task

Show that for all integers m,n≥0m, n \ge 0 there is exactly one admissible list of indices k1≫⋯≫krk_1 \gg \cdots \gg k_r (negative indices allowed, rr may be 00) with ∑Fki=m\sum F_{k_i} = m and ∑Fki+1=n\sum F_{k_i+1} = n.

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

Uniqueness: turn the pair (m,n)(m, n) into the real number x=n−ϕ^mx = n - \hat\phi m and use Exercise 1.2.8-35.

Hint 2

Existence: put the vectors vk=(Fk,Fk+1)v_k = (F_k, F_{k+1}) in a set one at a time. Use vk+vk+1=vk+2v_k + v_{k+1} = v_{k+2} and 2vk=vk+1+vk−22v_k = v_{k+1} + v_{k-2} to repair adjacent or equal indices.

Hint 3

Start with the empty list and add the vector (1,0)=v−1(1, 0) = v_{-1} exactly mm times and (0,1)=v0(0, 1) = v_0 exactly nn times. Show that the repair procedure stops, by a decreasing pair of counts.

Solution

Show the solution

Call a finite set AA of integers admissible if any two of its elements differ by at least 22. Let vk=(Fk,Fk+1)v_k = (F_k, F_{k+1}) for every integer kk and W(A)=∑a∈AvaW(A) = \sum_{a \in A}v_a. The task is to show that every (m,n)∈ℕ2(m, n) \in \mathbb N^2 equals W(A)W(A) for exactly one admissible AA.

Uniqueness. Let AA be admissible with W(A)=(m,n)W(A) = (m, n). Since Fk+1−ϕ^Fk=ϕkF_{k+1} - \hat\phi F_k = \phi^k, the sum is ∑a∈Aϕa=n−ϕ^m=x\sum_{a \in A}\phi^a = n - \hat\phi m = x. The set AA is a finite, sparse representation of xx in base ϕ\phi, so it is admissible in the sense of Exercise 1.2.8-35. By the uniqueness part of that exercise, AA is determined by xx, and so by (m,n)(m, n).

Existence. Three identities of the vectors are used. They follow from vk+1=vk+vk−1v_{k+1} = v_k + v_{k-1}:

vk+vk+1=vk+2,vk−1+vk=vk+1,2vk=vk+1+vk−2.v_k + v_{k+1} = v_{k+2}, \qquad v_{k-1} + v_k = v_{k+1}, \qquad 2v_k = v_{k+1} + v_{k-2}.

(For the last: vk+1+vk−2=(vk+vk−1)+(vk−vk−1)=2vkv_{k+1} + v_{k-2} = (v_k + v_{k-1}) + (v_k - v_{k-1}) = 2v_k.)

Define Add⁡(A,t)\operatorname{Add}(A, t) for an admissible AA and an integer tt by cases:

  1. If t∈At \in A: let A1=Add⁡(A∖{t},t+1)A_1 = \operatorname{Add}(A \setminus \{t\}, t + 1), and return Add⁡(A1,t−2)\operatorname{Add}(A_1, t - 2).
  2. Else if t+1∈At + 1 \in A: return Add⁡(A∖{t+1},t+2)\operatorname{Add}(A \setminus \{t+1\}, t + 2).
  3. Else if t−1∈At - 1 \in A: return Add⁡(A∖{t−1},t+1)\operatorname{Add}(A \setminus \{t-1\}, t + 1).
  4. Else return A∪{t}A \cup \{t\}.

Claim: Add⁡(A,t)\operatorname{Add}(A, t) is defined (the recursion stops), is admissible, satisfies W=W(A)+vtW = W(A) + v_t, and has at most ∣A∣+1|A| + 1 elements.

Value and admissibility. Case 4 is admissible because t−1,t,t+1∉At - 1, t, t + 1 \notin A. In case 2 the identity vt+vt+1=vt+2v_t + v_{t+1} = v_{t+2} shows that W(A)+vt=W(A∖{t+1})+vt+2W(A) + v_t = W(A \setminus \{t+1\}) + v_{t+2}. In case 3 use vt−1+vt=vt+1v_{t-1} + v_t = v_{t+1}. In case 1 use W(A)+vt=W(A∖{t})+2vt=W(A∖{t})+vt+1+vt−2W(A) + v_t = W(A \setminus \{t\}) + 2v_t = W(A \setminus \{t\}) + v_{t+1} + v_{t-2}, and the two calls add vt+1v_{t+1} and then vt−2v_{t-2}. By induction on the recursion the results of the calls are admissible with the right values.

The upper part is merged only upwards. In the first call of case 1, put B=A∖{t}B = A \setminus \{t\} and s=t+1s = t + 1. Then s−1∉Bs - 1 \notin B and s∉Bs \notin B, because AA has gaps at least 22. Under these two conditions, a call Add⁡(B,s)\operatorname{Add}(B, s) goes to case 2 as long as s+1∈Bs + 1 \in B and moves to (B∖{s+1},s+2)(B \setminus \{s + 1\}, s + 2). The new pair satisfies the two conditions again (s+1s + 1 was removed, and s+2∉Bs + 2 \notin B because s+1∈Bs + 1 \in B). Case 1 and case 3 never occur in this chain. So the chain ends in case 4, and the result differs from BB only at places greater than s−1=ts - 1 = t. In particular A1∩(−∞,t−1]=A∩(−∞,t−1]A_1 \cap (-\infty, t - 1] = A \cap (-\infty, t - 1].

Termination. Order the calls by the pair (∣A∣,ν)(|A|, \nu) with ν(A,t)=∣{a∈A:a≤t}∣\nu(A, t) = |\{a \in A : a \le t\}|, lexicographically. In cases 2 and 3 the new set has ∣A∣−1|A| - 1 elements. In case 1 the first call has ∣A∣−1|A| - 1 elements. The second call has the set A1A_1 with ∣A1∣≤∣A∣|A_1| \le |A| (by the size bound for the first call, which holds by induction), and ν(A1,t−2)=∣A∩(−∞,t−2]∣=ν(A,t)−1\nu(A_1, t - 2) = |A \cap (-\infty, t-2]| = \nu(A, t) - 1, because t∈At \in A and t−1∉At - 1 \notin A. So every call has a smaller pair than its parent, and the recursion stops. The size bound follows in the same induction: case 4 adds one element, cases 2 and 3 give at most ∣A∣|A|, and case 1 gives at most ∣A1∣+1≤∣A∣+1|A_1| + 1 \le |A| + 1.

Building (m,n)(m, n). Start with A=∅A = \emptyset. Apply A←Add⁡(A,−1)A \leftarrow \operatorname{Add}(A, -1) exactly mm times and then A←Add⁡(A,0)A \leftarrow \operatorname{Add}(A, 0) exactly nn times. Since v−1=(F−1,F0)=(1,0)v_{-1} = (F_{-1}, F_0) = (1, 0) and v0=(0,1)v_0 = (0, 1), the final set is admissible with W(A)=(m,n)W(A) = (m, n).

Check

The insertion procedure, run in python for all 0≤m,n<400 \le m, n < 40, gives an admissible set with the correct sums every time. Examples: (4,7)→{4,2}(4, 7) \to \{4, 2\}, since F4+F2=4F_4 + F_2 = 4 and F5+F3=7F_5 + F_3 = 7. (2,0)→{0,−3}(2, 0) \to \{0, -3\}, since F0+F−3=2F_0 + F_{-3} = 2 and F1+F−2=1−1=0F_1 + F_{-2} = 1 - 1 = 0. (0,2)→{1,−2}(0, 2) \to \{1, -2\}, since F1+F−2=0F_1 + F_{-2} = 0 and F2+F−1=2F_2 + F_{-1} = 2. (7,5)→{4,1,−1,−3}(7, 5) \to \{4, 1, -1, -3\}: F4+F1+F−1+F−3=3+1+1+2=7F_4 + F_1 + F_{-1} + F_{-3} = 3 + 1 + 1 + 2 = 7 and F5+F2+F0+F−2=5+1+0−1=5F_5 + F_2 + F_0 + F_{-2} = 5 + 1 + 0 - 1 = 5.

Remarks

For n=0n = 0 and m=Nm = N this gives the base ϕ\phi representation of the integer NN with finite expansion, as used in Exercise 1.2.8-35. Exercise 1.2.8-34 is the case with only positive indices. The result is due to D. A. Klarner (1968). The book's answer takes another route: it builds the joint representation from Exercise 1.2.8-41 by a shift of the indices.

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.