Find , and if is defined recursively by and for
a)
b)
c)
d)
Show solution
a) 3, 5, 7, 9 b) 3, 9, 27, 81 c) 2, 4, 16, 65536 d) 3, 13, 183, 33673
Fill in the table one value at a time, starting from .
a) , , , .
b) , , , .
c) , , , .
d) , , , .
Find , and if is defined recursively by and for
a)
b)
c)
d)
a) 3, 5, 7, 9 b) 3, 9, 27, 81 c) 2, 4, 16, 65536 d) 3, 13, 183, 33673
Fill in the table one value at a time, starting from .
a) , , , .
b) , , , .
c) , , , .
d) , , , .
Find , and if is defined recursively by , , and for
a)
b)
c)
d)
a) −1, 5, 2, 17 b) −4, 32, −4096, 536870912 c) 8, 176, 92672, 25764174848 d) −1/2, −4, 1/8, −32
Two starting values are given, and each new value uses the two previous ones.
a)
b)
c)
d)
Give a recursive definition of the sequence , if
a) b) c) d)
a) , b) , c) , d) ,
The sequence starts at , so the basis is . For the recursive step, compute and rewrite it in terms of .
a) . So , for .
b) . So , .
c) . So , .
d) Constant: , .
Let be the function such that is the sum of the first positive integers. Give a recursive definition of .
; for .
The sum of the first positive integers is the sum of the first plus the next one, .
Check: , , , . ✓
Give a recursive definition of , the sum of the integer and the nonnegative integer .
; .
Recurse on (the nonnegative one), building addition out of "add 1."
Give a recursive definition of , the product of the integer and the nonnegative integer .
; .
This one was done in class (Problem 11). Recurse on , building multiplication out of repeated addition.
Prove that when is a positive integer. ( is the th Fibonacci number.)
Let : . Use ordinary induction on .
Basis (): LHS , RHS . ✓
Inductive step. Assume : . Then
So holds. By induction, is true for all . ∎
In Fibonacci proofs, the step almost always ends with . Aim for that.
Show that the set defined by and whenever and is the set of positive integers.
Show both inclusions.
(induction on ). Let : .
So every positive integer is in .
(structural induction).
So every element of is a positive integer. Therefore . ∎
Give a recursive definition of the set of positive integers that are multiples of 5.
Basis: . Recursive: if then . (Also fine: if then .)
This generates , exactly the positive multiples of 5. An equally correct alternative (the class example): if and , then .
Give a recursive definition of
a) the set of odd positive integers.
b) the set of positive integer powers of 3.
c) the set of polynomials with integer coefficients.
a) Basis: . Recursive: if then . (Generates )
b) Basis: . Recursive: if then . (Generates ) If you count , use basis instead.
c) Let be the set of polynomials in with integer coefficients.
This builds any in "Horner form" . Another valid answer: Basis: and every integer is in . Recursive: if then and .
Give a recursive definition of
a) the set of even integers.
b) the set of positive integers congruent to 2 modulo 3.
c) the set of positive integers not divisible by 5.
a) Includes negatives, so you must go both ways. Basis: . Recursive: if then and .
b) The set is Basis: . Recursive: if then .
c) The set is (period 5). Basis: . Recursive: if then .
(Compare the class example: positive integers not divisible by 7 had basis and rule .)
Let be the set of positive integers defined by
a) Show that if , then .
b) Show that there exists an integer that does not belong to .
a) Structural induction.
So every element of is . ∎
b) Take . Then . Suppose . It's not the basis element, so it came from a recursive rule:
So . (Elements of are ; 9 and 13 never appear.)
Let be the set of positive integers defined by
a) Show that if , then .
b) Show that there exists an integer that does not belong to .
a) Structural induction.
b) : , but , has no integer solution, and is not a perfect square. So no rule produces 35, and . (Elements of : )
Give a recursive definition of each of these sets of ordered pairs of positive integers. Use structural induction to prove that the recursive definition you found is correct. (Hint: plot the points and look for patterns.)
a)
b)
c)
Each proof has two halves: (1) structural induction shows everything generated is in the set; (2) induction on shows everything in the set gets generated.
a) Basis: . Recursive: if then , , .
b) Basis: . Recursive: if then and .
c) Basis: . Recursive: if then and .
Define well-formed formulae of sets, variables representing sets, and operators from .
a) Give a recursive definition of the function , which counts the number of ones in a bit string .
b) Use structural induction to prove that .
a) (Same as from class, Problem 6.)
b) Fix ; use structural induction on . Let : .
Basis (): . ✓
Recursive step. Assume . For :
So holds. ∎
a) Give a recursive definition of the function , which equals the smallest digit in a nonempty string of decimal digits.
b) Use structural induction to prove that .
Let .
a) The string must be nonempty, so the basis is a single digit.
b) Fix nonempty ; induct on nonempty .
Basis (, a single digit): . ✓
Recursive step: assume for a nonempty , and let . Then
∎
Find the reversal of the following bit strings.
a) 0101 b) 1 1011 c) 1000 1001 0111
a) 1010 b) 1 1011 (a palindrome) c) 1110 1001 0001
Write the characters in reverse order (ignore the spaces; they're just grouping).
a)
b) . It's a palindrome.
c) , i.e. 1110 1001 0001.
Give a recursive definition of the reversal of a string. (Hint: first define the reversal of the empty string. Then write a string of length as , where has length , and express the reversal of in terms of and .)
; for , .
The last symbol moves to the front, followed by the reversal of the rest. Check: . ✓
Use structural induction to prove that .
Fix and use structural induction on . Let : .
Basis (): . ✓
Recursive step. Assume and let . Using the definition :
So holds. ∎
Give a recursive definition of , where is a string and is a nonnegative integer. (Here represents the concatenation of copies of .)
; .
Example: .
Give a recursive definition of the set of bit strings that are palindromes.
Why it's right: everything generated reads the same backward (wrapping a palindrome in matching ends keeps it a palindrome). Conversely, a palindrome of length has equal first and last symbols and a palindrome in the middle. Peel off the ends until you reach length 0 or 1, i.e. , , or . You need both even- and odd-length bases.
When does a string belong to the set of bit strings defined recursively by , and if ?
Exactly when it is ( zeros followed by ones) for some .
Generate: , then , then , then , … Each step wraps one more 0 on the left and one more 1 on the right. So : some number of 0s followed by the same number of 1s.
Recursively define the set of bit strings that have more zeros than ones.
Let be the set of bit strings with more 0s than 1s. One correct definition:
Everything generated is in : if and each have at least one more 0 than 1s, then has at least two more, and inserting one 1 leaves at least one more.
Everything in is generated (strong induction on length): all-zero strings come from concatenating 0s. If has a 1, delete one 1 to get with . Scan left to right, tracking . It starts at 0, ends , and moves by , so it hits exactly 1 at some point. Split there: has difference 1 and has difference . Both are shorter strings in , so = with a 1 inserted.
Use Exercise 39 (, ) and mathematical induction to show that , where is a string and is a nonnegative integer.
Let : .
Basis (): . ✓
Inductive step. Assume . Then
using (textbook Example 12) and the IH. ∎
Show that whenever is a string and is a nonnegative integer.
Induction on .
Basis (): . ✓
Inductive step. Assume . Then
∎
Use structural induction to show that , where is a full binary tree, equals the number of vertices of , and is the height of .
Recall: single root has , ; and for , and .
Basis (single vertex): . ✓
Recursive step. Assume and (IH). For :
∎
Use structural induction to show that , the number of leaves of a full binary tree , is 1 more than , the number of internal vertices of .
Definitions: for a single root, and . For : the leaves of are the leaves of and , so . The internal vertices are the new root plus those of and , so .
Basis: . ✓
Recursive step. Assume and . Then
∎
Find these values of Ackermann's function: a) b) c) d)
a) 0 b) 2 c) 2 d) 4
a) , : .
b) : .
c) , : .
d) .
Show that whenever .
Induction on . Let : .
Basis (): . ✓
Inductive step. Assume for some . Then
using (since ) and then the IH. ∎
Show that whenever .
Induction on .
Basis (): . ✓
Inductive step. Assume for some . Since ,
∎
Find these values of Ackermann's function: a) b)
a) 16 b) 65,536
Use (#52) and (#51).
a) .
b) , since . Then
Find .
, a tower of 65,536 twos: .
by #53.
Now for : , with . So is a tower of twos (, , …).
Therefore is a tower of exponents made of 65,536 twos, far too large to write out.
Prove that whenever and are nonnegative integers.
Induction on , with an inner induction on .
Basis (): . ✓
Inductive step. Assume is strictly increasing: for all . Show the same for , by induction on :
So is strictly increasing, completing the induction. ∎
Prove that whenever and are nonnegative integers.
We use #55 ( is increasing) and the lemma proved in #57: whenever .
Prove that whenever and are nonnegative integers.
Prove the stronger lemma: for all , . (Combined with , this gives for all .)
Induction on .
Basis (): for . ✓
Inductive step. Assume for all . Show for by induction on :
Hence always. ∎ (The book gets this from #56 as .)
Define recursively so that counts the number of 0s in the bit string . Then compute step by step from your definition.
; . .
.
Let be the set of ordered pairs of integers defined by: Basis: . Recursive step: if , then and .
a) List the elements produced by the first two applications of the recursive step.
b) Use structural induction to show whenever .
a) First application: , . Second: from : , ; from : , . New elements: .
b)
So for every . ∎