0% found this document useful (0 votes)
61 views

Assignment 5 S

Uploaded by

Maria Ademola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Assignment 5 S

Uploaded by

Maria Ademola
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SOLUTIONS

Assignment 5 SC/MATH 1019 C (Fall 2024)


Part (a): Pre-reading Due Friday, November 1, at 10:00 pm

Question A1:
Suppose that bn = n3n for every value of n.

(a) Compute a formula for bn − 3bn−1 when n ≥ 1. (Use algebra to simplify your formula.)
bn − 3bn−1 = n3n − 3(n − 1)3n−1 = n3n − (n − 1)3n = 3n
(b) Compute a formula for bn − 6bn−1 + 9bn−2 when n ≥ 2. (This should simplify a lot.)
bn − 6bn−1 + 9bn−2 = n3n − 6(n − 1)3n−1 + 9(n − 2)3n−2 = n3n − 2(n − 1)3n + (n − 2)3n
= n − 2(n − 1) + (n − 2) 3n = 0 · 3n = 0

Question A2:
Let dn = 5 · (−2)n + 2 · (3)n . Which of the following recurrences is satisfied by dn ? (See 8.2 Theorem 1)
(i) dn = 6dn−1 + 5dn−2 , (ii) dn = 4dn−1 − 6dn−2 , (iii) dn = dn−1 + 6dn−2 ,
(iv) dn = dn−1 − 5dn−2 , or (v) no correct answer is provided
We see that the right hand side of (iii) is
5 · (−2)n−1 + 2 · (3)n−1 + 6 · 5 · (−2)n−2 + 6 · 2 · (3)n−2 = − 52 + 15 n 2 4
3n ,
 
dn−1 + 6dn−2 = 2 (−2) + 3 + 3
5 15 n 2 4 n n n

but − 2 + 2 (−2) + 3 + 3 3 = 5 · (−2) + 2 · (3) = dn , so recurrence (iii) is satisfied.
Alternatively, instead of checking this directly, we could have used the theory of recurrence equations
from section 8.2 of the reading, and noted that dn should satisfy a recurrence with characteristic equation
(x − 3)(x + 2) = 0. Expanded this gives x2 − x − 6 = 0, or x2 = x + 6, which corresponds to the recurrence
dn = dn−1 + 6dn−2 .

Question A3:
Let an = 3n(2)n + 4(2)n . Which of the following recurrences is satisfied by an ? (See 8.2 Theorem 2)
(i)an = 4an−1 + 4an−2 , (ii) an = 4an−1 − 4an−2 , (iii) an = 2an−1 + 2an−2 ,
(iv) an = 7an−1 − 16an−2 + 12an−3 , or (v) no correct answer is provided
From the theory of linear recurrences, we see that an should be a solution to any with a characteristic
equation have (x − 2) as a root of multiplicity 2. In this case, both (ii) and (iv) fit the bill, since (ii) has
characteristic equation x2 = 4x − 4, and x2 − 4x + 4 = (x − 2)2 , while (iv) has characteristic equation
x3 = 7x2 − 16x + 12, and x3 − 7x2 + 16x − 12 = (x − 3)(x − 2)2
A direct verification is significantly more tedious in this case.

For (ii), we see


4an−1 −4an−2 = 12(n−1)2n−1 +16·2n−1 −12(n−2)2n−2 −16·2n−2 = (6n−3n)2n +(−6+8+6−4)2n = an

For (iv), we get


7an−1 − 16an−2 + 12an−3 = (21(n − 1) + 28)2n−1 + (−48(n − 2) − 64)2n−2 + (36(n − 3) + 48)2n−3
21 9 21 27
− 12 + n2n + − + 6 2n

= + 14 + 24 − 16 −
2 2 2 2
= 3n(2)n + 4(2)n = an

Question A4:

10± 100−48

Use the quadratic formula to find the two solutions to x2 − 10x + 12 = 0. x = 2 =5± 13

© 2024 Michael La Croix All Rights Reserved Page 1 of 5


Part (b): Practice and Review Due Monday, November 4, at 10:00 pm

Last assignment (question B4(c)) we saw how we could use a bijection from N × N to N to build a bijection
from N × N × N to N. This idea can be used any time there is a bijection between S × S and S. This
rarely happens with finite sets, but is a property that is shared by most infinite sets (in fact we do not
have a way to describe any infinite sets for which no such bijection exists).

