You are on page 1of 20

Islamic University of Gaza

Faculty of Engineering
Department of Computer Engineering
Fall 2011
ECOM 2311: Discrete Mathematics
Eng. Ahmed Abumarasa

Discrete Mathematics

Sec 1.1-1.6
The Foundations: Logic and Proof, Sets, and Functions
Chapter 1:

The Foundations: Logic and Proof, Sets, and Functions

 1.1: Logic

 Propositions must have clearly defined truth values (True or False), so a proposition must
be a declarative sentence with no free variables.
 Not: the negative of the propositions.

E.g. the negative of propositions p is (ꜚp called not p)

 Conjunction: the conjunction between two proposition is the AND connector.

(pᶺq) is true only when both p and q are true.

 Disjunction: the disjunction between two proposition is the OR connector.

(pᵛq) is false only when both p and q are false.

 Exclusive OR:
 Conditional Statements: p q

o CONVERSE: q p
o CONTRAPOSITIVE: ꜚq ꜚp
o INVERSE: ꜚp ꜚq

 Biconditional:
(p ↔ q)p if and only if q.

 consistent System:
System is consistent if all its propositions are true.

 Logic and Bit Operations:


Exercises:
1) 1.1.2: Which of these are propositions? What are the truth values of those that are
propositions?

Do not pass go. Not a proposition


What time is it? Not a proposition
There are no black flies in Maine a proposition
4+ X = 5 Not a proposition
x + 1 = 5 if x = 1. Not a proposition
x + y = y + z if x = z. a proposition

2) 1.1.4: Let p and q be the propositions


p: I bought a lottery ticket this week.
q: I won the million dollar jackpot on Friday.
Express each of these propositions as an English sentence.

a I did not buy a lottery ticket this week.


b Either I bought a lottery ticket this week or I won the million dollar jackpot on Friday.
[in the inclusive sense]
c If I bought a lottery ticket this week, then I won the million dollar jackpot on Friday.
d I bought a lottery ticket this week and I won the million dollar jackpot on Friday.
e I bought a lottery ticket this week if and only if I won the million dollar jackpot on Friday.
f If I did not buy a lottery ticket this week, then I did not win the million dollar jackpot on
Friday.
g I did not buy a lottery ticket this week, and I did not win the million dollar jackpot on Friday.
h Either I did not buy a lottery ticket this week, or else I did buy one and won the million
dollar jackpot on Friday.
3) 1.1.9: Let p and q be the propositions
p : You drive over 65 miles per hour.
q : You get a speeding ticket.
Write these propositions using p and q and logical connectives.

a) You do not drive over 65 miles per hour.


b) You drive over 65 miles per hour, but you do not get a speeding ticket.
c) You will get a speeding ticket if you drive over 65 miles per hour.
d) If you do not drive over 65 miles per hour, then you will not get a speeding ticket.
e) Driving over 65 miles per hour is sufficient for getting a speeding ticket.
f) You get a speeding ticket, but you do not drive over 65 miles per hour.
g) Whenever you get a speeding ticket, you are driving over 65 miles per hour.

a b c d e f g
Not p pᶺ (not p) p q not p not q p q qᶺ (not p) q p

4) 1.1.9: Construct a truth table for each of these compound propositions.

 A
p not p output
T F F
F T F

 C

P q not q P v not q Output


T T F T T
T F T T F
F T F F T
F F T T F

 E

P q not p not q p q not q not p Output


T T F F T T T
T F F T F F T
F T T F T T T
F F T T T T T
 1.2: Propositional Equivalences
 Tautology: A compound proposition that is always true.
 Contradiction: A compound proposition that is always false.
 Contingency: neither a tautology nor contradiction.
 Logical Equivalences: The compound propositions p and q are called logically equivalent if
p↔q is a tautology.
The notation p ≡ q denotes that p and q are logically equivalent.
Exercises:
1) 1.2.4: Use truth tables to verify the associative laws:

