Download HW 6 solutions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Wiles's proof of Fermat's Last Theorem wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Brouwer–Hilbert controversy wikipedia , lookup

Collatz conjecture wikipedia , lookup

Line (geometry) wikipedia , lookup

Fundamental theorem of algebra wikipedia , lookup

Mathematical proof wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
CS 173
Homework 6 (due 10/17/08)
Fall 2008
CS 173: Discrete Mathematical Structures, Fall 2008
Homework 6
Due at class on Friday, October 17, 2008
1. [10 points] Proof by Induction
Use induction to prove 3n < n! for all n > 6 with n ∈ N.
Answer.
Basis step. The claim is made for n > 6, therefore the base case we need to prove is n = 7. Given
that 37 = 2187, and 7! = 5040, the claim does hold for the base case.
Induction assumption. Assume the claim holds for n, that is 3 n < n!.
Inductive step. The claim we need to prove is: If 3 n < n!, then 3n+1 < (n + 1)!. We can prove this claim
directly from the induction assumption:
3n < n!
3 · 3n < 3 · n!
3n+1 < 3 · n! < (n + 1) · n!
3n+1 < (n + 1)!
In the second to last step, we used the fact that n + 1 > 3, which is true given that the
claim was made for n > 6.
2. [10 points] Proof by Induction
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)2 p 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.
Basis.
• For n = 1, choosing k = 0 and p = 0, n = (2 · 0 + 1)2 0 = 1.
Induction assumption. Assume the claim holds for n, that is, we can write the number n as the product of an
odd number and a power of two.
Inductive step. We need to prove: For n ∈ Z + , if for all m ∈ {1, 2, . . . , n} m can be written as the product
of an odd number and a power of two, then n + 1 can be written as a product of an odd
number and a power of two.
We divide the proof in two cases, function of whether n is even.
• If n is even, then the result follows easily with a direct proof: If n is even, then
(n + 1) is odd. Writing (n + 1)20 completes the proof for this case.
Alternatively, using induction, we can write (n+1) = (n−1)+2. Since n is even, then
(n−1) is odd, and by the induction assumption can be written as (n−1) = (2k+1)2 p ,
for some integers k and p. Moreover, since (n − 1) is odd, it does not have 2 as a
factor, which means p = 0. We can write (n + 1) = (2k + 1)2 0 + 2 = (2k + 1) + 2 =
(2k + 3) = (2(k + 1) + 1) = (2(k + 1) + 1)20 , which completes the proof for this case.
1
CS 173
Homework 6 (due 10/17/08)
Fall 2008
• If n is odd, then (n+1) is even. Therefore, (n+1) is divisible by 2. Let m = (n+1)/2.
Clearly, m < n. By the induction assumption, m can be written as m = (2k + 1)2 p ,
for k, p ∈ Z+ . Thus, (n + 1) = 2m = (2k + 1)2p+1 , which completes the proof.
3. [10 points] Proof by Induction
If you’ve done much graphics programming, you may have used the following two standard
trig identities 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
(cos(x) + i sin(x))n = cos(nx) + i sin(nx)
for any natural number n and any real number x (i is the square root of -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.
Answer.
Basis step. Since n could be any natural number, the base case is n = 0. Given that
(cos(x) + i sin(x))0 = 1,
and
cos(0x) + i sin(0x) = 1 + i0 = 1,
the claim is true for the base case.
Induction assumption. Assume (cos(x) + i sin(x)) n = cos(nx) + i sin(nx) holds for n.
Inductive step. The claim we need to prove is: If (cos(x)+i sin(x)) n = cos(nx)+i sin(nx), then (cos(x)+
i sin(x))n+1 = cos((n + 1)x) + i sin((n + 1)x). Multiplying by cos(x) + i sin(x) both sides
of the induction assumption, and then using the identities provided, we have:
(cos(x) + i sin(x))n+1 = (cos(x) + i sin(x)) · (cos(nx) + i sin(nx))
= cos(x) cos(nx) + i cos(x) sin(nx) + i sin(x) cos(nx) − sin(x) sin(nx)
= (cos(x) cos(nx) − sin(x) sin(nx)) + i(sin(nx) cos(x) + sin(x) cos(nx))
= cos(x + nx) + i sin(x + nx)
= cos((n + 1)x) + i sin((n + 1)x)
4. [15 points] Recursive Definitions
Reading Section 4.3 of the textbook should help with the following questions.
2
CS 173
Homework 6 (due 10/17/08)
Fall 2008
Figure 1. Two intersecting lines decomposing the plane into 4 regions, and three interjecting lines decomposing the plane
into 7 regions.
Figure 2. Inductive step to count the number of regions of n lines intersecting in the plane.
(a) Lines in a Plane
Here, we attempt to answer the age-old question: how many slices of pizza can a person
obtain by making n straight cuts with a knife? More formally, let L n be the number
regions created by drawing n lines in the plane with no lines being parallel and no three
lines intersecting at a single point . It is easy to see that L 0 = 1 and L1 = 2 (it’s helpful
to draw a picture).
i. What are L2 and L3 ?
Answer. (see Figure 4(a)i).
• L2 = 4.
• L3 = 7.
ii. Give a recursive definition for L n and briefly explain your answer.
Answer. Consider Figure 4(a)ii). Starting with three lines, we find the increase
in the number of regions when a fourth line, l, is added. Take l as a ray that
progressively intersects the rest of the lines, from left to right (or top to bottom
if l is vertical). Every time l meets a line, a region is divided by two, as for regions a,
and b. Additionally, when l meets the last line, two regions are divided in two, as for
regions c, and d. In general, we find that if there are n lines intersecting according
to the conditions given decomposing the plane in L n regions, then adding an extra
line increases the number of regions by n + 1. That is, L n+1 = Ln + n + 1.
(b) String of 1s and 0s
A bitstring is simply a sequence of zeroes and ones. Give a recursive definition for B n the
3
CS 173
Homework 6 (due 10/17/08)
Fall 2008
number of bitstrings of length n that contain no consecutive zeroes. Include appropriate
bases cases. Briefly explain your answer.
Answer.
Notation: A bitstring w of length n > 0 is written as w = ax, in which a ∈ {0, 1}, and x
is a bitstring of length n − 1. Also, let S n be the set of bitstring of length n that contain no
consecutive zeroes. This means Bn = |Sn |.
Basis.
• There is exactly one bitstring of length 0, the empty string . B 0 = |S0 | = |{}| = 1.
• There are exactly two bitstrings of length 1, namely ’0’ and ’1’. B 1 = |S1 | = |{0, 1}| =
2.
Recursive step. For n > 2: Consider a bitstring w ∈ S n . For n > 2, it either starts with 0 or with 1. Let
Zn ⊂ Sn be the set of bitstrings of length n that start with 0, and let O n ⊂ Sn be the set
of bitstrings of length n that start with 1. We can write:
Bn = |On | + |Zn |.
Consider a bitstring z ∈ On . The bitstring is of the form z = 1x, for some x ∈ S n−1 .
Since there are Bn possible choices for x, then |On | = Bn−1 . Similarly, consider y ∈ Zn .
The bitstring is of the form y = 0u, for some u ∈ S n−1 . However, in this case we know
that u cannot start with 0. That is, u is of the form u = 01t, for some t ∈ S n−2 . Since
there are Bn−2 possible choices for t, then |Zn | = Bn2 . Therefore, our recursive step is
Bn = Bn−1 + Bn−2 .
(Note that Bn looks very much like the Fibonacci numbers F n , but shifted by one. That
is, B1 = 2, but F1 = 1 and F2 = 2. Therefore, if we would like to look fancy, then we
could say Bn = Fn+1 .)
5. [5 points] An odd sequence
The following proof contains a mistake. Specifically and carefully describe what the mistake
is. Let a sequence of natural numbers be defined by the recurrence relation a n = an−2 + 2
witha1 = 3 and a2 = 2. We prove by induction on n that for all n ≥ 1 that a n is odd.
Basis Step: For n = 1 we have a1 = 3 which is odd
Inductive Step: Assume that for some number k, the numbers a 1 , ..., ak are all odd. We know
ak+1 = ak−1 + 2. By the inductive hypothesis ak−1 is odd which means ak−1 = 2j + 1 for some
natural number j. So ak+1 = (2j + 1) + 2 = 2(j + 1) + 1. So, we know ak+1 is odd.
Answer. The base case was not proved for n = 2. The recurrence a n = an−2 + 2 uses the value
of an−2 , thus we need to prove two cases in the basis step. The basis of the recurrence for a 2 is an
even number, therefore the claim does not hold for the base case.
4