Homework solutions - California State University, Los Angeles

Transcription

Homework solutions - California State University, Los Angeles
Math 248
February 3, 2015
HOMEWORK SOLUTIONS
HW1
(1) Let the following statements be given:
p = “You are the president of the USA.”
q = “You are born in the USA.”
(a) Translate (¬p) ∨ (¬q) into English.
Answer: “You are not the president or you are
not born in the USA.”
(b) Translate “If you are president of the USA, then you are not born in the USA.” into
symbols of formal logic. Answer: p → ¬q
(c) Translate “It is not true that you are born in the USA and are president of the USA”.
Answer: ¬(p ∧ q).
(d) Give the contrapositive (in English) of “If you are president of the USA, then you are
not born in the USA.” Answer: “If you are born in the USA, then you are not
president of the USA.”
(e) Give the converse (in English) of “If you are president of the USA, then you are not
born in the USA.” Answer: “If you are not born in the USA, then you are president
of the USA.”
(f) Civics Lesson: Using p, q and one connective, construct a true statement about USA
politics. Answer: p → q
(2) Fill in the truth table below and explain how this table shows that p ↔ q is logically
equivalent to (p → q) ∧ (q → p).
Answer:
p
T
T
F
F
q
T
F
T
F
p↔q
T
F
F
T
p→q
T
F
T
T
q→p
T
T
F
T
(p → q) ∧ (q → p)
T
F
F
T
p ↔ q is logically equivalent to (p → q) ∧ (q → p) because the corresponding columns of the
truth table are identical.
(3) Is p → q logically equivalent to q → p? Why or why not?
p = F and q = T then p → q is true, but q → p is false.
Answer: No. For example, if
HW2
(1) (Exercise 1.1 (14) from the text) Let the following statements be given:
p = “Andy is hungry.”
q = “The refrigerator is empty.”
r = “Andy is mad.”
(a) Translate the following into formal logic:
If Andy is hungry and the refrigerator is empty, then Andy is mad.
Answer: (p ∧ q) → r.
1
2
(b) Construct a truth table for the statement in (a).
Answer:
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
p∧q
T
T
F
F
F
F
F
F
(p ∧ q) → r
T
F
T
T
T
T
T
T
(c) Suppose that the statement in (a) is true, and suppose that Andy is not mad and the
refrigerator is empty. Is Andy hungry? Explain.
Answer: We are supposing that (p ∧ q) → r is true, r is false and q is true. There is only
one row of the truth table with these truth values — the third row from the bottom.
In this row, p has the truth value F , and so Andy is not hungry.
(2) Fill in the reasons in the following proof sequence of the tautology
((p ∧ q) → r) ⇒ (p → (¬q ∨ r)).
Answer:
1.
2.
3.
4.
5.
Reason
Statement
(p ∧ q) → r
given
¬(p ∧ q) ∨ r
implication
(¬p ∨ ¬q) ∨ r De Morgan
¬p ∨ (¬q ∨ r) associativity
p → (¬q ∨ r) implication
(3) Using a two-column format, prove that
p∨q
¬p
⇒ q.
Answer:
1.
2.
3.
4.
5.
Statement
p∨q
¬p
¬(¬p) ∨ q
¬p → q
q
Reason
given
given
double negation, 1
implication
modus ponens, 4,2
(4) Use a truth table to prove the modus ponens tautology: p ∧ (p → q) ⇒ q.
Answer: This is Example 1.5 of the book.
p
T
T
F
F
q
T
F
T
F
p→q
T
F
T
T
p ∧ (p → q) (p ∧ (p → q)) → q
T
T
F
T
F
T
F
T
Because the last column contains all T, (p ∧ (p → q)) → q is a tautology. This is fact can
be expressed as p ∧ (p → q) ⇒ q.
3
(5) Is p → ¬p a tautology? A contradiction?
Answer: This statement is neither as seen in the truth table:
p ¬p p → ¬p
T F
F
F T
T
HW3
(1) In the domain of all students, let M (x) be the predicate “x studies mathematics”, and
C(x) be the predicate “x studies chemistry”. Write the following statements in symbols of
predicate logic.
(a) No student studies both math and chemistry. Answer: ¬(∃x)(M (x) ∧ C(x)).
(b) All math students must study chemistry.
Answer: (∀x)(M (x) → C(x))
(c) Some math students must study chemistry. Answer: (∃x)(M (x)∧C(x)) or (∃x)(M (x) →
C(x)), the original statement is ambiguous!
(d) Not all students study math. Answer: ¬(∀x)(M (x)).
(2) In the domain of all integers, let E(x) be the predicate “x is even”, O(x) be the predicate “x
is odd”. Write the following statements in English. (With the goal of encouraging efficient
usage of the language, the number of words in the “official” solution is also given.)
(a) ¬(∃x)(E(x) ∧ O(x)). (7) Answer: No integer is both odd and even.
(b) (∀x)(E(x) ∨ O(x)). (7)
Answer: Any integer is even or is odd.
(c) (∀x)(∀y)(O(x) ∧ O(y) → E(x + y)). (9)
even.
Answer: The sum of any two odd integers is
(d) (∀x)(E(x) → (∃y)(∃z)(O(y) ∧ O(z) ∧ (x = y + z))). (10) Answer: Every even integer
is the sum of two odd integers.
(3) Rewrite the statement ¬(∀x)(∃y)(M (x) → ¬C(y)) with no negations.
Answer:
¬(∀x)(∃y)(M (x) → ¬C(y)) ⇔ (∃x)(∀y)¬(¬M (x) ∨ ¬C(y)) ⇔ (∃x)(∀y)(M (x) ∧ C(y))
HW4
(1) Let S be the statement “Every even integer greater than 2 is the sum of two prime numbers”.
Give statements, in English, for the following:
(a) The negation of S.
Answer: “Not every even integer greater than 2 is the sum of
two prime numbers”.
(b) The converse of S.
than 2.
Answer: The sum of two prime numbers is an even integer greater
(c) The contrapositive of S. Answer: “If a number is not the sum of two prime numbers,
then it is not an even integer greater than 2.”
(2) Prove: Let a, b and c be integers. If (ab)|c, then a|c.
Answer: Direct Proof: Suppose that (ab)|c. Then (ab)k = c for some integer k. Since
a(bk) = c and bk is an integer, this means that a|c.
4
(3) Prove: Let a and b be integers. If 5 does not divide ab, then 5 does not divide a and 5 does
not divide b.
Answer: Proof by contraposition: Specifically we prove that, if 5|a or 5|b, then 5|(ab). If
5|a, then 5k = a for some integer k. Multiplying by b we get 5(kb) = ab which implies 5|(ab)
since kb is an integer. Similarly, if 5|b, then 5|(ab).
(4) Prove: Let a be an integer. If 3 does not divide a, then 6 does not divide a.
Answer: We prove the contrapositive: If 6 divides a, then 3 divides a. Suppose that 6|a.
Then a = 6k for some integer k. Then a = 3(2k), and because 2k is an integer, 3|a.
(5) Prove that there are no even integers a and b such that a2 + b2 is odd. (Assume odd means
not even).
Answer: Proof by contradiction. Suppose, contrary to the claim, that there are even integers
a and b such that a2 +b2 is odd. Since 2|a and 2|b, there are integers k and l such that a = 2k
and b = 2l. Then a2 + b2 = (2k)2 + (2l)2 = 4k 2 + 4l2 = 2(2k 2 + 2l2 ) since 2k 2 + 2l2 is an
integer, this means that 2|(a2 + b2 ), that is, a2 + b2 is even. This contradicts the assumption
that a2 + b2 is odd.
HW5
(1) Let A = {1, 2}, B = {2, 3} and C = {1, 2, 3} be contained in the universal set U =
{1, 2, 3, 4, 5}. Calculate the following.
(a) A0 ∪ B 0 Answer: {1, 3, 4, 5}
(b) A × B
Answer: {(1, 2), (1, 3), (2, 2), (2, 3)}
(c) (A × B) ∩ (B × A).
Answer: {(2, 2)}
(d) P(A) ∩ P(B) Answer: {∅, {2}}
(e) {X | (X ⊆ C) ∧ (X 6⊆ A)} Answer: {{1, 2, 3}, {2, 3}, {1, 3}, {3}}
(2) Calculate P(P({1})). Answer: {∅, {∅}, {{1}}, {∅, {1}}}
(3) For the universal set U , the set of all students, let M be the set of all math students and let
S be the set of all smart students. Express the following using set notation.
(a) No math student is smart. Answer: M ∩ S = ∅
(b) If student is smart, he/she doesn’t study math. Answer: S ⊆ M 0
(4) In the universal set of all integers, let E be the set of even integers and P the set of prime
integers. Use set notation to express the following statements:
(a) 2 is the only even prime integer. Answer: E ∩ P = {2}
(b) Not all prime integers are even. Answer: P 6⊆ E or P ∩ E 0 6= ∅.
(c) There exist even integers that are not prime. Answer: E 6⊆ P or E ∩ P 0 6= ∅.
(d) 3 is a prime integer but not an even integer. Answer: 3 ∈ (P ∩ E 0 )
(e) 3 is not the only prime integer. (Okay to use connectives from logic too.)
Answer: (3 ∈ P ) ∧ (P ∩ {3}0 6= ∅)
(5) Let A and B be sets in a universal set U . For x ∈ U , let p be the statement x ∈ A and q be
the statement x ∈ B. What theorem of set theory is a consequence of the (contrapositive)
tautology (p → q) ⇔ (¬q → ¬p)?
Answer: With p and q as given, the tautology becomes
((x ∈ A) → (x ∈ B)) ⇔ (¬(x ∈ B) → ¬(x ∈ A)).
Since this applies to all x, we have
(∀x)((x ∈ A) → (x ∈ B)) ⇔ (∀x)(¬(x ∈ B) → ¬(x ∈ A)).
5
The left side of the ⇔ symbol is the statement A ⊆ B. The right side is the statement
B 0 ⊆ A0 . Reminder: ¬(x ∈ B) ⇔ (x 6∈ B) ⇔ (x ∈ B 0 ). Thus we get the theorem
A ⊆ B ⇔ B 0 ⊆ A0 .
HW6
(1) Let A and B be sets.
(a) Prove that B ⊆ A ∪ B.
Answer: By definition, x ∈ A ∪ B if x ∈ A or x ∈ B. In particular, if x ∈ B, then
x ∈ A ∪ B. Thus each element of B is an element of A ∪ B, that is, B ⊆ A ∪ B.
(b) Prove that, if A ⊆ B, then A ∪ B ⊆ B.
Answer: Suppose that A ⊆ B. If x ∈ A ∪ B, then x ∈ A or x ∈ B. In the first case,
since A ⊆ B, we have x ∈ B. So in either case, x ∈ B. Thus each element of A ∪ B is
an element of B, that is, A ∪ B ⊆ B.
(c) Prove that, if A ∪ B ⊆ B, then A ⊆ B.
Answer: Suppose that A ∪ B ⊆ B. If x ∈ A, then x ∈ A ∪ B, and, since A ∪ B ⊆ B,
we have x ∈ B. Thus each element of A is an element of B, that is, A ⊆ B.
(d) Prove that A ⊆ B if and only if A ∩ B 0 = ∅.
Answer: (a) We prove that A ⊆ B implies A ∩ B 0 = ∅. We do this by contraposition,
that is, we prove the contrapositive: A ∩ B 0 6= ∅ implies that A 6⊆ B. Suppose that
A ∩ B 0 6= ∅. Then there is some element x in A ∩ B 0 . Then x is in A but is not in B.
This shows that not all elements of A are in B and so A 6⊆ B.
(b) We prove that A ∩ B 0 = ∅ implies A ⊆ B. We do this by contraposition, that is, we
prove the contrapositive: A 6⊆ B implies that A ∩ B 0 6= ∅ . Suppose that A 6⊆ B. Then
there is some element x that is in A but is not in B. Since x in A ∩ B 0 , we have shown
that A ∩ B 0 is not the empty set.
OR
We prove the logically equivalent statement A 6⊆ B if and only if A ∩ B 0 6= ∅:
A 6⊆ B ⇔ (∃x)((x ∈ A) ∧ (x 6∈ B)) ⇔ (∃x)(x ∈ A ∩ B 0 ) ⇔ A ∩ B 0 6= ∅
(2) Let f : N → R be defined by f (x) = 1/x for all x ∈ N. Reminder: N = {1, 2, 3, . . . } is the
set of natural numbers. R is the set of real numbers.
(a) Is f injective (one-to-one)? Explain.
Answer: Yes, f is injective. Suppose that f (a) = f (b) for some a, b ∈ N. Then
1/a = 1/b, which implies that a = b.
(b) Is f surjective (onto)? Explain.
Answer: No. Counterexample: There is no x ∈ N such that 2 = f (x).
(3) Suppose that f : X → Y and g : Y → X are functions such that g(f (x)) = x for all x ∈ X.
Prove that f is injective (one-to-one). Complete sentences please!
Answer: To prove that f is injective, we need to show that, for all a, b ∈ X, if f (a) = f (b)
then a = b.
Suppose that f (a) = f (b) for some a, b ∈ X. Then, using the given property of f and g,
a = g(f (a)) = g(f (b)) = b. Thus f is injective.
6
HW7
(1) Let R+ be the set of positive real numbers, and f : R → R+ be defined by f (x) = 2x for
all x ∈ R. Is f a bijection? Answer: f is a bijection with inverse f −1 : R+ → R defined
by f −1 (y) = log2 y for all y ∈ R+ . Note that 2x > 0 for all x ∈ R and that log2 y is defined
for all y ∈ R+ . That is, the range of an exponential function and the domain of a logarithm
function are the same, namely R+ .
(2) Let f : R → R be defined by f (x) = 2x − 5 for all x ∈ R. Find the inverse of f . Answer:
If x, y ∈ R, then y = f (x) if and only if x = f −1 (y). That is, y = f (x) and x = f −1 (y) are
the same equation - just in one case solved for y and in the other case solved for x. We use
this fact to find the inverse of f .
With the given function f , the equation y = f (x) is y = 2x − 5. Solving this for x gives
−1
−1
x = (y + 5)/2, since this is the equation
( x = f (y), we have f (y) = (y + 5)/2
n
if n is even
(3) Let f : Z → R be defined by f (n) =
.
−n if n is odd
(a) Show that f is not invertible. Answer: f is not surjective (onto) since, for example,
there is no n ∈ Z such that f (n) = 1/2.
(b) Find a function g : R → Z so that g ◦ f is the identity function on Z. (Many answers
possible.) Answer: If g ◦ f is the identity function then g(f (n)) = n for all n ∈ Z.
For example, since f (3) = −3, we must have g(−3) = 3. That way g(f (3)) = 3.
Similarly, since f (4) = 4, we have g(4) = 4, and since f (−5) = 5, we have g(5) = −5,
etc. Once you see the pattern you can write down the formula for g:
For any integer x, g(x) = x if x is even, and g(x) = −x if x is odd.
This suffices to ensure that g(f (n)) = n for all integers n. But g is supposed to be a
function from R to Z . So we need to choose values for g(x) when x is not an integer.
These values are arbitrary since they don’t affect the requirement that g(f (n)) = n for
all integers n. We can justas well assume that g(x) = 0 when x is not an integer. In

if x ∈ Z and is even
x
this case, we have g(x) = −x if x ∈ Z and is odd for all x ∈ R.


0
otherwise
(4) Let f : Z → N ∪ {0} be defined by f (n) = |n| for all x ∈ Z.
(a) Is f injective (one-to-one)? Explain. Answer: No. To prove that f is not injective,
we show the existence of a, b ∈ Z such that f (a) = f (b), but a 6= b. This is done by
example: Let a = 1 and b = −1. Then f (a) = f (b) = 1 but a 6= b.
(b) Is f surjective (onto)? Explain. Answer: Yes. To prove that f is surjective, we show
that for all y ∈ N ∪ {0} there is some x ∈ Z such that y = f (x). This is easy since for
all y ∈ N ∪ {0}, we can pick x = y and then f (x) = y.
(5) Let f : Z → Z be defined by
(
n + 3 if n is odd
f (n) =
n − 5 if n is even
for all n ∈ Z. Find a formula for f −1 .
Answer: If x, y ∈ Z, then y = f (x) if and only if x = f −1 (y). That is, y = f (x) and
x = f −1 (y) are the same equation - just in one case solved for y and in the other case solved
for x. We use this fact to find the inverse of f . There are two cases:
• Suppose that x is odd. Then y = f (x) = x + 3. This implies that x = y − 3 and also
that y is even.
• Suppose that x is even. Then y = f (x) = x − 5. This implies that x = y + 5 and also
that y is odd.
7
Combining these results we have that, if y is even, then x = y − 3, and if y is odd, then
x = y + 5, that is
(
y − 3 if y is even
x=
.
y + 5 if y is odd
Since this is the equation x = f −1 (y), we have
(
y − 3 if y is even
.
f −1 (y) =
y + 5 if y is odd
HW8
(1) Let S be the set of states in the USA. For a, b ∈ S, define a relation ≡ by a ≡ b if a and b
share at least part of their borders.
(a) Is ≡ reflexive? Answer: Yes. A state and itself have exactly the same border.
(b) Is ≡ symmetric?
Answer: Yes. If a and b share a border, then b and a share the
same border.
(c) Is ≡ transitive? Answer: No. For example, (California) ≡ (Oregon) and (Oregon) ≡
(Washington), but (California) 6≡ (Washington) .
(d) Is ≡ an equivalence? Answer: No, since ≡ is not transitive.
(2) Explain why
R = {(1, 1), (2, 2), (3, 3), (4, 4), (2, 3), (3, 2), (2, 4), (4, 2)}
is not an equivalence relation on the set {1, 2, 3, 4}. Answer: R is not transitive. For
example, 3 R 2 and 2 R 4 but 3 R 4 is false.
(3) Let S be the set of all Math 248 students. Define a relation ≡ on S by
x ≡ y if student x got a (strictly) higher score on Quiz 3 than student y
for all x, y ∈ S.
(a) Is ≡ reflexive? Explain. Answer: No. In fact, x ≡ x is not true for any x ∈ S.
(b) Is ≡ symmetric? Explain. Answer: No. If x ≡ y, then x got a (strictly) higher score
on Quiz 3 than student y. This means that y did not get a (strictly) higher score on
Quiz 3 than student x, that is, y ≡ x is not true.
(c) Is ≡ transitive? Explain.
Answer: Yes, if x got a (strictly) higher score on Quiz 3
than student y and y got a (strictly) higher score on Quiz 3 than student z then x got
a (strictly) higher score on Quiz 3 than student z.
(4) Let X = {1, 2, 3} and S = P(X). Define an equivalence relation ≡ on S by
A ≡ B ⇔ |A| = |B|
for all A, B ∈ S. (Notation: |A| is the number of elements of set A.) What is the corresponding partition P of S?
Answer: P = {{∅}, {{1}, {2}, {3}}, {{1, 2}, {1, 3}, {2, 3}}, {{1, 2, 3}}}
(5) Let X = {1, 2, 3, 4} and S = X × X. Define an equivalence relation on S by x ≡ y if the
sum of of the entries in x equals the sum of the entries in y. For example, (1, 3) ≡ (2, 2).
What is the corresponding partition of S?
Answer:
P = {{(1, 1)},{(1, 2), (2, 1)}, {(1, 3), (3, 1), (2, 2)}, {(1, 4), (4, 1), (2, 3), (3, 2)},
{(2, 4), (4, 2), (3, 3)}, {(3, 4), (4, 3)}, {(4, 4)}}