a) A
p q R pvq (p v q) v r p q R qvr p v (q v r)
T T T T T T T T T T
T T F T T T T F T T
T F T T T T F T T T
T F F T T T F F F T
F T T T T F T T T T
F T F T T F T F T T
F F T F T F F T T T
F F F F F F F F F F

2) 1.2.12: Determine whether is a tautology.

.False ‫ يمكنا محاولة إثبات العكس أي يعني بحالة وجود إحتمال للمتغيرات تجعل ال الجملة‬,‫ أم ال‬tautology ‫لمعرفة هل هو‬
.T ‫ و األيسر‬F ‫في هذه الحالة يجب جعل الطرف األيمن‬
.T ‫ يجب ان تكون‬q ‫يعني‬
.P = f ‫ يجب انا يكون‬T ‫و لجعل الطرف األيسر‬
. , q =t P = f ‫ و هذا يتوفر بحالة كانت‬, T ‫ يجب ان تكون‬p q ‫باإلضافة ل‬
.tautology ‫ لذا الجملة ليست‬false ‫إذا وجدنا حالة يكون الناتج‬

.truth table ‫ يمكن حل السؤال ب‬:‫مالحظة‬

3) 1.2.14: Show that and are equivalent.

p q p↔q pᴧq Not p ᴧ not q


T T T T F T
T F F F F F
F T F F F F
F F t f t T

4) 1.2.29: Show that is a tautology.

Make it in truth table or follow this:

To make it false

The right side must be false, so (p = T, r = F).


To make the lift side true, so p q must be true since (p=t) so (q =t) and

q r must be true, since (r=f) so (q = f).

So we cannot make it false so it is a tautology.

5) 1.2.34 Find a compound proposition involving the propositions p, q, and r that is true when p
and q are true and r is false, but is false otherwise.

Solution: p ᴧ q ᴧ (not r)
Need discussion with student.

(p =t) , (q =t) and (r =f) ‫ فقط في حالة كان‬true ‫ تجعل النات النهائي‬compound proposition ‫في هذا السؤال يطلب عمل‬

‫ و تكون بحالة‬conjunction ‫في حالة وحدة فقط هي ال‬true ‫من الروابط التي تجعل الجواب‬

T ᴧ T ᴧ T == T ᴧ T ᴧ (not) F == p ᴧq ᴧ (not) r
 1.3 Predicates and Quantifiers
The statement P(x) is said to be the value of the propositional function P at x. Once a value has been
assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.

E.g. if p(x) is x>3 then


P (2): 2>3 proposition with false value.
P (5): 5>3 proposition with true value.

 QUANTIFIERS:
 THE UNIVERSAL QUANTIFIER
∀x P(x): for any x in the universe of discourse p(x) is true.
E.g. p(x): x^2 >= 0, where the universe of discourse consists of all real numbers.
∀x P(x) is true.

 THE EXISTENTIAL QUANTIFIER


∃x p(x): there exist at least x where p(x) is true.
E.g. p(x): x^2 =< 0, where the universe of discourse consists of all real numbers.
∃x P(x) is true when x = 0.

True False
∀x p(x) When P(x) is true for every x. When there is an x for which P(x) is false.
∃x p(x) When there is an x for which P(x) is true. When P{x) is false for every x.

 BINDING VARIABLES:
 When a quantifier is used on the variable x or when we assign a value to this variable,
we say that this occurrence of the variable is bound.
 Variable that is not bound by a quantifier or set equal to a particular value is said to be
free.
E.g.:
∀x ∃y p(x, y): both x and y are pound.
∀x p(x, y): x is pound, but y is free.

 NEGATIONS:
Exercises:

1) 1.3.1 Let P(x) denote the statement "x < 4." What are the truth values?
a) P (0).
b) P (4).
c) P (6).

a b C
true false False

2) 1.3.5 Let P(x) be the statement "x spends more than five hours every weekday in class,"
where the universe of discourse for x consists of all students. Express each of these
quantifications in English.
a) ∃x p(x)
b) ∀x p(x)
c) ∃x ꜚp(x)
d) ∀x ꜚp(x)
A There is a student who spends more than five hours every weekday in class.
B All students spend more than five hours every weekday in class.
C There is a student who does not spend more than five hours every weekday in class.
D All students don’t spend more than five hours every weekday in class.