Question B1:
Show that if S is a finite set with |S| > 1, then there is no bijection from S × S to S.
Hint: What are the cardinalities of S and S × S?
If there is a bijection from S × S to S, then |S × S| = |S|. But if S is finite with |S| > 1, then |S| ≥ 2,
so we would have |S| = |S × S| = |S| × |S| ≥ 2|S| > |S|. Since it is not possible that |S| > |S|, no such
bijection exists.

Question B2:
Suppose that f : S × S → S is any function. Define gn : S n → S recursively so that  g1 (x) = x for every x,
g2 (x1 , x2 ) = f (x1 , x2 ), and gn+1 (x1 , x2 , . . . , xn+1 ) = f gn (x1 , x2 , x3 , . . . , xn ), xn+1 .

(a) Show that if f is an injection and gk is an injection, then gk+1 is an injection.


Suppose that f is an injection and gk is an injection. If gk+1 (x1 , x2 , . . . , xk+1 ) = gk+1 (y1 , y2 , . . . , yk+1 ),
then f (gk (x1 , x2 , . . . , xk ), xk+1 ) = f (gk (y1 , y2 , . . . , yk ), yy+1 ), but f is an injection, so we conclude that
xk+1 = yk+1 and gk (x1 , x2 , . . . , xk ) = gk (y1 , y2 , . . . , yk ). Since gk is an injection, we further conclude
that (x1 , x2 , . . . , xk ) = (y1 , y2 , . . . , yk ). Together, these observations mean that it is necessary true
that (x1 , x2 , . . . , xk+1 ) = (y1 , y2 , . . . , yk+1 ), and we conclude that gk+1 is an injection.

(b) Show that if f is a surjection and gk is a surjection, then gk+1 is a surjection.


Suppose that f is a surjection and that gk is a surjection. To show that gk+1 is a surjection, we
need to show that an arbitrary element of S is in the range of gk+1 . So let s be an arbitrary element
of S. Since f is a surjection, there exist u, v in S such that f (u, v) = s. Since gk is a surjection,
there exists (s1 , s2 , . . . , sk ) ∈ S k such that gk (s1 , s2 , . . . , sk ) = u. If we combine these observations,
we conclude that gk+1 (s1 , s2 , . . . , sk , v) = f (gk (s1 , s2 , . . . , sk ), v) = f (u, v) = s, so s is in the range of
gk+1 , which must therefore be a surjection.

(c) Use induction to prove that if f is a bijection, then gn is a bijection for all n ≥ 2.
Suppose f is a bijection, and let P (k) be the statement gk is a bijection.

As a base case, we see that g2 is a bijection, since g2 = f , and f is a bijection. This means that P (2)
is true.

We now show that P (k) → P (k + 1). If P (k) is true for some k ≥ 2, then gk is a bijection. Two
consequences of this are that gk is an injection, and thus gk+1 is an injection by (a), and that gk is
a surjection, and thus gk+1 is a surjection by (b). Since gk+1 is an injection and a surjection, we
conclude that it is a bijection, and thus P (k + 1) is true.

We have shown that P (2) is true and that ∀k ≥ 2(P (k) → P (k + 1)). Therefore by mathematical
induction, we conclude that P (n) is true for all n ≥ 2.

Note: This is a slightly more abstract version of B4(c) from last assignment.

© 2024 Michael La Croix All Rights Reserved Page 2 of 5


Question B3:
The function f : N×N → N given by f (m, n) = 2m (2n+1)−1 (as described in B4 of Assignment 3) is, in fact,
a bijection. Let T = ∪∞ k

k=1 N , and define ℓ : T → N by ℓ(n1 , n2 , n3 , . . . , nk ) = f gk (n1 , n2 , . . . , nk ), k − 1 ,
where gk is constructed from f as in B2. This function ℓ is also a bijection.
This function requires that we have also defined a bijection g1 : N → N. The identity function is such a
bijection, and we take as given that g1 (n) = n.

(a) Compute ℓ(5), ℓ(4, 2), and ℓ(0, 2, 1, 0).


ℓ(5) = f (g1 (5), 0) = f (5, 0) = 25 (2 · 0 + 1) − 1 = 31

ℓ(4, 2) = f (g2 (4, 2), 1) = f (f (4, 2), 1) = f (24 (2 · 2 + 1) − 1, 2) = f (79, 2) = 279 × 3 − 1

ℓ(0, 2, 1, 0) = f (g4 (0, 2, 1, 0), 3) = f (f (g3 (0, 2, 1), 0), 3) = f (f (f (g2 (0, 2), 1), 0), 3) = f (f (f (f (0, 2), 1), 0), 3)
Now f (0, 2) = 20 (2 · 2 + 1) − 1 = 4, so f (f (0, 2), 1) = f (4, 1) = 24 (2 · 1 + 1) − 1 = 47. The number we
47
are looking for is thus ℓ(0, 2, 1, 0) = f (f (47, 0), 3) = f (247 − 1, 3) = 7 · 22 −1 − 1 A really big number!

