Chapter 5
Chapter 5
Logic
Introduction
In everyday life, reasoning proves different points. For instance, to prove your
parents that you performed well in school, you can show your grades. To prove your
friends that you are a true friend to them, you just need to be a loyal and honest friend.
Similarly, mathematics and computer science use mathematical logic or simply logic
to prove results. In particular, mathematical logic is used in mathematics to prove a
theorem. In computer science, logic is used to prove results of computer algorithm or
the correctness of a computer program.
Learning Outcomes:
At the end of this chapter, you are expected to:
LESSON 1:
LOGIC STATEMENTS AND QUANTIFIERS
Logic Statements
Remember!
If we can determine the truth or falsity of a statement, then it has a
truth value. If the statement is true, then the truth value of the statement is
1 value is false also.
true. But when its false, then the truth
Example 1: Identify Statements
1. Annabelle is beautiful.
2. Where do you live?
3. 1+1=2
4. x + 5 = 7.
Solution:
1. For most people that knows Annabelle they might agree on the statement
but not all will have the same thought specially people who don’t like
Annabelle. Therefore, statement one is not a logical statement.
2. The sentence “Where do you live?” is a question; it is not a declarative
sentence. Hence, it is not a statement.
3. Everyone knows that if 1 is added to 1 the answer will always be 2. Then,
statement 2 is a logical statement.
4. x + 5 = 7 is a statement. It is known as an open statement, a sentence that
has a variable. The truth value of this statement will depends on the value
of x. It is true if x = 2, and it is false for any values of x. For any given x, it
is true or false but not both.
Remember!
1. p: A square is a rectangle.
2. q: Today is Monday.
3. r: Every student has a ballpen.
Solution:
p: Today is Monday.
q: It is not raining.
r: I am going to a shopping.
s: I am not going to play volleyball game.
3
Example 4: Consider the following simple statements.
a: I am going to study
b: I am going to watch a movie.
c: I will not pass the exam.
1. ~a → c
2. b ˄ ~a
3. ~c ↔ a
Solution:
1. If I am not going to study, then I will not pass the exam.
2. I am going to watch a movie and I am not going to study.
3. I will pass the exam if and only if I am going to study.
4
Example 5: Let p, q, and r represent the following statements:
Solution:
1. If Cathy’s dancing style is similat to Maja and Cathy has a messy
hair, then Cathy is a rock dancer.
2. ~ r → (~ q ˄ ~ p )
Conjunction
Remember!
The conjunction p ˄ q is true if and only if both p and q are true.
Disjunction
5
Remember!
The disjunction p ˅ q is true if and only if p is true, q is true, or
both p and q are true.
1. 12 ≥ 10.
2. 6 is an even number and 6 is a composite number.
3. 5 is a prime number and 5 is an odd number.
4. 2 is an integer or 2 is an odd number.
5. – 5 ≤ - 10
Solution:
LESSON 2:
TRUTH TABLES, EQUIVALENT STATEMENTS, AND
TAUTOLOGIES
Truth Table
A truth table is a table used to check the “truth value” of any compound
statement for all possible truth values of its simple statements. It is a way to check all
possible outcomes.
Presented below are the truth tables for negattion, conjunction, and disjunction
for review purposes.
6
p q p˄q
T T T
T F F
F T F
F F F
In this section we will construct truth tables for a statement that involves a
combination of negation, conjunctions and disjunctions. If the given statement involves
only two simple statements, then we have to start by constructing a table with four
rows, called the standard table form.
p q
T T
T F
F T
F F
Now, use the truth values of p and q to produce the truth value of p ˅ q
p q (p ˅ q)
T T T
T F T
F T T
F F F
Negate the truth values in the p ˅ q column to produce the truth value of
~ (p ˅ q)
P q p˅q ~ (p ˅ q)
T T T F
T F T F
F T T F
F F F T
7
Lastly, use the values of ~ (p ˅ q) and q to produce the truth values of
~ (p ˅ q) ˄ q applying the truth value of conjunction. The shaded column
is the truth table for ~ (p ˅ q) ˄ q.
P q p˅q ~ (p ˅ q) ~ (p ˅ q) ˄ q
T T T F F
T F T F F
F T T F F
F F F T F
Solution: Start with the standard truth table form with 3 simple statements involved.
P q r
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
Now, use the truth values of p and q to produce the truth value of p ˅ q
p q r (p ˅ q)
T T T T
T T F T
T F T T
T F F T
F T T T
F T F T
8
F F T F
F F F F
p q r (p ˅ q) (p ˅ q) ˄ r
T T T T T
T T F T F
T F T T T
T F F T F
F T T T T
F T F T F
F F T F F
F F F F F
Solution: Using the procedure developed above, we can produce the following table.
Te shaded column is the truth table for p ˅ [~ (p ˄ ~q)]. The number below
signigfies the sequence in which columns were constructed.
P q r (p ˄ q) ~r (~r ˅ q) (p ˄ q) ˄ (~r ˅ q)
T T T T F T T
T T F T T T T
T F T F F F F
T F F F T T F
F T T F F T F
F T F F T T F
F F T F F F F
F F F F T T F
1 2 3 4
Equivalent Statements
Two statemens are said to be equivalent if they both have the same truth value
for all possible truth values of their simple statements. The symbol ≡ is used to
indicates equivalents statements.
Example 9. Show that ~ ( p ˅ ~ q) and ~p ˄ q are equivalent statements.
Solution: Construct the truth table of the given statements and compare the results.
For ~ ( p ˅ ~ q) :
P q ~q (p ˅ ~q) ~ (p ˅ ~q)
9
T T F T F
T F T T F
F T F F T
F F T T F
For ~p ˄ q:
P q ~p ~p˄q
T T F F
T F F F
F T T T
F F T F
Since the truth values of the given statements are the same, then
~(p ˅ ~ q) ≡ ~p ˄ q.
A tautology is a statement which is “always true” — that is, it is true for every
possible truth value. The opposite of a tautology is a contradiction, a statement which
is “always false”. In other words, a contradiction is false for every possible truth value.
Solution: Construct the truth table for (p → q) ∨ (q → p) and show that the statement
is always true.
p q p→q q→p (p → q) ˅ (q → p)
T T T T T
T F F T T
F T T F T
F F T T T
The last column contains only T’s. Therefore, the statement is a tautology.
Solution: Construct the truth table for p ˄ (~p ˄ q) and show that the statement is
always false.
p q ~p ~p ˄ q p ˄ (~p ˄ q)
T T F F F
T F F F F
F T T T F
F F T F F
10
The last column contains only F’s. Therefore, the statement is a self -
contradiction.
LESSON 3:
THE CONDITIONAL AND THE BICONDITIONAL
Conditional Statements
1. If x + 5 = 8, then x = 3.
2. If a polygon hasfour sides, then it is a quadrilateral.
3. If you don’t study your lesson, then you will not pass the exam.
4. If 2 is an integer, then 2 is a rational number.
Solution:
1. Antecedent: x + 5 = 8
Consequent: x = 3
4. Antecedent: 2 is an integer
Consequent: 2 is a rational number
Remember!
11
The conditional p → q is false if p is true and q is false. It is true in all
other cases.
Solution:
Binconditional Statements
1. y + 7 = 12 if and only if y = 5
2. x2 = 25 if and only if x = 5
3. x > 4 if and only if x > 3.
Solution:
1. The statement is true since the statement “y + 7 = 12” will be only true if “y
= 5”. Otherwise, the statement will be false.
2. If x = -5, the first equation is true and the second equation is false. Thus,
the statement is false.
3. The statement is false. If x = 4, the first statement will become false.
12
LESSON 4:
THE CONDITIONAL AND RELATED STATEMENTS
Every conditional statement has three related statements. They are called the
converse, inverse, and contrapositive.
The Converse
Remember!
The Converse of Conditional Statement
The Inverse
Remember!
The Inverse of Conditional Statement
The Contrapositive
Remember!
The Inverse of Conditional Statement
13
Example 14: Write the converse, inverse, and contrapositive of the following
conditional statements.
Solution:
1. Converse: If I will wake up on time, then I sleep early.
Inverse: If I will not sleep early, then I will not wake up on time.
Contrapositive: If I will not wake up on time, then I will not sleep early.
Observations:
1. Converse and inverse statements are equivalents because they have the
same truth values.
2. Conditional and contrapositive statements are equivalents because they
have the same truth values.
2. If two lines in a plane do not intersect, then the lines are parallel.
If two lines in a plane are not parallel, then the lines intersct.
Solution:
1. The second statement is the converse of the first. Thus, the statements are
not equivalent.
2. The second statement is the contrapositive of the first. Thus, the statements
are equivalent.
14
Chapter Exercise
2. Write the negation of each statement and determine the truth value.
a. p ˄ ~q
15
b. r → ~s
c. s ↔ ~r
d. r˅s
e. p→r
f. ~t ˄ u
a. p ˅ ~q
b. ~p ˄ q
c. (q ˄ ~p) ˅ ~q
d. ~(p ˅ q) ˄ (~r ˅ q)
e. [(p ˄ q) ˅ (r ˄ ~q)] ˄ (r ˅ ~q)
a. If Patsy has a messy hair today, then she will not show up to work.
b. If two lines are parallel, then they will not intersect.
c. If a polygon has 3 sides, then it is a triangle.
d. If the dog is barking, then someone is nearby.
16
8. Determine the truth value of the following conditional and biconditional
statements.
a. If a ≤ 3, then a > 3.
b. If two lines intersect, then it must create a right angle
c. If a=1, b=2, c=3, then a + b + c > 5
d. If a polygon has 3 sides, then it is a triangle.
e. x = 5 if and only if x + 7 = 12.
f. If x > 5 if and only if x > 2.
g. The triangle is an isosceles, if and only if two sides are equal.
h. The angle is acute, if and only if the angle is less than 90° degrees.
17