3) 1.3.7 Translate these statements into English, where C(x) is "x is a comedian" and F(x) is "x is
funny" and the universe of discourse consists of all people.
a) ∀x (C(x) F(x)). b) ∀x (C(x) ᴧ F(x)).
c) ∃x (C(x) F(x)). d) ∃x (C(x) ᴧ F(x)).

a For every one if he/she is a comedian then he/she a funny. (Every comedian is funny).
b Every one is a comedian and funny.
c There exists person if he/she is comedian then he/she funny.
d There exists comedian and funny.

4) 1.3.11 Let P (x) be the statement "x = x^2." If the universe of discourse consists of the
integers, what are the truth values?
e) ∃x p(x) f) ∀x p(x)
e True, If x =1 then 1 =1^2 =1 so there exist x where x=x^2
f False, sense if x=2 so 2 !=2^2, there exist x where p(x) false so ∀x p(x) false.
5) 1.3.22 Translate in two ways each of these statements into logical expressions using
predicates, quantifiers, and logical connectives. First, let the universe of discourse consist of
the students in your class and second, let it consist of all people.
a) Everyone in your class has a cellular phone.
b) Somebody in your class has seen a foreign movie.
c) There is a person in your class who cannot swim.

To make the two ways we suppose that C(x) be the propositional function
“x is in your class.” So

a) ∀x p(x)
Let P(x) is “x has a cellular phone." ∀x (c(x) p(x))
B ∃x P(x)
Let P(x) is “x has seen a foreign movie.” ∃x (C(x) ᴧ P(x)).
C ∃x ꜚP(x)
Let P(x) is “x can swim.” ∃x (C(x) ᴧ ꜚP(x)).

6) 1.3.32 Express the negation of these propositions using quantifiers, and then express the
negation in English.
a) Some drivers do not obey the speed limit.
b) All Swedish movies are serious.
c) No one can keep a secret.
d) There is someone in this class who does not have a good attitude.

A All drivers obey the speed limit.


B Some of Swedish movies are not serious.
C Someone can keep a secret.
d Everyone in this class has a good attitude.
 1.4 Nested Quantifiers

 ∀x ∀y p(x, y): for all x and y p(x, y) true.


 ∀x ∃y p(x, y): for all x there is some y p(x, y) true.
 ∃x ∀y p(x, y): there is x p(x, y) true for all y
 ∃x ∃y p(x, y): for some x and some y p(x, y) true.

e.g. we can see that:

 Every real number has additive inverse.


∀x ∃y (x and y are real numbers) (x+ y =0).

 Distribute a multiply over an add operations.

∀x ∀y ∀z (x* (y + z) = x*y +x*z))

 Statements involving nested quantifiers can be negated by successively applying the rules
for negating statements involving a single quantifier.
ꜚ ∀x ∃y f(x, y) ≡ ∃xꜚ∃y f(x, y) ≡ ∃x ∀y ꜚf(x, y).

 It is important to note that the order of the quantifiers is important, unless all the
quantifiers are universal quantifiers or all are existential quantifiers.
Exercises:

1.4.1 Translate these statements into English, where the universe of discourse for each variable consists
of all real numbers.
a. ∀x ∃y (x< y)
b. ∀x ∀y ( ( (x>=0) ᴧ (y>=0) ) (xy >=0)):
c. ∀x ∀y ∃z (xy=z).

a For every real number x there exist another real number less than x.
b For any two non-negative real numbers the multiplication of them is a non-negative real
number
c For any two real numbers the multiplication of them is real number.

1.4.8 Let Q(x, y) be the statement "student x has been a contestant on quiz show y." Express each of
these sentences in terms of Q(x, y), quantifiers, and logical connectives, where the universe of discourse
for x consists of all students at your school and for y consists of all quiz shows on television.

