Tutorial Exercises Logic Solutions
Tutorial Exercises Logic Solutions
Discrete Mathematics
Logic
1. Logic
2. Predicate Logic
3. Proofs
4. Set Theory
Question3 :
(a) P Q : Mathematics is easy or I do not need to study.
(b) PQ : Mathematics is easy and I do not need to study
(c) ~Q: I need to study.
(d) ~ ~Q: I do not need to study.
(e) ~ P: Mathematics is not easy.
(f) ~ PQ: Mathematics is not easy and I do not need to study.
(g) P Q: If Mathematics is easy, then I do not need to study
Question4
(a) The truth tables for (~ p q ) q and (~ p q ) q .
p q (~p q) q (~p q) q
T T F T T F F T
T F F F F F F F
F T T T T T T T
F F T T F T F F
Step: 1 2 3* 1 2 3*
The tables are the same
Question6
(a) The truth tables for the statements ( p ~ p ) (q r ) and q r .
p q r (p ~p) (q r) q r
T T T T F T T T
T T F T F T T T
T F T T F T T T
T F F T F F F F
F T T T T T T T
F T F T T T T T
F F T T T T T T
F F F T T F F F
Step: 2 1 4* 3 1*
Notice that the two statements are logically equivalent.
In fact, the truth value of the first is dependent entirely on the second
Question7
(a) ( p q ) ( p ~ q )
(p q) (p ~ q)
Step 1 4* 3 2
Place F under main connective F
must be F F F
1 , p must be T and q must be F.
st
T F T F
2nd , p must be T and ~q must be F
q must be T T
q cannot be both T and F , thus ( p q ) ( p ~ q ) can only ever be true and is a tautology
(b) ~ ( p q ) (q p )
~( p q) (q p)
Step 2 1 4* 3
Place F under main connective F
~must be F and must be F F F
1st must be T. 2nd , q must be T T T F
and p must be F
1st p can be F and q can be T, F T
no conflict
There is no contradiction, thus the statement is not a tautology
Question8
(a)
( p q ) r ~ ( p q ) r Implication Law
(~ p ~ q ) r De Morgan' s Law
~ p ~ q r Associativity
(b)
p ( p q ) ~ p ( p q ) Implication Law
~ p p q Associativity
T q Negation Law
T Dominance Law
Question9
(a)
LHS = ~ ( p q )
~ (~ p q ) Implication Law
~~ p ~ q De Morgan' s
p~q Double Negation
= RHS
(b)
LHS = ( p ~ q ) r
~ ( p ~ q ) r Implication Law
(~ p ~~ q ) r De Morgan' s
(~ p q ) r Double Negation
~ p (q r ) Associativity
p (q r ) Implication
= RHS
Question11
(a)
~ ( x > 1) ~ ( y 0)
~ (~ ( x > 1)) ~ ( y 0) Implication Law
( x > 1) ~ ( y 0) Double Negation
( x > 1) ( y > 0) Negation of
(b)
( y 0) ( x > 1)
~ ( y 0 ) ( x > 1) Implication Law .
( y > 0 ) ( x > 1) Negation of
Question12
~ (~ ( p q ) ~ q )
~~ ( p q ) ~~ q De Morgan' s
( p q) q Double Negation
pqq Associativity
pq Idempotent Law
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, lecturers jokes j, s hasnt laughed at j.
True or false ??
Question4
(a) x , ( x > 1 x > 0 )
This statement is true. Clearly, 0 < 1 < x, so x > 0
(b) x , ( x > 1 x > 2 )
This statement is false. Let x = 1.5 . Then x > 1 but x < 2 .
(c) (
x , x > 1 x 2 > x )
This statement is true. Let x = 2 . Then x > 1 and x 2 = 4 > 2 = x .
x 1
(d) x , x > 1 <
2
x +1 3
x 3 1
This statement is true. Let x = 3 . Then x > 1 and =
< .
2
x + 1 10 3
(e) x , y , x 2 + y 2 = 9
This statement is false. Let x = 1 and y = 1 . Then x 2 + y 2 = 2 9 .
(f) x , y , x 2 < y + 1
This statement is true. For x , let y = x 2 . Then clearly x 2 < y + 1 .
(g) x , y , x 2 + y 2 0
This statement is true. Let x = 0 . For each y , y 2 0 , and we have
x2 + y2 = y2 0 .
(ii) (
~ y , x ,, y < x 2 )
(
y , ~ x ,, y < x 2 )
y , x ,, y x 2
The negation of the statement is false.
Let y = 1 . We know x 2 0 for all x , i.e. x 2 > y .
x+ y
(iii) ~ y , x , x < y x < < y
2
x+ y
y , ~ x , x < y x < < y
2
x+ y
y , x , ~ x < y x < < y
2
x+ y x+ y
y , x , x < y x y
2 2
y , x , ( x < y ( y x x y ))
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)
~ P : ~ (x , x 2 = 2)
x , ~ ( x 2 = 2)
x , x 2 2
(b)
~ Q : ~ (x , x 2 + 1 2 x )
x , ~ ( x 2 + 1 2 x )
x , x 2 + 1 < 2 x
Question8
(a)
~ (x , x 0 ) x , ~ ( x 0 )
x , x < 0
The negation is true.
(b)
~ (z , (z is odd z is even))
z , ~ (z is odd z is even)
z , (z is not odd z is not even ) (De Morgan' s)
The original statement is true
(c)
( (
~ n , n is even n is prime ))
(
n , ~ n is even n is prime )
(
n , n is odd n is not prime) (De Morgan' s)
The original statement is true.
Question9
(a) ( (
~ y , y > 1 y 2 > 1 ))
(
y , ~ y > 1 y 2 > 1 )
y , (y > 1 ~ (y 2 > 1))
y , (y > 1 y 2 1)
The original statement is false. Take y = 0, then y = 0 > 1 y 2 = 0 < 1)
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 : n , m , n > m
~ P : ~ (n , m , n > m)
n , ~ (m , n > m )
n , m , ~ (n > m )
n , m , n m
The statement P is false. Let n = 1 . All natural numbers m are greater than n.
(b) P : x , x 2 0
(
~ P : ~ x , x 2 0 )
(
x , ~ x 2 0 )
x , x 2 < 0
The statement ~P is false. For any real number x, x 2 is not less than 0.
(c) Let D be the set of all dogs.
P :d D , d is vegetarian. .
~ P :~ (d D , d is vegetarian )
d D , ~ (d is vegetarian )
d D , d is not vegetarian
The statement ~P is probably false.
Question4
Question12 Prove or disprove this statement: For all integers, a, b if a < b , then
a2 < b2 .
Statement is of the form x D , y D , P( x, y ) Q ( x, y ) , so requires general
proof or disproof with a counterexample.
Counterexample: Let a = 5 and let b = 2 .
a < b but a 2 = 25 > 4 = b 2
Thus by counterexample the statement x D , y D , P( x, y ) Q ( x, y ) is false.
(a) If x = 4, 5, or 6, then x 2 3 x + 21 x.
Statement is of the form [ R( x ) S ( x ) T ( x )] Q ( x ) , where R (x ) is x = 4 ,
S (x ) is x = 5 , T ( x ) is x = 6 and Q (x ) is x 2 3 x + 21 x.
Case 1: Prove: R( x ) Q ( x ) , i.e. If x = 4 , then x 2 3 x + 21 x.
4 2 3 4 + 21
= 25
4
Therefore If x = 4 , then x 2 3 x + 21 x.
Case 2: Prove: S ( x ) Q ( x ) , i.e. If x = 5 , then x 2 3 x + 21 x.
5 2 3 5 + 21
= 31
5
Therefore If x = 5 , then x 2 3 x + 21 x. .
Case 3: Prove: T ( x ) Q ( x ) , i.e. If x = 6 , then x 2 3 x + 21 x.
6 2 3 6 + 21
= 39
6
Therefore If x = 6 , then x 2 3 x + 21 x. .
Thus If x = 4, 5, or 6, then x 2 3 x + 21 x.
(b) x , x 0 2 x + 3 4
Question17 Prove that the product of two odd integers is also an odd integer.
Statement is of the form x D , y D , P( x, y ) Q ( x, y ) , where D is the integers,
P ( x, y ) can be written as x is odd and y is odd, Q ( x, y ) can be written as x y is
odd.
x is odd x = 2k + 1 k ,
y is odd y = 2l + 1 l ,
x y = (2k + 1)(2l + 1)
= 4kl + 2k + 2l + 1
= 2(2kl + k + l ) + 1
= 2n + 1 where n = 2kl + k + l
x y is odd
Therefore the product of two odd integers is also an odd integer
Question19 Prove that the product of any four consecutive numbers, increased by one,
is a perfect square?
n D , P( n ) , where D is the integers, P (n ) is product of any four consecutive
numbers, increased by one, is a perfect square.
Let n, n + 1, n + 2, n + 3 be four consecutive integers.
n( n + 1)( n + 2)( n + 3) + 1 = n 4 + 6n 3 + 11n 2 + 6n + 1
= ( n 2 + 3n + 1)2
= k2 k = ( n 2 + 3n + 1) Z
Hence n( n + 1)( n + 2)( n + 3) + 1 is a perfect square
Thus the product of any four consecutive numbers, increased by one, is a perfect
square.
A B = (0, 1] (f) A = {x : x 1}
(a)
= {x : 0 < x 1}
C = ( , 0 ) (1, )
(b) A B = (g)
= {x : x < 0 x > 1}
(c) B C = B
(h) C A = [0, 1) = {x : 0 x < 1}
(d) A C = C
(i) C B = {0, 1}
(e) A C = A
(j) A C =
The sets A and B are disjoint.
Question2
(a) A B = (f) A = B
(h) P A = {2}
A P = A {2}
(d)
= {1, 2, 3, 5, 7, 9, 11, 13, K}
(i) B P = B {2}
A P = P {2}
(e) (j) A B = A
= {3, 5, 7, 11, 13, K}
P ( X ) = { , {1}, {2}, {3}, {4}, {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 4},
(a)
{3, 4}, {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}, {1, 2, 3, 4} }
Question6
(a) False.
Let B = {2} P ( X ) and. C = {1} P ( X ) . Then
2 B, 2 C BC also 1 C , 1 B C B
{1, 2, 3}
(1, 2} {1, 3}
{2, 3}
Question10 Omitted
has 2 k +1 elements.
We know that the set {1, 2, K , k } has 2 k subsets which contain the elements 1, 2, 3,
, k.
These subsets will also be subsets of X = {1, 2, K , k , k + 1}.
How do we take into account the element k + 1 ? Each of these original 2 k subsets
will determine a new subset when the element k + 1 is included in the original
subset and all subsets containing k + 1 will be so determined.
Thus, we have the subsets of {1, 2, 3, K , k } and the new subsets.
( )
So the total number of subsets of X = {1, 2, 3, K , k , k + 1} is 2 k + 2 k = 2 2 k = 2 k +1 .
So Claim( k + 1 ) is true.
Thus, by Mathematical Induction, Claim(n) is true for all n .
Question13
(a) Prove A B A C B C
KNOW: A B , that is, x A x B K (1)
PROVE: A C B C , that is, x A C x B C .
PROOF: Let x A C .
x A C x A x C
x B x C by (1)
xBC
Therefore, A C B C .
1. ( A B ) B B , that is, x ( A B ) B x B
2. B ( A B ) B , that is, x B x ( A B ) B
Proof of 1:
x (A B) B x (A B) x B
xB
(A B) B B
Thus, ( A B ) B = B
(a) (c)
( )
(A B) A = A B A (A ) U = U
= (A A) (B A) =
= ( B A)
(d)
= (B A)
(A U ) A = A A
(b) =U
(C B ) C = C B C
= C C B
=U B
=U
Question15
1 + ( 1)k
Let A = {0, 1}, B = n : k , n =
2
Step 1: Prove A B .
Let x A . Then x = 0 or x = 1 . Proof by cases.
1 1 1 + ( 1)1
Case 1: x = 0 x = = .
2 2
1 + 1 1 + ( 1)2
Case 2: x = 1 x = = .
2 2
1 + ( 1)k
Therefore, k , x = .
2
Therefore, A B .
Step 2: Prove B A .
1 + ( 1)k
Let y B . Then k , y = .
2
k can be an odd integer or an even integer.
Let k be an odd integer.
1 + ( 1)k 1 + ( 1) 0
Then y = = = = 0.
2 2 2
Let k be an even integer.
1 + ( 1)k 1 + 1 2
Then y = = = = 1.
2 2 2
Therefore, y = 0 or y = 1 .
Thus, y A .
Therefore, B A .
Therefore, by Step 1 and Step 2, A = B .
Question17
2. A B ( A B ) , that is, x A B x ( A B )
Proof of 1.:
x (A B ) ~ (x A B )
~ (x A x B)
~ ( x A) ~ ( x B )
x A xB
x A B
(A B) A B
Therefore, ( A B ) = A B
Therefore, A (B C ) = ( A B ) C .
(C U ) C = (C C ) (U C ) (C ) C = (C ) C
(a) = U U (c) = C C
=U =
( A U ) A = (A ) A (A B) A = A B A
(b) = A A
(d) ( )
= A A B
=A = B
=
Question19
( )
n 2 = (2k )2 = 4k 2 = 2 2k 2 .
(b) Let m O .
Then m is an odd integer k (m = 2k + 1)
m 2 = (2k + 1)2
= 4k 2 + 4k + 1
( )
= 2 2k 2 + 2k + 1,
(2k 2 + 2k )
Therefore, m 2 is an odd integer, so m T .
Thus, O T .
Question21
(a) Prove A B = A A B .
KNOW: A B = A ., that is x A x A B and x A B x A K (1)
PROVE: A B , that is, x A x B .
x A x A B (by 1)
x A xB
xB
Thus, A B .
(a) True
Prove A B = A B .
KNOW: A B = .
(b) True
( )
Prove A B A B B = .
KNOW: A B and A B .
PROVE: B = .
Let B , that is, there exists x such that x B .
Now, we have two cases.
Either x A or x A .
x A x B , which is a contradiction.
(c) True
Prove A and B A are disjoint, that is A (B A) = .
Suppose A (B A) , that is, there exists x such that x A (B A)
x A x (B A)
x A ( x B x A)
xA xA xB
This statement is false.
Therefore, A (B A) = .
x
0 1 2
x
0 1 2
-1
(iii) B A = {(0, 1), (0, 2), (2, 1), (2, 2 ), (3, 1), (3, 2)}
y
x
0 1 2 3
(b) Is A B B B No
(c) A B = {0, 1, 2, 3} ( A B ) C
( A B ) C = {( 0, a ), (0, b ), (1, a ), (1, b ), (2, a ), (2, b ), (3, a ), (3, b )}
( A C ) = {(1, a ), (1, b ), (2, a ), (2, b )} .
x
-1 0 1 2
-1
x
-1 0 1
-1
x
-1 0 1
-1
x
-1 0 1
-1
x
-2 -1 0 1 2
-1
(c) R3 = {( x, y ) : y 2 = 2 + x} .
y
x
-2 -1 0 1 2
-1
(d) R 4 = {( x, y ) : ( x 2 y )( x y ) = 0} .
y
x
-2 -1 0 1 2
-1
x
-2 -1 0 1 2
-1
x
-4 -3 -2 -1 0 1 2 3 4
-1
-2
-3
Question8
(a) R = {(2, 6 ), (2, 8), (2, 10 ), (3, 6 ), (4, 8)}
(b) Graph A B and circle the elements of R.
y
10
1
x
0 1 2 3 4
Question10 Write down the domain and range of the relation R on the given set A.
A = {h : h is a human being} , R = {( h1 , h2 ) : h1 is the sister of h2 }
Dom R = { f A : f is female f has a sibling},
Range R = {p A : p has a sister}
Question11 R = {(3, 4 ), (3, 5), (3, 6 ), (4, 5), (4, 6 ), (5, 6 )} .
1
R = {(4, 3), (5, 3), (6, 3), (5, 4 ), (6, 4 ), (6, 5)}
y2 x2
Question12 T 1 = {( x, y ) : + = 1} .
4 9
Sketch of T:
y
x
-4 -3 -2 -1 0 1 2 3 4
-1
-2
-3
Sketch of T 1 :
y
x
-4 -3 -2 -1 0 1 2 3 4
-1
-2
-3
x
-2 -1 0 1 2
Dom R = [ 2, 2] = {x : 2 x 2}.
However, the relation doesnt satisfy the vertical line test as both (0, 0 ) and (0, 1) are
elements of the relation
Question17
(i) Let A = {1, 5, 9} and B = {3, 4, 7} . F1 A B and F1 = {(1, 7 ), (5, 3), ( 9, 4 )}
(a) F1 is one-to-one as each element in the range appears only once.
(b) F1 is onto as range F1 = B
(a) The function satisfies the horizontal line test, thus F2 is one-to-one
(b) Range F2 = {2n : n } , thus, F2 is not onto
Question18 Let A = {4, 5, 6} and B = {5, 6, 7} 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) S 1 from B to A, S 1 = {(5, 5), (6, 4), (6, 6), (7, 5)} .
and T 1 from B to A, T 1 = {(6, 4), (5, 6), (7, 6)}
(b) S = {( 4, 6), (5, 5), (5, 7), (6, 6)} , (5, 5) S and (5, 7 ) S thus S is not a function,
Dom T = {4,6} A and (6, 5) T and , (6, 7) T , thus T is not a function,
(6, 4) S 1 and (6, 6 ) S 1 , thus S 1 is not a function
Dom T 1 = {5, 6, 7} = B each element in the domain appears only once, thus T 1
is a function.
Question19 Simplify the following:
(a) (1 3 4)(3 2 4) = (1 2 4)
(b) (1 3 4) 1 = (4 3 1)
(c) (2 5 4 1) 1 = (1 4 5 2)
(d) (3 2)(3 2 4)(3 1)(4 2) = (3 2 1 4)