Module 1
Module 1
Module1
Mathematical Logic
Prepared by
Venkatesh P
Assistant Professor
Department of Science and Humanities
Sri Sairam College of Engineering
Anekal, Bengaluru
-562106
Regulation-2018 (CBCS Scheme) Discrete mathematical structure
-18CS36
Module-1 Mathematical
Logic
☻Syllabus:
Fundamentals of Logic: Basic Connectives and Truth Tables, Logic Equivalence – The
Laws of Logic, Logical Implication – Rules of Inference. The Use of Quantifiers, Quantifiers,
Definitions and the Proofs of Theorems.
From the above examples we note that 1, 2, 3 are proposition, whereas 4 and 5 are not the
propositions.
Logical Connectives and Truth table:
New propositions are obtained by starting with given propositions with the aid of words or
phrases like ‘not’, ‘and’, ‘if … then, and ‘if and only if’. Such words or phrases are called
Logical connectives.
1. Negation:
A proposition is obtained by inserting the word ‘not’ at an appropriate place in the given
proposition is called the negation of the given proposition.
The negation of a Proposition p is denoted by ¬ p (read ‘not p’). For any Proposition p, if p
is true, then ¬ p is false, and if p is false, then ¬ p is true. i.e., If the truth value of a
proposition p is 1 then the truth value of ¬ p is 0 and If the truth value of a proposition p is 0
then the truth value of ¬ p is 1.
Example:
p: 4 is an even number.
¬ p: 4 is not an even number.
p ¬p
0 1
1 0
2. Conjunction:
A compound proposition obtained by combining two given propositions by inserting the
The conjunctionof two propositions p and q is denoted pby˄ q (read ‘p and q’). The
conjunction p ˄ qis true only when p is true and q isintrue,
all other cases it is false. i.e., the
truth value of the conjunction
p ˄ qis 1 only when the truth value of p is 1 and truth value of
q is 1, in all other cases the truth value
p ˄ qof
is 0.
Example:
p: √2 is an irrational number.
q: 9 isa prime number.
p q p˄q
0 0 0
0 1 0
1 0 0
1 1 1
3. Disjunction:
word ‘and’ in between them is called the conjunction of the given proposition.
A compound proposition obtained by combining two given propositions by inserting the
word ‘or’ in between them is called the disjunction of the given propositions.
5. Conditional:
A compound proposition obtained by combining two given propositions by using the words
‘if’ and ‘then’ at appropriate places is called a conditional.
The Conditional “If p, then q” is denoted by p → q and the Conditional “If q, then p” is
denoted by q → p. The Conditional p → q is false only when p is true and q is false, in all
other cases it is true. i.e., the truth value of the conditional p → q is 0 only when the truth
value of p is 1 and the truth value of q is 0, in all other cases the truth value of p → q is 1.
Example: p: 3 is a prime
number.
Problems:
(ⅳ) Since q is false and r is true, (q ˄ r) is false. Also, p is false, therefore p → (q ˄ r) is true.
Thus, the truth value of p → (q ˄ r) is 1.
(ⅴ) Since r is true and q is false (q → r) is true. Also, p is false. Therefore, p ˄ (q → r) is false.
Thus, the truth value of p ˄ (q → r) is 0
(ⅵ) Since r is true, ¬ r is false. Since q is false, q → (¬ r) is true. Also, p is false. Therefore, p
→ (q →¬ r) is true. Thus, the truth value of p → (q→¬ r) is 1.
3. Indicate how many rows are needed in the truth table for the compound proposition
(p ˅ (¬ q)) ↔ ((¬ r) ˄ s) → t. Find the truth value of the proposition if p and r, are true
and q, s, t, are false.
Solution:
The given compound proposition contains five primitives p, q, r, s, t. Therefore, the number
of possible combinations of the truth values of these components which we have to consider
is 25=32. Hence 32 rows are needed in the truth table for the given compound proposition.
Next, suppose that p and r, are true and q, s, t are false, then ¬ q is true and ¬ r is false. Since
p is true and ¬ q is true, (p ˅ (¬ q)) is true on the other hand, since ¬ r is false and s is false, ¬
r ˄ s is false. Also, t is false. Hence ((¬ r) ˄ s) →t is true.
Since (p ˅ (¬ q)) is true and ((¬ r) ˄ s) → t is true, it follows that the truth values of the given
propositions (p ˅ (¬ q)) ↔ ((¬ r ˄ s) → t is 1.
Solution:
(ⅰ) p ˅ q ˄ [ ¬ {(¬ p) ˄ q}]
= p ˅ q ˄ {(¬ ¬ p) ˅ (¬ q)} By De Morgan’s law
= p ˅ q ˄ {p ˅ (¬ q)} By Law of double negation
˅ ˄
= p ˅ Fo By Inverse law = p {q
(¬ q)}
=p By Identity law
Let s be a statement. If s contains no logical connectives other than ˄ and ⅴ, the dual of s
denoted by sd, is the statement obtained from s by replacing each occurrence of ˄ and ⅴ by
ⅴ and ˄ respectively, and each occurrence of To and Fo by Fo and To, respectively. Example:
Given the primitive statements p, q, r and the compound statements s: (p ˄ (¬ q)) ⅴ (r ˄ To)
¬ [ ¬ p ˄ ¬ q]
¬p↑¬q
ⅱ. ¬ (p ↑ q) ¬ [ ¬ (p ˄ q)]
¬ [ ¬ p ⅴ ¬ q]
¬p↓¬q
2. For any propositions p, q, r Prove the following
(i). p ↑ (q ↑ r) ⇔ ¬ pⅴ (q ˄ r) (ii). (p ↑ q) ↑ r ⇔ (p ˄ q) ⅴ¬ r
(iii). p ↓ (q ↓ r) ⇔ ¬ p ˄ (q ⅴr) (iv). (p ↓ q) ↓ r ⇔ (p ⅴ q) ˄ ¬ r
Solution: Using definition, we find that
(i). p ↑ (q ↑ r) ⇔ ¬ [p ˄ (q ↑ r))]
⇔ ¬
⇔ ¬ [¬ (p ˄ q)] ⅴ ¬ r [¬ (p
˄ q)
⇔ (p ˄ q) ⅴ¬ r
˄ r]
(iii). p ↓ (q ↓ r) ⇔ ¬ [p ⅴ (q ↓ r))]
⇔ ¬
[p ⅴ
¬ (q
ⅴ r)]
⇔ ¬ p ˄ ¬ [ ¬ (q ⅴ r)]
⇔ ¬ p ˄ (q ⅴr)
(iv). (p ↓ q) ↓ r ⇔ ¬ [(p ↓ q) ⅴ r]
⇔ ¬ [¬ (p ⅴ q) ⅴ r]
⇔ ¬ [¬ (p ⅴ q)] ˄ ¬ r
⇔ (p ⅴ q) ˄ ¬ r
0 0 1 1 1 1 1 1
0 1 1 0 1 0 0 1
1 0 0 1 0 1 1 0
1 1 0 0 1 1 1 1
Problems:
1. State the converse inverse and contrapositive of
ⅰ) If the triangle is not isosceles, then it is not equilateral
ⅱ) If the real number x 2 is greater than zero, then x is not equal to zero. iii)
If a quadrilateral is a parallelogram, then its diagonals bisect each other.
Solution:
(ⅰ) p: Triangle is not isosceles and q: Triangle is not equilateral.
Implication: p → q. if triangle is not isosceles then it is not equilateral.
Converse: q → p. if a triangle is not equilateral then it is not isosceles.
Inverse: ¬ p →¬ q. if a triangle is isosceles then it is equilateral.
Contrapositive: ¬ q→¬ p: if a triangle is equilateral then it is isosceles.
(ⅱ) p: A real number x2 is greater than zero and q: x is not equal to zero.
Implication: p → q. if a real number x2 is greater than zero then, x is not equal to zero.
Converse: q → p. if a real number x is not equal to zero then, x2 is greater zero.
Inverse: ¬ p→¬ q. if a real number x2 is not greater than zero then, x is equal to zero.
Contrapositive: If a real number x is equal to zero then, x2 is not greater than zero (ⅰii)
p: If Quadrilateral is a parallelogram and q: its Diagonals Bisects each other.
Implication: p → q. If Quadrilateral is a parallelogram, then its diagonals bisects each
other.
Converse: q → p. If the diagonals of the Quadrilateral bisect each other, then it is a
parallelogram.
Inverse: ¬ p →¬ q. If Quadrilateral is not a parallelogram, then its diagonals do not bisect
each other.
Contrapositive: ¬ q→¬ p: If the diagonals of the Quadrilateral do not bisect each other,
then it is a not a parallelogram.
2. Write down the following statements in the ‘Necessary and Sufficient Condition’
Language.
ⅰ) If the triangle is not isosceles, then it is not equilateral
ⅱ) If the real number x2 is greater than zero, then x is not equal to zero. iii)
If a quadrilateral is a parallelogram, then its diagonals bisect each other.
Solution:
Necessary Condition Language:
(i). For a triangle to be non-isosceles it is necessary that is not equilateral.
(ii). A necessary condition for a real number x 2 to be greater than zero is that x is not equal to
zero.
(iii). A necessary condition for a quadrilateral to be a parallelogram is that its diagonals bisect
each other.
Problems:
1. Test whether the following is valid argument.
If Sachin hits a century, then he gets a free car.
Sachin hits a century.
∴ Sachin gets a free car.
Solution: Let p: Sachin hits a century.
q: Sachin gets a free car.
The
p→q given
𝑝
∴𝑞
In view of Modus Pones Rule, this is a valid argument.
2. Test the validity of the following arguments.
If Ravi goes out with friends, he will not study.
If Ravi does not study, his father will become angry.
His father is not angry.
∴ Ravi has not gone out with friends.
Solution: Let p: Ravi goes out with friends.
q: Ravi does not study.
r: His father gets angry.
Then the given argument reads.
p→q
q→r
¬𝑟
∴¬𝑝
This argument is logically equivalent to (Using the rule of syllogism)
𝑝→𝑟
¬𝑟
∴¬𝑝
statement reads
p→q
𝑞
∴𝑝
We note that if p → q and q are true, there is no rule which asserts that p must be true.
Indeed, p can be false when p → q and q are true. See the table below.
p q p→q (p → q) ˄ q
0 1 1 1
∴ r ¬q→¬r ∴ (p ⅴ q) → r
∴ ¬r
Solution:
(i). Since p ˄ q is true, both p and q are true. Since p is true and p → (q → r) is true, q → r
Should be true. Since q is true and q → r is true, r should be true. Hence the given argument
is valid.
(ii). The premises p → ¬ q and ¬ q → ¬ r together yields the premise p → ¬ r. since p is true,
this premise p → ¬ r establishes that ¬ r is true. Hence the given argument is valid.
(iii) We note that
(p → r) ˄ (q → r) ⇔ (¬ p ⅴ r) ˄ (¬ q ⅴ r)
⇔ (r ⅴ¬ p) ˄ (r ⅴ¬ q) By Commutative law
⇔ r ⅴ (¬ p ˄ ¬ q) By Distributive law
⇔ ¬ (p ⅴ q) ⅴr By Commutative & De Morgan’s Law
⇔ (p ⅴ q) → r
This Logical equivalence shows that the given argument is valid.
9. Test whether the following arguments are valid:
r→s r→s
pⅴr ¬qⅴ¬s
∴ qⅴs ∴ ¬ (p ˄ r)
Solution:
(i) We note that
(p → q) ˄ (r → s) ˄ (p ⅴ r) ⇔ (p → q) ˄ (r → s) ˄ (¬ p
→ r)
By Commutative law
⇔ (p → q) ˄ (¬ p → r) ˄ (r → s)
Using Rule of Syllogism
⇔ (p → q) ˄ (¬ p → s)
Using Contrapositive
⇔ (¬ q → ¬ p) ˄ (¬ p → s)
UsingRule of Syllogism
⇔ (¬ q → s)
⇔qⅴs
This Logical equivalence shows that the given argument is valid.
(ii) We note that
(p → q) ˄ (r → s) ˄ (¬ q ⅴ ¬ s) ⇔ (p → q) ˄ (r → s) ˄ (q → ¬ s)
⇔ (p → q) ˄ (q → ¬ s) ˄ (r → s) By Commutative law
⇔ (p → ¬ s) ˄ (r → s) Using Rule of Syllogism
⇔ (p → ¬ s) ˄ (¬ s → ¬ r) Using Contrapositive
⇔ (p → ¬ r) Using Rule of Syllogism
⇔ ¬ p ⅴ¬ r)
⇔ ¬ (p ˄ r)
This Logical equivalence shows that the given argument is valid.
10. Show that the following argument is not valid:
p
pⅴq
q → (r → s)
t→r
∴¬s→¬t
Solution:
Here p is true (premise) and (p ⅴ q) is true (premise). Therefore, q may be true or false.
☻Open statement:
A declaration statement is an open statement
Example: “The number x+2 is an even integer” is denoted by P(x) then ¬ P(x) may be read
as “The number x+2 is not an even integer”.
Quantifiers:
The words “all”, “every”, “some”, “there exist” are associated with the idea of a quantity such
words are called quantifiers.
1. Universal quantifiers:
The symbol Ɐ has been used to denote the phrases “for all” and “for every” in logic “for
each” and “for any” are also taken up to equivalent to these. These equivalent phrases are
called universal quantifiers.
2. Existential quantifiers:
The symbol ∃ has been used to denote the phrases “there exist”, “for some” and “for at
least one” each of these equivalent phrases is called the existential quantifiers.
ⅰ) ∃x, q(x)
ⅱ) ∃x, [ p(x) ˄ q(x)]
ⅲ) ∃x, [ q(x) ˄ s(x)]
Rule1: The statement “Ɐ x ∈ s, p(x)” is true only when p(x) is true for each x ∈ s.
Rule2: The statement “∃ x ∈ s, p(x)” is false only when p(x) is false for every x ∈ s.
*Rules of inference:
Rule3: If an open statement p(x) is known to be true for all x in a universe s and if a ∈ s then
p(a) is true. (this is known as the rule of universal specification).
Rule4: if an open statement p(x) is proved to be true for any (arbitrary) x chosen from a set s
then the quantified statement Ɐ x ∈ s, p(x) is true. (this is known as the rule of universal
generalization)
*Logical equivalence:
Two quantified statements are said to be logically equivalent whenever they have the same
truth values in all possible situations.
The following results are easy to prove.
In words, this reads “For every real number x, x>3 then |x|>3”
Or Equivalently, “Every real number greater than 3 has its absolute value (magnitude) greater
than 3”
This is a true statement.
In words this reads “For every real number x, if |x| ≤3 then x≤3”
Or equivalently, “If the magnitude of a real number is less than or equal to 3, then the number
is less than or equal to 3”
Since the converse and inverse of a conditional are logically equivalent the statements ( ⅱ)
and (ⅲ) have the same truth values. Thus ⅲ) is a true statement.
Then the contrapositive of statement (i) is Ɐ x, [¬ q(x) → ¬ p(x)]…………………(ⅳ)
“Every real number which is less than or equal to 3 has its magnitude less than or equal to 3”.
2. Let p(x): x2-7x+10, q(x): x2-2x-3, r(x): x<0.
Determine the truth or falsity of the following statements. When the universe U contains
only the integers 2 and 5. If a statement is false. Provide a counter example or
explanation.
Accordingly:
(ⅰ) Since p(x) is true for all x ∈ U and ¬ r(x) is true for all x ∈ U, the statement Ɐ x,
[p(x) → ¬ r(x)] is true.
(ⅱ) Since q(x) is false for all x ∈ U and r(x) is false for all x ∈ U, the statement Ɐ x,
[q(x) → r(x)] is true.
(ⅲ) Since q(x) and r(x) are false for x=2, the statement ∃ x, [q(x) → r(x)] is true.
(ⅳ) Since p(x) is true for all x ∈ U but r(x) is false for all x ∈ U. the statement p(x) → r(x) is
false for all x ∈ U. consequently, ∃ x, [p(x) → r(x)] is false.
3. Negate and simplify each of the following.
{Ɐ x ∈ T, p(x)} → {Ɐ x ∈ T, ¬ q(x)}
The negation of this is
{Ɐ x ∈ T, p(x)} ˄ {∃ x ∈ T, q(x)}
In words, this reads “All triangles are right angled and some triangles are equiangular”.
Logical implication involving quantifiers
We note that
We note that
Ɐ x, [p(x) → q(x)] ˄ {Ɐ x, [q(x) → r(x)]} ˄ ¬ r(c)
⇒ {Ɐ x, [p(x) → r(x)] ˄ ¬ r(c)}, By Rule of Syllogism
⇒ {[p(c) → r(c)] ˄ ¬ r(c)}, By Rule of Universal Specification
⇒ ¬ p(c) By Modus Tollens Rule
This proves that the given argument is valid.
8. Prove that the following argument is valid.
Ɐ x, [p(x) ⅴ q(x)]
∃ x, ¬ p(x)
Ɐ x, [¬ q(x) ⅴ r(x)]
Ɐ x, [s(x) → ¬ r(x)]
∴ ∃ x, ¬ s(x) Solution:
We note that
Direct proof:
Recall that a proposition of the form “Ɐ x∈ S, p(x)” is true if p(x) is true for every x in
S. if S consists of only a limited number of elements, we can prove that the statement “ Ɐ x
S, p(x)” is true by considering p(a) for each a in S and verifying that p(a) is true (in each case).
Such a method of proof is called the method of exhaustion.
Disproof by counter example:
The way of disproving a proposition involving the universal quantifiers is to exhibit just one
case where the proposition is false. This method of disproof is called disproof by counter
example.
Problems:
1. Prove that, for all integers k and l, if k and l are both odd the k+l is even and kl is odd.
Solution:
Take any two integers k and l, and assume that both of these are odd (hypothesis)
Then k=2m+1, l=2n+! for some integers m and n. therefore, k+1=
(2m+1) +(2n+1) = 2(m+n+1)
kl= (2m+1)(2n+1) = 4mn+2(m+n)+1
We observe that k+l is divisible by 2 and kl is not divisible by 2. Therefore k+l is an even
integer and kl is an odd integer.
Since k and l are arbitrary integers, the proof of the given statement is complete.
2. For each of the following statements, provide an indirect proof by stating and proving the
contrapositive of the given statement.
(ⅰ) for all integers k and l, if kl is odd then both k and l are odd.
(ⅱ) for all integers k and l if k+l is even, then k and l are both even or both odd.
Solution:
The contrapositive of the given statement is
“For all integers k and l, if k is even or l is even then kl is even.
We now prove this contrapositive.
For any integers k and l, assume that k is even.
Then k=2m for some integer m, and kl=(2m)l=2(ml) which is evidently even. Similarly if l is
even, then kl=k(2n)=2kn for some integer n so that kl is even. This proves the contrapositive.
This proof of contrapositive serves as an indirect proof of the given statement.
(ⅱ). Here, the contrapositive of the given statement is
“for all integers k and l, if one of k and l and is odd and the other is even, then k+l is odd”
We now prove this contrapositive
For any odd integers k and l, assume that, one of k and l is odd and the other is even.
Suppose k is odd and l is even. Then k=2m+1 and l=2n for some integers m and n.
consequently k+l=(2m+1)+2n which is evidently odd.
Similarly, if k is even and l is odd, we find that k+l is odd. This proves the contrapositive.
This proof of contrapositive serves as an indirect proof of the given statement.
3. Give (ⅰ) direct proof (ⅱ) indirect proof (ⅲ) proof by contradiction for the
following statement: “if n is an odd integer, then n+9 is an even integer”.
Solution:
(ⅰ) Direct proof: assume that n is an odd integer. Then n=2k+1 for some integer k. This gives
n+9 = (2k+1)+9 = 2(k+5) from which it is evident that n+9 is even. This establishes the truth
of the given statement by a direct proof.
(ⅱ) Indirect proof: assume that n+9 is not an even integer. Then n+9 = 2k+1 for some
integer k. This gives n = (2k+1)-9=2(k-4), which shows that n is even. Thus, if n+9 is not
even, then n is not odd. This proves the contrapositive of the given statement. This proof of
the contrapositive serves as an indirect proof of the given statement.
(ⅲ) proof by contradiction: assume that the given statement is false. That is, assume that n
is odd and n+9 is odd, n+9=2k+1 for some integer k so that n=(2k+1)-9= 2(k-4) which shows
that n is even. This contradicts the assumption that n is odd. Hence the given statement must
be true.
4. Prove that every even integer n with 2≤n≤26 can be written as a sum of most three perfect
squares.
Solution:
Let S={2, 4, 6, …., 24, 26}. We have to prove that the statement: “ Ɐ x ∈ S, p(x)” is true,
where p(x): x is a sum of at most three perfect squares.
We observe that
2=12+12 16=42
4=22 18=42+12+12
6=22+12+12 20=32+32+12+1 2
8=22+22 22=32+32+22
10=32+12 24=42+22+22
12=22+22+22 26=52+12
14=32+22+12
For n=0 it is true that n 2=02=0=n and if n=1 is also true that n 2=12=1=n. however we cannot
conclude that n2=n for every integer n.
The rule of universal generalisation does not apply here, for we cannot consider the choices
of 0 (or 1) as an arbitrarily chosen integer. If n=2, n 2=4≠n=2, and this one counter example is
enough to tell us that the given statement is false.
However, either replacement namely n=0 or n=1 is not enough to establish the truth of the
statement. For some integer n, n2=n or ∃ n {n2=n}.
7. For all positive integers x and y if the product xy exceeds 25, then x>5 or y>5.
Solution:
Consider the negation of the conclusion that is suppose that 0 < x≤ 5 and 0 < y≤ 5. Under
these circumstances we find that 0< 𝑥 ∙ 𝑦 < 5 ∙ 5 = 25.
So, the product of xy does not exceed 25.