WUCT121 Discrete Mathematics Logic Tutorial Exercises ..., Study notes of Logic

WUCT121. Logic Tutorial Exercises Solutions. 1. WUCT121. Discrete Mathematics. Logic. Tutorial Exercises Solutions. 1. Logic. 2. Predicate Logic. 3. Proofs.

Typology: Study notes

2021/2022

Uploaded on 08/05/2022

jacqueline_nel
jacqueline_nel 🇧🇪

4.4

(242)

3.2K documents

1 / 44

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
WUCT121 Logic Tutorial Exercises Solutions 1
WUCT121
Discrete Mathematics
Logic
Tutorial Exercises Solutions
1. Logic
2. Predicate Logic
3. Proofs
4. Set Theory
5. Relations and Functions
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c

Partial preview of the text

Download WUCT121 Discrete Mathematics Logic Tutorial Exercises ... and more Study notes Logic in PDF only on Docsity!

WUCT

Discrete Mathematics

Logic

Tutorial Exercises Solutions

1. Logic

2. Predicate Logic

3. Proofs

4. Set Theory

5. Relations and Functions

Section 1: Logic

Question

(i) If x = 3 , then x < 2.

(a) Statement

(b) False

(c) x = 3 ⇒ x < 2

(ii) If x = 0 or x = 1 , then x = x

2 .

(a) Statement

(b) True

(c) x = ∨ x = ⇒ x = x

2 ( 0 1 )

(iii) There exists a natural number x for which x 2 x

2 = −.

(a) Statement

(b) False

(iv) If x ∈and x > 0 , then if x > 1 then x > 1 ..

(a) Statement

(b) True

(c) ( x ∈ ∧ x > 0 )⇒( x > 1 ⇒ x > 1 )

(v) xy = 5 implies that either x = 1 and y = 5 or x = 5 and y = 1.

(a) Statement

(b) False. Consider x =− 1 and y =− 5 or x =− 5 and y =− 1.

(c) xy = 5 ⇒(( x = 1 ∧ y = 5 )∨( x = 5 ∧ y = 1 ))

(vi) xy = 0 implies x = 0 or y = 0.

(a) Statement

(b) True

(c) xy = 0 ⇒ x = 0 ∨ y = 0

(vii) xy = yx.

(a) Statement

(b) True

(viii) There is a unique even prime number.

(a) Statement

(b) True, x = 2.

Question

(a) The truth tables for p ∨ ~ p and p ∧ ~ p.

p p (^) ∨ ~ p p (^) ∧ ~ p

T T F F T

F (^) T T (^) F F

(b) p ∨ ~ p is a tautology i.e. always true; p ∧ ~ p is a contradiction, i.e. always false

(c) Use truth tables.

p q ( p (^) ∨ ~p ) (^) ∨ q ( p (^) ∧ ~p ) (^) ∧ q

T T T F (^) T F F (^) F

T F T F (^) T F F (^) F

F T T T T F T F

F F T T T F T F

Step: 2 1 3* 2 1 3*

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.

Question

(a) The truth tables for the statements ( p ∨ ~ p ) ∧( q ∨ r )and q ∨ r.

p q r ( p~p ) ∧ ( qr ) qr

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

(b) The truth tables for the statements ( p ∧ ~ p ) ∨( q ∧ r )and q ∧ r.

p q r ( p~p ) ∨ ( qr ) qr

T T T F F T T T

T T F F F F F F

T F T F F F F F

T F F F F (^) F F (^) F

F T T F T T T T

F T F F T F F F

F F T F T F F F

F F F F 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 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

entirely on the truth-value of P. Similarly, if you have a compound statement, S , of

the form “ F ∨ P ”, where F stands for a contradiction, then the truth-value of S

depends entirely on the truth-value of P.

Question

(a) ( p ⇒ q ) ∨( p ⇒~ q )

( pq ) ∨^ ( p ⇒ ~ q )

Step 1 4* 3 2

Place F under main connective F

⇒ must be F F^ F

1

st ⇒ , p must be T and q must be F.

2

nd ⇒ , p must be T and ~ q must be F

T (^) F T 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 )

~( pq ) ∨^ ( qp )

Step 2 1 4* 3

Place F under main connective F

~must be F and ⇒ must be F F F

1

st ⇒ must be T. 2

