Review for CS1050 Review Questions • Without using truth tables, prove that (pq)  q is a tautology. • Prove that the sum.

Download Report

Transcript Review for CS1050 Review Questions • Without using truth tables, prove that (pq)  q is a tautology. • Prove that the sum.

Review for CS1050
Review Questions
• Without using truth tables, prove that
(pq)  q is a tautology.
• Prove that the sum of an even integer and an
odd integer is always odd.
• Use mathematical induction to prove that
2 n1
2
whenever nZ+.
(2 j  1)  3n

j n
Review Questions
• Prove that fn+1fn-1 – fn2 = (-1)n whenever n is a
positive integer.
• Without using set membership tables, prove or
disprove that if A,B and C are sets, then A –
(BC) = (A-B)  (A-C).
• Using the definition of “Big Oh” prove that n! is
O(nn).
• Prove that (3,5,7) is the only “prime triple”, i.e.,
the only set of three consecutive odd integers > 1
that are all prime.
Review Questions
• Suppose f: Z+  Z+ where f(n) = 4n + 1 and Z+
is the set of all non-negative integers.
– Is f one-to-one?
– Is f onto?
• Suppose f: Z+  Z+ where f(n) = 4n2 + 1 and Z+
is the set of all non-negative integers
– Is f one-to-one?
– Is f onto?
Without using truth tables, prove that
(pq)  q is a tautology.
(pq)  q
(pq)  q
(pq)  q
(pq)  q
p (q  q)
p T
T







Misc. T6 (Implication equivalence)
Misc. T6 (Implication equivalence)
Double Negation
Associative
Misc. T6 (Or tautology)
Domination
Prove that the sum of an even integer and an
odd integer is always odd.
Let e be an even integer and f be an odd integer. Then
there exists i,j  Z such at e = 2i and f=2j+1.
(Why not e = 2j and f=2j+1?)
Then e+f = 2i+2j+1 = 2(i+j) + 1 which is odd since i+j
must be an integer.
Use mathematical induction to prove that
2 n1
whenever nZ+.
(2 j  1)  3n2

j n
Basic Case: Let n = 1, then
2(1)1
1
 (2 j  1)   2j  1  3  31
j1
2
3
j1
Inductive Case:
Assume that the expression is true for n, i.e.,
2 n1
that
2
 (2 j  1)  3n
j n
then we must show that
2  n 1 1
 (2 j  1)  3n  1
2
j n1
2  n 1 1

(2 j  1) 
 2 j  1
jn 1
j n1

2n1
2n 1
2j  1  2n  1  22n  1  22n  1  1
j n
 3n2  (2n  1)  (2(2n)  1)  (2(2n  1)  1)
 3n2  2n  1 4n  1  4n  3  3n2  6n  3
 3(n  2n  1)
2
 3(n  1)
2
Prove that fn+1fn-1 – fn2 = (-1)n whenever n is a
positive integer.
Basis Step : For n=1 we have f2*f0 – f12 = 1*0
– 12 = -1 which is (-1)1
Inductive Step:
Assume the inductive hypothesis that fn+1fn-1
– fn2 = (-1)n . We must show that
that fn+1+1fn+1-1 – fn+12 = (-1)n+1
Then for n+1 we have that
fn+1+1fn+1-1 – fn+12 = fn+2fn – fn+12
= (fn+1+fn )fn- fn+12 = (fn+1fn) + fn2- fn+12
= (fn+1)(fn - fn+1) + fn2
= (-fn+1)(fn+1-fn)+ fn2
But we know that fn+1-fn = fn-1 so
= (-fn+1)(fn-1)+ fn2
= -(fn+1fn-1- fn2 )
= -(-1)n by the inductive hypothesis which is
(-1)n+1
Without using set membership tables, prove or
disprove that if A,B and C are sets, then A –
(BC) = (A-B)  (A-C).
Proof:
We must show that A – (BC)  (A-B)  (A-C) and that (AB)  (A-C)  A – (BC).
First we will show that A – (BC)  (A-B)  (A-C). Let e
be an arbitrary element in A – (BC). Then e A but
e(BC). Since e(BC), then either eB or eC or
both. If eA but eB, then e(A-B). If eA but eC,
then e(A-C). Since e is either an element of (A-B) or
(A-C), then e must be in their union.. Therefore e  (A-B)
 (A-C).
Now we will show that (A-B)  (A-C)  A –
(BC).
Let e be an arbitrary element in (A-B)  (A-C).
Then either e is in (A-B) or e is in (A-C) or e is in
both. If e is in (A-B), then e  A but eB. If e B
then e(BC). Therefore eA-(BC). If e is in
(A-C), then e  A but eC. If e C then
e(BC). Therefore eA-(BC).
Using the definition of “Big Oh”
n
prove that n! is O(n ).
Proof: We must show that  constants CN and kR
such that |n!|  C|nn| whenever n > k.
n!
= n(n-1)(n-2)(n-3)…(3)(2)(1)
 n(n)(n)(n)…(n)(n)(n)
n times
=nn
So choose k = 0 and C = 1
Prove that (3,5,7) is the only “prime triple”, i.e., the only set
of three consecutive odd integers > 1 that are all prime
We must show that, for any three consecutive odd
integers, at least one is divisible by some other
number. We will show that for every three
consecutive odd integers, one of them is divisible
by 3.
Proof:
Any three consecutive odd integers can be written as
2k+1, 2k+3, and 2k+5 for kZ.
For any kZ, there are three possible cases,
k = 3j,
k = 3j+1, k = 3j +2 for j  Z.
Case 1: k = 3j.
Then three consecutive odd integers look like:
2k+1= 2(3j) + 1 = 3(2j) + 1
2k+3= 2(3j) + 3 = 3(2j) + 3
= 3(2j+1) which is divisible by 3 since 2j+1 is an integer
2k+5 = 2(3j) + 5 = 3(2k) + 5 = 3(2k+1) + 2
Case 2: k = 3j+1
Then three consecutive odd integers look like:
2k+1= 2(3j+1) + 1 = 3(2j+1) which is divisible by 3 since
2j+1 is an integer.
2k+3= 2(3j+1) + 3 = 3(2j+1) +2
2k+5 = 2(3j+1) + 5 = 3(2j+2) + 1
Case 3: k = 3j+2
Then three consecutive odd integers look like:
2k+1= 2(3j+2) + 1 = 3(2j+1) + 2 2k+3= 2(3j+2) + 3 =
3(2j+2) +1
2k+5 = 2(3j+2) + 5 = 3(2j+3) which is divisible by 3 since
2j+3 is an integer.
The only number divisible by 3 and that is prime is 3 so
3,5,7 is the only possible “prime triple”.
Suppose f:Z+  Z+ where f(n) = 4n + 1 and
Z+ is the set of all non-negative integers.
Is f one-to-one?
Is f onto?
Suppose f: Z+  Z+ where f(n) = 4n2 + 1 and
Z+ is the set of all non-negative integers
Is f one-to-one?
Is f onto?