MATH 302 – Discrete Mathematics – Section 501 Homework 7

advertisement
Dr. Timo de Wolff
Institute of Mathematics
www.math.tamu.edu/~dewolff/Fall14/math302.html
MATH 302 – Discrete Mathematics – Section 501
Homework 7
Fall 2014
Due: Friday, October 31st, 2014, 9:10 a.m.
When you hand in your homework, do not forget to add your name and your UIN.
Exercise 1. Let f : N → N, g : N → N be recursive functions given by f (0) := 0, g(0) := 2
and
f (n + 1) := 3f (n) + 7,
g(n + 1) := g(n)2 − 2g(n) − 2.
1. Compute the values for 1, 2, . . . , 5 for f and g.
2. Show that f is injective.
Hint: Look at the sequence of values of f given in the first part. Which other property
of a function, which was discussed in the lecture, does f seemingly satisfy? Prove
this property and use it to conclude injectivity.
3. Prove with mathematical induction that the values of f alternate between odd and
even numbers (caution: you need to show the basis step for two numbers and you
might need to do a proof by cases or give a similar argument).
Exercise 2. Investigate the following recursive algorithm RecAlg1:
Input: a, b ∈ N with a < b.
Output: c ∈ N.
begin
if a = 0 then
return b
else
return RecAlg1(b mod a,a)
Algorithm 1: RecAlg1
1
1. Compute RecAlg1(3, 5), RecAlg1(4, 8), RecAlg1(6, 12). Also give the intermediate
steps.
2. Show that the algorithm terminates after finitely many steps.
3. Show that RecAlg1 yields the greatest common divisor for a and b. Use mathematical
induction in the following way: Let (rn , rn−1 ) be the input of the n-th recursive step
of RecAlg1.
• Show that RecAlg1(rn+1 , rn ) returns rn if and only if rn is the greatest common
divisor of rn−1 .
• Show that the greatest common divisor d of rj and rj−1 also divides rj+1.
Exercise 3. A n × m integral matrix is an array with n rows and m columns such that
all entries are integers. Thus, a 2 × 2 matrix A is of the form
a11 a12
A :=
a21 a22
with all aij ∈ Z. Matrices have a product. If A, B are 2 × 2 matrices, then the matrix
C := A · B is also a 2 × 2 matrix with entries cij := ai1 · b1j + ai2 · b2j .
1. Let
A :=
2 4
1 3
and B :=
3 1
2 0
Compute A · B, B · A and A · A · B.
2. We define An := A
· · · A}. Let fj denote the j-th Fibonacci number. Show
| · ·{z
n times
1 1
1 0
n
=
2
fn+1 fn
fn fn−1
.
Download