a. There is a student at your school who has been a contestant on a television quiz show.
b. No student at your school has ever been a contestant on a television quiz show.
c. There is a student at your school who has been a contestant on Jeopardy and on Wheel of
Fortune.
d. Every television quiz show has had a student from your school as a contestant.
e. At least two students from your school have been contestants on Jeopardy.

a ∃x ∃y Q(x, y)
b ꜚ ∃x ∃y Q(x, y)
c ∃x (Q(x, Jeopardy) ᴧ Q(x, Wheel of Fortune))
d ∀y ∃x Q(x, y)
e ∃x1 ∃x2 (Q(x1, Jeopardy) ᴧ Q(x2, Jeopardy) ᴧ (x1 ≠ x2))

1.4.21 Use predicates, quantifiers, logical connectives, and mathematical operators to express the
statement that every positive integer is the sum of the squares of four integers.

Solution:
∀x ∃a ∃b ∃c ∃ ((x x = a2 + b2 + c2 + d2) where the universe of discourse consists of all integers.
1.4.26 Let Q(x, y) be the statement "x + y = x - y." If the universe of discourse for both variables consists
of all integers, what are the truth values?

a False, 1 + 1≠1-1.
b True, 2 + 0=2-0.
c False, 1 + y≠1-y.
d False, x+2 ≠ x-2
e True, 2 + 0=2-0.
f True, x + 0=x-0.
g True, x + 0=x-0.
h False, x+2 ≠ x-2
i False, 1+2 ≠ 1-2

1.4.30 Rewrite each of these statements so that negations appear only within predicates (that is, so that
no negation is outside a quantifier or an expression involving logical connectives).

a. ꜚ ∃x ∃y p(x, y)
b. ꜚ ∀x ∃y p(x, y)
c. ꜚ ∃y (Q(y) ᴧ ∀x ꜚR(x, y))
d. ꜚ∃y (∃x R(x, y) ˅ ∀x S(x, y))
e. ꜚ∃y (∀x ∃z T(x, y, z) ˅ ∃x ∀z U(x, y, z))

a ∀x ∀y ꜚp(x, y)
b ∃x ∀y ꜚ p(x, y)
c ∀y (ꜚQ(y) ˅ ∃x R(x, y))
d ∀y (∀x ꜚR(x, y) ᴧ ∃x ꜚS(x, y))
e ∀y (∃x ∀z ꜚT(x, y, z) ᴧ ∀x ∃z ꜚU(x, y, z))
 Sec 1.5: Rules of Inference

 Rules of Inference for Quantified Statements:


Exercises:

1.5.3 3. What rule of inference is used in each of these arguments?

a) Alice is a mathematics major. Therefore, Alice is either a mathematics major or a computer


science major.
b) Jerry is a mathematics major and a computer science major. Therefore, Jerry is a mathematics
major.
c) If it is rainy, then the pool will be closed. It is rainy. Therefore, the pool is closed.
d) If it snows today, the university will close. The university is not closed today. Therefore, it did
not snow today.
e) If I go swimming, then I will stay in the sun too long. If I stay in the sun too long, then I will
sunburn. Therefore, if I go swimming, then I will sunburn.

Solution:
a Addition rule.
b Simplification rule.
c Modus ponens.
d Modus tollens.
E Hypothetical syllogism.

1.5.6 Use rules of inference to show that the hypotheses "If it does not rain or if it is not foggy, then
the sailing race will be held and the lifesaving demonstration will go on," "If the sailing race is held,
then the trophy will be awarded," and "The trophy was not awarded" imply the conclusion "It
rained."

Solution:

Let the following propositions:


 r: "It rains,"
 f: "It is foggy,"
 s: "The sailing race will be held,"
 l: "The life saving demonstration will go on,"
 T: "The trophy will be awarded."
1. Not t. Hypothesis
2. s t Hypothesis
3. not s Modus tollens using Steps 1 and 2
4. Hypothesis
5. contrapositive of Step 4
6. De Morgan's law and double negative
7. Addition, using Step 3
8. r ᴧ f Modus ponens using Steps 6 and 7
9. r Simplification using Step

