Section 1: Logic Question1 For each of the following collections of words: a Determine if it is a statement.. Question2 Translate into symbols the following compound statements and gi
Trang 1WUCT121 Discrete Mathematics
Logic Tutorial Exercises
Trang 2Section 1: Logic
Question1 For each of the following collections of words:
(a) Determine if it is a statement
(b) If it is a statement, determine if it is true or false
(c) Where possible, translate the statement into symbols, using the connectives
presented in lectures
(i) If x=3, then x<2
(ii) If x=0 or x=1, then x2 =x
(iii) There exists a natural number x for which x2 =−2x
(iv) If x∈ and x>0, then if x >1 then x>1
(v) xy =5⇒x=1 and y=5 or x=5 and y=1
(vi) xy =0⇒x =0or 0y=
(vii) If x and y are real numbers, xy= yx
(viii) There is a unique even prime number
Question2 Translate into symbols the following compound statements and give the
form of the compound statement In each case, list the statements p, q, r …
(a) If x is odd and y is odd then x+y is even
(b) It is not both raining and hot
(c) It is neither raining nor hot
(d) It is raining but it is hot
(e) −1≤x≤2
Question3 Let P be the statement “Mathematics is easy” and Q be the statement “I do
not need to study” Write down in words the following statements, and simplify if
Question4 Let p and q be statements
(a) Write down the truth tables for (~ p∨q)∧q and (~ p∧q)∨q
What do you notice about the truth tables?
Based on this result, a creative student concludes that you can always interchange
∨ and ∧ without changing the truth table Is the student right?
Trang 3Question5
(a) Construct truth tables for the compound statements p∨~ p and p∧~ p
(b) What do you notice about each of the statements in part (a)?
(c) Determine the truth-value of the compound statements
(p∨ ~ p)∨q and (p∧ ~ p)∧q.What do you notice?
Question6
(a) Construct truth tables for the compound statements (p∨ ~ p) (∧ q∨r) and
r
q∨ What do you notice?
(b) Construct truth tables for the compound statements (p∧ ~ p) (∨ q∧r) and
r
q∧ What do you notice?
Question7 Determine which of the following statements are tautologies using the
quick method where possible
(a) (p⇒q) (∨ p⇒~q)
(b) ~(p⇒q) (∨ q⇒ p)
(c) (p∧q)⇒(~r∨(p⇒q) )
Question8 Using Logical Equivalences and Substitution of Equivalence, write the
following expressions using only ∨, ∧ and ~ Further, write the expression in the
simplest form
(a) (p∧q)⇒r
(b) p⇒(p∨q)
Question9 Let p, q and r be statements Using Logical Equivalences, Substitution and
Substitution of Equivalence, prove the following
Question11 Using Logical Equivalences and Substitution of Equivalence, write the
following logical expressions using ∨ and ∧ only (even without ~)
(a) ~(x>1)⇒~(y≤0)
(b) (y≤0) (⇒ x>1)
Question12 Simplify the expression ~(~(p∨q)∧~q), using Logical Equivalences
Trang 4Section 2 :Predicate Logic
Question1 Write each of the following statements in words Write down whether you
think the statement is true or false
(a) ∀x∈,(x≠0⇒(x>0∨ x<0) )
(b) ∀x∈, x∈
(c) ∀ students s in WUCT121, ∃ an assigned problem p, s can correctly solve p
Question2 Write each of the following statements using logical quantifiers and
variables Write down whether you think the statement is true or false
(a) If the product of two numbers is 0, then both of the numbers are 0
(b) Each real number is less than or equal to some integer
(c) There is a student in WUCT121 who has never laughed at any lecturer’s
jokes
Question3 Translate each of the following statements into the notation of predicate
logic and simplify the negation of each statement Which statements do you think are
true?
(a) P: Someone loves everybody
(b) P: Everybody loves everybody
(c) P: Somebody loves somebody
(d) P: Everybody loves somebody
(e) P: All rational numbers are integers
(f) P: Not all natural numbers are even
(g) P: There exists a natural number that is not prime
(h) P: Every triangle is a right triangle
Question4 Are the following statements true or false? Give brief reasons why
(a) ∀x∈,(x>1⇒ x>0)
(b) ∀x∈,(x>1⇒ x>2)
(c) ∃x∈ (x> ⇒ x2 > x)
1,
,
2
x
x x
(e) ∀x∈,∀y∈,x2 +y2 =9
(f) ∀x∈,∃y∈,x2 < y+1
(g) ∃x∈,∀y∈,x2 +y2 ≥0
Trang 5(i) ∀ξ >0,∃x≠0, x <ξ
(ii) ∃y∈,∀x∈, y< x2
(iii) ∀y∈ ∀x∈ x< y⇒x< x+y < y
2,
Question7 Write the following statements using quantifiers Find their negations and
determine in each case whether the statement or its negation is true, giving a brief
reason
(a) P: For each real number, there is a smaller real number
(b) Q: Every real number is either positive or negative
Question8 Write down the negations of the following statements In each case decide
whether the statement or its negation is true
y
(e) ∃x∈,∀y∈,xy=1
(f) ∀n∈,∃p∈,n=2p
(g) ∀ε∈,∀x∈,∃y∈,(ε >0⇒ x−y <ε)
Question9 Write down the negations of the following statements In each case decide
whether the statement or its negation is false, giving a brief reason
(a) ∀y∈,(y>−1⇒ y2 >1)
(b) ∃x∈,x2+1=0
(c) ∀x,y,z∈,x−(y−z)≠(x−y)−z
(d) ∀x∈,∃y∈,x+y=0
Question10 Write the following statements using quantifiers Find their negations and
determine in each case whether the statement or its negation is false, giving brief
reason where possible
(a) P: For each natural number there is a smaller natural number
(b) P: The square of any real number is non-negative
(c) P: Some dogs are vegetarians
(d) P: There is a real number that is rational
(e) P: Every student likes at least one Mathematics subject
Trang 6Section 3: Proofs
Question1 Each of the following demonstrates the Rule of Modus Ponens, Modus
Tollens or the Law of Syllogism In each case, answer the question or complete the
sentence and indicate which of the logical rules is being demonstrated
(a) If Peter is unsure of an address, then he will phone Peter is unsure of John’s
address What does Peter do?
2 − x+ =
(c) We know that if x is a real number, then its square is positive or zero If y2 =−1,
what do we know about y?
Question2 Prove or disprove the following statements
(a) For all n∈, the expression n2 + n+29 is prime
(b) ∃x∈, ∀y∈, xy≠1
(c) ∀a,b∈, (a+b)2 =a2 +b2
(d) The average of any two odd integers is odd
Question3 Find the mistakes in the following “proofs”
(a) Result: ∀k∈, k >0⇒k2 +2k+1 is not prime
Proof: For k =2, k2 +2k+1=9, which is not prime Therefore the result is true
(b) Result: The difference between any odd integer and any even integer is odd
Proof: Let n be any odd integer and m be any even integer By definition of odd
∈+
n 2 1, , and by definition of even m=2k, k∈ Then
.12)12
=
n But 1 is odd Therefore the result holds
Question4 Prove each of the following results using a direct proof:
(a) For x∈ , x2+1≥2x
(b) For ,n∈ if n is odd, n is odd 2
(c) The sum of any two odd integers is even
(d) If the sum of two angles of a triangle is equal to the third angle, then the triangle
is a right angled triangle
Question5 Prove that if x is a negative real number, then (x−2)2 >4
Trang 7Question8 Prove that if n is an odd integer, then (−1)n =−1.
Question9 Prove, by contraposition, that if n is even, then n is even 2
Question10 Prove by cases, if m is an integer, then m2 + m+1 is always odd
Question11 Disprove the statement:
b a b a b a b
any values for a, b that make the statement true? Explain
Question12 Prove or disprove this statement: For all integers, a, b if a<b, then
2
2
b
a <
Question13 Prove if n is odd, then n is odd 2
Question14 Prove there is no smallest positive real number
Question15 Prove each of the following using proof by cases
(a) If ,x=4,5,or6 then x2 −3x+21≠x
(b) ∀ ∈ , ≠0⇒2x +3≠4
x
Question16 Prove there is a perfect square that can be written as the sum of two other
perfect squares (Note an integer n is a perfect square if and only if ∃k∈,n=k2)
Question17 Prove that the product of two odd integers is also an odd integer
Question18 Prove or disprove the following statements:
(a) The difference between any two odd integers is also an odd integer
(b) For any integer n, )3|n(6n+3
(c) The cube of any odd integer is an odd integer
(d) For any integers a, b, c, if a | , then c ab | c
(e) There is no largest even integer
(f) For all integers a, b, c, if a |/bc, then a |/ b
(g) For all integers n, 4(n2+n+1)−3n2 is a perfect square
(h) For any integers a, b, if a | then b a2 |b2
(i) For all integers n, 41 n2 − n+ is prime
(j) For all integers, n and m, if n−m is even, then n3 −m3 is even
Question19 Prove that the product of any four consecutive numbers, increased by one,
is a perfect square?
Trang 8Section 4: Set Theory
Question2 Let U =
Let }A={x∈:x is odd}, B={x∈:x is even and P={x∈:x is prime}
Write down the following sets:
(a) Write down the set P( )X by listing its elements
(b) How many elements in P( )X ?
(c) Is ∈P( )X ?
(d) Is { } ⊆P( )X ?
Question4 Write down the set P( ) by listing its elements
How many elements in P( ) ?
Question5 Let }X = 1,2,3,K,n , that is, X is a finite set with n elements
How many elements does P( )X have?
Question6 Let X = 1,2, } For each of the following statements, write down
whether it is True or False Give reasons
Trang 9Question7 Let }X = 1,2 Write down the set P(P(X)) by listing its elements
If }Y = 1,2,3 , how many elements would be in the set P(P(Y))? Write down two
Question9 Let X = 1,2, } Draw the Hasse Diagram for P( )X
Question10 Let }X = 1,2,3,4 Try to draw the Hasse Diagram for P( )X
Question11 Using the Principle of Mathematical Induction, prove that if
},,3
,
2
,
X = K , that is, X is a finite set with n elements, then the number of
elements in P( )X is 2n (A procedure for determining the number of sets is
sufficient for the inductive step.)
Question12 Give examples to demonstrate the following results
(a) P( )X ∪P( )Y ⊆P(X ∪Y) but P( )X ∪P( )Y ≠P(X ∪Y)
(b) P( )X ∩P( )Y =P(X ∩Y)
Question13 Let U be the universal set and let A, B and C be subsets of U
Use a typical element argument to prove the following set theoretic results
(a) A⊆B⇒ A∪C ⊆B∪C
(b) (A∪ )B ∩B=B
Question14 Let U be the universal set and let A, B and C be subsets of U
Using properties of union, intersection and complement and known set laws, simplify
Question16 Let U = Let A={n∈:∃k∈,n=2k− } and let
}3,:
B Write down 4 elements from each set
Show that t∈A∩B⇔∃w∈,(w is odd ∧ t=3w+2)
Question17 Let U be the universal set and let A, B and C be subsets of U
Use a typical element argument to prove the following set theoretic results
(a) (A∪B)= A∩B
(b) A∩(B−C) (= A∩B)−C
Trang 10Question18 Let U be the universal set and let A, B and C be subsets of U
Using properties of union, intersection and complement and known set laws, simplify
Question21 Let U be the universal set and let A, B and C be subsets of U
Prove or disprove the following:
Trang 11Section 5: Relations and Functions
Question1 Let }A= 1,2 , }B= 0,2,3 and C={a,b}
(a) List the elements and sketch the graphs in of : 2
(b) Is A×B⊆B×B
(c) List the elements of (A∪ )B ×C and (A×C)∪(B×C) What do you notice?
(d) List the elements of (A× )B ×C and C×(A×A)
Question2 Let }A= 1,2 and D={a,b} Write down D× Will this be the same as A
D
A× ?
Question3 Let }A={x∈:0< x<1 , }B={x∈:−1<x<3 and
}0
:
(a) Sketch the graph of A× in B 2
(b) Sketch the graph of C×C in Note: 2 C×C is called the until square in 2
(c) Sketch the graph of C× in 2
Question4 Let }A={a1,a2,Ka n and B={b1,b2,Kb m}
(a) How many elements in A× ? B
(b) Write out the elements of A× B
Question5 Let A, B and C be elements of P( )U Prove that
)()()
(a) List the elements of R
(b) Graph A × and circle the elements of R B
Trang 12Question10 Write down the domain and range of the relation R on the given set A
}beinghumana
is:
{h h
A= , R={(h1,h2):h1 is the sister of h2}
Question11 Let A= 3,4, } and B= 4,5, } and define the relation R from A to B as
follows: }R={(x,y):x< y Write down R and −1
R by listing their elements
Question12 For the relation T on given by }
94:),{(
2 2
=+
expression for the inverse relation −1
T Sketch both T and −1
T
Question13 Determine whether or not the given relation is reflexive, symmetric or
transitive Give a counterexample in each case in which the relation does not satisfy
the property
(a) R1 on the set A={h:h is a human being} given by
}ofsister theis:),
Find all the classes of R
Question16 Is the following relation a function? Give brief reason
R on [−2,2]={x∈:−2≤x≤2}, where
})1(11)
1(1:
),
Question17 Determine whether or not the following functions are:
(a) one-to-one , give brief reasons
(b) onto Give brief reasons
(i) Let A= 1,5, } and B= 3,4, } F1 ⊆ A×B and F1 ={(1,7),(5,3),(9,4)}
(ii) F2 on and F2 ={(x,y):y=2x}
Question18 Let }A= 4,5,6 and B= 5,6, } and define the relations S and T from A
to B as follows: S ={(x,y):x−y is even} and T ={(4,6),(6,5),(6,7)}
(a) Find expressions for S−1 and T− 1
(b) Which of S, T, S−1 and T− 1 are functions?
Question19 Simplify the following:
(a) (1 3 4)(3 2 4)
(b) (1 3 4)−1
Trang 13WUCT121 Discrete Mathematics
Logic Tutorial Exercises Solutions
Trang 14(iii) There exists a natural number x for which x2 =−2x
Trang 15Question2
p: x is odd q: y is odd r: x + y is even
Form: (p∨q)∧(r∨s)
Question3 :
The tables are the same
(b) The truth tables for (~ p∨q)∧p and (~ p∧q)∨ p
Trang 16(b) p∨~ p is a tautology i.e always true; p∧~ p is a contradiction, i.e always false
(c) Use truth tables
Notice that “true ∨ anything” is true and “false ∧ anything” is false
Conclusion: If you have a compound statement R of the form “T∨P”, where T stands for a tautology (and P is any compound statement), then R is also a
tautology Similarly, if you have a compound statement, S, of the form “F∧P”, where F stands for a contradiction, then S is also a contradiction
Notice that the two statements are logically equivalent
In fact, the truth value of the first is dependent entirely on the second
Trang 17(b) The truth tables for the statements (p∧ ~ p) (∨ q∧r) and q ∧ r
Notice that the two statements are logically equivalent
In fact, the truth value of the first is again dependent entirely on the second
Conclusion: If you have a compound statement R of the form “T∧P”, where T stands
for a tautology (and P is any compound statement), then the truth-value of R depends
the form “F∨P”, where F stands for a contradiction, then the truth-value of S depends entirely on the truth-value of P
Trang 18(c) (p∧q)⇒(~r∨(p⇒q) )
(p ∧ q) ⇒ (~r ∨ (p ⇒ q)
∧ p must be T and q must be T
q cannot be both T and F , thus (p∧q)⇒(~r∨(p⇒q) ) can only ever be true and is a
~
~
LawsMorgan'De
)
~(~
LawnImplicatio)
(
~
r q p
r q p
r q p r q
LawNegation
ityAssociativ
~
LawnImplicatio)
(
~
T
q T
q p p
q p p q p
~
sMorgan'De
~
~~
LawnImplicatio)
(~
~
~LHS
q p
q p
q p
(b)
( ) ( )
ityAssociativ)
(
~
NegationDouble
)(~
sMorgan'De
)
~~
(~
LawnImplicatio
~
~
~LHS
r q p
r q p
r q p
r q p
r q p
Trang 19Question10
(a) If x is a positive integer and x2 ≤3 then x=1
The proposition is True
Falseis01
~
Thus,
Truealsois 01
Trueis 0
~1
y x
y x
0()1
(
NegationDouble
)0(
~)1
(
LawnImplicatio)
0(
~))1(
(~
~
)0(
~)1
(
~
y x
y x
y x
y x
(b)
( ) ( )
( ) ( ) ( > ) (∨ > ) ≤
0
LawnImplicatio1
0
~
10
x y
x y
x y
ityAssociativ
NegationDouble
sMorgan'De
p
q q p
q q
p
q q p
Trang 20Section 2 :Predicate Logic
Question1
(a) Every real number that is not zero is either positive or negative
The statement is true
(b) The square root of every natural number is also a natural number
The statement is false (consider n=2)
(c) Every student in WUCT121 can correctly solve at least one assigned problem Lecturers are yet to work out if this is true or false!
Question2
(a) ∀x∈,∀y∈,(xy=0⇒(x=0∧ y=0) )
The statement is false (consider x=1 and y=0)
(b) ∀x∈,∃y∈, x≤ y
The statement is true
(c) ∃ student s in WUCT121, ∀ lecturer’s jokes j, s hasn’t laughed at j
H q H p
q p
H q H
p
q p
H q H p P
love
t doesn' ,,
loves ,
~,
loves ,,
~:
H q H p
q p
H q H
p
q p
H q H p P
love
t doesn' ,,
loves ,
~,
loves ,,
~:
H q H p
q p
H q H p
q p
H q H p P
love
t doesn' ,,
loves ,
~,
loves ,,
~:
Trang 21x x P
,
,
~:
p n p n
p n p n
P
2,,
2,
~,
2,,
~:
p n p n
P
2,,
2,,
~
~:
not primeis
,
~:
~
n n
n n P
not is, triangle
angle right tria
is, triangle
~:
~
T T
T T P
,
2
x
x x
This statement is true Let x=3 Then x>1 and
3
110
31
2 +y = y ≥
Trang 22(h) ∃x∈,∃y∈,(x< y⇒x2 < y2)
This statement is true Let x=0 and y =1 Then x < y and x2 =0<1= y2
Question5 For each of the following statements,
(i) ~(∀ξ >0,∃x≠0, x <ξ)
ξ ξ
ξ ξ
x x
,0,
0
,0
~,0
The negation of the statement is false
For any ξ >0, we can take
,
~,
x y x
y
x y x y
The negation of the statement is false
Let y=−1 We know x2 ≥0 for all x∈, i.e x >2 y
y y x x y x y x x
y
y y x x y x x
y
y y x x y x x
22
,,
2
~,,
2,
~,
The negation of the statement is false
Clearly, x< y∧(y ≤x∨x≥ y) is equivalent to x< y∧x≥ y, which is impossible
Question6
(a)
)2(
~,
)2,(
~:
x x P
Trang 23
Question7
(a)
),,
(
))(
~,,
(
)),
(
~,(
),,
(:~
~
),,
(
:
x y y x
x y y
x
x y y x
x y y x
P
x y y x
00
,
)0(
~)0(
~,
))00
(
~,(
))00
(,(
:~
~
))00
(,(
x x
x
x x
x
x x
x
x x
x Q
x x
0
~,0
x x
x x
~,
evenisodd is,
~
z z
z
z z
z
z z
is
~,
primeiseven
is,
~
n n
n
n n
n
n n
Trang 241
1
~0,
1
10
~,
1
10
,
~
y
y y
y
y
y y
y
y
y y
y
y
y y
1
~,,
1,
~,
1,,
x
xy y
x
xy y
x
xy y
p n p
n
p n p n
p n p n
2,,
2
~,,
2,
~,
2,,
ε
εε
ε
εε
ε
εε
ε
εε
x
y x y
x
y x y
x
y x y
x
y x y
x
y x y
x
0,,
,
6)
pt 1.4.2(Thm
~0,,
,
0
~,,
,
0,
~,,
0,,
~,
0,,
Trang 25(b)
01,
01
~,
01,
~
2 2 2
≠+
∈
∀
≡
=+
∈
∀
≡
=+
∈
∃
x x
x x
x x
z y
x
z y x z y x z
y
x
z y x z y x z y x
~,,,
,,,
,
0
~,,
0,
~,
0,
,
~
≠+
y x y
x
y x y x
y x y x
The negation is false For any real number x, x − x=0, so let y =−x
Question10 Write the following statements using quantifiers Find their negations and
determine in each case whether the statement or its negation is false, giving brief reason where possible
m n m
n
m n m n
m n m n
~,,
,
~,
,,
~:
0
~,
0,
~:
~
2 2 2
x x
x x P
The statement ~P is false For any real number x, x is not less than 0 2
(c) Let D be the set of all dogs
.vegetarianis
,
n vegetariais
~ ,
n vegetariais
,:~
~
d D d
d D d
d D d P
Trang 26(d) P:∃x∈,xis rational
nal not ratiois
,
rationalis
~,
rationalis
,:~
~
x x
x x
x x P
The statement ~P is false The number 2 is real and rational
(e) Let S be the set of all students and let M be the set of all mathematics subjects
m s
M m S s
M m S s
m s
M m S s
m s
M m S
s
m s
M m S s P
dislikes,
,
likes
~,,
likes,
~,
likes,,
~:
Trang 27(b) The statement is of the form: (P(x)⇒Q(x))∧(Q(x)⇒R(x)), thus the
conclusion is P(x)⇒R(x) So, applying the Law of syllogism, we know the final conclusion is as follows: Therefore, if x2 − x3 +2=0, then x=2 or x=1
(c) The statement is of the form: (P(x)⇒Q(x))∧~Q(a), thus the conclusion is
)(
~P a So, applying the universal rule of Modus Tollens, we conclude that
1
−
=
y is not real
Question2 Prove or disprove the following statements
(a) Statement is of the form ∀x ∈ D,P(x), so must prove with general proof, or disprove with counterexample
Disprove: Let n=29 Then
3129
)1129(29
292929
=
++
=+
x∈ that for all y ∈ D, P(x,y) is true
Prove: Let x=0, and let y∈ Then xy=0 ≠1
Thus, the statement is true
(c) Statement is of the form ∀x∈D,∀y∈D,P(x,y), so must prove with general proof, or disprove with counterexample
Disprove: Let a = b=1 Then,
(a + b)2 =(1+1)2 =22 =4 and a2+b2 =12+12 =2≠(a+b)2
Thus we have a counterexample
Therefore, it is false to say that ∀a,b∈,(a+b)2 =a2 +b2
Trang 28(d) Statement is of the form ∀x∈D,∀y∈D,P(x,y), so must prove with general proof, or disprove with counterexample
Disprove: Let n=1 and m=3, both of which are odd Then the average is
22
31
+ m
n
, which is not odd
Thus we have a counterexample
Therefore, it is false to say that the average of any two odd integers is odd
Question3 Find the mistakes in the following “proofs”
(a) Statement is of the form ∀x ∈ D,P(x), that is a universal statement, so requires proof with general proof, or disprove with counterexample
(b) The mistake is in the use of the definitions of odd and even numbers
When using an existential statement on two separate occasions, you should not
use the same variable; that is, if we use k for defining n as an odd integer
(n = k2 +1 for some k∈), then we must use a different letter for defining m as
an even integer (e.g m=2q for some q∈)
Question4
(a) Statement is of the form ∀x ∈ D,Q(x), where Q ( x) is “x2 +1≥2x”
Thus we must find a P ( x) to give the form ∀x∈D,P(x)⇒Q(x)
We know that for all x∈,x2 ≥0 , so let P ( x) be “ x2 ≥0 ”
x x
x x
x x
21
012
0)1(0
2 2
2 2
≥+
⇒
≥+
,1
2odd
is
2 2
2 2
p p n
p p n
p p
n n
++
=
⇒
++
=
⇒
∈+
=