Professional Documents
Culture Documents
Chapter1 Notes Malik Discrete
Chapter1 Notes Malik Discrete
Chapter1 Notes Malik Discrete
Discrete Mathematics:
Theory and Applications (Revised Edition)
Learning Objectives
Learn about sets
A = { x | x S, P(x) } or A = { x S | P(x) }
Example:
Example:
X = {a,e,i,o,u}, Y = {a, i, u} and z = {b,c,d,f,g}
Y Z, since a Y, but a Z
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
Example:
If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then
X∪Y = {1,2,3,4,5,6,7,8,9}
Discrete Mathematics: Theory and Applications (Revised Edition) 14
Sets
Intersection of Sets
Example:
If X = {1,2,3,4,5} and Y = {5,6,7,8,9}, then X ∩ Y = {5}
Example:
If X = {1,2,3,4,} and Y = {6,7,8,9}, then X ∩ Y =
Example:
• Example:
If X = {a,b,c,d} and Y =
{c,d,e,f}, then X – Y =
{a,b} and Y – X = {e,f}
Example:
If U = {a,b,c,d,e,f} and X = {c,d,e,f}, then X’ = {a,b}
Discrete Mathematics: Theory and Applications (Revised Edition) 23
Sets
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)}
Discrete Mathematics: Theory and Applications (Revised Edition) 26
Sets
Conjunction
Let p and q be statements.The conjunction of p and q,
written p ^ q , is the statement formed by joining statements p
and q using the word “and”
The statement p∧q is true if both p and q are true;
otherwise p∧q is false
Conjunction
Truth Table for
Conjunction:
Disjunction
Disjunction
Truth Table for
Disjunction:
Implication
Let p and q be statements.The statement “if p
then q” is called an implication or condition.
The implication “if p then q” is written p q
p q is read:
“If p, then q”
“p is sufficient for q”
q if p
q whenever p
Implication
Let p: Today is Sunday and q: I will wash the car.
The conjunction p q is the statement:
p q : If today is Sunday, then I will wash the car
The converse of this implication is written q p
If I wash the car, then today is Sunday
The inverse of this implication is ~p ~q
If today is not Sunday, then I will not wash the car
The contrapositive of this implication is ~q ~p
If I do not wash the car, then today is not Sunday
Statement Formulas
Definitions
Symbols p ,q ,r ,...,called statement variables
Symbols ~, ∧, ∨, →,and ↔ are called logical
connectives
1) A statement variable is a statement formula
2) If A and B are statement formulas, then the
expressions (~A ), (A ∧ B) , (A ∨ B ), (A → B )
and (A ↔ B ) are statement formulas
Expressions are statement formulas that are
constructed only by using 1) and 2) above
~ highest
∧ second highest
∨ third highest
→ fourth highest
↔ fifth highest
Tautology
A statement formula A is said to be a tautology if
the truth value of A is T for any assignment of the
truth values T and F to the statement variables
occurring in A
Contradiction
A statement formula A is said to be a
contradiction if the truth value of A is F for any
assignment of the truth values T and F to the
statement variables occurring in A
Disjunctive Syllogisms
Dilemma
Conjunctive Simplification
Valid Argument
Forms
Disjunctive Addition
Disjunctive Addition
Example:
Q(x,y) : x > y, where the Domain is the set of
integers
Q is a 2-place predicate
Q is T for Q(4,3) and Q is F for Q (3,4)
Discrete Mathematics: Theory and Applications (Revised Edition) 58
Quantifiers and First Order Logic
Universal Quantifier
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)
Two-place predicate: xy P ( x, y )
~ x P ( x) x ~ P ( x)
Theorem
As Facts
As Implications
As Biimplications
Indirect Proof
The implication p → q is equivalent to the
implication (∼q → ∼p)
Therefore, in order to show that p → q is true,
one can also show that the implication
(∼q → ∼p) is true
To show that (∼q → ∼p) is true, assume that the
negation of q is true and prove that the negation
of p is true
Pseudocode Conventions
Control Structures
Pseudocode Conventions
Block of Statement
To consider a set of statements a single
statement, the statements are written between the
words begin and end
begin
statement1
statement2
...
statementn;
end
Pseudocode Conventions
Comments
In describing the steps of an algorithm, comments are
included wherever necessary to clarify the steps
Two types of comments: single-line and multi-line
Single-line comments start anywhere in the line
with the pair of symbols //
Multi-line comments are enclosed between the pair
of symbols /* and */
Specifies what the algorithm does, as well as the input
and output