1.5.14 for each of these arguments, explain which rules of inference are used for each step.

a) "Linda, a student in this class, owns a red convertible. Everyone who owns a red convertible has
gotten at least one speeding ticket. Therefore, someone in this class has gotten a speeding
ticket."

Solution:
c(x):“x is in this class,"
r(x):”x owns a red convertible,"
t(x): “x has gotten a speeding ticket."

1. Hypothesis
2. Universal instantiation using Step 1
3. r(Linda) Hypothesis
4. t(Linda) Modus ponens using Steps 2 and 3
5. c(Linda) Hypothesis
6. c(Linda) ᴧ t(Linda) Conjunction using Steps 4 and 5
7. ∃x (c(x) ᴧ t(x)) Existential generalization using Step 6
 Sec 1.6: Introduction to Proofs

Methods of Proving Theorems:


 Direct Prove: A direct proof of a conditional statement p q is constructed
when the first step is the assumption that p is true; subsequent steps are
constructed using rules of inference, with the final step showing that q must
also be true.
 Proof by Contraposition: Proofs by contraposition make use of the fact
that the conditional statement p q is equivalent to its contrapositive,
.
 Proofs by Contradiction: Because the statement is a
contradiction whenever r is a proposition, we can prove that p is true if we can
show that
 VACUOUS PROOFS: is true when we know that p is false.
 TRIVIAL PROOFS: is true when we know that q is true.
 PROOFS OF EQUIVALENCE:
Exercise:

1.16.10 Use a direct proof to show that the product of two rational numbers is rational.

Solution:
First number x = a/b, b ≠0
Second number y =c/d, d≠0
X*y = a*c/b*d sense b ≠0 and d≠0 then b*d≠0.
Let a*c = l and b*d = m so x = l/m so x is rational number.

1.16.11 Prove or disprove that the product of two irrational numbers is irrational.

Solution:

To disprove it we need only one case doesn`t match the law.


Now let X = √2, irrational number.
X*X = 2 is rational number. (Product of two irrational numbers is not an irrational number).

1.6.16 Prove that if m and n are integers and m n is even, then m is even or n is even.

Solution:

Let p: m*n is event.


H: m is event.
L: n is event.
e have to prove P (m ᴠ n)
Using prove by Contraposition, not(m ᴠ n) not p
So: m is odd and n is odd
m= 2k +1
n= 2l +1
m*n = (2k +1)*(2l+1) = 4kl + 2k + 2l + 1 = 2(2kl +k + l) +1, let (2kl +k + l) = v
so m*n = 2v +1 so m*n is odd
by Contraposition if m*n is even, then m is even or n is even.
1.6.27 Prove that if n is a positive integer, then n is odd if and only if 5n + 6 is odd.

We must prove two implications.


First, we assume that n is odd and show that 5n + 6 is odd.
By assumption, n = 2k + 1 so 2n +6 = 5(2k +1) =6 = 10k + 11 = 10k +10 +1 = 2(5k +5) +1 = 5V +1
where v = (5k +5), so 5n +6 is odd.

Second, we have to show that if 5n + 6 is odd then n is odd.


Using indirect proves:
Let n is event so n = 2k
5n +6 = 10k +6 = 2(5k +3) so it is event so by contraposition if 5n + 6 is odd then n is odd.

From the two cases we found that n is odd if and only if 5n + 6 is odd.

External question: Prove that if x and y are real numbers, then max(x, y) + min(x, y) = x + y.

Solution:
Like this question we cane analysis it to its cases.
Max(x, y) has two cases if x is the max or y is max
Min(x, y) has two cases if y is the min or x is min

Case 1:
Let x is the max so y is the min so max(x, y) + min(x, y) = x +y.

Case 2:
Let y is the max so x is the min so max(x, y) + min(x, y) = y +x = x +y.

So in all cases max(x, y) + min(x, y) = x +y.

End Of the chapter One.

You might also like