National University of Sciences & Technology (NUST)
School of Electrical Engineering and Computer Science (SEECS)
Department of Basic Sciences
Discrete Mathematics
MATH-161
Lecture # 4
Course Instructor: Dr Saira Zainab
Cell # :03325193283
Email:
[email protected] Office # 207, IAEC
1
More Examples
(Conditional Operator)…
4. Determine whether each of these conditional statements is true or false.
a)If 1 + 1 = 2, then 2 + 2 = 5.
b)If 1 + 1 = 3, then 2 + 2 = 4.
c)If 1 + 1 = 3, then 2 + 2 = 5.
d)If monkeys can fly, then 1 + 1 = 3.
e)If 1 + 1 = 3, then unicorns exist.
f)If 1 + 1 = 3, then dogs can fly.
g)If 1 + 1 = 2, then dogs can fly.
h)If 2 + 2 = 4, then 1 + 2 = 3.
Conditional Statements
Converse, Contrapositive, Inverse
The proposition q p is called the converse statement of p q.
The proposition q p is called the contrapositive statement of p q.
The proposition p q is called the inverse statement of p q.
p q pq qp q p qp pq
T T T T F F T T
T F F T T F F T
F T T F F T T F
F F T T T T T T
3
Conditional Statements
Example:
What are the contrapositive, the converse, and the inverse of the
conditional statement
“The home team wins whenever it is raining”
Solution:
Because “q whenever p” is one of the ways to express the conditional
statement p → q, the original statement can be rewritten as
“If it is raining, then the home team wins.”
The contrapositive is
“If the home team does not win, then it is not raining.”
The converse is
“If the home team wins, then it is raining.”
The inverse is
“If it is not raining, then the home team does not win.”
4
Conditional Statements
Q. State the converse, contrapositive, and inverse of each of these
conditional statements.
a)If it snows today, I will ski tomorrow.
b)I come to class whenever there is going to be a quiz.
c)A positive integer is a prime only if it has no divisors other than 1 and
itself. (if p then q)
Q. State the converse, contrapositive, and inverse of each of these
conditional statements.
a)If it snows tonight, then I will stay at home.
b)I go to the beach whenever it is a sunny summer day.
c)When I stay up late, it is necessary that I sleep until noon.
5
Conditional Statements
It is necessary to wash Boss’s car to get promoted.
Equivalent to say
If you get promoted, then you wash boss’s car.
Contrapositive is
If you do not wash boss’s car then you do not get promoted.
6
Conditional Statements
Conditional Converse
pq qp
Inverse Contrapositive
p q qp
7
Assignment of the value
What is the value of x after each of these statements is encountered in a
computer program, if x = 1 before the statement is reached?
a)if x + 2 = 3 then x := x + 1
b)if (x + 1 = 3) OR (2x + 2 = 3) then x := x + 1
c)if (2x + 3 = 5) AND (3x + 4 = 7) then x := x + 1
d)if (x + 1 = 2) XOR (x + 2 = 3) then x := x + 1
e)if x < 2 then x := x + 1
8
Bits and Bits Strings
Find the bitwise OR, bitwise AND, and bitwise XOR of each of these pairs of
bit strings.
a)101 1110, 010 0001
b)1111 0000, 1010 1010
c)00 0111 0001, 10 0100 1000
d)11 1111 1111, 00 0000 0000
9
Conditional Statements
Biconditional Statements
Definition: Let p and q be propositions. The biconditional
statement pq, is the proposition “p if and
only if q”.
The biconditional (bi-implication) statement
p q is true when p and q have same truth
values and is false otherwise.
If p=q, then p q=1
10
Conditional Statements
Biconditional Statements
“p is necessary and sufficient for q”
“if p then q, and conversely”
“p iff q.”
Example: Let p be the statement “You can take the
flight,” and let q be the statement “You buy a
ticket.” Then p ↔ q is the statement “You can
take the flight if and only if you buy a ticket.”
11
Biconditional (if and only if)
• Binary Operator, Symbol:
p q pq p q pq
T T T 1 1 1
T F F 1 0 0
F T F 0 1 0
F F T 0 0 1
12
Biconditional (if and only if)
Write each of these propositions in the form “p if and only
if q” in English.
•If it is hot outside you buy an ice cream cone, and if you
buy an ice cream cone it is hot outside.
•For you to win the contest, it is necessary and sufficient
that you have the only winning ticket.
•You get promoted only if you have connections, and you
have connections only if you get promoted.
•If you watch television your mind will decay, and
conversely.
•The train runs late on exactly those days when I take it.
13
Biconditional (if and only if)
Let p, q, and r be the propositions
p : Grizzly bears have been seen in the area.
q : Hiking is safe on the trail.
r : Berries are ripe along the trail.
Write these propositions using p, q, and r and logical connectives (including
negations).
a)Berries are ripe along the trail, but grizzly bears have not been seen in the
area.
b)Grizzly bears have not been seen in the area and hiking on the trail is
safe, but berries are ripe along the trail.
c)If berries are ripe along the trail, hiking is safe if and only if grizzly bears
have not been seen in the area.
d)It is not safe to hike on the trail, but grizzly bears have not been seen in
the area and the berries along the trail are ripe.
e)For hiking on the trail to be safe, it is necessary but not sufficient that
berries not be ripe along the trail and for grizzly bears not to have been seen
in the area.
f)Hiking is not safe on the trail whenever grizzly bears have been seen in the
area and berries are ripe along the trail. 14
Try as much as you can from…
Relevant Exercises given at the end of Section 1.1 of :
Discrete Mathematics and its Applications
(with Combinatorics and Graph Theory)
6th Edition, The McGraw-Hill Companies, 2007,
Kenneth H. Rosen
(Already uploaded on LMS)