Homework 1 Solutions

advertisement
CSC236H: Introduction to the Theory of Computatoin
Homework 1 Solutions
1. Use induction to prove that the following equation holds for all positive integers n:
n
X
k=1
n
1
=
.
k(k + 1)
n+1
Solution. We prove this by induction on n.
Base case: Note that for n = 1 both sides of the equation equal 1/2.
Inductive hypothesis: Let m ∈ N and suppose the statement is true for n = m − 1, i.e. suppose that
m−1
X
k=1
1
m−1
=
.
k(k + 1)
m
Induction step: Using the inductive hypothesis we have
m
X
k=1
1
k(k + 1)
=
m−1
X
k=1
1
1
+
k(k + 1) m(m + 1)
m−1
1
+
m
m(m + 1)
(m − 1)(m + 1) + 1
m(m + 1)
m
.
m+1
=
=
=
Therefore the statement is also true for n = m.
2. Use induction to prove 3n < n! for all n > 6 with n ∈ N.
Solution. Base case: The claim is made for n > 6. Therefore the base case we need to verify is n = 7.
Since 37 = 2187 and 7! = 5040 the statement holds for the base case.
Inductive hypothesis: Let m ∈ N be an integer greater than 7 and assume that the statement is true
for n = m − 1, i.e. we assume taht
3m−1 < (m − 1)!.
Induction step: By the above assumption we have
3m = 3 · 3m−1
< 3 · (m − 1)!
by the induction hypothesis
< m · (m − 1)!
since m > 7
= m!
3. Use induction to prove that every positive integer n ∈ Z+ can be expressed as the product of an odd
number and a power of two. In other words, show n = (2k + 1)2p where k ∈ N and p ∈ N.
Hint: In the inductive step, break the proof down into one case for even numbers and one case for odd
numbers.
Solution. Basis: For n = 1, choosing k = 0 and p = 0 ,n = (2 · 0 + 1)20 = 1.
Inductive hypothesis: Let m ∈ N with m > 1. Assume the the claim holds for n ∈ {1, . . . , m − 1}, i.e.
they can each be written as the product of an odd number and a power of two.
Induction step: The number m is either even or odd.
1
• If m is even, then m = 2r for some 1 ≤ r < m. By induction hypothesis, r = (2t + 1)2q for some
integers t and q. Thus m = 2r = (2t + 1)2q+1 . In other words, the statement of the lemma holds
if we let k = t and p = q + 1.
• If m is odd, then m = 2r + 1 for some integer r. But then m = (2k + 1)2p for k = r and p = 0.
4. If you’ve done much graphics programming, you may have used the following two standard trigonometric identities often used to rotate objects:
cos(x + y) = cos(x) cos(y) − sin(x) sin(y)
sin(x + y) = sin(x) cos(y) + cos(x) sin(y)
Using these formulas, prove by induction that for any natural number n and any real number x
(cos(x) + i sin(x))n = cos(nx) + i sin(nx)
where i is the imaginary unit, i.e. the square root of -1 (in other words i2 = −1).
Do not convert this problem to exponential notation and try to solve it in that form. It doesn’t
make things simpler and it will confuse us when we grade.
Hint: this is not as bad as it looks. If your equations seem very complicated and won’t simplify,
look for a mistake in your algebra.
Solution. Basis: since the statement is supposed to hold for any natural number, the basis is n = 0 in
which case we have
(cos(x) + i sin(x))0 = 1,
and
cos(0 · x) + i sin(0 · x) = cos(0) + sin(0) = 1.
Inductive hypothesis: let m ∈ N be a natural number. Assume that the statement of the problem
holds for n = m − 1.
Induction step: for n = m we have
(cos(x) + i sin(x))m
=
(cos(x) + i sin(x)) · (cos(x) + i sin(x))m−1
=
(cos(x) + i sin(x)) · (cos((m − 1)x) + i sin((m − 1)x))
=
cos(x) cos((m − 1)x) − sin(x) sin((m − 1)x)
+ i(sin(x) cos((m − 1)x) + cos(x) sin((m − 1)x))
=
cos((m − 1)x + x) + i sin((m − 1)x + x)
=
cos(mx) + i sin(mx).
2
Download