Test I Solutions

CSCI/MATH2112 Test I
June 8, 2015
Calculators or other electronic devices are not allowed.
Name:
StudentID:
Distributivity:
Commutativity:
Associativity:
DeMorgan’s Laws:
Idempotent:
Double Negation:
Absorption:
Bound:
Negation:
Question
Points
1
2
2
3
3
2
4
3
5
2
6
2
7
2
8
10
9
5
10
7
11
10
12
10
13
0
Total:
58
Score
Important Formulas
P ∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R) P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R)
P ∨Q=Q∨P
P ∧Q=Q∧P
P ∨ (Q ∨ R) = (P ∨ Q) ∨ R
P ∧ (Q ∧ R) = (P ∧ Q) ∧ R
∼ (P ∨ Q) =∼ P ∧ ∼ Q
∼ (P ∧ Q) =∼ P ∨ ∼ Q
P ∧P =P
P ∨P =P
∼∼ P = P
P ∨ (P ∧ Q) = P
P ∧ (P ∨ Q) = P
P ∧T =P
P ∧F =F
P ∨T =T
P ∨F =P
P∧ ∼ P = F
P∨ ∼ P = T
CSci/Math2112
Test I
Page 1 of 3
Multiple Choice
Check off all correct answers to the below questions. You are not required to show your work for these
questions, but space is provided nonetheless.
1. (2 points) Consider the sets A = {a, b, c, d} and B = {a, b, d, e, f } with universe {a, b, c, d, e, f }. What
is A ∩ B equal to?
√
√
√
A∪B
A−B
{a, b, c, d, e, f }
{a, b, d} ∅
Solution: The elements in common between A and B are a, b, and d. Thus A ∩ B = {a, b, d}.
Since A = {e, f } and B = {c}, we have A ∪ B = {c, e, f } = {a, b, d}.
Further, A − B = {a, b, d}.
2. (3 points) Which of the following is equivalent to P ⇒ Q?
√
∼ P ⇒∼ Q Q ⇒ P
∼ Q ⇒∼ P
P∧ ∼ Q
∼P ∧Q
∼ (∼ P ∧ Q)
Solution:
3. (2 points) Let A be a set with cardinality n. How many different sets B exist such that B is a subset of
A and has cardinality k?
√ n
√
n!
n!
n!
n
2n k
(n − k)!
(n − k)!k!
k!
k
Solution: Picking a subset of size k of A is the same as choosing
k elements of n (where order does
n
n!
not matter). As shown in class and in the textbook, there are
=
ways to do that.
k
(n − k)!k!
4. (3 points) What is the coefficient of x2 y 4 in (2x + y)6 ?
√
6
15 30
60 120
2
Solution: By the binomial theorem we have (2x + y)6 =
6
6
2 4
2
2 (2x) y . Thus the coefficient is 2 × 2 = 15 × 4 = 60.
P6
6
k=0 k
(2x)k y 6−k . The term for k = 2 is
5. (2 points) In a bag of marbles there are 5 large and 3 small marbles, all of a different colour. How many
different ways are there to pick 2 large and 2 small marbles?
√
13 26
30 70 120
Solution: There are 52 ways to pick 2 marbles out of the 5 large, and 32 ways to pick 2 out of the
3 small. By multiplication principle, there are 52 32 = 10 × 3 = 30 total ways to pick the marbles.
6. (2 points) The implication Q ⇒ P is called the . . . of P ⇒ Q.
contrapositive
inverse
negative
counterexample
√
converse
Solution: The contrapositive is ∼ Q ⇒∼ P . The inverse is not defined for an implication. The
negative is P ∧ ∼ Q. A counterexample is a case in which the original statement is false.
7. (2 points) Consider the truth table below of the statement S in terms of the statements P and Q. What
is the disjunctive normal form of S?
P
T
T
F
F
Q
T
F
T
F
P ⇒Q
S
T
F
T
T
P∧ ∼ Q
√
(P ∧Q)∨(∼ P ∧Q)∨(∼ P ∧ ∼ Q)
(P ∨Q)∧(∼ P ∨Q)∧(∼ P ∨ ∼ Q)
Long Answer
Answer the questions in this part of the test in the space provided on the question sheets. If you run out of
room for an answer, continue on the back of the page, with the number of the question labelled.
8. (10 points) Negate the following statements. You may use shorthand for your work, but your final
answer should be in English.
(a) If the integer x is divisible by 4, then x is divisible by 2.
CSci/Math2112
Test I
Page 2 of 3
Solution: Since this is an implication with a variable, we consider this statement to be universally
quantified (even if it is not written). Thus the negation is “There exists an integer x which is
divisible by 4 and not divisible by 2.”
(b) The integer x is a prime and divisible by 7.
Solution: The integer x is not a prime or it is not divisible by 7.
9. (5 points) Show that P ⇒ (∼ Q ∨ R) and ∼ (P ∧ Q) ∨ R are logically equivalent.
Solution: This can be done algebraically or using a truth table.
Algebraically we have (using the equivalent form of an implication, associativity, and DeMorgan’s law,
in that order):
P ⇒ (∼ Q ∨ R) =∼ P ∨ (∼ Q ∨ R)
= (∼ P ∨ ∼ Q) ∨ R
=∼ (P ∧ Q) ∨ R.
The truth table is the following:
P
T
T
T
T
F
F
F
F
Q
T
T
F
F
T
T
F
F
R
T
F
T
F
T
F
T
F
∼Q
F
F
T
T
F
F
T
T
P ∧Q
T
T
F
F
F
F
F
F
∼ (P ∧ Q)
F
F
T
T
T
T
T
T
∼Q∨R
T
F
T
T
T
F
T
T
P ⇒ (∼ Q ∨ R)
T
F
T
T
T
T
T
T
∼ (P ∧ Q) ∨ R
T
F
T
T
T
T
T
T
10. (7 points) How many ways are there to arrange 5 cards out of a standard 52-card deck in a row such
that the first is a 6 or the last is a 6? (You do not need to multiply out your final answer.)
Solution: Let A be the arrangements with a 6 as first, and B with a 6 as last. Since we are looking
at arrangements, the order matters. Also, there can be no repetition.
We have |A| = 4 · 51 · 50 · 49 · 48 since there are four different 6s to choose from, and then there are 51
cards left to pick the remaining four cards.
Also, |B| = 4 · 51 · 50 · 49 · 48 since again there are four different ways to pick the 6 going last, and then
there are 51 cards remaining for the last four.
Finally, |A ∩ B| = 4 · 3 · 50 · 49 · 48 since there are four ways to pick the 6 in first, and then three remain
to choose from for the last 6, with 50 cards remaining for the last three to choose from.
We are looking for |A ∪ B|, which by Principle of Inclusion-Exclusion is
|A ∪ B| = |A| + |B| − |A ∩ B|
= 4 · 51 · 50 · 49 · 48 + 4 · 51 · 50 · 49 · 48 − 4 · 3 · 50 · 49 · 48.
11. (10 points) Prove the following statement: For all integers x, y, and z and positive integer n, if x ≡ y
(mod n) and x ≡ z (mod n), then y ≡ z (mod n).
Solution: We will do this by direct proof.
Proof. Let x, y, z be integers and n be a positive integer such that x ≡ y (mod n) and x ≡ z (mod n).
We then have that n | (x − y) and n | (x − z). Thus there exist integers a and b such that x − y = na
and x − z = nb. Then y − z = (x − z) − (x − y) = nb − na = n(b − a). Since b − a is an integer, this
shows that n | (y − z), so y ≡ z (mod n).
12. (10 points) Prove the following statement: For all integers x, if x2 6≡ 0 (mod 4), then x is odd.
Solution: We will do this by showing the contrapositive, which is: “For all integers x, if x is even,
then x2 ≡ 0 (mod 4).” (Note that this can also be proven by contradiction, but proof by contradiction
was not one of the topics for the test.)
Proof. Let x be an integer and suppose that x is even. Then there exists an integer a such that x = 2a.
Then x2 = 4a2 . Since a2 is an integer, we then have that 4 | x2 , so 4 | (x2 − 0). By definition, this
means x2 ≡ 0 (mod 4).
Thus by contrapositive, if x2 6≡ 0 (mod 4), then x is odd.
CSci/Math2112
Test I
Page 3 of 3
13. (5 points (bonus)) Prove the following statement: For all integers x and y we know that (x+y)3 ≡ x3 +y 3
(mod 3). [Hint: Use the binomial theorem.]
Solution:
2
2
3
Proof. Let x and y be integers. By the binomial theorem we have (x+y)3 = x3 +3x
y +3xy +y . Thus
(x + y)3 − (x3 + y 3 ) = 3(x2 y + xy 2 ). Since x2 y + xy 2 is an integer, we have 3 | (x + y)3 − (x3 + y 3 ) ,
so (x + y)3 ≡ x3 + y 3 (mod 3).