nd ⇒ , q must be T

and p must be F

T T F

1

st ⇒ p can be F and q can be T,

no conflict

F T

There is no contradiction, thus the statement is not a tautology

Question

(a) If x is a positive integer and 3

2 x ≤ then x = 1.

The proposition is True.

If x is a positive integer, then 3 3

2 x ≤ ⇒ x ≤.

Now 3 ≈ 1. 7 and so x = 1.

(b) (^ ~ (^ x > 1 )^ ∨~(^ y ≤ 0 ))^ ⇔~((^ x ≤ 1 )^ ∧(^ y > 0 )).

The proposition is false. (You should have tried proving it using De Morgan’s Laws and failed.)

Now find values of x and y that make the statement false.

Let x = 0 and y = 1.

and thepropositionis False.

Thus,~ 1 0 isFalse

1 0 isalsoTrue

~ 1 ~ 0 isTrue

≤ ∧ >

≤ ∧ >

∨ ≤

x y

x y

x y

Question

(a)

≡ > ∨ > ≤

≡ > ∨ ≤

≡ > ∨ ≤

⇒ ≤

( 1 ) ( 0 ) Negation of

( 1 ) ~( 0 ) DoubleNegation

~(~( 1 )) ~( 0 ) ImplicationLaw

~( 1 ) ~( 0 )

x y

x y

x y

x y

(b)

≡ ≤ ∨ >

≤ ⇒ >

0 1 Negation of

~ 0 1 ImplicationLaw

0 1

y x

y x

y x

.

Question

Idempotent Law

Associativity

DoubleNegation

~~ ~~ DeMorgan's

~ ~ ~

p q

p q q

p q q

p q q

p q q

≡ ∨

≡ ∨ ∨

≡ ∨ ∨

≡ ∨ ∨

∨ ∧

Section 2 :Predicate Logic

Question