(b) Evaluated ℓ−1 (12) and ℓ−1 (17).


Note: You will need to compute f −1 (n) for several different values of n. You can look for the relevant
entries in the table below.
Table of values of f(m,n)
n
m 0 1 2 3 4 5 6 7 8 9 10
0 0 2 4 6 8 10 12 14 16 18 20

1 1 5 9 13 17 21 25 29 33 37 41

2 3 11 19 27 35 43 51 59 67 75 83

3 7 23 39 55 71 87 103 119 135 151 167

4 15 47 79 111 143 175 207 239 271 303 335

More generally, you can also compute f −1 (n) directly by looking at the binary expansion of n. Split
n into a prefix, consisting of all the digits before the final 0 and a suffix consisting of all the trailing
1s, separated by the final 0. The number of trailing 1s is m, while the prefix (before the final 0) is the
binary expansion of n. For example 167 = 101001112 . This has 3 trailing 1s in binary, and 10102 is
the binary expansion of 10, so f −1 (167) = (3, 10).
We first observe that 12 = (1100)2 , and so f (0, 6) = 12. We are thus looking for a 7-tuple
(n1 , n2 , n3 , . . . , n7 ) with g7 (n1 , n2 , . . . , n7 ) = 0, but (0, 0, 0, 0, 0, 0m0) has this property. It is easy to
show by induction that gk (0, 0, 0, . . . , 0) = 0 for all k. We conclude that ℓ−1 (12) = (0, 0, 0, 0, 0, 0, 0).
To compute ℓ−1 (17), we note that 17 = (10001)2 , and so f (1, 4) = 17 (in fact this was an en-
try in our table from assignment 3). We are thus looking for a 5-tuple (n1 , n2 , n3 , n4 , n5 ) with
g5 (n1 , n2 , n3 , n4 , n5 ) = 1. Now g5 (n1 , n2 , n3 , n4 , n5 ) = f (g4 (n1 , n2 , n3 , n4 ), n5 ), so we first find (u, v)
with f (u, v) = 1. Since (u, v) = (1, 0), we conclude that n5 = 0 and g4 (n1 , n2 , n3 , n4 ) = 1. Continuing
in the same manner, since g4 (n1 , n2 , n3 , n4 ) = f (g3 (n1 , n2 , n3 ), n4 ), we once again use the fact that
f (1, 0) = 1 to conclude that n4 = 0 and g3 (n1 , n2 , n3 ) = 1. Since g3 (n1 , n2 , n3 ) = f (f (n1 , n2 ), n3 )
we see n3 = 0 and f (n1 , n2 ) = 1, from which we conclude (n1 , n2 ) = (1, 0). We conclude that
ℓ−1 (17) = (1, 0, 0, 0, 0).

© 2024 Michael La Croix All Rights Reserved Page 3 of 5


Question B4:
Let Σ be any finite alphabet. This means that there is an injection h : Σ → N. Describe how you could
use h to construct an injection from Σ∗ to T (the set T is describe in question B3).
Note: The notation Σ∗ is from section 5.3.3 of the text.
Note 2: Since ℓ is a bijection, T is countable. Then since you have found an injection from Σ∗ to T ,
it follows that Σ∗ must be countable too. With an appropriate choice of Σ, the set of all valid computer
programs in all languages is a subset of Σ∗ , so there must be real numbers that cannot be described by any
possible computer program.
We’d like to just say that if w is a word of length k, consisting of s1 s2 . . . sk , then f (w) = (h(s1 ), h(s2 ), . . . h(sk )).
This would have the convenient property that words of length k are mapped to elements of Nk . Unfortu-
nately, the word of length zero is an element of Σ∗ , and would not have an image under this maps. Oops!
One solution is to just pick any element of N that is not in the range of h and declare that this is the
image of the empty string.
A slightly different approach emphasizes the recursive definition of Σ∗ . We can build an injection f : Σ∗ →
T recursively. Declare that f (λ) = 0 (we don’t have to use 0, any element of N would be fine). Then
for any non-empty string wx with w ∈ Σ∗ and x ∈ Σ, we can define f (wx) = k(f (w), h(x)), where
k : Nn × N → Nn+1 is the natural bijection defined by k((x1 , x2 , . . . , xn ), y) = (x1 , x2 , . . . , xn , y)

