Lecture#4 DS Fall24
Lecture#4 DS Fall24
DISCRETE STRUCTURES
LECTURE # 4
By,
Dr. Mehwish Manzur
NUTECH
Layout of Today’s Lecture
• Laws of Logic
• Predicates and Quantifiers
• Methods of Proving Theorems
• Introduction to Sets
PREDICATES
Statements involving variables, such as “x > 3,” “x = y + 3,” “x + y = z,” and “computer x is
under attack by an intruder,” And “computer x is functioning properly,” are often found in
mathematical assertions, in computer programs, and in system specifications. These
statements are neither true nor false when the values of the variables are not specified.
“x is greater than 3” has two parts. The variable x, is
the subject of the statement. The second part the
predicate, “is greater than 3”
• We can denote the statement “x is greater than 3” by P (x), where P denotes the predicate
“is greater than 3” and x is the variable.
• The statement P(x) is also 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.
EXAMPLE
Let P(x) denote the statement “x > 3.” What are the truth values of P(4)
and P(2)?
Solution:
We obtain the statement P(4) by setting x = 4 in the statement “x > 3.”
Hence P(4), which is the statement “4 > 3,” is true.
However, P(2), which is the statement “2 > 3,” is false.
EXAMPLE
Let A(x) denote the statement “Computer x is under attack by an intruder”
Suppose that of the computers on campus, only CS2 and MATH1 are currently
under attack by intruders. What are truth values of A(CS1), A(CS2), and
A(MATH1)?
Solution:
Solution:
To obtain Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y). Hence, Q(1, 2) is
the statement “1 = 2 + 3” which is false.
The statement Q(3, 0) is the proposition “3 = 0 + 3” which is true.
QUANTIFIERS
Besides “for all” and “for every,” universal quantification can be expressed
in many other ways, including “all of,” “for each,” “given any,” “for arbitrary,”
Suppose that P(x) is “𝑥 2 > 0.” To show that the statement ∀xP(x) is false
where the universe of discourse consists of all integers,
We give a counterexample.We see that x = 0 is a counterexample because
𝑥 2 = 0 when x = 0, so 𝑥 2 is not greater than 0 when x = 0.
EXISTENTIAL QUANTIFICATION
Note:
Express the statement “Every student in this class has studied calculus” using
predicates and quantifiers.
Solution:
First, we rewrite the statement so that we can clearly identify the appropriate
quantifiers to use. Doing so, we obtain:
“For every student in this class, that student has studied calculus”
Express the statements “Some student in this class has visited Mexico” using
predicates and quantifiers.
Solution:
The statement “Some student in this class has visited Mexico” means that
“There is a student in this class with the property that the student has visited
Mexico”
“There is a student x in this class having the property that x has visited Mexico”
INTRODUCTION TO PROOFS
Direct Proof
p → q is true by showing that if p is true, then q must also be true, so that the
combination p true and q false never occurs.
EXAMPLE
Give a direct proof of the theorem “If n is an odd integer, then 𝑛2 is odd”
Solution:
Note that this theorem states ∀nP ((n) → Q(n)), where P(n) is “n is an odd integer” and Q(n)
is “𝑛2 is odd”
By the definition of an odd integer, it follows that n = 2k + 1. We want to show that 𝑛2 is
also odd. We can square both sides of the equation n = 2k + 1 to obtain a new equation
that expresses 𝑛2 .When we do this, we find that
𝑛2 = (2k + 1) 2 = 4𝑘 2 + 4𝑘 + 1 = 2(2𝑘 2 + 2𝑘) + 1 . By the definition of an odd
integer, we can conclude that 𝑛2 is an odd integer (it is one more than twice an integer).
Consequently, we have proved that if n is an odd integer, then 𝑛2 is an odd integer.
Hint Definition
The integer n is even if there exists an integer k such that
n = 2k, and n is odd if there exists an integer k such that
n = 2k + 1. (Note that every integer is either even or odd,
and no integer is both even and odd.)
EXAMPLE
Give a direct proof that “If m and n are both perfect squares, then mn is also a perfect square”
Solution:
• We assume that 𝑚 and 𝑛 are both perfect squares. By the definition of a perfect square,
it follows that there are integers s and t such that 𝑚 = 𝑠 2 and 𝑛 = 𝑡 2 .
• The goal of the proof is to show that mn must also be a perfect square when 𝑚 and 𝑛
are; looking ahead we see how we can show this by substituting 𝑠 2 for 𝑚 and 𝑡 2 for 𝑛
into 𝑚𝑛. This tells us that 𝑚𝑛 = 𝑠 2 𝑡 2 .
• Hence, 𝑚𝑛 = 𝑠 2 𝑡 2 = (𝑠𝑠)(𝑡𝑡) = (𝑠𝑡)(𝑠𝑡) = (𝑠𝑡)2 , using commutativity and
associativity of multiplication.
• By the definition of perfect square, it follows that 𝑚𝑛 is also a perfect square, because it
is the square of 𝑠𝑡, which is an integer. Hint
Definition
An integer a is a perfect square if there is an integer b
such that a = 𝑏2
Indirect Proof
Proof by Contraposition
Note that [a, b] is called the closed interval from a to b and (a, b)
is called the open interval from a to b.
Equal Sets
Two sets are equal if and only if they have the same elements.
Therefore, if A and B are sets, then
A and B are equal if and only if ∀x(x ∈ A ↔ x ∈ B)
We write A = B if A and B are equal sets.
EMPTY SET AND SINGLETON SET
There are some sets which hold great mathematical importance and are
referred to with such regularity that they have acquired special names and
notational conventions to identify them. One of these is the empty set,
denoted { } or ∅. Another is the singleton set {x} which contains exactly
one element, namely x.
SPECIAL SETS
• P or ℙ, denoting the set of all primes P = {2, 3, 5, 7,11, 13, 17, ...}
• N or ℕ, denoting the set of all natural numbers: N = {1, 2, 3, . . .}
• Z or ℤ, denoting the set of all integers (whether positive, negative
or zero): Z = {..., −2, −1, 0, 1, 2, ...}.
• Q or ℚ, Q = {a/b : a, b ∈ Z, b ≠ 0}. For example, 1/4 ∈ Q and 11/6 ∈
Q.
• R or ℝ, denoting the set of all real numbers. This set includes all
rational numbers, together with all irrational numbers (that is,
numbers which cannot be rewritten as fractions, such as π, e, and
√2, as well as numbers that cannot be defined).
• C or ℂ, denoting the set of all complex numbers : C = {a + bi : a, b ∈
R}. For example, 1 + 2i ∈ C.
Finite Set:
A set is finite if it contains a specific (finite) number of elements, i.e.,
If we can count the element in a set, such sets are called finite sets.
B = {2, 3, 4, 5, 6, 7} |B| = 6
A = {1, 2, 3, …} |A| = ∞
Subsets Sets:
The set A is a subset of B if and only if every element of A is also an
element of B. We use the notation A ⊆ B to indicate that A is a
subset of the set B.
The quantification of A ⊆ B is ∀x(x ∈ A → x ∈ B).
Note:
Examples
• The set of all men is a proper subset of the set of all people.
• {1, 3} ⊂ {1, 2, 3, 4}.
• {1, 2, 3, 4} ⊆ {1, 2, 3, 4}.
Theorem:
∅ ⊆ S and
S ⊆ S.
An obvious but useful identity, which can often be used to
show that two seemingly different sets are equal:
A = B if and only if A ⊆ B and B ⊆ A.
Subset Relationships
A = {x | x is a positive integer 8}
set A contains: 1, 2, 3, 4, 5, 6, 7, 8
B = {x | x is a positive even integer 10}
set B contains: 2, 4, 6, 8
C = {2, 4, 6, 8, 10}
set C contains: 2, 4, 6, 8, 10
The universal set U = {1,2,3,4,5,6,7,8,9,10}.
Subset Relationships
AA AB AC
BA BB BC
CA CB CC
Set Equality
Two sets are equal if and only if they contain precisely the same
elements.
The order in which the elements are listed is un important.
Elements may be repeated in set definitions without increasing the
size of the sets.
Examples
A = {1, 2, 3, 4} B = {1, 4, 2, 3}
A B and B A; therefore, A = B and B = A.
A = {1, 2, 2, 3, 4, 1, 2} B = {1, 2, 3, 4}
A B and B A; therefore, A = B and B = A.
Notations
Symbol Meaning
Upper case designates set name
Lower case designates set elements
{ } enclose elements in set
(or ∉ ) is (or is not) an element of
is a subset of (includes equal sets)
is a proper subset of
is not a subset of
is a superset of
| or : such that (if a condition is true)
| | the cardinality of a set
Venn Diagrams
Venn diagrams or set diagrams are diagrams that show all
possible logical relations between a finite collection of sets. Venn
diagrams were conceived around 1880 by John Venn.
Venn diagrams show relationships between sets and their
elements.
Sets A & B
Universal Set
Examples
Set Definition Elements
A = {x | x Z+ and x 8} {1, 2 ,3, 4, 5, 6 ,7, 8}
B = {x | x Z+, x is even and 10} {2, 4, 6, 8, 10}
AB
BA
Cont…
Set Definition Elements
A = {x | x Z+ and x 9} {1, 2 ,3, 4, 5, 6 ,7, 8,9}
B = {x | x Z+ ; x is even and 8} {2, 4, 6, 8,}
AB
BA
AB