(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!

Question

(a)x ∈, ∀ y ∈,( xy = 0 ⇒( x = 0 ∧ y = 0 ))

The statement is false (consider x = 1 and y = 0 ).

(b)x ∈, ∃ y ∈, xy

The statement is true.

(c) ∃ student s in WUCT121, ∀ lecturer’s jokes j , s hasn’t laughed at j.

True or false ??

Question3 Let H be the set of all people (human beings).

(a) P : ∃ p ∈ H ,∀ q ∈ H , p loves q.

( )

( )

p H q H p q

p H q H p q

P p H q H p q

, , doesn't love

,~ , loves

~ :~ , , loves

In a nice world, P is true!.

(b) P : ∀ pH ,∀ qH , p loves q.

( )

( )

p H q H p q

p H q H p q

P p H q H p q

, , doesn't love

,~ , loves

~ :~ , , loves

In a perfect world, P is true!

(c) P : ∃ pH ,∃ qH , p loves q.

( )

( )

p H q H p q

p H q H p q

P p H q H p q

, , doesn't love

,~ , loves

~ :~ , , loves

P is definitely true!

(d) P : ∀ pH ,∃ qH , p loves q.

( )

( )

p H q H p q

p H q H p q

P p H q H p q

, , doesn't love

,~ , loves

~ :~ , , loves

In our world, P is probably true!

(h) ( )

2 2 ∃ x ∈, ∃ y ∈ , x < yx < y

This statement is true. Let x = 0 and y = 1. Then x < y and

2 2 x = 0 < 1 = y.

Question5 For each of the following statements,

(i) ~(∀ ξ > 0 ,∃ x ≠ 0 , x < ξ)

x x

x x

The negation of the statement is false.

For any ξ > 0 , we can take

2

ξ

x = and we have x ≠ 0 but x < ξ.

(ii) ( )

2 ~ ∃ y ∈,∀ x ∈, , y < x

( )

2

2

y x y x

y x y x

The negation of the statement is false.

Let y =− 1. We know 0

2 x ≥ for all x ∈, i.e. x > y

2 .

(iii) (^)  

∀ ∈ ∀ ∈ < ⇒ < y

x y y x x y x 2

y x ( x y ( y x x y ))

y

x y x

x y y x x y

y

x y y x x y x

y

x y y x x y x

The negation of the statement is false.

Clearly, x < y ∧( yxxy )is equivalent to x < yxy , which is

impossible.

Question

(a)

2

2

2

x x

x x

P x x

(b)

x x x

x x x

Q x x x

2

2

2

Question

(a)

x y y x

x y y x

x y y x

P x y y x

P x y y x

The true statement is P because for a real number x , x – 1 is a smaller real

number.

(b)

x x

x x x

x x x

x x x

Q x x x

Q x x x

The true statement is ~ Q because x = 0 is neither positive nor negative.

Question

(a)

( ) ( )

x x

x x x x

The negation is true.

(b)

( ( ))

( )

,( isnotodd isnoteven) (DeMorgan's)

,~ isodd iseven

~ , isodd iseven

z z z

z z z

z z z

The original statement is true

(c)

( ( ))

( )

,^ (^ isodd isnot prime)^ (DeMorgan's)

,~ iseven isprime

~ , iseven isprime

n n n

n n n

n n n

The original statement is true.

(b)

( )

( )

2

2

2

x x

x x

x x

The original statement is false. For any real number, x , 0

2 x ≥ , so 1 1

2 x + ≥.

Thus, 1 0

2 x + ≠.

(c)

( ( ) ( ) )

( ( ) ( ) )

x y z x ( y z ) ( x y ) z

x y z x y z x y z

x y z x y z x y z

The original statement is false. Let x = y = 1 and z = 0.

Then 1 − ( 1 − 0 ) = 1 − 1 = 0 and ( 1 − 1 ) − 0 = 0 − 0 = 0.

(d)

( )

( )

( )

x y x y

x y x y

x y x y

x y x y

The negation is false. For any real number x , xx = 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.

(a) P : ∀ n ∈,∃ m ∈, n > m

( )

( )

( )

n m n m

n m n m

n m n m

P n m n m

The statement P is false. Let n = 1. All natural numbers m are greater than n.

(b) : , 0

2 Px ∈ x

( )

( )

2

2

2

x x

x x

P x x

The statement ~ P is false. For any real number x ,

2 x is not less than 0.

(c) Let D be the set of all dogs.

P : ∃ dD , d isvegetarian..

( )

( )

, isnot veget arian

,~ isvegetarian

~ :~ , isvegetarian

d D d

d D d

P d D d

The statement ~ P is probably false.

(d) P : ∃ x ∈, x isrational.

( )

( )

, isnot ratio nal

,~ isrational

~ :~ , isrational

x x

x x

P x x

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.

P : ∀ sS ,∃ mM , s likes m.

( )

( )

( )

s S m M s m

s S m M s m

s S m M s m

P s S m M s m

, , dislikes

, ,~ likes

,~ , likes

~ :~ , , likes

Unfortunately, P is more likely to be false.

(d) Statement is of the form ∀ xD , ∀ yD , 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

n + m , 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 ∀ xD , 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 = 2 k + 1 for some k ∈), then we must use a different letter for defining m as

an even integer (e.g. m = 2 q for some q ∈).

Question

(a) Statement is of the form ∀ xD , Q ( x ), where Q ( x )is “ x 1 2 x

2

  • ≥ ”.

Thus we must find a P ( x )to give the form ∀ xD , P ( x )⇒ Q ( x )

We know that for all , 0

2 x ∈  x ≥ , so let P ( x )be “ 0

2 x ≥ ”.

x x

x x

x x

2

2

2 2

Therefore for x , x 1 2 x

2 ∈  + ≥.

(b) Statement is of the form ∀ nD , P ( n )⇒ Q ( n ), where P ( n )is “ n is odd” and

Q ( n )is “

2 n is odd”

( )

is odd

2 1 where 2 2

isodd 2 1 ,

2

2 2

2 2

2 2

n

n q q p p

n p p

n p p

n n p p

Therefore, For n ∈,if n is odd,

2 n is odd.

(c) Statement is of the form ∀ xD , ∀ yD , P ( x , y )⇒ Q ( x , y ), where P ( x , y )is

“any two odd integers” and Q ( x , y )is “sum is even”.

Let x , y be any two odd integers.

isodd 2 1

isodd 2 1

r r p q

p q

p q

x y p q

y y q q

x x p p

Therefore, the sum of any two odd integers is even.

(d) Statement is of the form ∀ xD , P ( x )⇒ Q ( x ).

Let ABC be a triangle, with angles A , B and C.

We are given that the sum of two angles is equal to the third angle, i.e.

A + B = C K( 1 ).

We know that A + B + C = 180 °, since the angle sum of a triangle is 180 .°

isa rightangled triangle

180 180 by (1)

ABC
C
C
A B C C C

Therefore f the sum of two angles of a triangle is equal to the third angle, then the

triangle is a right angled triangle

Question5 Statement is of the form ∀ xD , P ( x )⇒ Q ( x ), where P ( x )is “ x is

negative real number”, and Q ( x )is “ ( 2 ) 4

2 x − > ”.

We know that for all x ∈ , x < 0

2

2

2

x

x x

x x

x x

x x

Therefore if x is a negative real number, then ( 2 ) 4

2 x − > ..

Question6 Statement is of the form ∃ xD , P ( x ), so to prove, must show one xD ,

which makes P ( x )true.

Let 7. 2 1 128 1 127

7 n = − = − = , which is prime.

Therefore, there is an integer n > 5 such that 2 − 1

n is prime

( )

is odd

2 1 where 2 2

isodd 2 1 ,

2

2 2

2 2

2 2

n

n q q p p

n p p

n p p

n n p p

Therefore, if n is odd,

2 n is odd, and so by proof by contraposition, if

2 n is even,

then n is even

Question10 Statement is of the form: ∀ mD , P ( m )⇒ Q ( m ), where P ( m )is “ m is

an integer”, and Q ( m )is “ 1

2 m + m + is always odd”. Now if m is an integer, then m

is even or m is odd, thus P ( m )≡ R ( m )∨ S ( m ), where R ( m )is “ m is even”, and

S ( m )is “ m is odd”.

Hence ( ) ( ) ( ( ) ( )) ( )

Rm Qm S m Q m

Pm Qm Rm Sm Qm

Case 1: Prove: R ( m )⇒ Q ( m ), i.e. If m is even, then 1

2 m + m + is always odd

( )

1 is odd

1 2 1 where 2

iseven 2 ,

2

2 2

2 2

2 2

m m

m m q q p p

m m p p

m m p p

n n p p

Therefore if m is even, then 1

2 m + m + is always odd

Case 2: Prove: S ( m )⇒ Q ( m ), i.e. If m is odd, then 1

2 m + m + is always odd

( )

1 is odd

1 2 1 where 2 3 1

isodd 2 1 ,

2

2 2

2 2

2 2

m m

m m l l k k

m m k k

m m k k k

m m k k

Therefore if m is odd, then 1

2 m + m + is always odd.

Thus if m is even or m is odd, then 1

2 m + m + is always odd, and so if m is an

integer, then 1

2 m + m + is always odd.

Question11 Disprove the statement: a b a b

a b a b

∀ ∈ ≠ ≠. Are there

any values for a , b that make the statement true? Explain.

Statement is of the form ∀ xD , P ( x ), that is a universal statement, so requires

disproof with counterexample

Let a = 1 and b = 2.

Then 3

a + b

But, a b a + b

Thus by counterexample the statement a b a b

a b a b

∀ ∈ ≠ ≠ is false

There are no real values that make the statement true.

If you try to solve for a and b , you come across a quadratic with only complex

solutions

Question12 Prove or disprove this statement: For all integers, a , b if a < b , then

2 2 a < b.

Statement is of the form ∀ xD , ∀ yD , 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

2 2 a = 25 > 4 = b

Thus by counterexample the statement ∀ xD , ∀ yD , P ( x , y )⇒ Q ( x , y )is false.

Question13 Prove if

2 n is odd, then n is odd.

Statement is of the form: ∀ nD , P ( n )⇒ Q ( n ), where P ( n )is “

2 n is odd”, and

Q ( n )is “ n is odd”. Direct proof is not possible, thus use proof by contraposition.

To prove by contraposition we must show ∀ nD , ~ Q ( n )⇒~ P ( n ). ~ Q ( n )is “ n is

not odd”, i.e. “ n is even”, and ~ P ( n )is “

2 n is not odd”, i.e. “

2 n is even”.

is even

2 where 2

iseven 2 ,

2

2 2

2 2

2 2

n

n q q p

n p

n p

n n p p

⇒ = ×

Therefore, if n is even,

2 n is even, and so by proof by contraposition, if

2 n is odd,

then n is odd