Question B5:
Recall that the Fibonacci sequence, f0 , f1 , f2 , . . . , is defined by
the initial conditions f0 = 0, f1 = 1, and the recurrence relation
fn = fn−1 + fn−2 for n = 2, 3, 4, . . . .
This means, in particular that f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5,
etc. It is an interesting fact that squares with these edge lengths can
be arranged to form a rectangle, as on the right.

(a) The area of the rectangle must be the sum of the areas of these squares, so since a square with side
length a has area a2 , compute (f1 )2 + (f2 )2 + (f3 )2 + (f4 )2 + (f5 )2 to find the area of the rectangle.
We check that (f1 )2 + (f2 )2 + (f3 )2 + (f4 )2 + (f5 )2 = 12 + 12 + 22 + 32 + 52 = 1 + 1 + 4 + 9 + 25 = 40

(b) Check that this is also f5 × f6 .


Note that f5 is the length of one side of the rectangle, and f6 = f5 + f4 is the length of the other.
f6 = f5 + f4 = 5 + 3 = 8, and indeed 40 = 5 × 8 = f5 × f6
2
(c) Use the fact that fn = fn−1 + fn−2 when n ≥ 2 to prove that fn fn+1 + fn+1 = fn+1 fn+2 when n ≥ 0.
2
fn fn+1 fn+1 = (fn + fn+1 )fn+1 = fn+2 fn+1

k
X
(d) Let P (k) be the statement fi2 is equal to fk fk+1 .
i=1

(i) Find a positive integer j such that P (j) is true.


We already checked in (a) and (b) that P (5) is true, but it’s also nice to check that P (1) is true
since 1i=1 fi2 = f12 = 11 = 1 × 1 = f1 f2 .
P

(ii) Show that if P (k) is true, then P (k + 1) is also true.


Hint: What needs to be added to the sum in P (k) to get the sum in P (k + 1)?
Assume that P (k) is true, so that ki=1 fi2 = fk fk+1 .
P

P 
Now consider k+1 2 = k 2 + f2 2
P
f
i=1 i f
i=1 i k+1 = fk fk+1 + fk+1 = fk+1 fk+2 By (c). Since this is
collectively the statement of P (k + 1) we conclude that P (k) → P (k + 1).

© 2024 Michael La Croix All Rights Reserved Page 4 of 5


(iii) Can you conclude that P (20) is a true statement? Explain how, or describe what extra infor-
mation you would require to reach this conclusion.
Parts (i) and (ii) give us the base case and inductive step required to apply mathematical
induction to conclude that P (k) is true for all k ≥ 1.
If we had completed (i) by simply observing that (a) and (b) verify P (5), then our base case
would be different, and we would only be in a position to conclude that P (k) is true for all
k ≥ 5. If for some reason the positive integer you found in (i) was greater than 20, then you
would not yet be in a position to conclude that P (20) is true, and would additionally need to
find a smaller base case.

Question B6:
Suppose that P (n) is a predicate with the properties:

• P (208) is false, and

• ∀k ≥ 30 P (k) → P (k + 1) .


(a) Use proof by contradiction (and induction) to prove that P (105) is false
Assume (for contradiction) that P (105) is true. We can conclude, by induction that ∀n ≥ 105(P (n)).
Our hypotheses don’t exactly match the setup for mathematical induction, but, as discussed in class
we could directly apply induction to Q(k) = P (k + 104). This means, by universal instantiation,
that P (208) is true. Since we know P (208) is false, this is a contradiction.
We conclude that our assumption must be false, and thus that P (105) is false.

(b) Show that it is impossible to conclude whether P (27) is true or false from the given information.
(You will need to give two examples of predicates. One example will show that it is not possible to
conclude that P (27) is true. A different example will show that it is not possible to conclude that
P (27) is false. Both examples need to satisfy the properties in the question.)
The predicates Q(x) defined by “x ≥ 300”  and R(x) defined by “(x ≥ 300) ∨ (x = 27)” satisfy,
Q(208) is false, ∀k ≥ 30 Q(k) → Q(k + 1) , R(208) is false, and ∀k ≥ 30 R(k) → R(k + 1) . This
shows that the given information applies equally well if P = Q or if P = R. Since Q(27) is false, it
is not possible to conclude that P (27) is true. Since R(27) is true, it is not possible to conclude that
P (27) is false.
Therefore it is is not possible to determine whether P (27) is true or false from the given information.

© 2024 Michael La Croix All Rights Reserved Page 5 of 5

You might also like