2024 HW1 Sol
2024 HW1 Sol
Due: 2024.3.8
Sol:
(a) f (m, n) = 2m − n
(b) f (m, n) = m2 − n2
(c) f (m, n) = m + n + 1
(d) f (m, n) = |m| − |n|
(e) f (m, n) = m2 − 4
Sol:
(a) This is clearly onto, since f (0, −n) = n for every integer n.
(b) This is not onto, since, for example, 2 is not in the range. To see this, if
m2 − n2 = (m − n)(m + 2) = 2, then m and n must have the same parity (both
even or both odd). In either case, both m − n and m + n are then even, so this
expression is divisible by 4 and hence cannot equal 2.
(c) This is onto, since f (0, n − 1) = n for every integer n.
(d) This is onto. To achieve negative values we set m = 0, and to achieve nonneg-
ative values we set n = 0.
(e) This is not onto, for the same reason as in part (b).
3. (6%) Consider the proposition “Alice will win the game only if she plays by the
rules.”
Sol:
(a) If Alice wins the game she plays by the rules. Playing by the rules in necessary
for Alice to win the game. Winning the game is a sufficient condition for having
played by the rules.
(b) If Alice plays by the rules, then she will win the game.
(c) If Alice doesn’t play by the rules, then she won’t win the game.
(d) It is true,since the hypothesis is false and the conclusion is true.
Sol:
5. (8%) Show that each of these conditional statements is tautology by using truth
tables.
Sol:
p q r p→q q→r p→r (p→q)∧(q→r) [(p→q)∧(q→r)]→(p→r)
T T T T T T T T
T T F T F F F T
T F T F T T F T
(a) T F F F T F F T
F T T T T T T T
F T F T F T F T
F F T T T T T T
F F F T T T T T
p q r p∨q p→r q→r (p∨q)∧(p→r)∧(q→r) [(p∨q)∧(p→r)∧(q→r)]→r
T T T T T T T T
T T F T F F F T
T F T T T T T T
(b) T F F T F T F T
F T T T T T T T
F T F T T F F T
F F T F T T F T
F F F F T T F T
6. (8%) Show that each of these conditional statements is a tautology without using
truth tables.
(a) [⇁p ∧ (p ∨ q)] → q
(b) [p ∧ (p → q)] → q
Sol:
(a) aaa
[⇁p ∧ (p ∨ q)] → q
≡T
≡ [F ∨ (p ∧ q)] → q
≡ (p ∧ q) → q
≡ ⇁p ∨ (⇁q ∨ q)
≡ ⇁p ∨ T
≡T
7. (8%) Show that the polynomial function Z+ ×Z+ →Z+ with f (m, n) = (m + n −
2)(m + n − 1)/2 + m is one-to-one and onto.
Sol: f (1, 1) = 1 f (2, 1) = 3 f (3, 1) = 6 f (4, 1) = 10 f (5, 1) = 15
f (6, 1) = 21
f (1, 2) = 2 f (2, 2) = 5 f (3, 2) = 9 f (4, 2) = 14 f (5, 2) = 20 f (6, 2) = 27
f (1, 3) = 4 f (2, 3) = 8 f (3, 3) = 13 f (4, 3) = 19 f (5, 3) = 26
f (1, 4) = 7 f (2, 4) = 12 f (3, 4) = 18 f (4, 4) = 25
f (1, 5) = 11 f (2, 5) = 17 f (3, 5) = 24
f (1, 6) = 16 f (2, 6) = 23
f (1, 7) = 22
We see by looking at the diagonals of this table that the function takes on suc-
cessive values as m + n increases. When m + n = 2, f (m, n) = 1. When m + n = 3,
f (m, n) takes on the values 2 and 3. When m + n = 4, f (m, n) takes on the values
4, 5, and 6. And so on. It is clear from the formula that the range of values the
(x−2)(x−1)
function takes on for a fixed value of m + n, say m + n = x, is 2
+ 1 through
(x−2)(x−1)
2
+ (x − 1), since m can assume the values 1,2,3,..., (x − 1) under these
conditions, and the first term in the formula is a fixed positive integer when m + n
is fixed. To show that this function is one-to-one and onto, we merely need to show
that the range of values for x + 1 picks up precisely where the range of values for x
left off, i.e., that f (x − 1, 1) + 1 = f (1, x). We compute:
(x − 2)(x − 1) x2 − x + 2 (x − 1)x
f (x − 1, 1) + 1 = + (x − 1) + 1 = = + 1 = f (1, x)
2 2 2
8. (10%) Determine the truth value of each of these statements if the domain consists
of all real numbers.
Sol:
√ 2
(a) T. Since 2 = 2.
(b) F. The two roots are complex.
(c) T. Since x2 + 2 ⩾ 0 + 2 ⩾ 1 for ∀x ∈ R.
(d) F. Counterexample: x = 0 or x = 1.
10. (8%) Determine the truth value of each of these statements if the domain consists
of all real numbers.
(a) ∀x∃y(x2 = y)
(b) ∀x∃y(x = y 2 )
(c) ∃x∀y(xy = 0)
(d) ∃x∃y(x + y ̸= y + x)
(e) ∀x(x ̸= 0 → ∃y(xy = 1))
(f) ∃x∀y(xy = 1)
(g) ∀x∃y(x + y = 1)
(h) ∃x∃y(x + 2y = 2 ∧ 2x + 4y = 5)
(i) ∀x∃y(x + y = 2 ∧ 2x − y = 1)
(j) ∀x∀y∃z(z = (x + y)/2)
Sol:
(a) T. (let y = x2 )
(b) F. (no such y exists if x is negative)
(c) T. (let x = 0)
(d) F. (the commutative law for addition always holds)
(e) T. (let y = 1/x)
(f) F. (the reciprocal of y depends on y - there is not one x that works for all y)
(g) T. (let y = 1 − x)
(h) F. (this system of equations is inconsistent)
(i) F. (this system has only one solution; if x = 0, for example then no y satisfies
y = 2 ∧ −y = 1)
(j) T. (let z = (x + y)/2)
11. (8%) Let P (x, y) be a propositional function. Show that ∃x∀yP (x, y)→∀y∃xP (x, y)
is a tautology.
Sol: Let us assume the hypothesis. This means that there is some x0 such that
P (x0 , y) holds for all y. Then it is certainly true for all y there exists an x such that
P (x, y) is true, since in each case we can take x = x0 .
12. (8%) Are these system specifications consistent? “The router can send packets to the
edge system only if it supports the new address space. For the router to support the
new address space, it is necessary that the latest software release be installed. The
router can send packets to the edge system if the latest software release is installed.
The router does not support the new address space.”
Sol:
Let s be “The router can send packets to the edge system"; let a be “The router
supports the new address space”; let r be “The latest software release is installed."
Then we are told s → a, a → r, r → s, and ¬ a. Since a is false, the first
conditional statement tells us that s must be false. From that we deduce from the
third conditional statement that r must be false. If indeed all three propositions are
false, then all four specifications are true, so they are consistent.
13. (10%) Determine which of the following compound propositions are logically equiv-
alent. P,Q,P(X), and Q(X) are propositions or propositional functions.
Sol:
(a) T
(b) T
(c) F
(d) T
Extra Exercises:
(a) p ⊕ ⇁p
(b) ⇁p ⊕ ⇁q
(c) (p ⊕ q) ∧ (p ⊕ ⇁q)
Sol:
p ⇁p p⊕⇁p
(a) T F T
F T T
p ⇁p q ⇁q ⇁p⊕⇁q
T F T F F
(b) T F F T T
F T T F T
F T F T F
p q ⇁q p⊕q p⊕⇁q (p⊕q) ∧ (p⊕⇁q)
T T F F T F
(c) T F T T F F
F T F T F F
F F T F T F
(a) ϕ ∈ {ϕ}
(b) ϕ ∈ {ϕ, {ϕ}}
(c) {ϕ} ∈ {ϕ}
(d) {ϕ} ∈ {{ϕ}}
(e) {ϕ} ⊂ {ϕ, {ϕ}}
(f) {{ϕ}} ⊂ {ϕ, {ϕ}}
(g) {{ϕ}} ⊂ {{ϕ}, {ϕ}}
Sol:
(a) true.
(b) true.
(c) false- see part (a).
(d) true.
(e) true- the one element in the set on the left is an element of the set on the right,
and the sets are not equal.
(f) true- similar to part (e).
(g) false- the two sets are equal.
Sol: Suppose that B were countable, say with elements b1 , b2 , .... Then since A ⊆ B,
we can list the elements of A using the order in which they appear in this listing of
B. Therefore A is countable, contradicting the hypothesis. Thus B is not countable.
4. Determine whether each of these functions from Z to Z is one-to-one.
(a) f (n) = n − 1
(b) f (n) = n2 + 1
(c) f (n) = n3
(d) f (n) = ⌈n/2⌉
Sol:
5. Prove the first De Morgan law by showing that if A and B are sets, A ∪ B = A ∩ B.
Sol: A ∪ B = {x|x ∈
/ A ∪ B}
= {x|¬(x ∈ (A ∪ B))}
= {x|¬(x ∈ A ∨ x ∈ B)}
= {x|¬(x ∈ A) ∧ ¬(x ∈ B)}
= {x|x ∈
/ A∧x∈
/ B}
= {x|x ∈ A ∧ x ∈ B}
= {x|x ∈ A ∩ B} = A ∩ B
6. Find f ◦g and g ◦f , where f (x) = x2 +1 and g(x) = x+2, are functions from R to R.
(a) (1%) You get an A in this class, but you do not do every exercise in this book.
(b) (1%) You get an A on the final, you do every exercise in this book, and you get
an A in this class.
(c) (2%) To get an A in this class, it is necessary for you to get an A on the final.
(d) (2%) You get an A on the final, but you don’t do every exercise in this book;
nevertheless, you get an A in this class.
(e) (2%) Getting an A on the final and doing every exercise in this book is sufficient
for getting an A in this class.
(f) (2%) You will get an A in this class if and only if you either do every exercise
in this book or you get an A on the final.
Sol:
(a) r ∧ ¬q
(b) p ∧ q ∧ r
(c) p ⇒ r
(d) p ∧ ¬q ∧ r
This sentence is a triple conjunction. The nevertheless in this sentence can be
thought of as another ’and’.
(e) (p ∧ q) ⇒ r
(f) r ⇐⇒ (p ∨ q)
Pn
8. (a) Show that j=1 (aj − aj−1 ) = an − a0 , where a0 , a1 , · · · , an is a sequence of real
numbers. This type of sum is called telescoping.
Pn
(b) Use the identity 1/(k(k+1)) = 1/k−1/(k+1) and (a) to compute k=1 1/(k(k+
1)).
Sol:
(a) We can write out this summation as:
(a1 − a0 ) + (a2 − a1 ) + (a3 − a2 ) + · · · + (an−1 − an−2 ) + (an − an−1 )
Notice what we can cancel out a1 and −a1 , a2 and −a2 all the way up to an−1
and −an−1 . This leaves us with −a0 and an , which is an − a0 .
(b) Assume that,
1/(k(k + 1)) = 1/k − 1/(k + 1) · · · · · · (1)
Pn
j=1 (aj − aj−1 ) = an − a0 = (aj )j=n − (aj−1 )j=1 · · · · · · (2)
Consider,
Pn Pn
k=1 1/(k(k + 1)) = k=1 (1/k − 1/(k + 1)) · · · · · · From(1)
Pn
= k=1 −(1/(k + 1) − 1/k)
= − nk=1 (1/(k + 1) − 1/k)
P
9. Show that the set of real numbers that are solutions of quadratic equations ax2 +
bx + c = 0, where a, b, and c are integers, is countable.
Sol: There are at most two real solutions of each quadratic equation, so the number
of solutions is countable as long as the number of triples (a, b, c), with a, b, and
c integers, is countable. But this follows from 2.5 Exercise 27 in the following
way. There are a countable number of pairs (b, c), since for each b (and there are
countably many b’s) there are only a countable number of pairs with that b as its
first coordinate. Now for each a (and there are countably many a’s) there are only a
countable number of triples with that a as its first coordinate (since we just showed
that there are only a countable number of pairs (b, c)). Thus again by 2.5 Exercise
27 there are only countably many triples.
Exercise 27 Sol: Since empty sets do not contribute any elements to unions, we can
assume that none of the sets in our given countable collection of countable sets is
the empty set. If there are no sets in the collection, then the union is empty and
therefore countable. Otherwise let the countable sets be A1 , A2 , . . .. (If there are
only a finite number k of them, then we can still assume that they form an infinite
sequence by taking Ak+1 = Ak+2 = . . . = A1 .) Since each set Ai is countable and
nonempty, we can list its elements in a sequence as ai1 , ai2 , . . .; again, if the set
is finite we can list its elements and then list ai1 repeatedly to assure an infinite
sequence. Now we just need a systematic way to put all the elements aij into a
sequence. We do this by listing first all the elements aij in which i + j = 2 (there is
only one such pair, (1, 1)), then all the elements in which i + j = 3 (there are only
two such pairs, (1, 2) and (2, 1)), and so on; except that we do not list any element
that we have already listed. So, assuming that these elements are distinct, our list
starts a11 , a12 , a21 , a13 , a22 , a31 , a14 , . . . (If any of these terms duplicates a previous
term, then it is simply omitted.) The result of this process will be either an infinite
sequence or a finite sequence containing all the elements of the union of the sets Ai .
Thus that union is countable.