Full DM Notes For 3rd Sem Students
Full DM Notes For 3rd Sem Students
OF
DISCRETE MATHEMATICS
BCA-3 SEM
SEC –A
PREPARED BY:
Mr. GAURAV SRIVASTAVA
Mathematical Logic
Lecture-1
2
Discrete Mathematics
Introduction
• True or False
• Yes or No
1,0
In Computer Science:
Discrete is called as Digital.
Continuous is called as Analog. 4
Discrete Mathematics
Introduction
Discrete object is something that is
countable.
Example of Discrete object:
1. People, chair & table.
2. Natural number.
3. Rational Number.
Example of Non-Discrete object:
The Real Numbers.
•
5
What is Discrete Mathematics ?
Definition
Discrete Mathematics is not the name of
a branch of mathematics ,like-Number
theory, Algebra & Calculus etc. Rather,
it's a description of a set of branches of
math that all have one common property
that they are „discrete‟rather than continuous.
Discrete Mathematics is the study of discrete
objects.
6
Why study Discrete Mathematics?
It develops your mathematical thinking/ logic
making.
It improves your problem solving ability.
If you are computer science student, then no
need to go anywhere else because Discrete
Mathematics is for you.
Discrete Mathematics is important to survive
in subjects like :Compiler design, database,
computer security, operating system &
automata theory etc.
7
Why study Discrete Mathematics ?
Many problems can be solve using
discrete mathematics.
For Example:
1. Sorting the list of integers.
2. Finding the shortest path from your home
to your‟s friends home.
3. Drawing a graph with 2 conditions:
(i) You are not allowed to lift your pen.
(ii) You are not allowed to repeat edges.
8
Why study Discrete Mathematics ?
4.How many different combination of passwords
are possible with just eight alphanumeric
characters.
5. Encrypt a message & deliver it to your friend
and you don‟t want anybody to read that
message except your friend.
9
Discrete Vs Continuous
The whole world of mathematics is
divided into two realms:
1. Discrete 2. Continuous
Discrete Objects Continuous Objects
1. Discrete object is something that is Continuous object is something that
countable. is not countable.
2. Natural Numbers are discrete. Real Numbers are continuous
3. For Example : 1,2,3,4,5,……. For Example; 0.001 ,0.0001,0.1001 &
so on
4. Consider a function Y=X ; Consider functio Y= X ;
X,Y belongs to Natural Number X,Y belongs to Real Numbers.
5. Digital Clock is discrete in nature. Analog clock is continuous in nature.
- There is no continous time - In analog clock- hour , minute and
- Transition from one time to second hands move smoothly over
another time.
- 10:42:57 10:42:58 10
1.1 Propositional Logic
Introduction
A proposition is a declarative sentence (a
sentence that declares a fact) that is either
true or false, but not both.
Are the following sentences propositions?
Toronto is the capital of Canada. (Yes)
Read this carefully. (No)
1+2=3 (Yes)
x+1=2 (No)
What time is it? (No)
11
1.1 Propositional Logic
12
1.1 Propositional Logic
DEFINITION 1
Let p be a proposition. The negation of p, denoted by ¬p, is the statement
“It is not the case that p.”
The proposition ¬p is read “not p.” The truth value of the negation of p, ¬p
is the opposite of the truth value of p.
Examples
Find the negation of the proposition “Today is Friday.” and
express this in simple English.
Solution: The negation is “It is not the case that today is Friday.”
In simple English, “Today is not Friday.” or “It is not
Friday today.”
Find the negation of the proposition “At least 10 inches of rain
fell today in Miami.” and express this in simple English.
Solution: The negation is “It is not the case that at least 10 inches
of rain fell today in Miami.”
In simple English, “Less than 10 inches of rain fell today
13
in Miami.”
1.1 Propositional Logic
Note: Always assume fixed times, fixed places, and particular people
unless otherwise noted.
Truth table: The Truth Table for the
Negation of a Proposition.
p ¬p
T F
F T
Logical operators are used to form new propositions from two or more
existing propositions. The logical operators are also called
connectives.
14
1.1 Propositional Logic
DEFINITION 2
Let p and q be propositions. The conjunction of p and q, denoted by p
Λ q, is the proposition “p and q”. The conjunction p Λ q is true when
both p and q are true and is false otherwise.
Examples
Find the conjunction of the propositions p and q where p is the
proposition “Today is Friday.” and q is the proposition “It is
raining today.”, and the truth value of the conjunction.
Solution: The conjunction is the proposition “Today is Friday and it
is raining today.” The proposition is true on rainy Fridays.
15
1.1 Propositional Logic
DEFINITION 3
Let p and q be propositions. The disjunction of p and q, denoted by p ν
q, is the proposition “p or q”. The conjunction p ν q is false when both
p and q are false and is true otherwise.
Note:
inclusive or : The disjunction is true when at least one of the two
propositions is true.
E.g. “Students who have taken calculus or computer science can take
this class.” – those who take one or both classes.
exclusive or : The disjunction is true only when one of the
proposition is true.
E.g. “Students who have taken calculus or computer science, but not
both, can take this class.” – only those who take one of them.
Definition 3 uses inclusive or.
16
1.1 Propositional Logic
DEFINITION 4
Let p and q be propositions. The exclusive or of p and q, denoted by p q,
is the proposition that is true when exactly one of p and q is true and is
false otherwise.
The Truth Table for The Truth Table for The Truth Table for the
the Conjunction of the Disjunction of Exclusive Or (XOR) of
Two Propositions. Two Propositions. Two Propositions.
p q pΛq p q pνq p q p q
T T T T T T T T F
T F F T F T T F T
F T F F T T F T T
F F F F F F F F F
17
Discrete Mathematics
Lecture-2
18
1.1 Propositional Logic
Conditional Statements
DEFINITION 5
Let p and q be propositions. The conditional statement p → q, is the
proposition “if p, then q.” The conditional statement is false when p is
true and q is false, and true otherwise. In the conditional
statement p
→ q, p is called the hypothesis (or antecedent or premise) and q is
called the conclusion (or consequence).
A conditional statement is also called an implication.
Example: “If I am elected, then I will lower taxes.” p→q
implication:
elected, lower taxes. T T |T
not elected, lower taxes. F T |T
not elected, not lower taxes. F F |T
elected, not lower taxes. T F |F
19
1.1 Propositional Logic
Example:
Let p be the statement “Maria learns discrete mathematics.” and
q the statement “Maria will find a good job.” Express the
statement p → q as a statement in English.
Solution: Any of the following -
“If Maria learns discrete mathematics, then she will find a
good job.
“Maria will find a good job when she learns discrete
mathematics.”
“For Maria to get a good job, it is sufficient for her to
learn discrete mathematics.”
“Maria will find a good job unless she does not learn
discrete mathematics.”
20
1.1 Propositional Logic
Types of conditional/ Implication statements
Converse Implication
Definition : The statement q=> p is called converse implication of
the statement of p=> q
Contrapositive Implication
Definition : The statement ~ q => ~ p is called contrapositive of
the statement p= > q .
Inverse Implication:
Defintion : The statement ~ p => ~ q is called inverse
implication of the statement p => q
21
Example:
Let p: It rains
q: The crops will grow.
Write down the converse ,inverse and contrapositive of the given
statements:
Solution : p=> q It rains then the crops will grow .
q=> p If the crops grow , then there has been rain.
~q=> ~p If the crops do not grow then there has been no rain.
~p => ~q If it does not rain then the crops will not grow.
22
1.1 Propositional Logic
DEFINITION 6
Let p and q be propositions. The biconditional statement p ↔ q is the
proposition “p if and only if q.” The biconditional statement p ↔ q is
true when p and q have the same truth values, and is false otherwise.
Biconditional statements are also called bi-implications.
24
Discrete Mathematics
Lecture-3
25
1.1 Propositional Logic
Truth Tables of Compound Propositions
We can use connectives to build up complicated compound
propositions involving any number of propositional variables, then
use truth tables to determine the truth value of these compound
propositions.
Example: Construct the truth table of the compound proposition
(p ν ¬q) → (p Λ q).
T T F T T T
T F T T F F
F T F F F T
F F T T F F 26
1.1 Propositional Logic
Precedence of Logical Operators
We can use parentheses to specify the order in which logical
operators in a compound proposition are to be applied.
To reduce the number of parentheses, the precedence order is
defined for logical operators.
28
1.1 Propositional Logic
Example: How can this English sentence be translated into a logical
expression?
“You can access the Internet from campus only if you are a
computer science major or you are not a freshman.”
Solution: Let a, c, and f represent “You can access the Internet from
campus,” “You are a computer science major,” and “You are
a freshman.” The sentence can be translated into:
a → (c ν ¬f).
29
1.1 Propositional Logic
Logic and Bit Operations
Computers represent information using bits.
A bit is a symbol with two possible values, 0 and 1.
By convention, 1 represents T (true) and 0 represents F (false).
A variable is called a Boolean variable if its value is either true or
false.
Bit operation – replace true by 1 and false by 0 in logical
operations.
Example: Find the bitwise OR, bitwise AND, and bitwise XOR of the
bit string 01 1011 0110 and 11 0001 1101.
Solution:
01 1011 0110
11 0001 1101
-------------------
11 1011 1111 bitwise OR
01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR
31
Discrete Mathematics
Lecture-4
32
1.2 Propositional Equivalences
Introduction
DEFINITION 1
A compound proposition that is always true, no matter what the truth
values of the propositions that occurs in it, is called a tautology. A
compound proposition that is always false is called a contradiction. A
compound proposition that is neither a tautology or a contradiction is
called a contingency.
T F T F
F T T F
33
1.2 Propositional Equivalences
Logical Equivalences
DEFINITION 2
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.
Note: The above examples can also be done using truth tables.
FUNCTIONALLY COMPLETE
SET OF
CONNECTIVES
Functionally Complete
(p q)
(p q) Double negation (2)
(pq ) DeMorgan
Example: Find an expression equivalent to
p q that uses only conjunctions and
negations.
p q pq
How many minterms in the DNF?
T T T
T F F
F T T
F F T
Discussion #10
called canonical or accepted forms.
A logical expression is said to be in disjunctive
normal form (DNF) if it is written as a disjunction,
Chapter 1, Section 5
in which all terms are conjunctions of literals.
Similarly, a logical expression is said to be in
conjunctive normal form (CNF) if it is written as a
conjunction of disjunctions of literals.
2/19
Normal Forms
The method to transform any two
logical expressions P and Q to some
Standard forms of expression P‟ and Q‟
such that a simple comparison of P‟
and Q‟, show whether P and Q are
equivalent (P≈Q). The standards forms
are called “Normal Forms” OR
“Canonical forms” .
Some Terminology
Elementary Product : In an logical
expressions, a product of the variables
and their negations is called an
“elementary product”.
For Example: Let P and Q be two atomic
variables Then ~Pꓥ Q,~Qꓥ P, Pꓥ ~Q and
Q ꓥ ~P are elementary product.
Elementary Sum : In an logical
expressions, a sum of the variables
and their negations is called an
“elementary sum”.
For Example: Let P and Q be two
atomic variables Then ~PVQ,~QVP,
PV~Q and Q V~P are elementary
product.
Types of Normal Forms
1. Disjunctive NormalForms(DNF).
Discussion #10
Term Literal, i.e. P or P
Chapter 1, Section 5
EXAMPLE:
1. PV(Q∧R) ,PV(~Q ∧R) ,(P Q) (P Q)
and P (Q R) are in disjunctive
normal form.
2. P∧(QVR) are not in disjunctive
normal form. 8/19
Disjunctive Normal Form
(pq) (pq)
Truth Table
Discussion #10
P Q R The only definition of
is the truth table
T T T F
T T F T (P Q R)
(P Q R)
Chapter 1, Section 5
T F T T
T F F F
minterms
F T T F
F T F F
F F T T (P Q R)
F F F F
14/19
(P Q R) (P Q R) (P Q R)
DNF and CNF
Disjunctive Normal Form (DNF)
( .. .. .. ) ( .. .. .. ) … ( .. .. )
Discussion #10
Term Literal, i.e. P or P
Examples: (P Q) (P Q)
Chapter 1, Section 5
P (Q R)
(pq) (pq)
Truth Table
(p q)
(p q) Double negation (2)
(pq ) DeMorgan
Example: Find an expression equivalent to
p q that uses only conjunctions and
negations.
p q pq
How many minterms in the DNF?
T T T
T F F
F T T
F F T
Discussion #10
The following procedure converts an expression to DNF or CNF:
1. Remove all and .
Chapter 1, Section 5
2. Move inside. (Use De Morgan’s law.)
3. Use distributive laws to get proper form.
Simplify as you go. (e.g. double-neg., idemp., comm., assoc.)
28/19
CNF Conversion Example
( .. .. .. ) ( .. .. .. ) … ( .. .. )
((P Q) R (P Q))
((P Q) R (P Q))
Discussion #10
impl.
(P Q) R (P Q) deM.
(P Q) R (P Q) deM.
(DNF) (P Q) R (P Q) double neg.
Chapter 1, Section 5
((P R) (Q R)) (P Q) distr.
((P R) (P Q)) distr.
((Q R) (P Q))
(((P R) P) ((P R) Q)) distr.
(((Q R) P) ((Q R) Q))
(P R) (P R Q) (Q R) assoc. comm. idemp.
29/19
CNF Conversion Example
( .. .. .. ) ( .. .. .. ) … ( .. .. )
((P Q) R (P Q))
((P Q) R (P Q))
Discussion #10
impl.
(P Q) R (P Q) deM.
(P Q) R (P Q) deM.
(DNF) (P Q) R (P Q) double neg.
Chapter 1, Section 5
((P R) (Q R)) (P Q) distr.
((P R) (P Q)) distr.
((Q R) CNF (P Q))
(((P
Using thecommutative
R) P) and R) Q))
((Pidempotent distr.
laws on the previous step and then the
(((Q R) P) ((Q R) Q))
distributive law, we obtain this formula
as R)
(Pthe (P normal
conjunctive R Q)form. (Q R) assoc. comm. idemp.
30/19
CNF Conversion Example
( .. .. .. ) ( .. .. .. ) … ( .. .. )
(P R) (P R Q)
((P Q) R (P Q))
(Q R)
((P Q) R (P Q))
Discussion #10
impl.
(P R) (P R Q)
(P Q) R (P Q) (F Q deM.
R) - ident.
(P Q) R (P Q) (P R) ((PdeM. F)
(DNF) (P Q) R (P Q) (Q R))
double neg. distr.
Chapter 1, Section 5
- comm.,
(P R) (Fdistr.
((P R) (Q R)) (P Q)
((P R) (P Q)) (Q R)) - dominat.
distr.
((Q R) (P Q)) (P R) (Q R) - ident.
(((P R) P) ((P R) Q)) distr.
(((Q R) P) ((Q R) Q))
(P R) (P R Q) (Q R) assoc. comm. idemp.
31/19
DNF Expression Generation
Discussion #10
P Q R The only definition of
is the truth table
T T T F
T T F T (P Q R)
(P Q R)
Chapter 1, Section 5
T F T T
T F F F
minterms
F T T F
F T F F
F F T T (P Q R)
F F F F
32/19
(P Q R) (P Q R) (P Q R)
CNF Expression Generation
1. Find .
2.
3.
Find the DNF of .
}
Form a
Then, use De Morgan’s law to get the conjunction of
Discussion #10
CNF of (i.e. () ) max terms
P Q max terms
Chapter 1, Section 5
T T T F
T F F T (P Q) (P Q)
F T T F
F F F T (P Q) (P Q)
1
Argument
Premises ⇒ Conclusion
Example:
“If you have a current password, then you can log onto the network.”
“You have a current password.” 𝑝→𝑞
𝑝
Therefore, ----------------
“You can log onto the network.” ∴𝑞
2
• An argument is valid if the truth of all its premises implies that the
conclusion is true.
3
Example:
• Either team A or Team B will win the match
• Team B lost
• Therefore Team A won
----------------------------------------------
The general form of this argument is:
Either P or Q
Not P
Therefore Q
(P ∨ Q) ∧ ┐P→Q , or
4
Rules of Inference for Propositional Logic
5
Checking the validity of an Argument form
• Step 1: Construct truth table for the premises and conclusion.
• Step 2: Find the rows in which all the premises are true(critical rows).
• Step 3: Check conclusion of all critical rows.
a) If in each critical rows the conclusion is true then the argument is
valid.
b) If there is a row in which conclusion is false then the argument form
is invalid.
6
Example:
Determine whether the following argument is valid or invalid
P q ¬𝒑 𝒑→𝒒 ┐q
𝑃→𝑞 T T F T F Formal
¬𝑝 T F F F T
∴ ¬𝑞
F T T T F
F F T T T
Solution
put all premises true:
p→q=T Informal
┐p = T, then p = F
Now, put q = T. So, we still have p → q = T, but q = T, Then ┐q = F.
The conclusion is False whereas all premises are true, Therefor, the argument is invalid.
7
Example : Determine whether the following argument is valid or invalid
(Hint: use informal method) 𝑝→𝑞
𝑞→ 𝑝→𝑟
𝑝
∴𝑟
Solution:
put all premises true: (p → q) = T
q → (p → r) = T
p=T
.........................................
Since p = T and (p → q) = T, then q = T
Now, since q = T and q → (p → r) = T then Q := (p → r) = T
We have p = T and (p → r) = T then r must be true. Therefore r = T and
the argument is valid.
8
Exercise:
Determine whether the following argument is valid or invalid:
𝑝 → ¬𝑟
𝑟 → (𝑝 → 𝑞)
𝑟→𝑝
∴ ¬𝑝 → ¬𝑞
9
Methods of Proof
Discrete Mathematics
SLOT-6
1
PROOF
Proof: valid arguments that establish the
truth of a mathematical statement
Argument: a sequence of statements that
end with a conclusion
Valid: the conclusion or final statement of
the argument must follow the truth of
proceeding statements or premise of the
argument
2
Argument and inference
• An argument is valid if and only if it is
impossible for all the premises to be true
and the conclusion to be false
• Rules of inference: use them to deduce
(construct) new statements from statements
that we already have
• Basic tools for establishing the truth of
statements
3
The purpose of rules of inference
• We use rules of inference to construct valid
arguments.
4
Rules of inference for propositional logic
• Can always use truth table to show an
argument form is valid
• For an argument form with 10
propositional variables, the truth table
requires 210 rows
5
Inference Rules - General Form
• Inference Rule –
• Pattern establishing that if we know that a set of
hypotheses are all true, then a certain related
conclusion statement is true.
• Hypothesis 1
Hypothesis 2 …
conclusion “” means “therefore”
6
Inference Rules & Implications
7
How to determine the validity of
argument?
The argument form with premises
p1 , p2 ,, pn and conclusion is valid when
( p1 p2 pn )is
aq is a tautology
8
Modus Ponens
Consider (p (p→q)) → q
9
Modus Ponens example
Assume you are given the following two
statements:
p
“you are in this class”
“if you are in this class, you will get a grade” pq
q
Let p = “you are in this class”
Let q = “you will get a grade”
10
Modus Tollens
Assume that we know: ¬q and p → q
Recall that p → q = ¬q → ¬p
Thus, we know ¬q and ¬q → ¬p
We can conclude ¬p
q
pq
p
11
Modus Tollens example
Assume you are given the following two
statements:
q
“you will not get a grade”
“if you are in this class, you will get a grade” pq
p
Let p = “you are in this class”
Let q = “you will get a grade”
12
Addition & Simplification
Addition: If you know
that p is true, then p q p
will ALWAYS be true pq
Simplification: If p q is
true, then p will pq
ALWAYS be true p
13
Example of proof
Example 6 of Rosen, section 1.5
We have the hypotheses:
“It is not sunny this afternoon and it ¬p q
p is colder than yesterday”
q “We will go swimming only if it is r→p
sunny”
r
“If we do not go swimming, then we ¬r → s
s will take a canoe trip”
t “If we take a canoe trip, then we will s→t
be home by sunset”
Does this imply that “we will be t
home by sunset”?
14
Example of proof
1. ¬p q 1st hypothesis
2. ¬p Simplification using step 1
3. r→p 2nd hypothesis
4. ¬r Modus tollens using steps 2 & 3
5. ¬r → s 3rd hypothesis
6. s Modus ponens using steps 4 & 5
7. s→t 4th hypothesis
8. t Modus ponens using steps 6 & 7
p q
pq pq pq
p q p 15
More rules of inference
Conjunction: if p and q are true p
separately, then pq is true q
pq pq
Disjunctive syllogism: If pq is
true, and p is false, then q must p
be true q
pq
Resolution: If pq is true, and p r
¬pr is true, then qr must be true
q r
pq
Hypothetical syllogism: If p→q is qr
true, and q→r is true, then p→r
must be true pr
16
Example of proof
question 4
Given the hypotheses:
“If it does not rain or if it is not (¬r ¬f) →
foggy, then the sailing race will (s l)
be held and the lifesaving
demonstration will go on”
“If the sailing race is held, then s→t
the trophy will be awarded”
“The trophy was not awarded” ¬t
r
Can you conclude: “It rained”? 17
Example of proof
1. ¬t 3rd hypothesis
2. s→t 2nd hypothesis
3. ¬s Modus tollens using steps 2 & 3
4. (¬r¬f)→(sl) 1st hypothesis
5. ¬(sl)→¬(¬r¬f) Contrapositive of step 4
6. (¬s¬l)→(rf) DeMorgan’s law and double negation law
7. ¬s¬l Addition from step 3
8. rf Modus ponens using steps 6 & 7
9. r Simplification using step 8
p q
pq p pq pq
q pq p p 18
19
Example
“It is not sunny this
afternoon and it is colder
than yesterday” p q 1)p q hypothesis
“We will go swimming 2)p simplication using (1)
only if it is sunny” r p 3)r p hypothesis
“If we do not go 4)r modus tollens using (2) and (3)
swimming, then we will 5)r s hypothesis
take a canoe trip” r s 6) s modus ponens using (4)
“If we take a canoe trip, 7) s t hypothesis
then we will be home by 8)t modus ponens using (6) and (7)
sunset”
s t
Can we concludet
“We will be home by sunset”?
20
Example
“If you send me an email
message, then I will finish
1) p q hypothesis
my program” pq 2)q p contrapositive of (1)
“If you do not send me an 3)p r hypothesis
email message, then I will 4) q r hypotheical syllogism using (2) and (3)
go to sleep early” p r 5)r s hypothesis
“If I go to sleep early, then 6) q s hypothetical syllogism using (4) and (5)
I will wake up feeling
refreshed”
rs
Predicates
and
Quantifiers
Previously Concept…
In predicate logic, a predicate is modeled as a
proposional function P(·) from subjects to
propositions.
P(x): “x is a prime number” (x: any subject)
P(3): “3 is a prime number.” (proposition!)
Quantifier Expressions
University
of Hawaii
of discourse)
false if P(x) is false for at least one x in D
01/01/2022
• Let x be a variable and D be a set; P(x) is a sentence
• Then P(x) is called a predicate or propositional
function with respect to the set D if for each value of x
in D, P(x) is a statement; i.e., P(x) is true or false
• Moreover, D is called the domain (universe) of
discourse and x is called the free variable
Quantifiers and First Order Logic
( Another Definition)
• Universal Quantifier
01/01/2022
• Let P(x) be a predicate and let D be the domain of
the discourse. The universal quantification of P(x) is
the statement:
• For all x, P(x) or
• For every x, P(x)
• The symbol is read as “for all and every”
•
x, P ( x) or x D, P( x)
• Two-place predicate: x, y, P( x, y )
Quantifiers and First Order Logic
( Another Definition)
• Existential Quantifier
01/01/2022
• Let P(x) be a predicate and let D be the universe of
discourse. The existential quantification of P(x) is the
statement:
• There exists x, P(x)
• The symbol is read as “there exists”
• x D, P( x) or x, P( x)
• Bound Variable
• The variable appearing in: x, P ( xor) x, P( x)
Quantifiers and First Order Logic
• Negation of Predicates (DeMorgan’s Laws)
01/01/2022
• x, P ( x ) x, P ( x )
• Example:
• If P(x) is the statement “x has won a race” where the
domain of discourse is all runners, then the universal
quantification of P(x) is x, P ( x ), i.e., every runner
has won a race. The negation of this statement is “it is
not the case that every runner has won a race.
Therefore there exists at least one runner who has not
won a race. Therefore: x, P ( x )
•
x, P( x) x, P( x)
L
studied calculus.”
If domain for x consists of the students in
or
If domain for x consists of all people
Let S(x) be the predicate: “x is in this class”
Translation: x (S(x) C(x))
Translating from English
Express the statement “Some students in this
class has visited Mexico” using predicates and
quantifiers.
Let M(x) be the statement: “x has visited
Mexico”
If domain for x consists of the students in this
class, then
it can be translated as x M(x)
or
If domain for x consists of all people
Theorem:
Generalized De Morgan's laws for logic
1. x P(x) x P(x)
2. x P(x) x P(x)
Negations: Examples
What are the negations of the statements
x (x2 x) and x (x2 = 2)?
x (x2 x) x (x x) x (x2 x)
2
Instantiation:
c is one particular
member
of the domain
Generalization:
for an arbitrary member
c
Example
• “Everyone in this discrete mathematics has taken a course in
computer science” and “Marla is a student in this class” imply
“Marla has taken a course in computer science”
x( p ( x) q ( x))
q (a ), where a is a particular element in the domain
p ( a )
Proof Methods
• Proving pq
• Direct proof: Assume p is true, and prove q.
• Indirect proof: Assume q, and prove p.
• Trivial proof: Prove q true.
• Vacuous proof: Prove p is true.
• Proving p
• Proof by contradiction: Prove p (r r)
(r r is a contradiction); therefore p must be false.
• Prove (a b) p
• Proof by cases: prove (a p) and (b p).
• More …
Direct Proof Example
• Definition: An integer n is called odd iff n=2k+1
for some integer k; n is even iff n=2k for some k.
• Axiom: Every integer is either odd or even.
• Theorem: (For all numbers n) If n is an odd
integer, then n2 is an odd integer.
• Proof: If n is odd, then n = 2k+1 for some integer
k. Thus, n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k)
+ 1. Therefore n2 is of the form 2j + 1 (with j the
integer 2k2 + 2k), thus n2 is odd. □
Another Example
33
other than 1 (i.e., gcd(p,q)=1), such that r=p/q. A
real number that is not rational is called irrational.
Indirect Proof
• Proving pq
• Indirect proof: Assume q, and prove p.
34
Indirect Proof Example
• Theorem: (For all integers n)
If 3n+2 is odd, then n is odd.
• Proof: Suppose that the conclusion is false, i.e.,
35
that n is even. Then n=2k for some integer k.
Then 3n+2 = 3(2k)+2 = 6k+2 = 2(3k+1). Thus
3n+2 is even, because it equals 2j for integer j =
3k+1. So 3n+2 is not odd. We have shown that
¬(n is odd)→¬(3n+2 is odd), thus its contra-
positive (3n+2 is odd) → (n is odd) is also true.
□
PROOF BY COUNTER
EXAMPLE &
MATHEMATICAL
INDUCTION
CONTENTS
• PROOF BY COUNTER EXAMPLE
• MATHEMATICAL INDUCTION
STRONG
INDUCTION
• 2ND PRINCIPLE OF MATHEMATICAL INDUCTION.
• USES DIFFERENT INDUCTIVE STEP THAN FIRST PRINCIPLE.
• STEPS
1. BASIC STEP : { SHOW P(0) IS TRUE }
2. INDUCTIVE HYPOTHESIS :
ASSUME P(K) IS TRUE FOR ALL NO ≤ K ≤ N.
3. INDUCTIVE STEP :
SHOW BASED ON ASSUMPTION THAT P(K+1) IS
TRUE.
3
8
EXAMPLE
3
9
SET THEORY
Sets
Definition: Well-defined collection of distinct objects
Members or Elements: part of the collection
Roster Method: Description of a set by listing the
elements, enclosed with braces
Examples:
Vowels = {a,e,i,o,u}
Membership examples
“a belongs to the set of Vowels” is written as:
a Vowels
“j does not belong to the set of Vowels:
j Vowels
01/01/2022
Basic notations for sets
For sets, we’ll use variables S, T, U, …
We can denote a set S in writing by
listing all of its elements in curly
braces:
{a, b, c} is the set of whatever 3 objects
are denoted by a, b, c.
Set builder notation: For any
proposition P(x) over any universe of
discourse, {x|P(x)} is the set of all x
such that P(x).
e.g., {x | x is an integer where x>0
and x<5 }
3
Sets
Set-builder method
A = { x | x S, P(x) } or A = { x S | P(x) }
01/01/2022
Sets
Standard Symbols which denote sets of numbers
N : The set of all natural numbers (i.e.,all positive integers)
Z : The set of all integers
Z+ : The set of all positive integers
Z* : The set of all nonzero integers
E : The set of all even integers
Q : The set of all rational numbers
Q* : The set of all nonzero rational numbers
Q+ : The set of all positive rational numbers
R : The set of all real numbers
R* : The set of all nonzero real numbers
R+ : The set of all positive real numbers
C : The set of all complex numbers
C* : The set of all nonzero complex numbers
01/01/2022
Sets
Subsets
“X is a subset of Y” is written as X Y
Example:
Z= {b,c,d,f,g}
Y Z, since a Y, but a Z
01/01/2022
Sets
Superset
X and Y are sets. If X Y, then “X is contained in
Y” or “Y contains X” or Y is a superset of X,
written Y X
Proper Subset
X and Y are sets. X is a proper subset of Y if X
Y and there exists at least one element in Y that
is not in X. This is written X Y.
Example:
X = {a,e,i,o,u}, Y = {a,e,i,o,u,y}
X Y , since y Y, but y X
01/01/2022
Sets
Set Equality
X and Y are sets. They are said to be equal if every
element of X is an element of Y and every element of Y is
an element of X, i.e. X Y and Y X
Examples:
{1,2,3} = {2,3,1}
01/01/2022
Sets
01/01/2022
Sets
Cardinality of Sets
Let S be a finite set with n distinct elements,
where n ≥ 0. Then |S| = n , where the
cardinality (number of elements) of S is n
Example:
If P = {red, blue, yellow}, then |P| = 3
Singleton
A set with only one element is a singleton
Example:
H = { 4 }, |H| = 1, H is a singleton
01/01/2022
Sets
Power Set
For any set X ,the power set of X ,written P(X),is
the set of all subsets of X
Example:
If X = {red, blue, yellow}, then P(X) = { ,
{red}, {blue}, {yellow}, {red,blue}, {red,
yellow}, {blue, yellow}, {red, blue, yellow} }
Universal Set
An arbitrarily chosen, but fixed set
01/01/2022
Sets
Venn Diagrams
Abstract visualization
of a Universal set, U
as a rectangle, with all
subsets of U shown as
circles.
Shaded portion
represents the
corresponding set
Example:
In Figure 1, Set X,
shaded, is a subset
of the Universal set,
U
01/01/2022
Set Operations and Venn
Diagrams
Union of Sets
01/01/2022
Sets
Intersection of Sets
01/01/2022
Sets
Disjoint Sets
01/01/2022
Sets
Difference
01/01/2022
Sets
Complement
01/01/2022
Sets
01/01/2022
Sets
Ordered Pair
X and Y are sets. If x X and y Y, then an
ordered pair is written (x,y)
Order of elements is important. (x,y) is not
necessarily equal to (y,x)
Cartesian Product
The Cartesian product of two sets X and Y ,written X
× Y ,is the set
X × Y ={(x,y)|x ∈ X , y ∈ Y}
For any set X, X × = = × X
Example:
X = {a,b}, Y = {c,d}
X × Y = {(a,c), (a,d), (b,c), (b,d)}
Y × X = {(c,a), (d,a), (c,b), (d,b)}
01/01/2022
01/01/2022
Relations
Binary Relations
Degree of a Vertex − The degree of a vertex V of a graph G (denoted by deg (V)) is the number
of edges incident with the vertex V.
Even and Odd Vertex − If the degree of a vertex is even, the vertex is called an even vertex and
if the degree of a vertex is odd, the vertex is called an odd vertex.
Degree of a Graph − The degree of a graph is the largest vertex degree of that graph. For the
above graph the degree of the graph is 3.
The Handshaking Lemma − In a graph, the sum of all the degrees of all the vertices is equal to
twice the number of edges.
Types of Graphs
There are different types of graphs, which we will learn in the following section.
Null Graph
A null graph has no edges. The null graph of n
vertices is denoted by Nn
Simple Graph
A graph is called simple graph/strict graph if the graph is undirected and does not contain any
loops or multiple edges.
Multi-Graph
If in a graph multiple edges between the same set of vertices are allowed, it is called Multigraph.
In other words, it is a graph having at least one loop or multiple edges.
Directed and Undirected Graph
A graph G=(V,E)
is called a directed graph if the edge set is made of ordered vertex pair and a graph is called
undirected if the edge set is made of unordered vertex pair.
A graph is connected if any two vertices of the graph are connected by a path; while a graph is
disconnected if at least two vertices of the graph are not connected by a path. If a graph G is
disconnected, then every maximal connected subgraph of G
.
Regular Graph
A graph is regular if all the vertices of the graph have the same degree. In a regular graph G of
degree r
is r.
Complete Graph
A graph is called complete graph if every two vertices pair are joined by exactly one edge. The
complete graph with n vertices is denoted by Kn
Cycle Graph
If a graph consists of a single cycle, it is called cycle graph. The cycle graph with n vertices is
denoted by Cn
Bipartite Graph
and V2, in such a way that each edge in the graph joins a vertex in V1 to a vertex in V2, and there
are no edges in G that connect two vertices in V1 or two vertices in V2, then the graph G
A complete bipartite graph is a bipartite graph in which each vertex in the first set is joined to
every single vertex in the second set. The complete bipartite graph is denoted by Kx,y
Representation of Graphs
There are mainly two ways to represent a graph −
Adjacency Matrix
Adjacency List
Adjacency Matrix
An Adjacency Matrix A[V][V]
is a 2D array of size V×V where V is the number of vertices in a undirected graph. If there is an
edge between Vx to Vy then the value of A[Vx][Vy]=1 and A[Vy][Vx]=1, otherwise the value
will be zero. And for a directed graph, if there is an edge between Vx to Vy, then the value of
A[Vx][Vy]=1
, otherwise the value will be zero.
Let us consider the following undirected graph and construct the adjacency matrix −
a b c d
a 0 1 1 0
b 1 0 1 0
c 1 1 0 1
d 0 0 1 0
Let us consider the following directed graph and construct its adjacency matrix −
Adjacency matrix of the above directed graph will be −
a b c d
a 0 1 1 0
b 0 0 1 0
c 0 0 0 1
d 0 0 0 0
Adjacency List
of linked lists is used to represent the graph G with V number of vertices. An entry A[Vx]
represents the linked list of vertices adjacent to the Vx−th
vertex. The adjacency list of the undirected graph is as shown in the figure below −
Planar vs. Non-planar graph
Planar graph − A graph G
is called a planar graph if it can be drawn in a plane without any edges crossed. If we draw graph
in the plane without edge crossing, it is called embedding the graph in the plane.
Non-planar graph − A graph is non-planar if it cannot be drawn in a plane without graph edges
crossing.
Isomorphism
If two graphs G and H contain the same number of vertices connected in the same way, they are
called isomorphic graphs (denoted by G≅H
).
It is easier to check non-isomorphism than isomorphism. If any of these following conditions
occurs, then two graphs are non-isomorphic −
Example
Homomorphism
A homomorphism from a graph G
Properties of Homomorphisms
Euler Graphs
A connected graph G
is called an Euler graph, if there is a closed trail which includes every edge of the graph G
. An Euler path is a path that uses every edge of a graph exactly once. An Euler path starts and
ends at different vertices.
An Euler circuit is a circuit that uses every edge of a graph exactly once. An Euler circuit always
starts and ends at the same vertex. A connected graph G
is an Euler graph if and only if all vertices of G are of even degree, and a connected graph G
is Eulerian if and only if its edge set can be decomposed into cycles.
is called Hamiltonian graph if there is a cycle which includes every vertex of G and the cycle is
called Hamiltonian cycle. Hamiltonian walk in graph G
If G
is a simple graph with n vertices, where n≥3 If deg(v)≥n2 for each vertex v, then the graph G
If G
is a simple graph with n vertices, where n≥2 if deg(x)+deg(y)≥n for each pair of non-
adjacent vertices x and y, then the graph G