Hints and Solutions to Exercises
Total Page:16
File Type:pdf, Size:1020Kb
Appendix A Hints and Solutions to Exercises Chapter 0 since the Fundamental theorem of recur- n 2 sion is of outstanding importance even to Exercise 0.1 The ansatz leads to ξ + n 1 n 2 = define such elementary things like addition ξ + ξ , such that ξ ξ 1, which is solved + = + of the natural numbers, we will state and by τ 1 √5 2 0 and σ 1 √5 2 ∶= ( + )~ > ∶= ( − )~ = prove it here for the connoisseur (and all 1 τ 0. − ~ < n n those who want to become one). Its first ap- Let Fn aτ bσ with 0 F0 a b = + = = + plication will be the definition of factorials and 1 F1 aτ bσ a b √5 2. = = + = ( − ) ~ in the next exercise. Hence a 1 √5 b and consequently τ n =σn ~ = − Fundamental Theorem of Recursion. Let Fn − . (This formula is named for N0 M = √5 M be a set, η0 M, and ϕ M × . Then n n ∈ ∈ N0 J. P. M. Binet.) Similarly, if Ln aτ bσ there exists exactly one mapping η M = + ∈ with 2 L0 a b and 1 L1 1 a which fulfills the recurrence = = + n n= = + ( − b √5 2, we get Ln τ σ . ) ~ = + 0 N0 For n N, we have η 0 η , k η k 1 ϕ k, η k . ∈ ( ) = ∀ ∈ ∶ ( + ) = ( ( )) N0 n 1 n 1 σ n Proof. Uniqueness. Let η, µ M both Fn 1 τ + σ + τ σ τ ∈ + − . fulfill the recurrence. Then η 0 η0 µ 0 n − n σ n Fn = τ σ = ( ) = = ( ) 1 τ and if η k µ k for k N0, then η k 1 − − ( ) = ( ) ∈ ( + ) = 2 ϕ k, η k ϕ k, µ k µ k 1 . By in- But σ τ 1 τ , whence σ τ 1, such ( ( )) = ( ( )) = ( + ) ~ = − ~ S ~ S < duction we get η µ. that Fn 1 Fn τ, as n . Similarly for = + Existence. The wanted function η N0 M L ~ → → ∞ ⊂ × n. must have the following properties: Remark A.1. While it is by an easy in- k N0 ηk M k, ηk η , (A) ∀ ∈ ∃ ∈ ∶ ( ) ∈ duction proof that one can show that there k N0 m1, m2 M NN0 ∀ ∈ ∀ ∈ ∶ is only one mapping F 0 which ful- k, m1 , k, m2 η m1 m2 , (B) ∈ ( ) ( ) ∈ ⇒ = fills the recurrence (0.4) and we proved 0, η0 η k N0 m M ( ) ∈ ∧ ∀ ∈ ∀ ∈ ∶ the existence by deducing Binet’s formula, k, m η k 1, ϕ k, m η . (C) ( ) ∈ ⇒ ( + ( )) ∈ the question whether any such recurrence Condition (C) is satisfied, e.g., by leads to a well-defined mathematical object N0 M. Therefore we choose is rather subtle and usually ignored in the × literature. Because of the latter fact and η µ N0 M µ fulfills C . = { ⊂ × S ( )} A. M. Hinz et al., The Tower of Hanoi – Myths and Maths, DOI: 10.1007/978-3-0348-0237-6, Ó Springer Basel 2013 266 Appendix A. Hints and Solutions to Exercises We now prove (A) and (B) simultaneously such that from (b) we get by induction on k. By definition, 0, η0 η. k k k! k! ( ) ∈ + = + Assume that 0, µ0 η for some M µ0 ` ` + 1 `!(k − `)! (` + 1)!(k − ` − 1)! ( ) ∈ ∋ ≠ η0. Let µ η 0, µ0 . Then 0, η0 µ (k + 1)! k + 1 ∶= ∖ {( )} ( ) ∈ = = . and if κ, m µ, then κ 1, ϕ κ, m µ ( + 1)!( − )! + 1 ( ) ∈ ( + ( )) ∈ ` k ` ` as well, since no element of the form κ ( + 1, ` has been taken away from η. There- ) Exercise 0.3 a) The case k 0 is just fore, µ has property (C); but then η µ, in = ⊂ for definiteness: of course, the empty set contradiction to the definition of the latter 0 can neither be permuted nor deranged set. [ ] in the ordinary sense of these words, but there is precisely one mapping from 0 to For the induction step, put ηk 1 [ ] + ∶= 0 , and this mapping does not have a fixed ϕ k, ηk . If k 1, m η for some M [ ] ( ) ( + ) ∈ ∋ point, such that f 0 1. On the other hand, m ηk 1, define µ η k 1, m . Again = ≠ + ∶= ∖{( + )} the only mapping from 1 to 1 clearly (C) is fulfilled for µ ( 0, η0 has not been [ ] [ ] ( ) has a fixed point, whence f 1 0. excluded and k 1, m k 1, ϕ k, ηk ), = ( + ) ≠ ( + ( )) Let k N and ` k . Any derange- and we get the contradiction η µ. ∈ ∈ [ ] ⊂ ◻ ment σ on k can be modified to yield a [ ] derangement σ on k 1 , namely by defin- ̃ [ + ] ing σ σ on k ` , σ ` k 1, and ̃ = [ ] ∖ { } ̃( ) = + Exercise 0.2 a) Induction on `. There σ k 1 σ ` , i.e. by mapping ` on k 1 ̃( + ) = ( ) + is exactly one (injective) mapping from and the latter to the former image of `. This 0 to k . An injection ι from ` 1 makes up for k f derangements on k 1 . [ ] = ∅ [ ] [ + ] ⋅ k [ + ] to k , ` k 0, can have k values for A derangement σ on k 1 can be [ ] ∈ [ ] [ − ] ι ` 1 , and ι ` ( stands for “restricted manipulated as follows. Define τ k 1 ( + ) ↾ [ ] ↾ ∶ [ − ] → to”) runs through all injections from ` k ` by τ i i for i ` and τ i i 1 [ ] [ ]∖{ } ( ) = < ( ) = + to k ι ` 1 , such that there are all otherwise. This yields a derangement σ on [ ] ∖ { (k + 1)}! k! 1 ̃ k 1 by putting σ τ σ τ − on k ` , in all k ( − ) injec- [ + ] ̃ = ○ ○ [ ]∖{ } k 1 ` ! = k ` 1 ! σ ` k 1, and σ k 1 `. This leads to tions from(( −` )1− to) k (. − ( + )) ̃( ) = + ̃( + ) = [ + ] [ ] another k f k 1 derangements on k 1 ⋅ − [ + ] The statement about bijections fol- which are obviously different from the ones lows from the special case ` k, together constructed earlier by the fact that they = just switch k 1 with some ` k . Con- with the pigeonhole principle which ex- + ∈ [ ] versely, a derangement on k 1 either has cludes the possibility of an injection from [ + ] k to a smaller set. this property or not, such that it is easy to [ ] convince oneself that all of them are among b) Again by the pigeonhole principle, there the k f k f k 1 constructed ones. We thus ( + − ) is no subset of k with ` k elements. For observed the two basic rules of counting, [ ] > k! k `, we have from (a) injective namely not to forget any object and not to ≥ k ` ! count any twice. ( − ) mappings from ` to k . Each element of b) To show that (0.14) follows from (0.15) [ ] [ ] k is easy: clearly, x1 0 and for k N, we can [ ] occurs `! times as a permuted image = ∈ ` add the two equations set of one of these injections. k xk 1 k 1 xk 1 , + = ( + ) − (− ) c) For k `, all three terms are 0. For k `, k < = xk kxk 1 1 , k 1 k k = − + (− ) we have + 1 and 0. ` 1 = = ` ` 1 = to obtain xk 1 xk k 1 xk kxk 1, + + + + = ( + ) + − If k `, then k 1 ` 1, k `, and k ` 1, whence xk 1 k xk xk 1 . > + ≥ + ≥ ≥ + + = ( + − ) Appendix A. Hints and Solutions to Exercises 267 As Euler admits himself, “however, it 1110 10112, such that every bit of 11 is = is not as easy” to derive (0.15) from (0.14). smaller than or equal to the corresponding 1039 Therefore, we first prove formula (0.16) as- one of 1039 and therefore is odd ac- 11 suming (0.14) by induction, where the in- cording to (0.8). duction step for k N reads ∈ Exercise 0.5 Employ Fleury’s algorithm: xk 1 k xk xk 1 start in a vertex of odd degree, A say, avoid + = ( + − ) k 1 ` k using a bridge (edge) that separates the re- − 1 1 k k 1 ! (− ) (− ) maining graph into two components, and = ( + ) `Q0 `! + k 1 ! = ( + ) delete used edges. For example: k 1 ` + 1 ABCDABDAC. k 1 ! (− ) . = ( + ) `Q0 `! = Exercise 0.6 We can employ Fleury’s al- gorithm for the graph in Figure A.1, whose Finally, the implication “(0.16) ⇒ vertices are all even. Starting with edge a, (0.15)” is trivial. we follow Fleury to get the trail abcdef, Exercise 0.4 103910 100000011112 and here denoted by the labels of the edges. = f c d a b e Figure A.1: Muhammad’s sign manual as a graph Exercise 0.7 We will describe the algo- n G for all v V G . The length ` of the ∶= S S ∈ ( ) rithm informally. To check an edge ab for queue is put to 1 and qb 1, such that ver- = being a bridge in G, we search for a path tex b is now first in the line. Then we search from b to a in G ab. Starting in b, we successively for its neighbors u in G ab − − screen all neighbors of b, then neighbors of which have not yet been visited, i.e. with neighbors and so on, but skipping those al- qu n. If we encounter a, we stop: ab is = ready encountered. (Since we stay as close not a bridge. Otherwise we increase ` by 1 to the root b as possible, this is called a and put qu `. After all neighbors of b have = breadth-first search (BFS)). The result is a been scanned, we decrease ` by 1 and also tree rooted in b and spanning its connected all qu n 1 and restart the search for ∈ [ − ] component in G ab. If a is not on that neighbors of the first vertex v in the queue, − tree, then ab is a bridge. that is with qv 1, as long as there is any, = i.e. ` u V G qu n 1 0. For a practical realization, we may = S{ ∈ ( )S ∈ [ − ]}S ≠ construct a queue of vertices to be checked Exercise 0.8 a) Coming from L T, the next for their neighbors.