Discrete Mathematics ICS127
Lecturer: Dr. Alex Tiskinhttp://www.dcs.warwick.ac.uk/˜tiskin
Department of Computer Science
University of Warwick
Discrete Mathematics I – p. 1/292
Discrete Mathematics IMathematics relevant to computer scienceUsed in other CS courses
29 lectures in Autumn TermWeekly problem sheets, seminars from week 2 —please sign up!
Website: http://www.dcs.warwick.ac.uk/~tiskin/teach/dm1.html
Seminar signup open now
Discrete Mathematics I – p. 2/292
Discrete Mathematics IClass test in week 7 (new from 2002/03!)
Exam in week 1 of Summer TermResults at the end of Summer Term
Discrete Mathematics I – p. 3/292
Discrete Mathematics ILecture notes available at lectures
Website: http://www.dcs.warwick.ac.uk/~tiskin/teach/dm1.html
Forum: http://forums.warwick.ac.uk, thenclick on Departments > Computer Science> UGyear1 > CS127
Please participate!
Discrete Mathematics I – p. 4/292
Discrete Mathematics IDiscrete Maths II — a Summer Term optionLecturer: Dr. Mike Joy
Discrete maths in depth, highly recommended!
Discrete Mathematics I – p. 5/292
Discrete Mathematics IRecommended books:
Discrete MathematicsRoss and Wright (Prentice Hall, 2003)
Discrete Mathematics and its ApplicationsRosen (McGraw-Hill, 2003)
Discrete Mathematics for Computer ScientistsTruss (Addison-Wesley, 1999)
Discrete Mathematics I – p. 6/292
Discrete Mathematics IWhich is the best?
• Ross and Wright: the most helpful. . .
• Rosen: the most interesting. . .
• Truss: the most advanced. . .
Hundreds more, the choice is yours!
Discrete Mathematics I – p. 7/292
Discrete Mathematics IWhich is the best?
• Ross and Wright: the most helpful. . .
• Rosen: the most interesting. . .
• Truss: the most advanced. . .
Hundreds more, the choice is yours!
Discrete Mathematics I – p. 7/292
Discrete Mathematics IWhich is the best?
• Ross and Wright: the most helpful. . .
• Rosen: the most interesting. . .
• Truss: the most advanced. . .
Hundreds more, the choice is yours!
Discrete Mathematics I – p. 7/292
Discrete Mathematics IWhich is the best?
• Ross and Wright: the most helpful. . .
• Rosen: the most interesting. . .
• Truss: the most advanced. . .
Hundreds more, the choice is yours!
Discrete Mathematics I – p. 7/292
Discrete Mathematics IWhich is the best?
• Ross and Wright: the most helpful. . .
• Rosen: the most interesting. . .
• Truss: the most advanced. . .
Hundreds more, the choice is yours!
Discrete Mathematics I – p. 7/292
Discrete Mathematics IAlso:
Proofs and Fundamentals: a First Course in AbstractMathematicsBloch (Birkhäuser, 2002)
Does not cover whole course, but helps with proofs
Discrete Mathematics I – p. 8/292
Discrete Mathematics IAlso:
Proofs and Fundamentals: a First Course in AbstractMathematicsBloch (Birkhäuser, 2002)
Does not cover whole course, but helps with proofs
Discrete Mathematics I – p. 8/292
Introduction
Discrete Mathematics I – p. 9/292
IntroductionMathematics:
the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .What does “5” mean?
Five apples, five hats, five lottery numbers. . .Abstraction of all five-element sets
What set does 0 represent? The empty set
Discrete Mathematics I – p. 10/292
IntroductionMathematics: the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .What does “5” mean?
Five apples, five hats, five lottery numbers. . .Abstraction of all five-element sets
What set does 0 represent? The empty set
Discrete Mathematics I – p. 10/292
IntroductionMathematics: the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .What does “5” mean?
Five apples, five hats, five lottery numbers. . .Abstraction of all five-element sets
What set does 0 represent? The empty set
Discrete Mathematics I – p. 10/292
IntroductionMathematics: the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .What does “5” mean?
Five apples, five hats, five lottery numbers. . .Abstraction of all five-element sets
What set does 0 represent? The empty set
Discrete Mathematics I – p. 10/292
IntroductionMathematics: the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .What does “5” mean?
Five apples, five hats, five lottery numbers. . .Abstraction of all five-element sets
What set does 0 represent?
The empty set
Discrete Mathematics I – p. 10/292
IntroductionMathematics: the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .What does “5” mean?
Five apples, five hats, five lottery numbers. . .Abstraction of all five-element sets
What set does 0 represent? The empty set
Discrete Mathematics I – p. 10/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}
{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionA set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠,♥,♣,♦}{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N natural numbers
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven even naturals
{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/292
IntroductionThe empty set: {} = ∅Plays a role for sets similar to 0 for numbers
Discrete Mathematics I – p. 12/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?
Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?
Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?
No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why?
It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionSome “tough” questions:
Do infinite sets have “sizes”?Yes, but these are beyond natural numbers
Can infinite sets have different sizes?Yes, a huge variety of possible sizes
Is there a set of all sets?No! Not even a set of all (infinite) set sizes
Why? It can be proved!
Discrete Mathematics I – p. 13/292
IntroductionNatural sciences are based on evidence
Mathematics is based on proof(but evidence helps to understand proofs)
Discrete Mathematics I – p. 14/292
IntroductionNatural sciences are based on evidence
Mathematics is based on proof(but evidence helps to understand proofs)
Discrete Mathematics I – p. 14/292
IntroductionTo write proofs, we need a special language:
• precise (unambiguous)
• concise (clear and relatively brief)
The “grammar” of this language is logic
Discrete Mathematics I – p. 15/292
IntroductionAll eagles can flySome pigs cannot fly
Therefore, some pigs are not eagles
Proof.
Consider all creatures. If it is an eagle, it can fly.Hence, if it cannot fly, it is not an eagle.
There is a creature that is a pig and cannot fly.By the above statement, it is not an eagle.
Discrete Mathematics I – p. 16/292
IntroductionAll eagles can flySome pigs cannot fly
Therefore, some pigs are not eagles
Proof.
Consider all creatures. If it is an eagle, it can fly.Hence, if it cannot fly, it is not an eagle.
There is a creature that is a pig and cannot fly.By the above statement, it is not an eagle.
Discrete Mathematics I – p. 16/292
IntroductionAll eagles can flySome pigs cannot fly
Therefore, some pigs are not eagles
Proof.
Consider all creatures. If it is an eagle, it can fly.Hence, if it cannot fly, it is not an eagle.
There is a creature that is a pig and cannot fly.By the above statement, it is not an eagle.
Discrete Mathematics I – p. 16/292
IntroductionThe same in mathematical notation:
If for all x, eagle(x) ⇒ canfly(x),and for some y, pig(y) ∧ ¬canfly(y),
then for some z, pig(z) ∧ ¬eagle(z)
Proof. Consider all x ∈ Creatures .
By first condition, ¬canfly(x) ⇒ ¬eagle(x).
Take any y such that pig(y) ∧ ¬canfly(y).By the above, we have pig(y) ∧ ¬eagle(y).Take z = y.
Discrete Mathematics I – p. 17/292
IntroductionSome concepts are basic, i.e. need no definitionExamples: set, natural number
All other concepts must be definedExamples: finite set, even number
Some facts are axioms, i.e. need no proofExample: equal sets have the same elements
All other facts must be provedExample: the set of even numbers is infinite
This is the axiomatic method
Discrete Mathematics I – p. 18/292
IntroductionSome concepts are basic, i.e. need no definitionExamples: set, natural number
All other concepts must be definedExamples: finite set, even number
Some facts are axioms, i.e. need no proofExample: equal sets have the same elements
All other facts must be provedExample: the set of even numbers is infinite
This is the axiomatic method
Discrete Mathematics I – p. 18/292
IntroductionSome concepts are basic, i.e. need no definitionExamples: set, natural number
All other concepts must be definedExamples: finite set, even number
Some facts are axioms, i.e. need no proofExample: equal sets have the same elements
All other facts must be provedExample: the set of even numbers is infinite
This is the axiomatic method
Discrete Mathematics I – p. 18/292
IntroductionSome concepts are basic, i.e. need no definitionExamples: set, natural number
All other concepts must be definedExamples: finite set, even number
Some facts are axioms, i.e. need no proofExample: equal sets have the same elements
All other facts must be provedExample: the set of even numbers is infinite
This is the axiomatic method
Discrete Mathematics I – p. 18/292
IntroductionSome concepts are basic, i.e. need no definitionExamples: set, natural number
All other concepts must be definedExamples: finite set, even number
Some facts are axioms, i.e. need no proofExample: equal sets have the same elements
All other facts must be provedExample: the set of even numbers is infinite
This is the axiomatic method
Discrete Mathematics I – p. 18/292
IntroductionCourse structure:
• Logic
• Sets
• More fun: relations, functions, graphs
Any questions?
Discrete Mathematics I – p. 19/292
IntroductionCourse structure:
• Logic
• Sets
• More fun: relations, functions, graphs
Any questions?
Discrete Mathematics I – p. 19/292
Logic
Discrete Mathematics I – p. 20/292
Logic
In everyday life, we use all sorts of sentences:
Five is less than ten. Welcome to Tweedy’s farm!Pigs can fly. What’s in the pies?There is life on Mars. It’s not as bad as it looks. . .
A statement is a sentence that is either true or false(but not both!).
Discrete Mathematics I – p. 21/292
Logic
In everyday life, we use all sorts of sentences:
Five is less than ten.
Welcome to Tweedy’s farm!
Pigs can fly.
What’s in the pies?
There is life on Mars.
It’s not as bad as it looks. . .
A statement is a sentence that is either true or false(but not both!).
Discrete Mathematics I – p. 21/292
Logic
In everyday life, we use all sorts of sentences:
Five is less than ten. Welcome to Tweedy’s farm!Pigs can fly. What’s in the pies?There is life on Mars. It’s not as bad as it looks. . .
A statement is a sentence that is either true or false(but not both!).
Discrete Mathematics I – p. 21/292
Logic
In everyday life, we use all sorts of sentences:
Five is less than ten. Welcome to Tweedy’s farm!Pigs can fly. What’s in the pies?There is life on Mars. It’s not as bad as it looks. . .
A statement is a sentence that is either true or false(but not both!).
Discrete Mathematics I – p. 21/292
Logic
False and true are Boolean values: B = {F, T}
(After G. Boole, 1815–1864)
value(5 < 10) = T
value(“Pigs can fly”) = F
value(“It’s not as bad as it looks”) — ?
value(“The pie is not as bad as it looks”) = F
Discrete Mathematics I – p. 22/292
Logic
False and true are Boolean values: B = {F, T}(After G. Boole, 1815–1864)
value(5 < 10) = T
value(“Pigs can fly”) = F
value(“It’s not as bad as it looks”) — ?
value(“The pie is not as bad as it looks”) = F
Discrete Mathematics I – p. 22/292
Logic
False and true are Boolean values: B = {F, T}(After G. Boole, 1815–1864)
value(5 < 10) = T
value(“Pigs can fly”) = F
value(“It’s not as bad as it looks”) — ?
value(“The pie is not as bad as it looks”) = F
Discrete Mathematics I – p. 22/292
Logic
False and true are Boolean values: B = {F, T}(After G. Boole, 1815–1864)
value(5 < 10) = T
value(“Pigs can fly”) = F
value(“It’s not as bad as it looks”) — ?
value(“The pie is not as bad as it looks”) = F
Discrete Mathematics I – p. 22/292
Logic
False and true are Boolean values: B = {F, T}(After G. Boole, 1815–1864)
value(5 < 10) = T
value(“Pigs can fly”) = F
value(“It’s not as bad as it looks”) — ?
value(“The pie is not as bad as it looks”) = F
Discrete Mathematics I – p. 22/292
Logic
Often need compound statements:
(5 < 10) AND (Pigs can fly)
. . . i.e. T AND F = F — similar e.g. to 3 + 4 = 7
Discrete Mathematics I – p. 23/292
Logic
Often need compound statements:
(5 < 10) AND (Pigs can fly)
. . . i.e. T AND F = F — similar e.g. to 3 + 4 = 7
Discrete Mathematics I – p. 23/292
Logic
Boolean operators on B:
¬A NOT A negationA ∧B A AND B conjunctionA ∨B A OR B disjunctionA ⇒ B IF A THEN B implicationA ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Boolean operators on B:
¬A NOT A negation
A ∧B A AND B conjunctionA ∨B A OR B disjunctionA ⇒ B IF A THEN B implicationA ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Boolean operators on B:
¬A NOT A negationA ∧B A AND B conjunction
A ∨B A OR B disjunctionA ⇒ B IF A THEN B implicationA ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Boolean operators on B:
¬A NOT A negationA ∧B A AND B conjunctionA ∨B A OR B disjunction
A ⇒ B IF A THEN B implicationA ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Boolean operators on B:
¬A NOT A negationA ∧B A AND B conjunctionA ∨B A OR B disjunctionA ⇒ B IF A THEN B implication
A ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Boolean operators on B:
¬A NOT A negationA ∧B A AND B conjunctionA ∨B A OR B disjunctionA ⇒ B IF A THEN B implicationA ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Boolean operators on B:
¬A NOT A negationA ∧B A AND B conjunctionA ∨B A OR B disjunctionA ⇒ B IF A THEN B implicationA ⇔ B A ⇒ B AND B ⇒ A equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/292
Logic
Negation (NOT A): ¬A
True if A false, false if A true
A ¬A
F T
T F
Discrete Mathematics I – p. 25/292
Logic
Negation (NOT A): ¬A
True if A false, false if A true
A ¬A
F T
T F
Discrete Mathematics I – p. 25/292
Logic
Examples:
¬[5 < 10]
⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F ⇐⇒ T
Discrete Mathematics I – p. 26/292
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T
⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F ⇐⇒ T
Discrete Mathematics I – p. 26/292
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F ⇐⇒ T
Discrete Mathematics I – p. 26/292
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly]
⇐⇒ ¬F ⇐⇒ T
Discrete Mathematics I – p. 26/292
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F
⇐⇒ T
Discrete Mathematics I – p. 26/292
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F ⇐⇒ T
Discrete Mathematics I – p. 26/292
Logic
Conjunction (A AND B): A ∧B
True if both A and B true
A B A ∧B
F F F
F T F
T F F
T T T
Discrete Mathematics I – p. 27/292
Logic
Conjunction (A AND B): A ∧B
True if both A and B true
A B A ∧B
F F F
F T F
T F F
T T T
Discrete Mathematics I – p. 27/292
Logic
Example:
[5 < 10] ∧ [Pigs can fly]
⇐⇒ T ∧ F ⇐⇒ F
Discrete Mathematics I – p. 28/292
Logic
Example:
[5 < 10] ∧ [Pigs can fly] ⇐⇒ T ∧ F
⇐⇒ F
Discrete Mathematics I – p. 28/292
Logic
Example:
[5 < 10] ∧ [Pigs can fly] ⇐⇒ T ∧ F ⇐⇒ F
Discrete Mathematics I – p. 28/292
Logic
Disjunction (A OR B): A ∨B
True if either A or B true (or both)
A B A ∨B
F F F
F T T
T F T
T T T
Discrete Mathematics I – p. 29/292
Logic
Disjunction (A OR B): A ∨B
True if either A or B true (or both)
A B A ∨B
F F F
F T T
T F T
T T T
Discrete Mathematics I – p. 29/292
Logic
Example:
[5 < 10] ∨ [Pigs can fly]
⇐⇒ T ∨ F ⇐⇒ T
Discrete Mathematics I – p. 30/292
Logic
Example:
[5 < 10] ∨ [Pigs can fly] ⇐⇒ T ∨ F
⇐⇒ T
Discrete Mathematics I – p. 30/292
Logic
Example:
[5 < 10] ∨ [Pigs can fly] ⇐⇒ T ∨ F ⇐⇒ T
Discrete Mathematics I – p. 30/292
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Happy — definitely singsUnhappy — may or may not sing
Discrete Mathematics I – p. 31/292
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Happy — definitely singsUnhappy — may or may not sing
Discrete Mathematics I – p. 31/292
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Happy — definitely singsUnhappy — ?
may or may not sing
Discrete Mathematics I – p. 31/292
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Happy — definitely singsUnhappy — may or may not sing
Discrete Mathematics I – p. 31/292
Logic
Implication (IF A THEN B): A ⇒ B
True if A false; true if B true; false otherwise
A B A ⇒ B
F F T
F T T
T F F
T T T
Everything implies truth; false implies anything
Discrete Mathematics I – p. 32/292
Logic
Implication (IF A THEN B): A ⇒ B
True if A false; true if B true; false otherwise
A B A ⇒ B
F F T
F T T
T F F
T T T
Everything implies truth; false implies anything
Discrete Mathematics I – p. 32/292
Logic
Implication (IF A THEN B): A ⇒ B
True if A false; true if B true; false otherwise
A B A ⇒ B
F F T
F T T
T F F
T T T
Everything implies truth; false implies anything
Discrete Mathematics I – p. 32/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ]
⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F
[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ]
⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T
[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ]
⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Examples:[
[5 < 10] ⇒ [Pigs fly]]
⇐⇒ [T ⇒ F ] ⇐⇒ F[
[Pigs fly] ⇒ [5 < 10]]
⇐⇒ [F ⇒ T ] ⇐⇒ T[
[Pigs fly] ⇒ [5 > 10]]
⇐⇒ [F ⇒ F ] ⇐⇒ T
Discrete Mathematics I – p. 33/292
Logic
Example (by G. Hardy):2 + 2 = 5 =⇒ I am Count Dracula
“Proof”:2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒ 2 = 1
Dracula and I are two =⇒Dracula and I are one
Discrete Mathematics I – p. 34/292
Logic
Example (by G. Hardy):2 + 2 = 5 =⇒ I am Count Dracula
“Proof”:2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒ 2 = 1
Dracula and I are two =⇒Dracula and I are one
Discrete Mathematics I – p. 34/292
Logic
Example (by G. Hardy):2 + 2 = 5 =⇒ I am Count Dracula
“Proof”:2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒ 2 = 1
Dracula and I are two =⇒Dracula and I are one
Discrete Mathematics I – p. 34/292
Logic
Example: 2 + 2 = 5 =⇒ Grass is green
Proof:2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒
4 + 5 = 5 + 4 =⇒ T
T =⇒ Grass is green
Discrete Mathematics I – p. 35/292
Logic
Example: 2 + 2 = 5 =⇒ Grass is green
Proof:2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒
4 + 5 = 5 + 4 =⇒ T
T =⇒ Grass is green
Discrete Mathematics I – p. 35/292
Logic
Example: 2 + 2 = 5 =⇒ Grass is green
Proof:2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒
4 + 5 = 5 + 4 =⇒ T
T =⇒ Grass is green
Discrete Mathematics I – p. 35/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B
B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B
B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B
B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B
B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Implication A ⇒ B can have many disguises:
A implies B B is implied by A
A leads to B B follows from A
A is stronger than B B is weaker than A
A is sufficient for B B is necessary for A
Discrete Mathematics I – p. 36/292
Logic
Examples:
For a number to be divisible by 4, it is
necessary
thatit is even
For a triangle to be isosceles, it is sufficient that it isequilateral
Discrete Mathematics I – p. 37/292
Logic
Examples:
For a number to be divisible by 4, it is necessary thatit is even
For a triangle to be isosceles, it is sufficient that it isequilateral
Discrete Mathematics I – p. 37/292
Logic
Examples:
For a number to be divisible by 4, it is necessary thatit is even
For a triangle to be isosceles, it is
sufficient
that it isequilateral
Discrete Mathematics I – p. 37/292
Logic
Examples:
For a number to be divisible by 4, it is necessary thatit is even
For a triangle to be isosceles, it is sufficient that it isequilateral
Discrete Mathematics I – p. 37/292
Logic
Equivalence (A IF AND ONLY IF B): A ⇔ B
True if A and B agree; false otherwise
A B A ⇔ B
F F T
F T F
T F F
T T T
IF AND ONLY IF often contracted to IFF
Discrete Mathematics I – p. 38/292
Logic
Equivalence (A IF AND ONLY IF B): A ⇔ B
True if A and B agree; false otherwise
A B A ⇔ B
F F T
F T F
T F F
T T T
IF AND ONLY IF often contracted to IFF
Discrete Mathematics I – p. 38/292
Logic
Equivalence (A IF AND ONLY IF B): A ⇔ B
True if A and B agree; false otherwise
A B A ⇔ B
F F T
F T F
T F F
T T T
IF AND ONLY IF often contracted to IFF
Discrete Mathematics I – p. 38/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ]
⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F
[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ]
⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F
[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ]
⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Examples:[
[5 < 10] ⇔ [Pigs fly]]
⇐⇒ [T ⇔ F ] ⇐⇒ F[
[Pigs fly] ⇔ [5 < 10]]
⇐⇒ [F ⇔ T ] ⇐⇒ F[
[Pigs fly] ⇔ [5 > 10]]
⇐⇒ [F ⇔ F ] ⇐⇒ T
Discrete Mathematics I – p. 39/292
Logic
Implication and equivalence are often used to statetheorems
Examples:
Axiom. If n is in N, then n + 1 is in N.That is, for all n, [n in N] =⇒ [n + 1 in N]
Theorem. Number n is even iff n + 1 is odd.That is, for all n in N, [n even] ⇐⇒ [n + 1 odd]
Discrete Mathematics I – p. 40/292
Logic
Implication and equivalence are often used to statetheorems
Examples:
Axiom. If n is in N, then n + 1 is in N.
That is, for all n, [n in N] =⇒ [n + 1 in N]
Theorem. Number n is even iff n + 1 is odd.That is, for all n in N, [n even] ⇐⇒ [n + 1 odd]
Discrete Mathematics I – p. 40/292
Logic
Implication and equivalence are often used to statetheorems
Examples:
Axiom. If n is in N, then n + 1 is in N.That is, for all n, [n in N] =⇒ [n + 1 in N]
Theorem. Number n is even iff n + 1 is odd.That is, for all n in N, [n even] ⇐⇒ [n + 1 odd]
Discrete Mathematics I – p. 40/292
Logic
Implication and equivalence are often used to statetheorems
Examples:
Axiom. If n is in N, then n + 1 is in N.That is, for all n, [n in N] =⇒ [n + 1 in N]
Theorem. Number n is even iff n + 1 is odd.
That is, for all n in N, [n even] ⇐⇒ [n + 1 odd]
Discrete Mathematics I – p. 40/292
Logic
Implication and equivalence are often used to statetheorems
Examples:
Axiom. If n is in N, then n + 1 is in N.That is, for all n, [n in N] =⇒ [n + 1 in N]
Theorem. Number n is even iff n + 1 is odd.That is, for all n in N, [n even] ⇐⇒ [n + 1 odd]
Discrete Mathematics I – p. 40/292
Logic
More examples (from geometry):
Axiom. If two points are distinct, then there is exactlyone line connecting them.
Theorem. A triangle has two equal sides, if and onlyif it has two equal angles.
Discrete Mathematics I – p. 41/292
Logic
More examples (from geometry):
Axiom. If two points are distinct, then there is exactlyone line connecting them.
Theorem. A triangle has two equal sides, if and onlyif it has two equal angles.
Discrete Mathematics I – p. 41/292
Logic
Implication and equivalence are used in proofs
Example:
Theorem. If number n is even, then n + 2 is even.
Proof.[n even] ⇒ [n + 1 odd] ⇒ [(n + 1) + 1 even]
Discrete Mathematics I – p. 42/292
Logic
Implication and equivalence are used in proofs
Example:
Theorem. If number n is even, then n + 2 is even.
Proof.[n even] ⇒ [n + 1 odd] ⇒ [(n + 1) + 1 even]
Discrete Mathematics I – p. 42/292
Logic
Implication and equivalence are used in proofs
Example:
Theorem. If number n is even, then n + 2 is even.
Proof.[n even] ⇒ [n + 1 odd] ⇒ [(n + 1) + 1 even]
Discrete Mathematics I – p. 42/292
Logic
When proving “⇔”, must prove both “⇒” and “⇐”!
Example (a stronger theorem):
Theorem. Number n is even, iff n + 2 is even.
Proof.
“⇒” as before
“⇐”: [n + 2 = (n + 1) + 1 even] ⇒ [n + 1 odd] ⇒[n even]
Discrete Mathematics I – p. 43/292
Logic
When proving “⇔”, must prove both “⇒” and “⇐”!
Example (a stronger theorem):
Theorem. Number n is even, iff n + 2 is even.
Proof.
“⇒” as before
“⇐”: [n + 2 = (n + 1) + 1 even] ⇒ [n + 1 odd] ⇒[n even]
Discrete Mathematics I – p. 43/292
Logic
When proving “⇔”, must prove both “⇒” and “⇐”!
Example (a stronger theorem):
Theorem. Number n is even, iff n + 2 is even.
Proof.
“⇒” as before
“⇐”: [n + 2 = (n + 1) + 1 even] ⇒ [n + 1 odd] ⇒[n even]
Discrete Mathematics I – p. 43/292
Logic
To cut down on brackets, we use priorities
Highest priority: ¬, then ∧, ∨, then ⇒, ⇔
Example:
¬(A ∧B) ⇔ ¬A ∨ ¬B means¬(A ∧B) ⇔ ((¬A) ∨ (¬B))
Discrete Mathematics I – p. 44/292
Logic
To cut down on brackets, we use priorities
Highest priority: ¬, then ∧, ∨, then ⇒, ⇔Example:
¬(A ∧B) ⇔ ¬A ∨ ¬B means¬(A ∧B) ⇔ ((¬A) ∨ (¬B))
Discrete Mathematics I – p. 44/292
Logic
Truth table completely define logical operators.
Not always convenient:
(¬(T ∧ F ) ∨ ¬(F ⇒ T )) ⇔ (¬¬(F ∨ T ) ∨ F )
— true or false?
((A ∨B) ∧ C) ∨ ((¬A ∧ ¬B) ∨ ¬C)
— true for all A, B, C?
To simplify expressions, will use laws of logic
Discrete Mathematics I – p. 45/292
Logic
Truth table completely define logical operators.
Not always convenient:
(¬(T ∧ F ) ∨ ¬(F ⇒ T )) ⇔ (¬¬(F ∨ T ) ∨ F )
— true or false?
((A ∨B) ∧ C) ∨ ((¬A ∧ ¬B) ∨ ¬C)
— true for all A, B, C?
To simplify expressions, will use laws of logic
Discrete Mathematics I – p. 45/292
Logic
Truth table completely define logical operators.
Not always convenient:
(¬(T ∧ F ) ∨ ¬(F ⇒ T )) ⇔ (¬¬(F ∨ T ) ∨ F )
— true or false?
((A ∨B) ∧ C) ∨ ((¬A ∧ ¬B) ∨ ¬C)
— true for all A, B, C?
To simplify expressions, will use laws of logic
Discrete Mathematics I – p. 45/292
Logic
Truth table completely define logical operators.
Not always convenient:
(¬(T ∧ F ) ∨ ¬(F ⇒ T )) ⇔ (¬¬(F ∨ T ) ∨ F )
— true or false?
((A ∨B) ∧ C) ∨ ((¬A ∧ ¬B) ∨ ¬C)
— true for all A, B, C?
To simplify expressions, will use laws of logic
Discrete Mathematics I – p. 45/292
Logic
Laws of Boolean logic (hold for any A, B, C):
¬¬A ⇐⇒ A double negation
A ∧ A ⇐⇒ A ∧ idempotentA ∨ A ⇐⇒ A ∨ idempotent
A ∧B ⇐⇒ B ∧ A ∧ commutativeA ∨B ⇐⇒ B ∨ A ∨ commutative
Discrete Mathematics I – p. 46/292
Logic
Laws of Boolean logic (hold for any A, B, C):
¬¬A ⇐⇒ A double negation
A ∧ A ⇐⇒ A ∧ idempotentA ∨ A ⇐⇒ A ∨ idempotent
A ∧B ⇐⇒ B ∧ A ∧ commutativeA ∨B ⇐⇒ B ∨ A ∨ commutative
Discrete Mathematics I – p. 46/292
Logic
Laws of Boolean logic (hold for any A, B, C):
¬¬A ⇐⇒ A double negation
A ∧ A ⇐⇒ A ∧ idempotentA ∨ A ⇐⇒ A ∨ idempotent
A ∧B ⇐⇒ B ∧ A ∧ commutativeA ∨B ⇐⇒ B ∨ A ∨ commutative
Discrete Mathematics I – p. 46/292
Logic
More laws of Boolean logic:
(A ∧B) ∧ C ⇐⇒ A ∧ (B ∧ C) ∧ associative(A ∨B) ∨ C ⇐⇒ A ∨ (B ∨ C) ∨ associative
A ∧ (B ∨ C) ⇐⇒ (A ∧B) ∨ (A ∧ C)∧ distributes over ∨
A ∨ (B ∧ C) ⇐⇒ (A ∨B) ∧ (A ∨ C)∨ distributes over ∧
Compare a · (b + c) = a · b + a · c,but a + b · c 6= (a + b) · (a + c)
Discrete Mathematics I – p. 47/292
Logic
More laws of Boolean logic:
(A ∧B) ∧ C ⇐⇒ A ∧ (B ∧ C) ∧ associative(A ∨B) ∨ C ⇐⇒ A ∨ (B ∨ C) ∨ associative
A ∧ (B ∨ C) ⇐⇒ (A ∧B) ∨ (A ∧ C)∧ distributes over ∨
A ∨ (B ∧ C) ⇐⇒ (A ∨B) ∧ (A ∨ C)∨ distributes over ∧
Compare a · (b + c) = a · b + a · c,but a + b · c 6= (a + b) · (a + c)
Discrete Mathematics I – p. 47/292
Logic
More laws of Boolean logic:
(A ∧B) ∧ C ⇐⇒ A ∧ (B ∧ C) ∧ associative(A ∨B) ∨ C ⇐⇒ A ∨ (B ∨ C) ∨ associative
A ∧ (B ∨ C) ⇐⇒ (A ∧B) ∨ (A ∧ C)∧ distributes over ∨
A ∨ (B ∧ C) ⇐⇒ (A ∨B) ∧ (A ∨ C)∨ distributes over ∧
Compare a · (b + c) = a · b + a · c,but a + b · c 6= (a + b) · (a + c)
Discrete Mathematics I – p. 47/292
Logic
More laws of Boolean logic:
(A ∧B) ∧ C ⇐⇒ A ∧ (B ∧ C) ∧ associative(A ∨B) ∨ C ⇐⇒ A ∨ (B ∨ C) ∨ associative
A ∧ (B ∨ C) ⇐⇒ (A ∧B) ∨ (A ∧ C)∧ distributes over ∨
A ∨ (B ∧ C) ⇐⇒ (A ∨B) ∧ (A ∨ C)∨ distributes over ∧
Compare a · (b + c) = a · b + a · c,but a + b · c 6= (a + b) · (a + c)
Discrete Mathematics I – p. 47/292
Logic
De Morgan’s laws:
¬(A ∧B) ⇐⇒ ¬A ∨ ¬B¬(A ∨B) ⇐⇒ ¬A ∧ ¬B
Thus, A ∧B ⇐⇒ ¬(¬A ∨ ¬B),so ∧ can be expressed via ¬, ∨Alternatively, A ∨B ⇐⇒ ¬(¬A ∧ ¬B),so ∨ can be expressed via ¬, ∧(Cannot remove both ∧, ∨ at the same time!)
Discrete Mathematics I – p. 48/292
Logic
De Morgan’s laws:
¬(A ∧B) ⇐⇒ ¬A ∨ ¬B¬(A ∨B) ⇐⇒ ¬A ∧ ¬B
Thus, A ∧B ⇐⇒ ¬(¬A ∨ ¬B),so ∧ can be expressed via ¬, ∨
Alternatively, A ∨B ⇐⇒ ¬(¬A ∧ ¬B),so ∨ can be expressed via ¬, ∧(Cannot remove both ∧, ∨ at the same time!)
Discrete Mathematics I – p. 48/292
Logic
De Morgan’s laws:
¬(A ∧B) ⇐⇒ ¬A ∨ ¬B¬(A ∨B) ⇐⇒ ¬A ∧ ¬B
Thus, A ∧B ⇐⇒ ¬(¬A ∨ ¬B),so ∧ can be expressed via ¬, ∨Alternatively, A ∨B ⇐⇒ ¬(¬A ∧ ¬B),so ∨ can be expressed via ¬, ∧
(Cannot remove both ∧, ∨ at the same time!)
Discrete Mathematics I – p. 48/292
Logic
De Morgan’s laws:
¬(A ∧B) ⇐⇒ ¬A ∨ ¬B¬(A ∨B) ⇐⇒ ¬A ∧ ¬B
Thus, A ∧B ⇐⇒ ¬(¬A ∨ ¬B),so ∧ can be expressed via ¬, ∨Alternatively, A ∨B ⇐⇒ ¬(¬A ∧ ¬B),so ∨ can be expressed via ¬, ∧(Cannot remove both ∧, ∨ at the same time!)
Discrete Mathematics I – p. 48/292
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A A ∨ F ⇐⇒ A identity laws
A ∧ F ⇐⇒ F A ∨ T ⇐⇒ Tannihilation laws
A ∧ ¬A ⇐⇒ F A ∨ ¬A ⇐⇒ Tlaws of excluded middle
A ∧ (A ∨B) ⇐⇒ A ⇐⇒ A ∨ (A ∧B)absorption laws
Discrete Mathematics I – p. 49/292
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A A ∨ F ⇐⇒ A identity laws
A ∧ F ⇐⇒ F A ∨ T ⇐⇒ Tannihilation laws
A ∧ ¬A ⇐⇒ F A ∨ ¬A ⇐⇒ Tlaws of excluded middle
A ∧ (A ∨B) ⇐⇒ A ⇐⇒ A ∨ (A ∧B)absorption laws
Discrete Mathematics I – p. 49/292
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A A ∨ F ⇐⇒ A identity laws
A ∧ F ⇐⇒ F A ∨ T ⇐⇒ Tannihilation laws
A ∧ ¬A ⇐⇒ F A ∨ ¬A ⇐⇒ Tlaws of excluded middle
A ∧ (A ∨B) ⇐⇒ A ⇐⇒ A ∨ (A ∧B)absorption laws
Discrete Mathematics I – p. 49/292
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A A ∨ F ⇐⇒ A identity laws
A ∧ F ⇐⇒ F A ∨ T ⇐⇒ Tannihilation laws
A ∧ ¬A ⇐⇒ F A ∨ ¬A ⇐⇒ Tlaws of excluded middle
A ∧ (A ∨B) ⇐⇒ A ⇐⇒ A ∨ (A ∧B)absorption laws
Discrete Mathematics I – p. 49/292
Logic
Finally,
(A ⇒ B) ⇐⇒ (¬A ∨B) ⇐⇒ ¬(A ∧ ¬B)
(A ⇔ B) ⇐⇒ (A ⇒ B) ∧ (B ⇒ A) ⇐⇒(A ∧B) ∨ (¬A ∧ ¬B)
So, ⇒ and ⇔ are redundant (but convenient)
Discrete Mathematics I – p. 50/292
Logic
Finally,
(A ⇒ B) ⇐⇒ (¬A ∨B) ⇐⇒ ¬(A ∧ ¬B)
(A ⇔ B) ⇐⇒ (A ⇒ B) ∧ (B ⇒ A) ⇐⇒(A ∧B) ∨ (¬A ∧ ¬B)
So, ⇒ and ⇔ are redundant (but convenient)
Discrete Mathematics I – p. 50/292
Logic
Finally,
(A ⇒ B) ⇐⇒ (¬A ∨B) ⇐⇒ ¬(A ∧ ¬B)
(A ⇔ B) ⇐⇒ (A ⇒ B) ∧ (B ⇒ A) ⇐⇒(A ∧B) ∨ (¬A ∧ ¬B)
So, ⇒ and ⇔ are redundant (but convenient)
Discrete Mathematics I – p. 50/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T
T F F F F
T F
F T F T T
F T
F T T F T
F F
F T T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T
F F F F
T F F
T F T T
F T F
T T F T
F F F
T T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T F
F F F
T F F T
F T T
F T F T
T F T
F F F T
T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T F F F
F
T F F T F T
T
F T F T T F
T
F F F T T T
T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧B) ⇐⇒ (¬A ∨ ¬B)
A B A ∧B ¬(A ∧B) ¬A ¬B (¬A ∨ ¬B)
T T T F F F F
T F F T F T T
F T F T T F T
F F F T T T T
? ?
Discrete Mathematics I – p. 51/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A)
⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A)
⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A)
⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B)
⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒(B ∨ ¬A) ⇐⇒ (¬A ∨B) ⇐⇒ (A ⇒ B)
¬B ⇒ ¬A is the contapositive of A ⇒ B
B ⇒ A is the converse of A ⇒ B
Statement A ⇒ B is equivalent to its contrapositive,but not to its converse
Equivalence with contrapositive allows proof bycontradiction
Discrete Mathematics I – p. 52/292
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Holmes: Elementary, my dear Watson! Alert peoplenever leave things behind. But he left his walkingstick. Therefore, he must be absent-minded.
A = “person is alert”B = “person does not leave things behind”
Holmes’ argument: (A ⇒ B) =⇒ (¬B ⇒ ¬A)
Discrete Mathematics I – p. 53/292
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Holmes: Elementary, my dear Watson! Alert peoplenever leave things behind. But he left his walkingstick. Therefore, he must be absent-minded.
A = “person is alert”B = “person does not leave things behind”
Holmes’ argument: (A ⇒ B) =⇒ (¬B ⇒ ¬A)
Discrete Mathematics I – p. 53/292
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Holmes: Elementary, my dear Watson! Alert peoplenever leave things behind. But he left his walkingstick. Therefore, he must be absent-minded.
A = “person is alert”B = “person does not leave things behind”
Holmes’ argument: (A ⇒ B) =⇒ (¬B ⇒ ¬A)
Discrete Mathematics I – p. 53/292
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Holmes: Elementary, my dear Watson! Alert peoplenever leave things behind. But he left his walkingstick. Therefore, he must be absent-minded.
A = “person is alert”B = “person does not leave things behind”
Holmes’ argument: (A ⇒ B) =⇒ (¬B ⇒ ¬A)
Discrete Mathematics I – p. 53/292
Logic
Sign in a restaurant:
Good food is not cheap.
Cheap food is not good.Is it repeating the same thing twice?
Yes! The statements are contrapositive to each other.
Discrete Mathematics I – p. 54/292
Logic
Sign in a restaurant:
Good food is not cheap.
Cheap food is not good.Is it repeating the same thing twice?
Yes! The statements are contrapositive to each other.
Discrete Mathematics I – p. 54/292
Logic
Somebody walks into a pub and says:
If I drink, everybody drinks!
Can this statement be true?
Discrete Mathematics I – p. 55/292
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose everybody in the world drinks. Thenevery person can say that.
Case 2: Suppose Joe does not drink. Then Joe can saythat.
Discrete Mathematics I – p. 56/292
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose everybody in the world drinks. Thenevery person can say that.
Case 2: Suppose Joe does not drink. Then Joe can saythat.
Discrete Mathematics I – p. 56/292
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose everybody in the world drinks. Thenevery person can say that.
Case 2: Suppose Joe does not drink. Then Joe can saythat.
Discrete Mathematics I – p. 56/292
Logic
Somebody walks into a pub and says:
If anybody drinks, I drink!
Can this statement be true?
Discrete Mathematics I – p. 57/292
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose nobody in the world drinks. Thenevery person can say that.
Case 2: Suppose Jack drinks. Then Jack can saythat.
Discrete Mathematics I – p. 58/292
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose nobody in the world drinks. Thenevery person can say that.
Case 2: Suppose Jack drinks. Then Jack can saythat.
Discrete Mathematics I – p. 58/292
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose nobody in the world drinks. Thenevery person can say that.
Case 2: Suppose Jack drinks. Then Jack can saythat.
Discrete Mathematics I – p. 58/292
Logic
So far — statements about individual objects:
Five is less than tenThe pie is not as bad as it looks
Often need to say more:
Some natural numbers are less than tenAll pies are not as bad as they look
Discrete Mathematics I – p. 59/292
Logic
So far — statements about individual objects:
Five is less than tenThe pie is not as bad as it looks
Often need to say more:
Some natural numbers are less than tenAll pies are not as bad as they look
Discrete Mathematics I – p. 59/292
Logic
Some natural numbers are less than ten
Could try to specify an instance:
Five is less than ten
What if we do not have an instance?
Discrete Mathematics I – p. 60/292
Logic
Some natural numbers are less than ten
Could try to specify an instance:
Five is less than ten
What if we do not have an instance?
Discrete Mathematics I – p. 60/292
Logic
Some natural numbers are less than ten
Could try to specify an instance:
Five is less than ten
What if we do not have an instance?
Discrete Mathematics I – p. 60/292
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·All pies are not as bad as they look
(Chicken pie. . . ) ∧ (Mushroom pie. . . ) ∧(Cabbage pie. . . ) ∧ · · ·Cannot have infinite conjunction/disjunction!
Discrete Mathematics I – p. 61/292
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·All pies are not as bad as they look
(Chicken pie. . . ) ∧ (Mushroom pie. . . ) ∧(Cabbage pie. . . ) ∧ · · ·Cannot have infinite conjunction/disjunction!
Discrete Mathematics I – p. 61/292
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·
All pies are not as bad as they look
(Chicken pie. . . ) ∧ (Mushroom pie. . . ) ∧(Cabbage pie. . . ) ∧ · · ·Cannot have infinite conjunction/disjunction!
Discrete Mathematics I – p. 61/292
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·All pies are not as bad as they look
(Chicken pie. . . ) ∧ (Mushroom pie. . . ) ∧(Cabbage pie. . . ) ∧ · · ·Cannot have infinite conjunction/disjunction!
Discrete Mathematics I – p. 61/292
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·All pies are not as bad as they look
(Chicken pie. . . ) ∧ (Mushroom pie. . . ) ∧(Cabbage pie. . . ) ∧ · · ·
Cannot have infinite conjunction/disjunction!
Discrete Mathematics I – p. 61/292
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·All pies are not as bad as they look
(Chicken pie. . . ) ∧ (Mushroom pie. . . ) ∧(Cabbage pie. . . ) ∧ · · ·Cannot have infinite conjunction/disjunction!
Discrete Mathematics I – p. 61/292
Logic
A predicate is a sentence with variables
Becomes true or false when values are substituted forvariables
Values are taken from a particular set (the range)
Always assume range is nonempty
Discrete Mathematics I – p. 62/292
Logic
A predicate is a sentence with variables
Becomes true or false when values are substituted forvariables
Values are taken from a particular set (the range)
Always assume range is nonempty
Discrete Mathematics I – p. 62/292
Logic
Examples:
x < 10 (x in N)
“Pie p is not as bad as it looks” (p in Pies)
Can be true or false, depending on x, p
Discrete Mathematics I – p. 63/292
Logic
Examples:
x < 10 (x in N)
“Pie p is not as bad as it looks” (p in Pies)
Can be true or false, depending on x, p
Discrete Mathematics I – p. 63/292
Logic
Examples:
x < 10 (x in N)
“Pie p is not as bad as it looks” (p in Pies)
Can be true or false, depending on x, p
Discrete Mathematics I – p. 63/292
Logic
A predicate can have more than one variable
Examples:
x < y (x, y in N)
“Pie p is better than pie q” (p, q in Pies)
Discrete Mathematics I – p. 64/292
Logic
A predicate can have more than one variable
Examples:
x < y (x, y in N)
“Pie p is better than pie q” (p, q in Pies)
Discrete Mathematics I – p. 64/292
Logic
A predicate can have more than one variable
Examples:
x < y (x, y in N)
“Pie p is better than pie q” (p, q in Pies)
Discrete Mathematics I – p. 64/292
Logic
Predicate with no variables: ordinary statement
Examples:
5 < 10
“My pie is better than your pie”
Discrete Mathematics I – p. 65/292
Logic
Predicate with no variables: ordinary statement
Examples:
5 < 10
“My pie is better than your pie”
Discrete Mathematics I – p. 65/292
Logic
Predicate with no variables: ordinary statement
Examples:
5 < 10
“My pie is better than your pie”
Discrete Mathematics I – p. 65/292
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)): ∃x : P (x)
Universal (FOR ALL x, P (x)): ∀x : P (x)
A particular range of x always assumed
Discrete Mathematics I – p. 66/292
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)): ∃x : P (x)
Universal (FOR ALL x, P (x)): ∀x : P (x)
A particular range of x always assumed
Discrete Mathematics I – p. 66/292
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)): ∃x : P (x)
Universal (FOR ALL x, P (x)): ∀x : P (x)
A particular range of x always assumed
Discrete Mathematics I – p. 66/292
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)): ∃x : P (x)
Universal (FOR ALL x, P (x)): ∀x : P (x)
A particular range of x always assumed
Discrete Mathematics I – p. 66/292
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
∀p ∈ Pies : “p is not as bad as it looks”
∀x ∈ N : ∃y ∈ N : x < y
∃y ∈ N : ∀x ∈ N : x < y — note the difference!
Discrete Mathematics I – p. 67/292
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
∀p ∈ Pies : “p is not as bad as it looks”
∀x ∈ N : ∃y ∈ N : x < y
∃y ∈ N : ∀x ∈ N : x < y — note the difference!
Discrete Mathematics I – p. 67/292
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
∀p ∈ Pies : “p is not as bad as it looks”
∀x ∈ N : ∃y ∈ N : x < y
∃y ∈ N : ∀x ∈ N : x < y — note the difference!
Discrete Mathematics I – p. 67/292
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
∀p ∈ Pies : “p is not as bad as it looks”
∀x ∈ N : ∃y ∈ N : x < y
∃y ∈ N : ∀x ∈ N : x < y — note the difference!
Discrete Mathematics I – p. 67/292
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
∀p ∈ Pies : “p is not as bad as it looks”
∀x ∈ N : ∃y ∈ N : x < y
∃y ∈ N : ∀x ∈ N : x < y — note the difference!
Discrete Mathematics I – p. 67/292
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒∀π ∈ Pies : “π is not as bad as it looks”
Variable under a quantifier bound, otherwise free
Example:
∃y ∈ N : x > y x free, y bound
Truth value depends on x, but not on y
Discrete Mathematics I – p. 68/292
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒
∀π ∈ Pies : “π is not as bad as it looks”
Variable under a quantifier bound, otherwise free
Example:
∃y ∈ N : x > y x free, y bound
Truth value depends on x, but not on y
Discrete Mathematics I – p. 68/292
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒∀π ∈ Pies : “π is not as bad as it looks”
Variable under a quantifier bound, otherwise free
Example:
∃y ∈ N : x > y x free, y bound
Truth value depends on x, but not on y
Discrete Mathematics I – p. 68/292
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒∀π ∈ Pies : “π is not as bad as it looks”
Variable under a quantifier bound, otherwise free
Example:
∃y ∈ N : x > y x free, y bound
Truth value depends on x, but not on y
Discrete Mathematics I – p. 68/292
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒∀π ∈ Pies : “π is not as bad as it looks”
Variable under a quantifier bound, otherwise free
Example:
∃y ∈ N : x > y x free, y bound
Truth value depends on x, but not on y
Discrete Mathematics I – p. 68/292
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒∀π ∈ Pies : “π is not as bad as it looks”
Variable under a quantifier bound, otherwise free
Example:
∃y ∈ N : x > y x free, y bound
Truth value depends on x, but not on y
Discrete Mathematics I – p. 68/292
Logic
P (x, y) ⇐⇒ x > y x, y free
P (u, v) ⇐⇒ u > v u, v free
Q1(x) ⇐⇒ P (x, 5) ⇐⇒ x > 5 x free
Q2(z) ⇐⇒ P (3, z) ⇐⇒ 3 > z z free
Q3(y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)⇐⇒ ∀u : u > y y free x, u bound
Q4(v) ⇐⇒ ∃y : P (v, y) ⇐⇒ ∃w : P (v, w)⇐⇒ ∃w : v > w v free y, w bound
Discrete Mathematics I – p. 69/292
Logic
P (x, y) ⇐⇒ x > y x, y free
P (u, v) ⇐⇒ u > v u, v free
Q1(x) ⇐⇒ P (x, 5) ⇐⇒ x > 5 x free
Q2(z) ⇐⇒ P (3, z) ⇐⇒ 3 > z z free
Q3(y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)⇐⇒ ∀u : u > y y free x, u bound
Q4(v) ⇐⇒ ∃y : P (v, y) ⇐⇒ ∃w : P (v, w)⇐⇒ ∃w : v > w v free y, w bound
Discrete Mathematics I – p. 69/292
Logic
P (x, y) ⇐⇒ x > y x, y free
P (u, v) ⇐⇒ u > v u, v free
Q1(x) ⇐⇒ P (x, 5) ⇐⇒ x > 5 x free
Q2(z) ⇐⇒ P (3, z) ⇐⇒ 3 > z z free
Q3(y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)⇐⇒ ∀u : u > y y free x, u bound
Q4(v) ⇐⇒ ∃y : P (v, y) ⇐⇒ ∃w : P (v, w)⇐⇒ ∃w : v > w v free y, w bound
Discrete Mathematics I – p. 69/292
Logic
P (x, y) ⇐⇒ x > y x, y free
P (u, v) ⇐⇒ u > v u, v free
Q1(x) ⇐⇒ P (x, 5) ⇐⇒ x > 5 x free
Q2(z) ⇐⇒ P (3, z) ⇐⇒ 3 > z z free
Q3(y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)⇐⇒ ∀u : u > y y free x, u bound
Q4(v) ⇐⇒ ∃y : P (v, y) ⇐⇒ ∃w : P (v, w)⇐⇒ ∃w : v > w v free y, w bound
Discrete Mathematics I – p. 69/292
Logic
P (x, y) ⇐⇒ x > y x, y free
P (u, v) ⇐⇒ u > v u, v free
Q1(x) ⇐⇒ P (x, 5) ⇐⇒ x > 5 x free
Q2(z) ⇐⇒ P (3, z) ⇐⇒ 3 > z z free
Q3(y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)⇐⇒ ∀u : u > y y free x, u bound
Q4(v) ⇐⇒ ∃y : P (v, y) ⇐⇒ ∃w : P (v, w)⇐⇒ ∃w : v > w v free y, w bound
Discrete Mathematics I – p. 69/292
Logic
P (x, y) ⇐⇒ x > y x, y free
P (u, v) ⇐⇒ u > v u, v free
Q1(x) ⇐⇒ P (x, 5) ⇐⇒ x > 5 x free
Q2(z) ⇐⇒ P (3, z) ⇐⇒ 3 > z z free
Q3(y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)⇐⇒ ∀u : u > y y free x, u bound
Q4(v) ⇐⇒ ∃y : P (v, y) ⇐⇒ ∃w : P (v, w)⇐⇒ ∃w : v > w v free y, w bound
Discrete Mathematics I – p. 69/292
Logic
P (x, y) ⇐⇒ x > y x, y free
Q5 ⇐⇒ ∃z : P (0, z)⇐⇒ ∃z : 0 > z ⇐⇒ F z bound
Q6 ⇐⇒ ∀y : ∃x : P (x, y)⇐⇒ ∀y : ∃x : x > y ⇐⇒ T x, y bound
Q7 ⇐⇒ P (3, 5) ⇐⇒ 3 > 5 ⇐⇒ F
Discrete Mathematics I – p. 70/292
Logic
P (x, y) ⇐⇒ x > y x, y free
Q5 ⇐⇒ ∃z : P (0, z)⇐⇒ ∃z : 0 > z ⇐⇒ F z bound
Q6 ⇐⇒ ∀y : ∃x : P (x, y)⇐⇒ ∀y : ∃x : x > y ⇐⇒ T x, y bound
Q7 ⇐⇒ P (3, 5) ⇐⇒ 3 > 5 ⇐⇒ F
Discrete Mathematics I – p. 70/292
Logic
P (x, y) ⇐⇒ x > y x, y free
Q5 ⇐⇒ ∃z : P (0, z)⇐⇒ ∃z : 0 > z ⇐⇒ F z bound
Q6 ⇐⇒ ∀y : ∃x : P (x, y)⇐⇒ ∀y : ∃x : x > y ⇐⇒ T x, y bound
Q7 ⇐⇒ P (3, 5) ⇐⇒ 3 > 5 ⇐⇒ F
Discrete Mathematics I – p. 70/292
Logic
P (x, y) ⇐⇒ x > y x, y free
Q5 ⇐⇒ ∃z : P (0, z)⇐⇒ ∃z : 0 > z ⇐⇒ F z bound
Q6 ⇐⇒ ∀y : ∃x : P (x, y)⇐⇒ ∀y : ∃x : x > y ⇐⇒ T x, y bound
Q7 ⇐⇒ P (3, 5) ⇐⇒ 3 > 5 ⇐⇒ F
Discrete Mathematics I – p. 70/292
Logic
Suppose set S finite: S = {a1, . . . , an}
∀x ∈ S : P (x) ⇐⇒ P (a1) ∧ · · · ∧ P (an)
∃x ∈ S : P (x) ⇐⇒ P (a1) ∨ · · · ∨ P (an)
On a finite range, quantifiers can be expressed byBoolean operators
Not so on an infinite range
Discrete Mathematics I – p. 71/292
Logic
Suppose set S finite: S = {a1, . . . , an}∀x ∈ S : P (x) ⇐⇒ P (a1) ∧ · · · ∧ P (an)
∃x ∈ S : P (x) ⇐⇒ P (a1) ∨ · · · ∨ P (an)
On a finite range, quantifiers can be expressed byBoolean operators
Not so on an infinite range
Discrete Mathematics I – p. 71/292
Logic
Suppose set S finite: S = {a1, . . . , an}∀x ∈ S : P (x) ⇐⇒ P (a1) ∧ · · · ∧ P (an)
∃x ∈ S : P (x) ⇐⇒ P (a1) ∨ · · · ∨ P (an)
On a finite range, quantifiers can be expressed byBoolean operators
Not so on an infinite range
Discrete Mathematics I – p. 71/292
Logic
Suppose set S finite: S = {a1, . . . , an}∀x ∈ S : P (x) ⇐⇒ P (a1) ∧ · · · ∧ P (an)
∃x ∈ S : P (x) ⇐⇒ P (a1) ∨ · · · ∨ P (an)
On a finite range, quantifiers can be expressed byBoolean operators
Not so on an infinite range
Discrete Mathematics I – p. 71/292
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T (∀x : F ) ⇐⇒ F
(∃x : T ) ⇐⇒ T (∃x : F ) ⇐⇒ F
∀x : (P (x) ∧Q) ⇐⇒ (∀x : P (x)) ∧Q
(if Q does not contain free x)
Holds for ∀, ∃, and for each of ¬, ∧, ∨, ⇒, ⇔
Discrete Mathematics I – p. 72/292
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T (∀x : F ) ⇐⇒ F
(∃x : T ) ⇐⇒ T (∃x : F ) ⇐⇒ F
∀x : (P (x) ∧Q) ⇐⇒ (∀x : P (x)) ∧Q
(if Q does not contain free x)
Holds for ∀, ∃, and for each of ¬, ∧, ∨, ⇒, ⇔
Discrete Mathematics I – p. 72/292
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T (∀x : F ) ⇐⇒ F
(∃x : T ) ⇐⇒ T (∃x : F ) ⇐⇒ F
∀x : (P (x) ∧Q) ⇐⇒ (∀x : P (x)) ∧Q
(if Q does not contain free x)
Holds for ∀, ∃, and for each of ¬, ∧, ∨, ⇒, ⇔
Discrete Mathematics I – p. 72/292
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T (∀x : F ) ⇐⇒ F
(∃x : T ) ⇐⇒ T (∃x : F ) ⇐⇒ F
∀x : (P (x) ∧Q) ⇐⇒ (∀x : P (x)) ∧Q
(if Q does not contain free x)
Holds for ∀, ∃, and for each of ¬, ∧, ∨, ⇒, ⇔
Discrete Mathematics I – p. 72/292
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T (∀x : F ) ⇐⇒ F
(∃x : T ) ⇐⇒ T (∃x : F ) ⇐⇒ F
∀x : (P (x) ∧Q) ⇐⇒ (∀x : P (x)) ∧Q
(if Q does not contain free x)
Holds for ∀, ∃, and for each of ¬, ∧, ∨, ⇒, ⇔
Discrete Mathematics I – p. 72/292
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T (∀x : F ) ⇐⇒ F
(∃x : T ) ⇐⇒ T (∃x : F ) ⇐⇒ F
∀x : (P (x) ∧Q) ⇐⇒ (∀x : P (x)) ∧Q
(if Q does not contain free x)
Holds for ∀, ∃, and for each of ¬, ∧, ∨, ⇒, ⇔
Discrete Mathematics I – p. 72/292
Logic
De Morgan’s laws for predicates:
¬∀x : P (x) ⇐⇒ ∃x : ¬P (x)
¬∃x : P (x) ⇐⇒ ∀x : ¬P (x)
Discrete Mathematics I – p. 73/292
Logic
Quantifiers — handle with care!
∀x : (P (x) ∧Q(x)) ⇐⇒ (∀x : P (x)) ∧ (∀x : Q(x))
∃x : (P (x) ∨Q(x)) ⇐⇒ (∃x : P (x)) ∨ (∃x : Q(x))
But:
∀x : (P (x) ∨Q(x)) 6⇒ (∀x : P (x)) ∨ (∀x : Q(x))(“⇐” still holds)
∃x : (P (x) ∧Q(x)) 6⇐ (∃x : P (x)) ∧ (∃x : Q(x))(“⇒” still holds)
Discrete Mathematics I – p. 74/292
Logic
Quantifiers — handle with care!
∀x : (P (x) ∧Q(x)) ⇐⇒ (∀x : P (x)) ∧ (∀x : Q(x))
∃x : (P (x) ∨Q(x)) ⇐⇒ (∃x : P (x)) ∨ (∃x : Q(x))
But:
∀x : (P (x) ∨Q(x)) 6⇒ (∀x : P (x)) ∨ (∀x : Q(x))
(“⇐” still holds)
∃x : (P (x) ∧Q(x)) 6⇐ (∃x : P (x)) ∧ (∃x : Q(x))(“⇒” still holds)
Discrete Mathematics I – p. 74/292
Logic
Quantifiers — handle with care!
∀x : (P (x) ∧Q(x)) ⇐⇒ (∀x : P (x)) ∧ (∀x : Q(x))
∃x : (P (x) ∨Q(x)) ⇐⇒ (∃x : P (x)) ∨ (∃x : Q(x))
But:
∀x : (P (x) ∨Q(x)) 6⇒ (∀x : P (x)) ∨ (∀x : Q(x))(“⇐” still holds)
∃x : (P (x) ∧Q(x)) 6⇐ (∃x : P (x)) ∧ (∃x : Q(x))(“⇒” still holds)
Discrete Mathematics I – p. 74/292
Logic
Quantifiers — handle with care!
∀x : (P (x) ∧Q(x)) ⇐⇒ (∀x : P (x)) ∧ (∀x : Q(x))
∃x : (P (x) ∨Q(x)) ⇐⇒ (∃x : P (x)) ∨ (∃x : Q(x))
But:
∀x : (P (x) ∨Q(x)) 6⇒ (∀x : P (x)) ∨ (∀x : Q(x))(“⇐” still holds)
∃x : (P (x) ∧Q(x)) 6⇐ (∃x : P (x)) ∧ (∃x : Q(x))
(“⇒” still holds)
Discrete Mathematics I – p. 74/292
Logic
Quantifiers — handle with care!
∀x : (P (x) ∧Q(x)) ⇐⇒ (∀x : P (x)) ∧ (∀x : Q(x))
∃x : (P (x) ∨Q(x)) ⇐⇒ (∃x : P (x)) ∨ (∃x : Q(x))
But:
∀x : (P (x) ∨Q(x)) 6⇒ (∀x : P (x)) ∨ (∀x : Q(x))(“⇐” still holds)
∃x : (P (x) ∧Q(x)) 6⇐ (∃x : P (x)) ∧ (∃x : Q(x))(“⇒” still holds)
Discrete Mathematics I – p. 74/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧
∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y))
⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y))
⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y))
⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
P (x) true for exactly one x in S:
∃x ∈ S : (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒∃x ∈ S : (P (x)∧∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒∃x ∈ S : (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Exercise: P (x) true for all but one x in S
Discrete Mathematics I – p. 75/292
Sets
Discrete Mathematics I – p. 76/292
SetsSet: a basic (undefined) concept
By a set we shall understand any collectioninto a whole M of definite, distinct objects ofour intuition or of our thought. These objectsare called the elements of M .
G. Cantor (1845–1918)
Discrete Mathematics I – p. 77/292
SetsSet: a basic (undefined) concept
By a set we shall understand any collectioninto a whole M of definite, distinct objects ofour intuition or of our thought. These objectsare called the elements of M .
G. Cantor (1845–1918)
Discrete Mathematics I – p. 77/292
SetsAnything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}Neven = {0, 2, 4, 6, 8, 10, . . .}Junk = {239, banana, ace of spades}A set can be an element of another set
SuperJunk = {239, Junk , ∅} ={239, {banana, ace of spades, 239}, ∅}
Discrete Mathematics I – p. 78/292
SetsAnything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}
Neven = {0, 2, 4, 6, 8, 10, . . .}Junk = {239, banana, ace of spades}A set can be an element of another set
SuperJunk = {239, Junk , ∅} ={239, {banana, ace of spades, 239}, ∅}
Discrete Mathematics I – p. 78/292
SetsAnything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}Neven = {0, 2, 4, 6, 8, 10, . . .}
Junk = {239, banana, ace of spades}A set can be an element of another set
SuperJunk = {239, Junk , ∅} ={239, {banana, ace of spades, 239}, ∅}
Discrete Mathematics I – p. 78/292
SetsAnything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}Neven = {0, 2, 4, 6, 8, 10, . . .}Junk = {239, banana, ace of spades}
A set can be an element of another set
SuperJunk = {239, Junk , ∅} ={239, {banana, ace of spades, 239}, ∅}
Discrete Mathematics I – p. 78/292
SetsAnything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}Neven = {0, 2, 4, 6, 8, 10, . . .}Junk = {239, banana, ace of spades}A set can be an element of another set
SuperJunk = {239, Junk , ∅} ={239, {banana, ace of spades, 239}, ∅}
Discrete Mathematics I – p. 78/292
SetsAnything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}Neven = {0, 2, 4, 6, 8, 10, . . .}Junk = {239, banana, ace of spades}A set can be an element of another set
SuperJunk = {239, Junk , ∅} ={239, {banana, ace of spades, 239}, ∅}
Discrete Mathematics I – p. 78/292
SetsOrder of elements does not matter
Junk = {banana, ace of spades, 239}
Repetition of elements does not matter
Junk ={banana, banana, ace of spades, 239, 239, 239}
Discrete Mathematics I – p. 79/292
SetsOrder of elements does not matter
Junk = {banana, ace of spades, 239}Repetition of elements does not matter
Junk ={banana, banana, ace of spades, 239, 239, 239}
Discrete Mathematics I – p. 79/292
SetsThe empty set: ∅ = {}
A singleton: any one-element set
MorningStars = {Venus}NonpositiveNaturals = {0}EmptySets = {∅} 6= ∅
Discrete Mathematics I – p. 80/292
SetsThe empty set: ∅ = {}A singleton: any one-element set
MorningStars = {Venus}NonpositiveNaturals = {0}EmptySets = {∅} 6= ∅
Discrete Mathematics I – p. 80/292
SetsThe empty set: ∅ = {}A singleton: any one-element set
MorningStars = {Venus}
NonpositiveNaturals = {0}EmptySets = {∅} 6= ∅
Discrete Mathematics I – p. 80/292
SetsThe empty set: ∅ = {}A singleton: any one-element set
MorningStars = {Venus}NonpositiveNaturals = {0}
EmptySets = {∅} 6= ∅
Discrete Mathematics I – p. 80/292
SetsThe empty set: ∅ = {}A singleton: any one-element set
MorningStars = {Venus}NonpositiveNaturals = {0}EmptySets = {∅} 6= ∅
Discrete Mathematics I – p. 80/292
SetsElement x is in set A: x ∈ A
Jupiter ∈ Planets , orange 6∈ Junk
Set A is a subset of set B, if all elements of A are alsoelements of B (but not necessarily the other wayround)
A ⊆ B ⇐⇒ ∀x : x ∈ A ⇒ x ∈ B
Discrete Mathematics I – p. 81/292
SetsElement x is in set A: x ∈ A
Jupiter ∈ Planets , orange 6∈ Junk
Set A is a subset of set B, if all elements of A are alsoelements of B (but not necessarily the other wayround)
A ⊆ B ⇐⇒ ∀x : x ∈ A ⇒ x ∈ B
Discrete Mathematics I – p. 81/292
SetsElement x is in set A: x ∈ A
Jupiter ∈ Planets , orange 6∈ Junk
Set A is a subset of set B, if all elements of A are alsoelements of B (but not necessarily the other wayround)
A ⊆ B ⇐⇒ ∀x : x ∈ A ⇒ x ∈ B
Discrete Mathematics I – p. 81/292
SetsElement x is in set A: x ∈ A
Jupiter ∈ Planets , orange 6∈ Junk
Set A is a subset of set B, if all elements of A are alsoelements of B (but not necessarily the other wayround)
A ⊆ B ⇐⇒ ∀x : x ∈ A ⇒ x ∈ B
Discrete Mathematics I – p. 81/292
SetsIn particular, for any set A: A ⊆ A ∅ ⊆ A
∅ ⊆ ∅Neven ⊆ N
∅ ⊆ {banana} ⊆ {banana, 239} ⊆ Junk
Discrete Mathematics I – p. 82/292
SetsIn particular, for any set A: A ⊆ A ∅ ⊆ A
∅ ⊆ ∅
Neven ⊆ N
∅ ⊆ {banana} ⊆ {banana, 239} ⊆ Junk
Discrete Mathematics I – p. 82/292
SetsIn particular, for any set A: A ⊆ A ∅ ⊆ A
∅ ⊆ ∅Neven ⊆ N
∅ ⊆ {banana} ⊆ {banana, 239} ⊆ Junk
Discrete Mathematics I – p. 82/292
SetsIn particular, for any set A: A ⊆ A ∅ ⊆ A
∅ ⊆ ∅Neven ⊆ N
∅ ⊆ {banana} ⊆ {banana, 239} ⊆ Junk
Discrete Mathematics I – p. 82/292
SetsWhat are the axioms of set theory?
The Law of Extensionality:
Two sets with all the same elements are equal
For any sets A, B: (A ⊆ B) ∧ (B ⊆ A) ⇒ A = B
In particular, there is only one empty set
Discrete Mathematics I – p. 83/292
SetsWhat are the axioms of set theory?
The Law of Extensionality:
Two sets with all the same elements are equal
For any sets A, B: (A ⊆ B) ∧ (B ⊆ A) ⇒ A = B
In particular, there is only one empty set
Discrete Mathematics I – p. 83/292
SetsWhat are the axioms of set theory?
The Law of Extensionality:
Two sets with all the same elements are equal
For any sets A, B: (A ⊆ B) ∧ (B ⊆ A) ⇒ A = B
In particular, there is only one empty set
Discrete Mathematics I – p. 83/292
SetsWhat are the axioms of set theory?
The Law of Extensionality:
Two sets with all the same elements are equal
For any sets A, B: (A ⊆ B) ∧ (B ⊆ A) ⇒ A = B
In particular, there is only one empty set
Discrete Mathematics I – p. 83/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}In particular: {x ∈ S | T} = S {x ∈ S | F} = ∅
Discrete Mathematics I – p. 84/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}In particular: {x ∈ S | T} = S {x ∈ S | F} = ∅
Discrete Mathematics I – p. 84/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}
In particular: {x ∈ S | T} = S {x ∈ S | F} = ∅
Discrete Mathematics I – p. 84/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}In particular: {x ∈ S | T} =
S {x ∈ S | F} = ∅
Discrete Mathematics I – p. 84/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}In particular: {x ∈ S | T} = S
{x ∈ S | F} = ∅
Discrete Mathematics I – p. 84/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}In particular: {x ∈ S | T} = S {x ∈ S | F} =
∅
Discrete Mathematics I – p. 84/292
SetsLet P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Range often made explicit: {x ∈ S | P (x)}In particular: {x ∈ S | T} = S {x ∈ S | F} = ∅
Discrete Mathematics I – p. 84/292
SetsExamples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}
{x ∈ Planets | x is red} = {Mars}{x ∈ N | x ≥ 0} = N
{x ∈ Planets | x is a banana} = ∅
Discrete Mathematics I – p. 85/292
SetsExamples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}{x ∈ Planets | x is red} = {Mars}
{x ∈ N | x ≥ 0} = N
{x ∈ Planets | x is a banana} = ∅
Discrete Mathematics I – p. 85/292
SetsExamples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}{x ∈ Planets | x is red} = {Mars}{x ∈ N | x ≥ 0} = N
{x ∈ Planets | x is a banana} = ∅
Discrete Mathematics I – p. 85/292
SetsExamples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}{x ∈ Planets | x is red} = {Mars}{x ∈ N | x ≥ 0} = N
{x ∈ Planets | x is a banana} = ∅
Discrete Mathematics I – p. 85/292
SetsAnother axiom of set theory
The Law of Abstraction:
For any predicate P (x), there is a set {x | P (x)}
Discrete Mathematics I – p. 86/292
SetsAnother axiom of set theory
The Law of Abstraction:
For any predicate P (x), there is a set {x | P (x)}
Discrete Mathematics I – p. 86/292
SetsAnother axiom of set theory
The Law of Abstraction:
For any predicate P (x), there is a set {x | P (x)}Extensionality + Abstraction = Set Theory
Discrete Mathematics I – p. 86/292
SetsAnother axiom of set theory
The Law of Abstraction:
For any predicate P (x), there is a set {x | P (x)}Extensionality + Abstraction = CONTRADICTION
Discrete Mathematics I – p. 86/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}
B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B
B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox
A barber shaves everyone who does not shavehimself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}B ∈ B — true or false?
B ∈ B =⇒ B 6∈ B B 6∈ B =⇒ B ∈ B
Contradiction!
Discrete Mathematics I – p. 87/292
SetsRussell’s paradox can only be explained byinconsistency of axioms
Set theory can be fixed — no details here
Extensionality + Abstraction =Naive set theory
Discrete Mathematics I – p. 88/292
SetsRussell’s paradox can only be explained byinconsistency of axioms
Set theory can be fixed — no details here
Extensionality + Abstraction =Naive set theory
Discrete Mathematics I – p. 88/292
SetsRussell’s paradox can only be explained byinconsistency of axioms
Set theory can be fixed — no details here
Extensionality + Abstraction =
Naive set theory
Discrete Mathematics I – p. 88/292
SetsRussell’s paradox can only be explained byinconsistency of axioms
Set theory can be fixed — no details here
Extensionality + Abstraction = Naive set theory
Discrete Mathematics I – p. 88/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}Venn diagrams (illustration only!):
A B A ∩B A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}
Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}Venn diagrams (illustration only!):
A B A ∩B A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}
Venn diagrams (illustration only!):
A B A ∩B A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}Venn diagrams (illustration only!):
A B
A ∩B A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}Venn diagrams (illustration only!):
A B A ∩B
A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}Venn diagrams (illustration only!):
A B A ∩B A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsOperations on sets:
Intersection: A ∩B = {x | (x ∈ A) ∧ (x ∈ B)}Union: A ∪B = {x | (x ∈ A) ∨ (x ∈ B)}Venn diagrams (illustration only!):
A B A ∩B A ∪B
Sets A, B are called disjoint, if A ∩B = ∅
Discrete Mathematics I – p. 89/292
SetsMore operations on sets:
Difference: A \B = {x | (x ∈ A) ∧ (x 6∈ B)}
A B A \B B \ A
If A, B disjoint, then A \B = A, B \ A = B
Discrete Mathematics I – p. 90/292
SetsMore operations on sets:
Difference: A \B = {x | (x ∈ A) ∧ (x 6∈ B)}
A B
A \B B \ A
If A, B disjoint, then A \B = A, B \ A = B
Discrete Mathematics I – p. 90/292
SetsMore operations on sets:
Difference: A \B = {x | (x ∈ A) ∧ (x 6∈ B)}
A B A \B
B \ A
If A, B disjoint, then A \B = A, B \ A = B
Discrete Mathematics I – p. 90/292
SetsMore operations on sets:
Difference: A \B = {x | (x ∈ A) ∧ (x 6∈ B)}
A B A \B B \ A
If A, B disjoint, then A \B = A, B \ A = B
Discrete Mathematics I – p. 90/292
SetsMore operations on sets:
Difference: A \B = {x | (x ∈ A) ∧ (x 6∈ B)}
A B A \B B \ A
If A, B disjoint, then A \B = A, B \ A = B
Discrete Mathematics I – p. 90/292
SetsLet S be a fixed (universal) set, A ⊆ S
Complement of A (with respect to S): A = S \ A
S
A
A
Discrete Mathematics I – p. 91/292
SetsLet S be a fixed (universal) set, A ⊆ S
Complement of A (with respect to S): A = S \ A
S
A
A
Discrete Mathematics I – p. 91/292
SetsLet S be a fixed (universal) set, A ⊆ S
Complement of A (with respect to S): A = S \ A
S
A
A
Discrete Mathematics I – p. 91/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}
A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B =
{a, b, c, f, g} A ∩B = {a, c}A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g}
A ∩B = {a, c}A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B =
{a, c}A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}
A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B =
{b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B = {b}
B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B = {b} B \ A =
{f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B = {b} B \ A = {f, g}
Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsExamples:
A = {a, b, c}, B = {c, a, f, g}A ∪B = {a, b, c, f, g} A ∩B = {a, c}A \B = {b} B \ A = {f, g}Note: A ∪B = (A ∩B) ∪ (A \B) ∪ (B \ A)
Also: (A ∪B) \ (A ∩B) = (A \B) ∪ (B \ A)
Discrete Mathematics I – p. 92/292
SetsLaws of set operations (hold for any A, B, C):
¯A = A double complement
A ∩ A = A ∩ idempotentA ∪ A = A ∪ idempotent
A ∩B = B ∩ A ∩ commutativeA ∪B = B ∪ A ∪ commutative
Discrete Mathematics I – p. 93/292
SetsLaws of set operations (hold for any A, B, C):
¯A = A double complement
A ∩ A = A ∩ idempotentA ∪ A = A ∪ idempotent
A ∩B = B ∩ A ∩ commutativeA ∪B = B ∪ A ∪ commutative
Discrete Mathematics I – p. 93/292
SetsLaws of set operations (hold for any A, B, C):
¯A = A double complement
A ∩ A = A ∩ idempotentA ∪ A = A ∪ idempotent
A ∩B = B ∩ A ∩ commutativeA ∪B = B ∪ A ∪ commutative
Discrete Mathematics I – p. 93/292
SetsMore laws of set operations:
(A ∩B) ∩ C = A ∩ (B ∩ C) ∩ associative(A ∪B) ∪ C = A ∪ (B ∪ C) ∪ associative
A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)∩ distributes over ∪
A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)∪ distributes over ∩
Compare with arithmetic and Boolean logic
Discrete Mathematics I – p. 94/292
SetsMore laws of set operations:
(A ∩B) ∩ C = A ∩ (B ∩ C) ∩ associative(A ∪B) ∪ C = A ∪ (B ∪ C) ∪ associative
A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)∩ distributes over ∪
A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)∪ distributes over ∩
Compare with arithmetic and Boolean logic
Discrete Mathematics I – p. 94/292
SetsMore laws of set operations:
(A ∩B) ∩ C = A ∩ (B ∩ C) ∩ associative(A ∪B) ∪ C = A ∪ (B ∪ C) ∪ associative
A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)∩ distributes over ∪
A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)∪ distributes over ∩
Compare with arithmetic and Boolean logic
Discrete Mathematics I – p. 94/292
SetsMore laws of set operations:
(A ∩B) ∩ C = A ∩ (B ∩ C) ∩ associative(A ∪B) ∪ C = A ∪ (B ∪ C) ∪ associative
A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)∩ distributes over ∪
A ∪ (B ∩ C) = (A ∪B) ∩ (A ∪ C)∪ distributes over ∩
Compare with arithmetic and Boolean logic
Discrete Mathematics I – p. 94/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C B ∪ C A ∩ (B ∪ C)
A ∩B A ∩ C (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C
B ∪ C A ∩ (B ∪ C)
A ∩B A ∩ C (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C B ∪ C
A ∩ (B ∪ C)
A ∩B A ∩ C (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C B ∪ C A ∩ (B ∪ C)
A ∩B A ∩ C (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C B ∪ C A ∩ (B ∪ C)
A ∩B
A ∩ C (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C B ∪ C A ∩ (B ∪ C)
A ∩B A ∩ C
(A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsA ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
A B
C B ∪ C A ∩ (B ∪ C)
A ∩B A ∩ C (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒
(x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒
(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒
(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒
(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒
x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsProve A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B∪C)) ⇐⇒(x ∈ A) ∧ (x ∈ B ∨ x ∈ C) ⇐⇒(x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⇐⇒(x ∈ A∩B)∨(x ∈ A∩C) ⇐⇒ x ∈ (A∩B)∪(A∩C)
Hence A ∩ (B ∪ C) = (A ∩B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/292
SetsDe Morgan’s laws:
A ∩B = A ∪ B A ∪B = A ∩ B
Thus, A ∩B = A ∪ B,so ∩ can be expressed via , ∪Alternatively, A ∪B = A ∩ B,so ∪ can be expressed via , ∩(Cannot remove both ∩, ∪ at the same time!)
Discrete Mathematics I – p. 97/292
SetsDe Morgan’s laws:
A ∩B = A ∪ B A ∪B = A ∩ B
Thus, A ∩B = A ∪ B,so ∩ can be expressed via , ∪
Alternatively, A ∪B = A ∩ B,so ∪ can be expressed via , ∩(Cannot remove both ∩, ∪ at the same time!)
Discrete Mathematics I – p. 97/292
SetsDe Morgan’s laws:
A ∩B = A ∪ B A ∪B = A ∩ B
Thus, A ∩B = A ∪ B,so ∩ can be expressed via , ∪Alternatively, A ∪B = A ∩ B,so ∪ can be expressed via , ∩
(Cannot remove both ∩, ∪ at the same time!)
Discrete Mathematics I – p. 97/292
SetsDe Morgan’s laws:
A ∩B = A ∪ B A ∪B = A ∩ B
Thus, A ∩B = A ∪ B,so ∩ can be expressed via , ∪Alternatively, A ∪B = A ∩ B,so ∪ can be expressed via , ∩(Cannot remove both ∩, ∪ at the same time!)
Discrete Mathematics I – p. 97/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B A ∩B
A B A ∪ B
Discrete Mathematics I – p. 98/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B A ∩B
A B A ∪ B
Discrete Mathematics I – p. 98/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B
A ∩B
A B A ∪ B
Discrete Mathematics I – p. 98/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B A ∩B
A B A ∪ B
Discrete Mathematics I – p. 98/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B A ∩B
A
B A ∪ B
Discrete Mathematics I – p. 98/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B A ∩B
A B
A ∪ B
Discrete Mathematics I – p. 98/292
Sets
A ∩B = A ∪ B
S
A B
A ∩B A ∩B
A B A ∪ B
Discrete Mathematics I – p. 98/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒
x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒
¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒
(x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒
(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒
x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
Sets
Prove A ∩B = A ∪ B
Proof. Consider any x ∈ S.
x ∈ A ∩B ⇐⇒ x 6∈ A ∩B ⇐⇒¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒(x ∈ A) ∨ (x ∈ B) ⇐⇒ x ∈ (A ∪ B)
Hence A ∩B = A ∪ B
Discrete Mathematics I – p. 99/292
SetsStill more laws:
Let A ⊆ S
A ∩ S = A A ∪ ∅ = A identity laws
A ∩ ∅ = ∅ A ∪ S = S annihilation laws
A ∩ A = ∅ A ∪ A = Slaws of excluded middle
A ∩ (A ∪B) = A = A ∪ (A ∩B)absorption laws
Discrete Mathematics I – p. 100/292
SetsStill more laws:
Let A ⊆ S
A ∩ S = A A ∪ ∅ = A identity laws
A ∩ ∅ = ∅ A ∪ S = S annihilation laws
A ∩ A = ∅ A ∪ A = Slaws of excluded middle
A ∩ (A ∪B) = A = A ∪ (A ∩B)absorption laws
Discrete Mathematics I – p. 100/292
SetsStill more laws:
Let A ⊆ S
A ∩ S = A A ∪ ∅ = A identity laws
A ∩ ∅ = ∅ A ∪ S = S annihilation laws
A ∩ A = ∅ A ∪ A = Slaws of excluded middle
A ∩ (A ∪B) = A = A ∪ (A ∩B)absorption laws
Discrete Mathematics I – p. 100/292
SetsStill more laws:
Let A ⊆ S
A ∩ S = A A ∪ ∅ = A identity laws
A ∩ ∅ = ∅ A ∪ S = S annihilation laws
A ∩ A = ∅ A ∪ A = Slaws of excluded middle
A ∩ (A ∪B) = A = A ∪ (A ∩B)absorption laws
Discrete Mathematics I – p. 100/292
SetsA structure with such properties is called a Booleanalgebra
Examples:
B = {F, T}operations ∧, ∨, ¬ identities F , T
Set of all subsets of fixed S
operations ∩, ∪,¯ identities ∅, S
Discrete Mathematics I – p. 101/292
SetsA structure with such properties is called a Booleanalgebra
Examples:
B = {F, T}operations ∧, ∨, ¬ identities F , T
Set of all subsets of fixed S
operations ∩, ∪,¯ identities ∅, S
Discrete Mathematics I – p. 101/292
SetsA structure with such properties is called a Booleanalgebra
Examples:
B = {F, T}operations ∧, ∨, ¬ identities F , T
Set of all subsets of fixed S
operations ∩, ∪,¯ identities ∅, S
Discrete Mathematics I – p. 101/292
SetsThe powerset of S is the set of all subsets of S
P(S) = {A | A ⊆ S}A ∈ P(S) ⇐⇒ A ⊆ S
Discrete Mathematics I – p. 102/292
SetsExamples:
P(∅) =
{∅} (note: P(∅) 6= ∅!)
P({Bunty}) = {∅, {Bunty}}P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsExamples:
P(∅) = {∅}
(note: P(∅) 6= ∅!)
P({Bunty}) = {∅, {Bunty}}P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsExamples:
P(∅) = {∅} (note: P(∅) 6= ∅!)
P({Bunty}) = {∅, {Bunty}}P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsExamples:
P(∅) = {∅} (note: P(∅) 6= ∅!)
P({Bunty}) =
{∅, {Bunty}}P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsExamples:
P(∅) = {∅} (note: P(∅) 6= ∅!)
P({Bunty}) = {∅, {Bunty}}
P({a, b, c}) ={∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsExamples:
P(∅) = {∅} (note: P(∅) 6= ∅!)
P({Bunty}) = {∅, {Bunty}}P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsExamples:
P(∅) = {∅} (note: P(∅) 6= ∅!)
P({Bunty}) = {∅, {Bunty}}P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/292
SetsIf S finite, P(S) finite
If S has n elements, P(S) has 2n elements
If S infinite, P(S) infinite
(Sometimes P(S) denoted 2S , even if S infinite)
Discrete Mathematics I – p. 104/292
SetsIf S finite, P(S) finite
If S has n elements, P(S) has 2n elements
If S infinite, P(S) infinite
(Sometimes P(S) denoted 2S , even if S infinite)
Discrete Mathematics I – p. 104/292
SetsIf S finite, P(S) finite
If S has n elements, P(S) has 2n elements
If S infinite, P(S) infinite
(Sometimes P(S) denoted 2S , even if S infinite)
Discrete Mathematics I – p. 104/292
SetsIf S finite, P(S) finite
If S has n elements, P(S) has 2n elements
If S infinite, P(S) infinite
(Sometimes P(S) denoted 2S , even if S infinite)
Discrete Mathematics I – p. 104/292
SetsProperties of P:
P(A ∩B) = P(A) ∩ P(B)
In general, P(A ∪B) 6= P(A) ∪ P(B)(but ⊇ holds)
In general, P(A \B) 6= P(A) \ P(B)(but ⊆ holds)
Discrete Mathematics I – p. 105/292
SetsProperties of P:
P(A ∩B) = P(A) ∩ P(B)
In general, P(A ∪B) 6= P(A) ∪ P(B)(but ⊇ holds)
In general, P(A \B) 6= P(A) \ P(B)(but ⊆ holds)
Discrete Mathematics I – p. 105/292
SetsProperties of P:
P(A ∩B) = P(A) ∩ P(B)
In general, P(A ∪B) 6= P(A) ∪ P(B)(but ⊇ holds)
In general, P(A \B) 6= P(A) \ P(B)(but ⊆ holds)
Discrete Mathematics I – p. 105/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B).
True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒
(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒
(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒
(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒
∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒
∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒
X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒
X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A) ∪ P(B) ⊆ P(A ∪B). True
Proof. Consider any X .
X ∈ P(A) ∪ P(B) ⇐⇒(X ∈ P(A)) ∨ (X ∈ P(B)) ⇐⇒(X ⊆ A) ∨ (X ⊆ B) ⇐⇒(∀x ∈ X : x ∈ A) ∨ (∀x ∈ X : x ∈ B) =⇒∀x ∈ X : (x ∈ A) ∨ (x ∈ B) ⇐⇒∀x ∈ X : (x ∈ A ∪B) ⇐⇒X ⊆ A ∪B ⇐⇒ X ∈ P(A ∪B)
Discrete Mathematics I – p. 106/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B).
False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}.
Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}}
X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}
=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsProve or disprove: For all A, B,P(A ∪B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such thatX ∈ P(A ∪B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
X ⊆ A ∪B = {0, 1} =⇒ X ∈ P(A ∪B)
X 6∈ P(A) = {∅, {0}} X 6∈ P(B) = {∅, {1}}=⇒ X 6∈ P(A) ∪ P(B)
Discrete Mathematics I – p. 107/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsLet x1, x2, . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1, x2, . . . , xn)
JunkSeq1 = (239, banana, ace of spades)
JunkSeq2 = (banana, 239, ace of spades, 239)
JunkSeq1 6= JunkSeq2
A sequence is not a set!
(. . . and not a basic concept, will be defined later)
Discrete Mathematics I – p. 108/292
SetsFor sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
length(JunkSeq1 ) = 3 length((x, y)) = 2
Sequence of length 2 is called an ordered pair
A direct definition: (x, y) means {{x, y}, x}
Discrete Mathematics I – p. 109/292
SetsFor sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
length(JunkSeq1 ) = 3 length((x, y)) = 2
Sequence of length 2 is called an ordered pair
A direct definition: (x, y) means {{x, y}, x}
Discrete Mathematics I – p. 109/292
SetsFor sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
length(JunkSeq1 ) = 3 length((x, y)) = 2
Sequence of length 2 is called an ordered pair
A direct definition: (x, y) means {{x, y}, x}
Discrete Mathematics I – p. 109/292
SetsFor sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
length(JunkSeq1 ) = 3 length((x, y)) = 2
Sequence of length 2 is called an ordered pair
A direct definition: (x, y) means {{x, y}, x}
Discrete Mathematics I – p. 109/292
SetsFor sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
length(JunkSeq1 ) = 3 length((x, y)) = 2
Sequence of length 2 is called an ordered pair
A direct definition: (x, y) means {{x, y}, x}
Discrete Mathematics I – p. 109/292
SetsFor sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
length(JunkSeq1 ) = 3 length((x, y)) = 2
Sequence of length 2 is called an ordered pair
A direct definition: (x, y) means {{x, y}, x}
Discrete Mathematics I – p. 109/292
SetsThe Cartesian product of sets A, B is the set of allordered pairs (a, b), where a ∈ A, b ∈ B
(After R. Descartes, 1596–1650)
A×B = {(a, b) | (a ∈ A) ∧ (b ∈ B)}A2 = A× A the Cartesian square of A
Discrete Mathematics I – p. 110/292
SetsThe Cartesian product of sets A, B is the set of allordered pairs (a, b), where a ∈ A, b ∈ B
(After R. Descartes, 1596–1650)
A×B = {(a, b) | (a ∈ A) ∧ (b ∈ B)}A2 = A× A the Cartesian square of A
Discrete Mathematics I – p. 110/292
SetsThe Cartesian product of sets A, B is the set of allordered pairs (a, b), where a ∈ A, b ∈ B
(After R. Descartes, 1596–1650)
A×B = {(a, b) | (a ∈ A) ∧ (b ∈ B)}
A2 = A× A the Cartesian square of A
Discrete Mathematics I – p. 110/292
SetsThe Cartesian product of sets A, B is the set of allordered pairs (a, b), where a ∈ A, b ∈ B
(After R. Descartes, 1596–1650)
A×B = {(a, b) | (a ∈ A) ∧ (b ∈ B)}A2 = A× A the Cartesian square of A
Discrete Mathematics I – p. 110/292
SetsExamples:
∅ × A =
A× ∅ = ∅ for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsExamples:
∅ × A = A× ∅ =
∅ for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsExamples:
∅ × A = A× ∅ = ∅ for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsExamples:
∅ × A = A× ∅ = ∅ for any set A
{Bunty} × {Fowler} =
{(Bunty, Fowler)}{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsExamples:
∅ × A = A× ∅ = ∅ for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}
{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsExamples:
∅ × A = A× ∅ = ∅ for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}{Fowler} × {Bunty} =
{(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsExamples:
∅ × A = A× ∅ = ∅ for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/292
SetsMore examples:
{a, b, c} × {d, e} =
{(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}N×Planets = {(n, x) | (n ∈ N)∧ (x ∈ Planets)} ={(5, Saturn), (239, Earth), . . .}N2 = N× N = {(m, n) | m, n ∈ N}
Discrete Mathematics I – p. 112/292
SetsMore examples:
{a, b, c} × {d, e} ={(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}
N×Planets = {(n, x) | (n ∈ N)∧ (x ∈ Planets)} ={(5, Saturn), (239, Earth), . . .}N2 = N× N = {(m, n) | m, n ∈ N}
Discrete Mathematics I – p. 112/292
SetsMore examples:
{a, b, c} × {d, e} ={(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}N×Planets =
{(n, x) | (n ∈ N)∧ (x ∈ Planets)} ={(5, Saturn), (239, Earth), . . .}N2 = N× N = {(m, n) | m, n ∈ N}
Discrete Mathematics I – p. 112/292
SetsMore examples:
{a, b, c} × {d, e} ={(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}N×Planets = {(n, x) | (n ∈ N)∧ (x ∈ Planets)} =
{(5, Saturn), (239, Earth), . . .}N2 = N× N = {(m, n) | m, n ∈ N}
Discrete Mathematics I – p. 112/292
SetsMore examples:
{a, b, c} × {d, e} ={(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}N×Planets = {(n, x) | (n ∈ N)∧ (x ∈ Planets)} ={(5, Saturn), (239, Earth), . . .}
N2 = N× N = {(m, n) | m, n ∈ N}
Discrete Mathematics I – p. 112/292
SetsMore examples:
{a, b, c} × {d, e} ={(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}N×Planets = {(n, x) | (n ∈ N)∧ (x ∈ Planets)} ={(5, Saturn), (239, Earth), . . .}N2 = N× N = {(m, n) | m, n ∈ N}
Discrete Mathematics I – p. 112/292
SetsIf A, B finite, A×B finite
If A has m elements, B has n elements, then A×Bhas m · n elements
(. . . hence the “×” sign)
If A infinite, B nonempty, then A×B, B ×A infinite
Discrete Mathematics I – p. 113/292
SetsIf A, B finite, A×B finite
If A has m elements, B has n elements, then A×Bhas m · n elements
(. . . hence the “×” sign)
If A infinite, B nonempty, then A×B, B ×A infinite
Discrete Mathematics I – p. 113/292
SetsIf A, B finite, A×B finite
If A has m elements, B has n elements, then A×Bhas m · n elements
(. . . hence the “×” sign)
If A infinite, B nonempty, then A×B, B ×A infinite
Discrete Mathematics I – p. 113/292
SetsIf A, B finite, A×B finite
If A has m elements, B has n elements, then A×Bhas m · n elements
(. . . hence the “×” sign)
If A infinite, B nonempty, then A×B, B ×A infinite
Discrete Mathematics I – p. 113/292
SetsProperties of ×:
In general, A×B 6= B × A
In general, (A×B)× C 6= A× (B × C)
. . . but = holds if we identify ((a, b), c) and (a, (b, c))
Discrete Mathematics I – p. 114/292
SetsProperties of ×:
In general, A×B 6= B × A
In general, (A×B)× C 6= A× (B × C)
. . . but = holds if we identify ((a, b), c) and (a, (b, c))
Discrete Mathematics I – p. 114/292
SetsProperties of ×:
In general, A×B 6= B × A
In general, (A×B)× C 6= A× (B × C)
. . . but = holds if we identify ((a, b), c) and (a, (b, c))
Discrete Mathematics I – p. 114/292
SetsProperties of ×:
In general, A×B 6= B × A
In general, (A×B)× C 6= A× (B × C)
. . . but = holds if we identify ((a, b), c) and (a, (b, c))
Discrete Mathematics I – p. 114/292
SetsA× (B ∩ C) = (A×B) ∩ (A× C)(A ∩B)× C = (A× C) ∩ (B × C)
A× (B ∪ C) = (A×B) ∪ (A× C)(A ∪B)× C = (A× C) ∪ (B × C)
A× (B \ C) = (A×B) \ (A× C)(A \B)× C = (A× C) \ (B × C)
× distributes over ∩,∪, \
Discrete Mathematics I – p. 115/292
SetsA× (B ∩ C) = (A×B) ∩ (A× C)(A ∩B)× C = (A× C) ∩ (B × C)
A× (B ∪ C) = (A×B) ∪ (A× C)(A ∪B)× C = (A× C) ∪ (B × C)
A× (B \ C) = (A×B) \ (A× C)(A \B)× C = (A× C) \ (B × C)
× distributes over ∩,∪, \
Discrete Mathematics I – p. 115/292
SetsA× (B ∩ C) = (A×B) ∩ (A× C)(A ∩B)× C = (A× C) ∩ (B × C)
A× (B ∪ C) = (A×B) ∪ (A× C)(A ∪B)× C = (A× C) ∪ (B × C)
A× (B \ C) = (A×B) \ (A× C)(A \B)× C = (A× C) \ (B × C)
× distributes over ∩,∪, \
Discrete Mathematics I – p. 115/292
SetsA× (B ∩ C) = (A×B) ∩ (A× C)(A ∩B)× C = (A× C) ∩ (B × C)
A× (B ∪ C) = (A×B) ∪ (A× C)(A ∪B)× C = (A× C) ∪ (B × C)
A× (B \ C) = (A×B) \ (A× C)(A \B)× C = (A× C) \ (B × C)
× distributes over ∩,∪, \
Discrete Mathematics I – p. 115/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).
(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒
(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒
(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒
(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒
((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒
(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsProve A× (B ∪ C) = (A×B) ∪ (A× C)
Proof. Consider any (x, y).(x, y) ∈ A× (B ∪ C) ⇐⇒(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒(x ∈ A) ∧ (y ∈ B ∨ y ∈ C) ⇐⇒(x ∈ A ∧ y ∈ B) ∨ (x ∈ A ∧ y ∈ C) ⇐⇒((x, y) ∈ A×B) ∨ ((x, y) ∈ A× C) ⇐⇒(x, y) ∈ (A×B) ∪ (A× C)
Hence A× (B ∪ C) = (A×B) ∪ (A× C).
Discrete Mathematics I – p. 116/292
SetsThe Cartesian product of sets A1, A2, . . . , An is theset of all ordered sequences (a1, a2, . . . , an), whereai ∈ Ai for all i ∈ {1, . . . , n}
A1 × · · · × An ={(a1, . . . , an) | ∀i ∈ {1, . . . , n} : ai ∈ Ai}
An = A× A× · · · × A (n times)the n-th Cartesian power of A
Discrete Mathematics I – p. 117/292
SetsThe Cartesian product of sets A1, A2, . . . , An is theset of all ordered sequences (a1, a2, . . . , an), whereai ∈ Ai for all i ∈ {1, . . . , n}A1 × · · · × An =
{(a1, . . . , an) | ∀i ∈ {1, . . . , n} : ai ∈ Ai}
An = A× A× · · · × A (n times)the n-th Cartesian power of A
Discrete Mathematics I – p. 117/292
SetsThe Cartesian product of sets A1, A2, . . . , An is theset of all ordered sequences (a1, a2, . . . , an), whereai ∈ Ai for all i ∈ {1, . . . , n}A1 × · · · × An =
{(a1, . . . , an) | ∀i ∈ {1, . . . , n} : ai ∈ Ai}An = A× A× · · · × A (n times)
the n-th Cartesian power of A
Discrete Mathematics I – p. 117/292
SetsIf A1, A2, . . . , An finite, A1 × A2 × · · · × An finite
If for all i, Ai has ni elements, A1 × · · · × Ak hasn1 · . . . · nk elements
If one of A1, A2, . . . , An infinite, A1 × A2 × · · · × An
infinite (unless one of them is empty)
Discrete Mathematics I – p. 118/292
SetsIf A1, A2, . . . , An finite, A1 × A2 × · · · × An finite
If for all i, Ai has ni elements, A1 × · · · × Ak hasn1 · . . . · nk elements
If one of A1, A2, . . . , An infinite, A1 × A2 × · · · × An
infinite (unless one of them is empty)
Discrete Mathematics I – p. 118/292
SetsIf A1, A2, . . . , An finite, A1 × A2 × · · · × An finite
If for all i, Ai has ni elements, A1 × · · · × Ak hasn1 · . . . · nk elements
If one of A1, A2, . . . , An infinite, A1 × A2 × · · · × An
infinite (unless one of them is empty)
Discrete Mathematics I – p. 118/292
SetsTherefore:
If A finite, An finite
If A has k elements, An has kn elements
If A infinite, An infinite
Discrete Mathematics I – p. 119/292
Relations
Discrete Mathematics I – p. 120/292
RelationsConsider P (x, y) = x ≤ y x, y ∈ N
{(x, y) | x ≤ y} ⊆ N× N = N2
Discrete Mathematics I – p. 121/292
RelationsConsider P (x, y) = x ≤ y x, y ∈ N
{(x, y) | x ≤ y} ⊆ N× N = N2
Discrete Mathematics I – p. 121/292
RelationsA relation between sets A, B is a subset of A×B
Rp : A ↔ B ⇐⇒ Rp ⊆ A×B
Example:
R≤ = {(a, b) ∈ N× N | a ≤ b} ⊆ N× N = N2
Write a p b for (a, b) ∈ Rp
For example a ≤ b instead of (a, b) ∈ R≤
Discrete Mathematics I – p. 122/292
RelationsA relation between sets A, B is a subset of A×B
Rp : A ↔ B ⇐⇒ Rp ⊆ A×B
Example:
R≤ = {(a, b) ∈ N× N | a ≤ b} ⊆ N× N = N2
Write a p b for (a, b) ∈ Rp
For example a ≤ b instead of (a, b) ∈ R≤
Discrete Mathematics I – p. 122/292
RelationsA relation between sets A, B is a subset of A×B
Rp : A ↔ B ⇐⇒ Rp ⊆ A×B
Example:
R≤ = {(a, b) ∈ N× N | a ≤ b} ⊆ N× N = N2
Write a p b for (a, b) ∈ Rp
For example a ≤ b instead of (a, b) ∈ R≤
Discrete Mathematics I – p. 122/292
RelationsA relation between sets A, B is a subset of A×B
Rp : A ↔ B ⇐⇒ Rp ⊆ A×B
Example:
R≤ = {(a, b) ∈ N× N | a ≤ b} ⊆ N× N = N2
Write a p b for (a, b) ∈ Rp
For example a ≤ b instead of (a, b) ∈ R≤
Discrete Mathematics I – p. 122/292
RelationsExamples of relations:
Equality relation R=A: A ↔ A
R=A= {(a, a) | a ∈ A}
Usually drop A: a = a
Empty relation ∅ : A ↔ A
Complete relation A2 : A ↔ A
Discrete Mathematics I – p. 123/292
RelationsExamples of relations:
Equality relation R=A: A ↔ A
R=A= {(a, a) | a ∈ A}
Usually drop A: a = a
Empty relation ∅ : A ↔ A
Complete relation A2 : A ↔ A
Discrete Mathematics I – p. 123/292
RelationsExamples of relations:
Equality relation R=A: A ↔ A
R=A= {(a, a) | a ∈ A}
Usually drop A: a = a
Empty relation ∅ : A ↔ A
Complete relation A2 : A ↔ A
Discrete Mathematics I – p. 123/292
RelationsExamples of relations:
Equality relation R=A: A ↔ A
R=A= {(a, a) | a ∈ A}
Usually drop A: a = a
Empty relation ∅ : A ↔ A
Complete relation A2 : A ↔ A
Discrete Mathematics I – p. 123/292
RelationsExamples of relations:
Equality relation R=A: A ↔ A
R=A= {(a, a) | a ∈ A}
Usually drop A: a = a
Empty relation ∅ : A ↔ A
Complete relation A2 : A ↔ A
Discrete Mathematics I – p. 123/292
RelationsMore examples of relations:
R<, R≤, R>, R≥ N ↔ N
R| : N ↔ N m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k ·m = n
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 124/292
RelationsMore examples of relations:
R<, R≤, R>, R≥ N ↔ N
R| : N ↔ N m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k ·m = n
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 124/292
RelationsMore examples of relations:
R<, R≤, R>, R≥ N ↔ N
R| : N ↔ N m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k ·m = n
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 124/292
RelationsMore examples of relations:
R<, R≤, R>, R≥ N ↔ N
R| : N ↔ N m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k ·m = n
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 124/292
RelationsMore examples of relations:
R<, R≤, R>, R≥ N ↔ N
R| : N ↔ N m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k ·m = n
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 124/292
RelationsMore examples of relations:
Rs : N ↔ N m s n ⇐⇒ m2 = n
Rm : People ↔ Peoplex m y ⇐⇒ the mother of x is y
In these relations, for every x ∈ A, there is a uniquey ∈ B, such that x is related to y
Such relations are called functions
Discrete Mathematics I – p. 125/292
RelationsMore examples of relations:
Rs : N ↔ N m s n ⇐⇒ m2 = n
Rm : People ↔ Peoplex m y ⇐⇒ the mother of x is y
In these relations, for every x ∈ A, there is a uniquey ∈ B, such that x is related to y
Such relations are called functions
Discrete Mathematics I – p. 125/292
RelationsMore examples of relations:
Rs : N ↔ N m s n ⇐⇒ m2 = n
Rm : People ↔ Peoplex m y ⇐⇒ the mother of x is y
In these relations, for every x ∈ A, there is a uniquey ∈ B, such that x is related to y
Such relations are called functions
Discrete Mathematics I – p. 125/292
RelationsMore examples of relations:
Rs : N ↔ N m s n ⇐⇒ m2 = n
Rm : People ↔ Peoplex m y ⇐⇒ the mother of x is y
In these relations, for every x ∈ A, there is a uniquey ∈ B, such that x is related to y
Such relations are called functions
Discrete Mathematics I – p. 125/292
RelationsRp, Rq : A ↔ B
Rp ∩Rq, Rp ∪Rq, Rp \Rq : A ↔ B
Discrete Mathematics I – p. 126/292
RelationsRp, Rq : A ↔ B
Rp ∩Rq, Rp ∪Rq, Rp \Rq : A ↔ B
Discrete Mathematics I – p. 126/292
RelationsRp : A ↔ B Rq : B ↔ C
The composition of p and q Rp ◦ q : A ↔ C
∀(a, c) ∈ A×C : a(p ◦ q)c ⇔ ∃b ∈ B : (a p b)∧(b q c)
Discrete Mathematics I – p. 127/292
RelationsRp : A ↔ B Rq : B ↔ C
The composition of p and q Rp ◦ q : A ↔ C
∀(a, c) ∈ A×C : a(p ◦ q)c ⇔ ∃b ∈ B : (a p b)∧(b q c)
Discrete Mathematics I – p. 127/292
RelationsRp : A ↔ B Rq : B ↔ C
The composition of p and q Rp ◦ q : A ↔ C
∀(a, c) ∈ A×C : a(p ◦ q)c ⇔ ∃b ∈ B : (a p b)∧(b q c)
Discrete Mathematics I – p. 127/292
RelationsExamples:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Rq ◦ t : People ↔ Animals
x(q ◦ t)z ⇐⇒ x has a parent with pet z
Rq ◦ q : People ↔ People
x(q ◦ q)z ⇐⇒ x is a grandchild of z
Discrete Mathematics I – p. 128/292
RelationsExamples:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Rq ◦ t : People ↔ Animals
x(q ◦ t)z ⇐⇒ x has a parent with pet z
Rq ◦ q : People ↔ People
x(q ◦ q)z ⇐⇒ x is a grandchild of z
Discrete Mathematics I – p. 128/292
RelationsExamples:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rt : People ↔ Animalsx t y ⇐⇒ x has y as a pet
Rq ◦ t : People ↔ Animals
x(q ◦ t)z ⇐⇒ x has a parent with pet z
Rq ◦ q : People ↔ People
x(q ◦ q)z ⇐⇒ x is a grandchild of z
Discrete Mathematics I – p. 128/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B Rq : B ↔ C
Prove: if Rp, Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Rp function =⇒ ∃!y ∈ B : x p y
Rq function =⇒ ∃!z ∈ C : y q z
Hence ∃!z ∈ C : x(p ◦ q)z
Therefore, Rp ◦ q is a function.
Discrete Mathematics I – p. 129/292
RelationsRp : A ↔ B
The inverse of p Rp−1 : B ↔ A
∀(b, a) ∈ B × A : b(p−1)a ⇐⇒ a p b
Example:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rq−1 : People ↔ People
x q−1 y ⇐⇒ x is a parent of y
Discrete Mathematics I – p. 130/292
RelationsRp : A ↔ B
The inverse of p Rp−1 : B ↔ A
∀(b, a) ∈ B × A : b(p−1)a ⇐⇒ a p b
Example:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rq−1 : People ↔ People
x q−1 y ⇐⇒ x is a parent of y
Discrete Mathematics I – p. 130/292
RelationsRp : A ↔ B
The inverse of p Rp−1 : B ↔ A
∀(b, a) ∈ B × A : b(p−1)a ⇐⇒ a p b
Example:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rq−1 : People ↔ People
x q−1 y ⇐⇒ x is a parent of y
Discrete Mathematics I – p. 130/292
RelationsRp : A ↔ B
The inverse of p Rp−1 : B ↔ A
∀(b, a) ∈ B × A : b(p−1)a ⇐⇒ a p b
Example:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rq−1 : People ↔ People
x q−1 y ⇐⇒ x is a parent of y
Discrete Mathematics I – p. 130/292
RelationsRp : A ↔ B
The inverse of p Rp−1 : B ↔ A
∀(b, a) ∈ B × A : b(p−1)a ⇐⇒ a p b
Example:
Rq : People ↔ People x q y ⇐⇒ x is a child of y
Rq−1 : People ↔ People
x q−1 y ⇐⇒ x is a parent of y
Discrete Mathematics I – p. 130/292
RelationsRelation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R= A2 R≤ R|
Rp reflexive iff R= ⊆ Rp
Discrete Mathematics I – p. 131/292
RelationsRelation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R=
A2 R≤ R|
Rp reflexive iff R= ⊆ Rp
Discrete Mathematics I – p. 131/292
RelationsRelation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R= A2
R≤ R|
Rp reflexive iff R= ⊆ Rp
Discrete Mathematics I – p. 131/292
RelationsRelation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R= A2 R≤
R|
Rp reflexive iff R= ⊆ Rp
Discrete Mathematics I – p. 131/292
RelationsRelation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R= A2 R≤ R|
Rp reflexive iff R= ⊆ Rp
Discrete Mathematics I – p. 131/292
RelationsRelation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R= A2 R≤ R|
Rp reflexive iff R= ⊆ Rp
Discrete Mathematics I – p. 131/292
RelationsRelation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R= A2 ∅R∗ : N ↔ N x ∗ y ⇔ (x + y = 10)
Rp symmetric iff Rp−1 = Rp
Discrete Mathematics I – p. 132/292
RelationsRelation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R=
A2 ∅R∗ : N ↔ N x ∗ y ⇔ (x + y = 10)
Rp symmetric iff Rp−1 = Rp
Discrete Mathematics I – p. 132/292
RelationsRelation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R= A2
∅R∗ : N ↔ N x ∗ y ⇔ (x + y = 10)
Rp symmetric iff Rp−1 = Rp
Discrete Mathematics I – p. 132/292
RelationsRelation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R= A2 ∅
R∗ : N ↔ N x ∗ y ⇔ (x + y = 10)
Rp symmetric iff Rp−1 = Rp
Discrete Mathematics I – p. 132/292
RelationsRelation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R= A2 ∅R∗ : N ↔ N x ∗ y ⇔ (x + y = 10)
Rp symmetric iff Rp−1 = Rp
Discrete Mathematics I – p. 132/292
RelationsRelation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R= A2 ∅R∗ : N ↔ N x ∗ y ⇔ (x + y = 10)
Rp symmetric iff Rp−1 = Rp
Discrete Mathematics I – p. 132/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R= ∅ R≤ R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R=
∅ R≤ R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R= ∅
R≤ R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R= ∅ R≤
R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R= ∅ R≤ R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R= ∅ R≤ R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R= ∅ R≤ R<
Rp antisymmetric iff Rp ∩Rp−1 ⊆ R=
Note non-symmetric 6⇔ antisymmetric (e.g. R=)
Discrete Mathematics I – p. 133/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R= A2 ∅ R≤ R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
A2 ∅ R≤ R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R= A2
∅ R≤ R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R= A2 ∅
R≤ R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R= A2 ∅ R≤
R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R= A2 ∅ R≤ R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R= A2 ∅ R≤ R<
Rp transitive iff Rp ◦ p ⊆ Rp
Discrete Mathematics I – p. 134/292
RelationsRelation R∼ : A ↔ A is an equivalence relation,if it is reflexive, symmetric and transitive
Relation R� : A ↔ A is a partial order,if it is reflexive, antisymmetric and transitive
Discrete Mathematics I – p. 135/292
RelationsRelation R∼ : A ↔ A is an equivalence relation,if it is reflexive, symmetric and transitive
Relation R� : A ↔ A is a partial order,if it is reflexive, antisymmetric and transitive
Discrete Mathematics I – p. 135/292
RelationsExamples of equivalence relations:
R=
Rp : People ↔ People
a p b ⇐⇒ a and b share a birthday
Discrete Mathematics I – p. 136/292
RelationsExamples of equivalence relations:
R=
Rp : People ↔ People
a p b ⇐⇒ a and b share a birthday
Discrete Mathematics I – p. 136/292
Relations{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
R| : N ↔ Z a divides b
a | b ⇐⇒ ∃k ∈ Z : k · a = b
R≡n: Z ↔ Z a ≡n b ⇐⇒ n|(a− b)
R≡nis called congruence modulo n
Discrete Mathematics I – p. 137/292
Relations{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
R| : N ↔ Z a divides b
a | b ⇐⇒ ∃k ∈ Z : k · a = b
R≡n: Z ↔ Z a ≡n b ⇐⇒ n|(a− b)
R≡nis called congruence modulo n
Discrete Mathematics I – p. 137/292
Relations{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
R| : N ↔ Z a divides b
a | b ⇐⇒ ∃k ∈ Z : k · a = b
R≡n: Z ↔ Z a ≡n b ⇐⇒ n|(a− b)
R≡nis called congruence modulo n
Discrete Mathematics I – p. 137/292
Relations{. . . ,−3,−2,−1, 0, 1, 2, 3, . . . } = Z integers
R| : N ↔ Z a divides b
a | b ⇐⇒ ∃k ∈ Z : k · a = b
R≡n: Z ↔ Z a ≡n b ⇐⇒ n|(a− b)
R≡nis called congruence modulo n
Discrete Mathematics I – p. 137/292
RelationsProve: R≡n
is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Let x ∈ Z.
x ≡n x ⇐⇒ n | (x− x) ⇐⇒ n | 0 ⇐⇒∃k : k · n = 0 ⇐⇒ T (since 0 · n = 0)
Hence R≡nreflexive.
Discrete Mathematics I – p. 138/292
RelationsProve: R≡n
is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Let x ∈ Z.
x ≡n x ⇐⇒ n | (x− x) ⇐⇒ n | 0 ⇐⇒∃k : k · n = 0 ⇐⇒ T (since 0 · n = 0)
Hence R≡nreflexive.
Discrete Mathematics I – p. 138/292
RelationsProve: R≡n
is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Let x ∈ Z.
x ≡n x ⇐⇒ n | (x− x) ⇐⇒ n | 0 ⇐⇒∃k : k · n = 0 ⇐⇒ T (since 0 · n = 0)
Hence R≡nreflexive.
Discrete Mathematics I – p. 138/292
RelationsProve: R≡n
is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Let x ∈ Z.
x ≡n x ⇐⇒ n | (x− x) ⇐⇒ n | 0 ⇐⇒∃k : k · n = 0 ⇐⇒ T (since 0 · n = 0)
Hence R≡nreflexive.
Discrete Mathematics I – p. 138/292
RelationsProve: R≡n
is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Let x ∈ Z.
x ≡n x ⇐⇒ n | (x− x) ⇐⇒ n | 0 ⇐⇒∃k : k · n = 0 ⇐⇒ T (since 0 · n = 0)
Hence R≡nreflexive.
Discrete Mathematics I – p. 138/292
RelationsLet x, y ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
(−k) · n = −(x− y) = y − x =⇒n | (y − x) =⇒ y ≡n x
Hence R≡nsymmetric.
Discrete Mathematics I – p. 139/292
RelationsLet x, y ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
(−k) · n = −(x− y) = y − x =⇒n | (y − x) =⇒ y ≡n x
Hence R≡nsymmetric.
Discrete Mathematics I – p. 139/292
RelationsLet x, y ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
(−k) · n = −(x− y) = y − x =⇒n | (y − x) =⇒ y ≡n x
Hence R≡nsymmetric.
Discrete Mathematics I – p. 139/292
RelationsLet x, y ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
(−k) · n = −(x− y) = y − x =⇒n | (y − x) =⇒ y ≡n x
Hence R≡nsymmetric.
Discrete Mathematics I – p. 139/292
RelationsLet x, y, z ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
y ≡n z =⇒ n | (y − z) =⇒ ∃l : l · n = y − z
(k + l) · n = (x− y) + (y − z) = x− z =⇒n | (x− z) =⇒ x ≡n z
Hence R≡ntransitive.
R≡nreflexive, symmetric and transitive, therefore
R≡nis an equivalence relation.
Discrete Mathematics I – p. 140/292
RelationsLet x, y, z ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
y ≡n z =⇒ n | (y − z) =⇒ ∃l : l · n = y − z
(k + l) · n = (x− y) + (y − z) = x− z =⇒n | (x− z) =⇒ x ≡n z
Hence R≡ntransitive.
R≡nreflexive, symmetric and transitive, therefore
R≡nis an equivalence relation.
Discrete Mathematics I – p. 140/292
RelationsLet x, y, z ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
y ≡n z =⇒ n | (y − z) =⇒ ∃l : l · n = y − z
(k + l) · n = (x− y) + (y − z) = x− z =⇒n | (x− z) =⇒ x ≡n z
Hence R≡ntransitive.
R≡nreflexive, symmetric and transitive, therefore
R≡nis an equivalence relation.
Discrete Mathematics I – p. 140/292
RelationsLet x, y, z ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
y ≡n z =⇒ n | (y − z) =⇒ ∃l : l · n = y − z
(k + l) · n = (x− y) + (y − z) = x− z =⇒n | (x− z) =⇒ x ≡n z
Hence R≡ntransitive.
R≡nreflexive, symmetric and transitive, therefore
R≡nis an equivalence relation.
Discrete Mathematics I – p. 140/292
RelationsLet x, y, z ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
y ≡n z =⇒ n | (y − z) =⇒ ∃l : l · n = y − z
(k + l) · n = (x− y) + (y − z) = x− z =⇒n | (x− z) =⇒ x ≡n z
Hence R≡ntransitive.
R≡nreflexive, symmetric and transitive, therefore
R≡nis an equivalence relation.
Discrete Mathematics I – p. 140/292
RelationsLet x, y, z ∈ Z.
x ≡n y =⇒ n | (x− y) =⇒ ∃k : k · n = x− y
y ≡n z =⇒ n | (y − z) =⇒ ∃l : l · n = y − z
(k + l) · n = (x− y) + (y − z) = x− z =⇒n | (x− z) =⇒ x ≡n z
Hence R≡ntransitive.
R≡nreflexive, symmetric and transitive, therefore
R≡nis an equivalence relation.
Discrete Mathematics I – p. 140/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}
By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsR∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set ofall elements related to a
[a]∼ = {x ∈ A | x ∼ a}By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
The set of all equivalence classes of R∼ is the quotientset of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/292
RelationsExample:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Size ofPeople/Rp = 366
∀x, y ∈ People : ([x]p = [y]p) ∨ ([x]p ∩ [y]p = ∅)
Discrete Mathematics I – p. 142/292
RelationsExample:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Size ofPeople/Rp =
366
∀x, y ∈ People : ([x]p = [y]p) ∨ ([x]p ∩ [y]p = ∅)
Discrete Mathematics I – p. 142/292
RelationsExample:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Size ofPeople/Rp = 366
∀x, y ∈ People : ([x]p = [y]p) ∨ ([x]p ∩ [y]p = ∅)
Discrete Mathematics I – p. 142/292
RelationsExample:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Size ofPeople/Rp = 366
∀x, y ∈ People : ([x]p = [y]p) ∨ ([x]p ∩ [y]p = ∅)
Discrete Mathematics I – p. 142/292
RelationsLet Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}Size of [Fred]p ≈ 6bln/365.25 ≈ 16mln
Suppose George was born on 29 February
[George]p = {x ∈ People | x born on 29 February}Size of [George]p ≈ 6bln/(4 ∗ 365.25) ≈ 4mln
Discrete Mathematics I – p. 143/292
RelationsLet Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}
Size of [Fred]p ≈ 6bln/365.25 ≈ 16mln
Suppose George was born on 29 February
[George]p = {x ∈ People | x born on 29 February}Size of [George]p ≈ 6bln/(4 ∗ 365.25) ≈ 4mln
Discrete Mathematics I – p. 143/292
RelationsLet Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}Size of [Fred]p ≈ 6bln/365.25 ≈ 16mln
Suppose George was born on 29 February
[George]p = {x ∈ People | x born on 29 February}Size of [George]p ≈ 6bln/(4 ∗ 365.25) ≈ 4mln
Discrete Mathematics I – p. 143/292
RelationsLet Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}Size of [Fred]p ≈ 6bln/365.25 ≈ 16mln
Suppose George was born on 29 February
[George]p = {x ∈ People | x born on 29 February}Size of [George]p ≈ 6bln/(4 ∗ 365.25) ≈ 4mln
Discrete Mathematics I – p. 143/292
RelationsLet Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}Size of [Fred]p ≈ 6bln/365.25 ≈ 16mln
Suppose George was born on 29 February
[George]p = {x ∈ People | x born on 29 February}
Size of [George]p ≈ 6bln/(4 ∗ 365.25) ≈ 4mln
Discrete Mathematics I – p. 143/292
RelationsLet Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}Size of [Fred]p ≈ 6bln/365.25 ≈ 16mln
Suppose George was born on 29 February
[George]p = {x ∈ People | x born on 29 February}Size of [George]p ≈ 6bln/(4 ∗ 365.25) ≈ 4mln
Discrete Mathematics I – p. 143/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5=
{. . . ,−10,−5, 0, 5, 10, . . . }[1]≡5
= {. . . ,−9,−4, 1, 6, 11, . . . }[2]≡5
= {. . . ,−8,−3, 2, 7, 12, . . . }[3]≡5
= {. . . ,−7,−2, 3, 8, 13, . . . }[4]≡5
= {. . . ,−6,−1, 4, 9, 14, . . . }[a]≡5
called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5=
{. . . ,−9,−4, 1, 6, 11, . . . }[2]≡5
= {. . . ,−8,−3, 2, 7, 12, . . . }[3]≡5
= {. . . ,−7,−2, 3, 8, 13, . . . }[4]≡5
= {. . . ,−6,−1, 4, 9, 14, . . . }[a]≡5
called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsAnother example:
R≡5: Z ↔ Z a ≡5 b ⇐⇒ 5 | (a− b)
[0]≡5= {. . . ,−10,−5, 0, 5, 10, . . . }
[1]≡5= {. . . ,−9,−4, 1, 6, 11, . . . }
[2]≡5= {. . . ,−8,−3, 2, 7, 12, . . . }
[3]≡5= {. . . ,−7,−2, 3, 8, 13, . . . }
[4]≡5= {. . . ,−6,−1, 4, 9, 14, . . . }
[a]≡5called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/292
RelationsR∼ : A ↔ A — an equivalence relation
Theorem.
The equivalence classes of R∼ are pairwise disjoint.
∀a, b ∈ A : ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)The union of all equivalence classes is the whole A.⋃
a∈A[a]∼ = A
A is partitioned by R∼ into a disjoint union ofequivalence classes
Discrete Mathematics I – p. 145/292
RelationsR∼ : A ↔ A — an equivalence relation
Theorem.
The equivalence classes of R∼ are pairwise disjoint.
∀a, b ∈ A : ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)
The union of all equivalence classes is the whole A.⋃
a∈A[a]∼ = A
A is partitioned by R∼ into a disjoint union ofequivalence classes
Discrete Mathematics I – p. 145/292
RelationsR∼ : A ↔ A — an equivalence relation
Theorem.
The equivalence classes of R∼ are pairwise disjoint.
∀a, b ∈ A : ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)The union of all equivalence classes is the whole A.⋃
a∈A[a]∼ = A
A is partitioned by R∼ into a disjoint union ofequivalence classes
Discrete Mathematics I – p. 145/292
RelationsR∼ : A ↔ A — an equivalence relation
Theorem.
The equivalence classes of R∼ are pairwise disjoint.
∀a, b ∈ A : ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)The union of all equivalence classes is the whole A.⋃
a∈A[a]∼ = A
A is partitioned by R∼ into a disjoint union ofequivalence classes
Discrete Mathematics I – p. 145/292
RelationsProof. For all a, b, we need:
([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)
Consider two cases: a ∼ b, a 6∼ b.
Discrete Mathematics I – p. 146/292
RelationsProof. For all a, b, we need:
([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)Consider two cases: a ∼ b, a 6∼ b.
Discrete Mathematics I – p. 146/292
RelationsCase a ∼ b. Take any x ∈ [a]∼.
(x ∼ a) ∧ (a ∼ b) =⇒ x ∼ b =⇒ x ∈ [b]∼
Hence [a]∼ ⊆ [b]∼. Similarly [b]∼ ⊆ [a]∼.
Therefore [a]∼ = [b]∼.
Discrete Mathematics I – p. 147/292
RelationsCase a ∼ b. Take any x ∈ [a]∼.
(x ∼ a) ∧ (a ∼ b) =⇒ x ∼ b =⇒ x ∈ [b]∼
Hence [a]∼ ⊆ [b]∼. Similarly [b]∼ ⊆ [a]∼.
Therefore [a]∼ = [b]∼.
Discrete Mathematics I – p. 147/292
RelationsCase a ∼ b. Take any x ∈ [a]∼.
(x ∼ a) ∧ (a ∼ b) =⇒ x ∼ b =⇒ x ∈ [b]∼
Hence [a]∼ ⊆ [b]∼. Similarly [b]∼ ⊆ [a]∼.
Therefore [a]∼ = [b]∼.
Discrete Mathematics I – p. 147/292
RelationsCase a ∼ b. Take any x ∈ [a]∼.
(x ∼ a) ∧ (a ∼ b) =⇒ x ∼ b =⇒ x ∈ [b]∼
Hence [a]∼ ⊆ [b]∼. Similarly [b]∼ ⊆ [a]∼.
Therefore [a]∼ = [b]∼.
Discrete Mathematics I – p. 147/292
RelationsCase a 6∼ b. Suppose ∃x : x ∈ [a]∼ ∩ [b]∼.
(x ∼ a) ∧ (x ∼ b) =⇒ a ∼ b — contradiction.
Therefore [a]∼ ∩ [b]∼ = ∅.
Discrete Mathematics I – p. 148/292
RelationsCase a 6∼ b. Suppose ∃x : x ∈ [a]∼ ∩ [b]∼.
(x ∼ a) ∧ (x ∼ b) =⇒ a ∼ b — contradiction.
Therefore [a]∼ ∩ [b]∼ = ∅.
Discrete Mathematics I – p. 148/292
RelationsCase a 6∼ b. Suppose ∃x : x ∈ [a]∼ ∩ [b]∼.
(x ∼ a) ∧ (x ∼ b) =⇒ a ∼ b — contradiction.
Therefore [a]∼ ∩ [b]∼ = ∅.
Discrete Mathematics I – p. 148/292
RelationsCase a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅
Therefore ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)Finally, for all a ∈ A: a ∼ a =⇒ a ∈ [a]∼ ⊆ A.
Hence A ⊆ ⋃
a∈A[a]∼ ⊆ A.
Therefore⋃
a∈A[a]∼ = A.
Discrete Mathematics I – p. 149/292
RelationsCase a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅Therefore ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)
Finally, for all a ∈ A: a ∼ a =⇒ a ∈ [a]∼ ⊆ A.
Hence A ⊆ ⋃
a∈A[a]∼ ⊆ A.
Therefore⋃
a∈A[a]∼ = A.
Discrete Mathematics I – p. 149/292
RelationsCase a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅Therefore ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)
Finally, for all a ∈ A: a ∼ a =⇒ a ∈ [a]∼ ⊆ A.
Hence A ⊆ ⋃
a∈A[a]∼ ⊆ A.
Therefore⋃
a∈A[a]∼ = A.
Discrete Mathematics I – p. 149/292
RelationsCase a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅Therefore ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)
Finally, for all a ∈ A: a ∼ a =⇒ a ∈ [a]∼ ⊆ A.
Hence A ⊆ ⋃
a∈A[a]∼ ⊆ A.
Therefore⋃
a∈A[a]∼ = A.
Discrete Mathematics I – p. 149/292
RelationsCase a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅Therefore ([a]∼ = [b]∼) ∨ ([a]∼ ∩ [b]∼ = ∅)
Finally, for all a ∈ A: a ∼ a =⇒ a ∈ [a]∼ ⊆ A.
Hence A ⊆ ⋃
a∈A[a]∼ ⊆ A.
Therefore⋃
a∈A[a]∼ = A.
Discrete Mathematics I – p. 149/292
RelationsIf A finite, A/R∼ finite
If A has n elements, and if every [a]∼ has m elements,then m | n, and A/R∼ has n/m elements
If A infinite, A/R∼ can be finite or infinite
Discrete Mathematics I – p. 150/292
RelationsIf A finite, A/R∼ finite
If A has n elements, and if every [a]∼ has m elements,then m | n, and A/R∼ has n/m elements
If A infinite, A/R∼ can be finite or infinite
Discrete Mathematics I – p. 150/292
RelationsIf A finite, A/R∼ finite
If A has n elements, and if every [a]∼ has m elements,then m | n, and A/R∼ has n/m elements
If A infinite, A/R∼ can be finite or infinite
Discrete Mathematics I – p. 150/292
RelationsRelation R∼ : A ↔ A is an equivalence relation,if it is reflexive, symmetric and transitive
Relation R� : A ↔ A is a partial order,if it is reflexive, antisymmetric and transitive
Set A is partially ordered
Discrete Mathematics I – p. 151/292
RelationsRelation R∼ : A ↔ A is an equivalence relation,if it is reflexive, symmetric and transitive
Relation R� : A ↔ A is a partial order,if it is reflexive, antisymmetric and transitive
Set A is partially ordered
Discrete Mathematics I – p. 151/292
RelationsExamples:
R≤, R≥ : N ↔ N
Hasse diagram (illustration only):
0
1
2
3
4
R≤
0
1
2
3
4
R≥
Discrete Mathematics I – p. 152/292
RelationsExamples:
R≤, R≥ : N ↔ N
Hasse diagram (illustration only):
��
��
�
0
1
2
3
4
R≤
0
1
2
3
4
R≥
Discrete Mathematics I – p. 152/292
RelationsExamples:
R≤, R≥ : N ↔ N
Hasse diagram (illustration only):
��
��
�
0
1
2
3
4
R≤
��
��
�
0
1
2
3
4
R≥
Discrete Mathematics I – p. 152/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is an descendant of y
(Everyone is his/her own descendant)
Lamech Bitenosh
Noah Naamah
Shem Ham Japheth
Discrete Mathematics I – p. 153/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is an descendant of y
(Everyone is his/her own descendant)
Lamech Bitenosh
Noah Naamah
Shem Ham Japheth
Discrete Mathematics I – p. 153/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is an descendant of y
(Everyone is his/her own descendant)
�
Lamech
�
Bitenosh
�Noah � Naamah
�
Shem
�
Ham
�
Japheth
Discrete Mathematics I – p. 153/292
RelationsR| : N ↔ N x | y ⇐⇒ ∃k : k · x = y
1
2 3 5 7
4 6 9
810
0
Discrete Mathematics I – p. 154/292
RelationsR| : N ↔ N x | y ⇐⇒ ∃k : k · x = y
�
1�2 �3 � 5 � 7
�
4
�
6�
9
�
8
10
0
Discrete Mathematics I – p. 154/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.
Discrete Mathematics I – p. 155/292
RelationsProve: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Let x, y ∈ N.
x | y =⇒ ∃k : k · x = y
y | x =⇒ ∃l : l · y = x
x = l · y = k · l · x =⇒ k · l = 1 =⇒k = l = 1 =⇒ x = y
Hence R| antisymmetric.Discrete Mathematics I – p. 155/292
RelationsLet x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | zHence R| transitive.
R| reflexive, antisymmetric and transitive, thereforeR| is a partial order.
Discrete Mathematics I – p. 156/292
RelationsLet x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | zHence R| transitive.
R| reflexive, antisymmetric and transitive, thereforeR| is a partial order.
Discrete Mathematics I – p. 156/292
RelationsLet x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | zHence R| transitive.
R| reflexive, antisymmetric and transitive, thereforeR| is a partial order.
Discrete Mathematics I – p. 156/292
RelationsLet x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | z
Hence R| transitive.
R| reflexive, antisymmetric and transitive, thereforeR| is a partial order.
Discrete Mathematics I – p. 156/292
RelationsLet x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | zHence R| transitive.
R| reflexive, antisymmetric and transitive, thereforeR| is a partial order.
Discrete Mathematics I – p. 156/292
RelationsLet x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | zHence R| transitive.
R| reflexive, antisymmetric and transitive, thereforeR| is a partial order.
Discrete Mathematics I – p. 156/292
RelationsR⊆ : P(S) ↔ P(S) A ⊆ B
S = {0, 1, 2}
∅
01
2
1202
01
012
Discrete Mathematics I – p. 157/292
RelationsR⊆ : P(S) ↔ P(S) A ⊆ B
S = {0, 1, 2}
∅
01
2
1202
01
012
Discrete Mathematics I – p. 157/292
RelationsR⊆ : P(S) ↔ P(S) A ⊆ B
S = {0, 1, 2}
�
∅
�0 �
1
� 2�12 �
02
� 01�
012
Discrete Mathematics I – p. 157/292
RelationsR� : A ↔ A — a partial order
R� is called a total order, if for all a, b ∈ A,either a � b or b � a
Set A is called totally ordered
Discrete Mathematics I – p. 158/292
RelationsR� : A ↔ A — a partial order
R� is called a total order, if for all a, b ∈ A,either a � b or b � a
Set A is called totally ordered
Discrete Mathematics I – p. 158/292
RelationsExamples:
R≤ R≥ — total (but still a partial order!)
RE R| R⊆ — not total
Discrete Mathematics I – p. 159/292
RelationsExamples:
R≤ R≥ — total (but still a partial order!)
RE R| R⊆ — not total
Discrete Mathematics I – p. 159/292
RelationsR� : A ↔ A — a partial order (need not be total)
a ∈ A
c ∈ A is an upper bound of a, if a � c
d ∈ A is a lower bound of a, if d � a
Discrete Mathematics I – p. 160/292
RelationsR� : A ↔ A — a partial order (need not be total)
a ∈ A
c ∈ A is an upper bound of a, if a � c
d ∈ A is a lower bound of a, if d � a
Discrete Mathematics I – p. 160/292
RelationsR� : A ↔ A — a partial order (need not be total)
a ∈ A
c ∈ A is an upper bound of a, if a � c
d ∈ A is a lower bound of a, if d � a
Discrete Mathematics I – p. 160/292
Relationsa, b ∈ A
c ∈ A is an upper bound of a, b, if (a � c) ∧ (b � c)
d ∈ A is a lower bound of a, b, if (d � a) ∧ (d � b)
Discrete Mathematics I – p. 161/292
Relationsa, b ∈ A
c ∈ A is an upper bound of a, b, if (a � c) ∧ (b � c)
d ∈ A is a lower bound of a, b, if (d � a) ∧ (d � b)
Discrete Mathematics I – p. 161/292
Relationsa, b ∈ A
c ∈ A is the least upper bound of a, b, if
• c is an upper bound of a, b
• for all x ∈ A, (a � x) ∧ (b � x) ⇒ (c � x)
c = lub(a, b) (may not exist!)
Discrete Mathematics I – p. 162/292
Relationsa, b ∈ A
c ∈ A is the least upper bound of a, b, if
• c is an upper bound of a, b
• for all x ∈ A, (a � x) ∧ (b � x) ⇒ (c � x)
c = lub(a, b) (may not exist!)
Discrete Mathematics I – p. 162/292
Relationsa, b ∈ A
c ∈ A is the least upper bound of a, b, if
• c is an upper bound of a, b
• for all x ∈ A, (a � x) ∧ (b � x) ⇒ (c � x)
c = lub(a, b) (may not exist!)
Discrete Mathematics I – p. 162/292
Relationsa, b ∈ A
c ∈ A is the least upper bound of a, b, if
• c is an upper bound of a, b
• for all x ∈ A, (a � x) ∧ (b � x) ⇒ (c � x)
c = lub(a, b) (may not exist!)
Discrete Mathematics I – p. 162/292
Relationsa, b ∈ A
c ∈ A is the least upper bound of a, b, if
• c is an upper bound of a, b
• for all x ∈ A, (a � x) ∧ (b � x) ⇒ (c � x)
c = lub(a, b) (may not exist!)
Discrete Mathematics I – p. 162/292
Relationsa, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
• d is a lower bound of a, b
• for all x ∈ A, (x � a) ∧ (x � b) ⇒ (x � d)
d = glb(a, b) (may not exist!)
Discrete Mathematics I – p. 163/292
Relationsa, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
• d is a lower bound of a, b
• for all x ∈ A, (x � a) ∧ (x � b) ⇒ (x � d)
d = glb(a, b) (may not exist!)
Discrete Mathematics I – p. 163/292
Relationsa, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
• d is a lower bound of a, b
• for all x ∈ A, (x � a) ∧ (x � b) ⇒ (x � d)
d = glb(a, b) (may not exist!)
Discrete Mathematics I – p. 163/292
Relationsa, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
• d is a lower bound of a, b
• for all x ∈ A, (x � a) ∧ (x � b) ⇒ (x � d)
d = glb(a, b) (may not exist!)
Discrete Mathematics I – p. 163/292
Relationsa, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
• d is a lower bound of a, b
• for all x ∈ A, (x � a) ∧ (x � b) ⇒ (x � d)
d = glb(a, b) (may not exist!)
Discrete Mathematics I – p. 163/292
RelationsExample:
RE : People ↔ PeoplexE y ⇐⇒ x is a descendant of y
lub(x, y) = youngest common ancestor(x, y)
glb(x, y) = oldest common descendant(x, y)
May not exist, e.g. if x, y are not relatives
Discrete Mathematics I – p. 164/292
RelationsExample:
RE : People ↔ PeoplexE y ⇐⇒ x is a descendant of y
lub(x, y) = youngest common ancestor(x, y)
glb(x, y) = oldest common descendant(x, y)
May not exist, e.g. if x, y are not relatives
Discrete Mathematics I – p. 164/292
RelationsExample:
RE : People ↔ PeoplexE y ⇐⇒ x is a descendant of y
lub(x, y) = youngest common ancestor(x, y)
glb(x, y) = oldest common descendant(x, y)
May not exist, e.g. if x, y are not relatives
Discrete Mathematics I – p. 164/292
RelationsExample:
RE : People ↔ PeoplexE y ⇐⇒ x is a descendant of y
lub(x, y) = youngest common ancestor(x, y)
glb(x, y) = oldest common descendant(x, y)
May not exist, e.g. if x, y are not relatives
Discrete Mathematics I – p. 164/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)always exists
glb(a, b) = greatest common divisor(a, b)always exists
Discrete Mathematics I – p. 165/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) =
least common multiple(a, b)always exists
glb(a, b) = greatest common divisor(a, b)always exists
Discrete Mathematics I – p. 165/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)
always exists
glb(a, b) = greatest common divisor(a, b)always exists
Discrete Mathematics I – p. 165/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)always exists
glb(a, b) = greatest common divisor(a, b)always exists
Discrete Mathematics I – p. 165/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)always exists
glb(a, b) =
greatest common divisor(a, b)always exists
Discrete Mathematics I – p. 165/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)always exists
glb(a, b) = greatest common divisor(a, b)
always exists
Discrete Mathematics I – p. 165/292
RelationsR| : N ↔ N x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)always exists
glb(a, b) = greatest common divisor(a, b)always exists
Discrete Mathematics I – p. 165/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) =
max(a, b) always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b)
always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) =
min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) = min(a, b)
always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}
Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR≤ : N ↔ N
lub(a, b) = max(a, b) always exists
glb(a, b) = min(a, b) always exists
{lub(a, b), glb(a, b)} = {a, b}Same holds for any total order
Discrete Mathematics I – p. 166/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪B always exists
glb(A, B) = A ∩B always exists
Discrete Mathematics I – p. 167/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) =
A ∪B always exists
glb(A, B) = A ∩B always exists
Discrete Mathematics I – p. 167/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪B
always exists
glb(A, B) = A ∩B always exists
Discrete Mathematics I – p. 167/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪B always exists
glb(A, B) = A ∩B always exists
Discrete Mathematics I – p. 167/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪B always exists
glb(A, B) =
A ∩B always exists
Discrete Mathematics I – p. 167/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪B always exists
glb(A, B) = A ∩B
always exists
Discrete Mathematics I – p. 167/292
RelationsR⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪B always exists
glb(A, B) = A ∩B always exists
Discrete Mathematics I – p. 167/292
RelationsR� : A ↔ A — a partial order
R� is called a lattice, if for all a, b ∈ A,lub(a, b) and glb(a, b) exist
(Sometimes A itself called a lattice)
Discrete Mathematics I – p. 168/292
RelationsR� : A ↔ A — a partial order
R� is called a lattice, if for all a, b ∈ A,lub(a, b) and glb(a, b) exist
(Sometimes A itself called a lattice)
Discrete Mathematics I – p. 168/292
RelationsR� : A ↔ A — a partial order
R� is called a lattice, if for all a, b ∈ A,lub(a, b) and glb(a, b) exist
(Sometimes A itself called a lattice)
Discrete Mathematics I – p. 168/292
RelationsExamples:
any total order (e.g. R≤, R≥)
R| R⊆ for any S
Discrete Mathematics I – p. 169/292
RelationsExamples:
any total order (e.g. R≤, R≥)
R|
R⊆ for any S
Discrete Mathematics I – p. 169/292
RelationsExamples:
any total order (e.g. R≤, R≥)
R| R⊆ for any S
Discrete Mathematics I – p. 169/292
RelationsR� : A ↔ A — a partial order
a ∈ A is maximal: ∀x ∈ A : (a � x) ⇒ (a = x)
b ∈ A is minimal: ∀x ∈ A : (x � b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest: ∀x ∈ A : x � a
b ∈ A is the least: ∀x ∈ A : b � x
Can have at most one greatest/least element
Discrete Mathematics I – p. 170/292
RelationsR� : A ↔ A — a partial order
a ∈ A is maximal: ∀x ∈ A : (a � x) ⇒ (a = x)
b ∈ A is minimal: ∀x ∈ A : (x � b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest: ∀x ∈ A : x � a
b ∈ A is the least: ∀x ∈ A : b � x
Can have at most one greatest/least element
Discrete Mathematics I – p. 170/292
RelationsR� : A ↔ A — a partial order
a ∈ A is maximal: ∀x ∈ A : (a � x) ⇒ (a = x)
b ∈ A is minimal: ∀x ∈ A : (x � b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest: ∀x ∈ A : x � a
b ∈ A is the least: ∀x ∈ A : b � x
Can have at most one greatest/least element
Discrete Mathematics I – p. 170/292
RelationsR� : A ↔ A — a partial order
a ∈ A is maximal: ∀x ∈ A : (a � x) ⇒ (a = x)
b ∈ A is minimal: ∀x ∈ A : (x � b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest: ∀x ∈ A : x � a
b ∈ A is the least: ∀x ∈ A : b � x
Can have at most one greatest/least element
Discrete Mathematics I – p. 170/292
RelationsR� : A ↔ A — a partial order
a ∈ A is maximal: ∀x ∈ A : (a � x) ⇒ (a = x)
b ∈ A is minimal: ∀x ∈ A : (x � b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest: ∀x ∈ A : x � a
b ∈ A is the least: ∀x ∈ A : b � x
Can have at most one greatest/least element
Discrete Mathematics I – p. 170/292
RelationsExamples:
R⊆ : P(S) ↔ P(S)
∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least
S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N
0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least
no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N
no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least
0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N
1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least
0 greatest
Discrete Mathematics I – p. 171/292
RelationsExamples:
R⊆ : P(S) ↔ P(S) ∅ least S greatest
R≤ : N ↔ N 0 least no greatest
R≥ : N ↔ N no least 0 greatest
R| : N ↔ N 1 least 0 greatest
Discrete Mathematics I – p. 171/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
no maximal elements (Adam and Eve? GE?)
no greatest elements
Discrete Mathematics I – p. 172/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
no maximal elements (Adam and Eve? GE?)
no greatest elements
Discrete Mathematics I – p. 172/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
no maximal elements (Adam and Eve? GE?)
no greatest elements
Discrete Mathematics I – p. 172/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
no maximal elements (Adam and Eve? GE?)
no greatest elements
Discrete Mathematics I – p. 172/292
RelationsRE : People ↔ People
xE y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
no maximal elements (Adam and Eve? GE?)
no greatest elements
Discrete Mathematics I – p. 172/292
RelationsR| : N \ {0, 1} ↔ N \ {0, 1}
minimal elements: prime numbers
no least elements
no maximal ⇒ no greatest
Discrete Mathematics I – p. 173/292
RelationsR| : N \ {0, 1} ↔ N \ {0, 1}minimal elements: prime numbers
no least elements
no maximal ⇒ no greatest
Discrete Mathematics I – p. 173/292
RelationsR| : N \ {0, 1} ↔ N \ {0, 1}minimal elements: prime numbers
no least elements
no maximal ⇒ no greatest
Discrete Mathematics I – p. 173/292
RelationsR| : N \ {0, 1} ↔ N \ {0, 1}minimal elements: prime numbers
no least elements
no maximal ⇒ no greatest
Discrete Mathematics I – p. 173/292
RelationsR⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}
minimal elements: singletons
no least elements
maximal elements: singleton complements
no greatest elements
Discrete Mathematics I – p. 174/292
RelationsR⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}minimal elements: singletons
no least elements
maximal elements: singleton complements
no greatest elements
Discrete Mathematics I – p. 174/292
RelationsR⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}minimal elements: singletons
no least elements
maximal elements: singleton complements
no greatest elements
Discrete Mathematics I – p. 174/292
RelationsR⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}minimal elements: singletons
no least elements
maximal elements: singleton complements
no greatest elements
Discrete Mathematics I – p. 174/292
RelationsR⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}minimal elements: singletons
no least elements
maximal elements: singleton complements
no greatest elements
Discrete Mathematics I – p. 174/292
RelationsA partially ordered set may have no greatest or leastelement (even if the set is finite)
A finite, totally ordered set must have the greatest andthe least elements
A finite, partially ordered set must have maximal andminimal elements (but may not have the greatest andthe least)
A maximal or minimal element may not be unique
If a greatest or least element exists, it is unique
Discrete Mathematics I – p. 175/292
RelationsA partially ordered set may have no greatest or leastelement (even if the set is finite)
A finite, totally ordered set must have the greatest andthe least elements
A finite, partially ordered set must have maximal andminimal elements (but may not have the greatest andthe least)
A maximal or minimal element may not be unique
If a greatest or least element exists, it is unique
Discrete Mathematics I – p. 175/292
RelationsA partially ordered set may have no greatest or leastelement (even if the set is finite)
A finite, totally ordered set must have the greatest andthe least elements
A finite, partially ordered set must have maximal andminimal elements (but may not have the greatest andthe least)
A maximal or minimal element may not be unique
If a greatest or least element exists, it is unique
Discrete Mathematics I – p. 175/292
RelationsA partially ordered set may have no greatest or leastelement (even if the set is finite)
A finite, totally ordered set must have the greatest andthe least elements
A finite, partially ordered set must have maximal andminimal elements (but may not have the greatest andthe least)
A maximal or minimal element may not be unique
If a greatest or least element exists, it is unique
Discrete Mathematics I – p. 175/292
RelationsA partially ordered set may have no greatest or leastelement (even if the set is finite)
A finite, totally ordered set must have the greatest andthe least elements
A finite, partially ordered set must have maximal andminimal elements (but may not have the greatest andthe least)
A maximal or minimal element may not be unique
If a greatest or least element exists, it is unique
Discrete Mathematics I – p. 175/292
Functions
Discrete Mathematics I – p. 176/292
FunctionsA function from set A to set B is a relationRf : A ↔ B, where for every a ∈ A, there is a uniqueb ∈ B, such that afb
A B
f
Discrete Mathematics I – p. 177/292
FunctionsA function from set A to set B is a relationRf : A ↔ B, where for every a ∈ A, there is a uniqueb ∈ B, such that afb
��
��
�
A
��
��
B
f
Discrete Mathematics I – p. 177/292
Functionsf : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : afb)
f maps A into B
Instead of afb, write f(a) = b or f : a 7→ b
f maps a to b
Discrete Mathematics I – p. 178/292
Functionsf : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : afb)
f maps A into B
Instead of afb, write f(a) = b or f : a 7→ b
f maps a to b
Discrete Mathematics I – p. 178/292
Functionsf : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : afb)
f maps A into B
Instead of afb, write f(a) = b or f : a 7→ b
f maps a to b
Discrete Mathematics I – p. 178/292
Functionsf : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : afb)
f maps A into B
Instead of afb, write f(a) = b or f : a 7→ b
f maps a to b
Discrete Mathematics I – p. 178/292
Functionsf : A → B
A is the domain of f Domf = A
B is the co-domain of f Codomf = B
f : a 7→ b a ∈ A b ∈ B
b is the image of a
a is the pre-image of b
Discrete Mathematics I – p. 179/292
Functionsf : A → B
A is the domain of f Domf = A
B is the co-domain of f Codomf = B
f : a 7→ b a ∈ A b ∈ B
b is the image of a
a is the pre-image of b
Discrete Mathematics I – p. 179/292
Functionsf : A → B
A is the domain of f Domf = A
B is the co-domain of f Codomf = B
f : a 7→ b a ∈ A b ∈ B
b is the image of a
a is the pre-image of b
Discrete Mathematics I – p. 179/292
Functionsf : A → B
A is the domain of f Domf = A
B is the co-domain of f Codomf = B
f : a 7→ b a ∈ A b ∈ B
b is the image of a
a is the pre-image of b
Discrete Mathematics I – p. 179/292
FunctionsExamples:
Identity function idA : A → AidA = {(a, a) | a ∈ A} = R=A
A A
idA
Discrete Mathematics I – p. 180/292
FunctionsExamples:
Identity function idA : A → AidA = {(a, a) | a ∈ A} = R=A
��
��
�
A
��
��
A
idA
Discrete Mathematics I – p. 180/292
Functionsf : N → N f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}
g : {0, 1, 2} → N g = {(0, 0), (1, 1), (2, 4)}g ⊆ f Domg ⊆ Domf Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/292
Functionsf : N → N f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}g : {0, 1, 2} → N g = {(0, 0), (1, 1), (2, 4)}
g ⊆ f Domg ⊆ Domf Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/292
Functionsf : N → N f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}g : {0, 1, 2} → N g = {(0, 0), (1, 1), (2, 4)}g ⊆ f
Domg ⊆ Domf Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/292
Functionsf : N → N f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}g : {0, 1, 2} → N g = {(0, 0), (1, 1), (2, 4)}g ⊆ f Domg ⊆ Domf Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/292
Functionsf : N → N f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}g : {0, 1, 2} → N g = {(0, 0), (1, 1), (2, 4)}g ⊆ f Domg ⊆ Domf Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/292
Functionsf : N → N f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}g : {0, 1, 2} → N g = {(0, 0), (1, 1), (2, 4)}g ⊆ f Domg ⊆ Domf Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/292
FunctionsAn infinite sequence of elements of set A is anyfunction a : N → A
Integer sequence N → Z, Boolean sequence N → B,etc.
Instead of a(k) write ak: a = (a0, a1, a2, a3, . . . )
Examples:
a : N → N a = (0, 1, 4, 9, 16, . . . )
b : N → B b = (F, T, F, T, F, . . . )
Discrete Mathematics I – p. 182/292
FunctionsAn infinite sequence of elements of set A is anyfunction a : N → A
Integer sequence N → Z, Boolean sequence N → B,etc.
Instead of a(k) write ak: a = (a0, a1, a2, a3, . . . )
Examples:
a : N → N a = (0, 1, 4, 9, 16, . . . )
b : N → B b = (F, T, F, T, F, . . . )
Discrete Mathematics I – p. 182/292
FunctionsAn infinite sequence of elements of set A is anyfunction a : N → A
Integer sequence N → Z, Boolean sequence N → B,etc.
Instead of a(k) write ak: a = (a0, a1, a2, a3, . . . )
Examples:
a : N → N a = (0, 1, 4, 9, 16, . . . )
b : N → B b = (F, T, F, T, F, . . . )
Discrete Mathematics I – p. 182/292
FunctionsAn infinite sequence of elements of set A is anyfunction a : N → A
Integer sequence N → Z, Boolean sequence N → B,etc.
Instead of a(k) write ak: a = (a0, a1, a2, a3, . . . )
Examples:
a : N → N a = (0, 1, 4, 9, 16, . . . )
b : N → B b = (F, T, F, T, F, . . . )
Discrete Mathematics I – p. 182/292
FunctionsAn infinite sequence of elements of set A is anyfunction a : N → A
Integer sequence N → Z, Boolean sequence N → B,etc.
Instead of a(k) write ak: a = (a0, a1, a2, a3, . . . )
Examples:
a : N → N a = (0, 1, 4, 9, 16, . . . )
b : N → B b = (F, T, F, T, F, . . . )
Discrete Mathematics I – p. 182/292
FunctionsLet n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n− 1}
A finite sequence of elements of set A is any functiona : Nn → A
Example: g = (0, 1, 4)
Number n is the sequence length
Discrete Mathematics I – p. 183/292
FunctionsLet n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n− 1}A finite sequence of elements of set A is any functiona : Nn → A
Example: g = (0, 1, 4)
Number n is the sequence length
Discrete Mathematics I – p. 183/292
FunctionsLet n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n− 1}A finite sequence of elements of set A is any functiona : Nn → A
Example: g = (0, 1, 4)
Number n is the sequence length
Discrete Mathematics I – p. 183/292
FunctionsLet n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n− 1}A finite sequence of elements of set A is any functiona : Nn → A
Example: g = (0, 1, 4)
Number n is the sequence length
Discrete Mathematics I – p. 183/292
Functionsf : A → B g : B → C
The composition of f and g f ◦ g : A → C
Same as relation composition Rf◦g
Rf , Rg functions =⇒ Rf◦g a function
∀a ∈ A : (f ◦ g)(a) = g(f(a))
Discrete Mathematics I – p. 184/292
Functionsf : A → B g : B → C
The composition of f and g f ◦ g : A → C
Same as relation composition Rf◦g
Rf , Rg functions =⇒ Rf◦g a function
∀a ∈ A : (f ◦ g)(a) = g(f(a))
Discrete Mathematics I – p. 184/292
Functionsf : A → B g : B → C
The composition of f and g f ◦ g : A → C
Same as relation composition Rf◦g
Rf , Rg functions =⇒ Rf◦g a function
∀a ∈ A : (f ◦ g)(a) = g(f(a))
Discrete Mathematics I – p. 184/292
Functionsf : A → B g : B → C
The composition of f and g f ◦ g : A → C
Same as relation composition Rf◦g
Rf , Rg functions =⇒ Rf◦g a function
∀a ∈ A : (f ◦ g)(a) = g(f(a))
Discrete Mathematics I – p. 184/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) =
(n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) =
(n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) =
n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) =
(n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
g : Z → Z n 7→ n2
(f ◦ f)(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f)(n) = n2 + 1
(g ◦ g)(n) = (n2)2 = n4
Note (f ◦ g) 6= (g ◦ f)
Discrete Mathematics I – p. 185/292
Functionsf : A → B
The (functional) inverse of f f−1 : B → A
Same as relation inverse Rf−1, but may not be afunction
(we say “functional inverse may not exist”)
∀a ∈ A, b ∈ B : (f(a) = b) ⇔ (f−1(b) = a)
Discrete Mathematics I – p. 186/292
Functionsf : A → B
The (functional) inverse of f f−1 : B → A
Same as relation inverse Rf−1, but may not be afunction
(we say “functional inverse may not exist”)
∀a ∈ A, b ∈ B : (f(a) = b) ⇔ (f−1(b) = a)
Discrete Mathematics I – p. 186/292
Functionsf : A → B
The (functional) inverse of f f−1 : B → A
Same as relation inverse Rf−1, but may not be afunction
(we say “functional inverse may not exist”)
∀a ∈ A, b ∈ B : (f(a) = b) ⇔ (f−1(b) = a)
Discrete Mathematics I – p. 186/292
Functionsf : A → B
The (functional) inverse of f f−1 : B → A
Same as relation inverse Rf−1, but may not be afunction
(we say “functional inverse may not exist”)
∀a ∈ A, b ∈ B : (f(a) = b) ⇔ (f−1(b) = a)
Discrete Mathematics I – p. 186/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
f−1(n) = n− 1
g : Z → Z n 7→ n2
g−1does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
f−1(n) =
n− 1
g : Z → Z n 7→ n2
g−1does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
f−1(n) = n− 1
g : Z → Z n 7→ n2
g−1does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
f−1(n) = n− 1
g : Z → Z n 7→ n2
g−1does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
f−1(n) = n− 1
g : Z → Z n 7→ n2
g−1
does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/292
FunctionsExamples:
f : Z → Z n 7→ n + 1
f−1(n) = n− 1
g : Z → Z n 7→ n2
g−1 does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/292
Functionsf : A → B
The range of f is the set of all elements in B that havea pre-image in A
f(A) = {b ∈ B | ∃a ∈ A : f(a) = b}
f(A)
A B
f
Discrete Mathematics I – p. 188/292
Functionsf : A → B
The range of f is the set of all elements in B that havea pre-image in A
f(A) = {b ∈ B | ∃a ∈ A : f(a) = b}
f(A)
A B
f
Discrete Mathematics I – p. 188/292
Functionsf : A → B
The range of f is the set of all elements in B that havea pre-image in A
f(A) = {b ∈ B | ∃a ∈ A : f(a) = b}
f(A)
A B
f
Discrete Mathematics I – p. 188/292
Functionsf : A → B
The range of f is the set of all elements in B that havea pre-image in A
f(A) = {b ∈ B | ∃a ∈ A : f(a) = b}
f(A)
��
��
�A
��
��
B
f
Discrete Mathematics I – p. 188/292
FunctionsExamples:
f : N → N n 7→ n + 1
f(N) = N \ {0} = {1, 2, 3, 4, . . . }g : {0, 1, 2} → N n 7→ n2
g({0, 1, 2}) = {0, 1, 4}
Discrete Mathematics I – p. 189/292
FunctionsExamples:
f : N → N n 7→ n + 1
f(N) =
N \ {0} = {1, 2, 3, 4, . . . }g : {0, 1, 2} → N n 7→ n2
g({0, 1, 2}) = {0, 1, 4}
Discrete Mathematics I – p. 189/292
FunctionsExamples:
f : N → N n 7→ n + 1
f(N) = N \ {0} = {1, 2, 3, 4, . . . }
g : {0, 1, 2} → N n 7→ n2
g({0, 1, 2}) = {0, 1, 4}
Discrete Mathematics I – p. 189/292
FunctionsExamples:
f : N → N n 7→ n + 1
f(N) = N \ {0} = {1, 2, 3, 4, . . . }g : {0, 1, 2} → N n 7→ n2
g({0, 1, 2}) = {0, 1, 4}
Discrete Mathematics I – p. 189/292
FunctionsExamples:
f : N → N n 7→ n + 1
f(N) = N \ {0} = {1, 2, 3, 4, . . . }g : {0, 1, 2} → N n 7→ n2
g({0, 1, 2}) =
{0, 1, 4}
Discrete Mathematics I – p. 189/292
FunctionsExamples:
f : N → N n 7→ n + 1
f(N) = N \ {0} = {1, 2, 3, 4, . . . }g : {0, 1, 2} → N n 7→ n2
g({0, 1, 2}) = {0, 1, 4}
Discrete Mathematics I – p. 189/292
FunctionsFunction called surjective, if its range is the wholeco-domain
f : A� B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f(a) = b
A B
f
Also say f maps A onto B
Discrete Mathematics I – p. 190/292
FunctionsFunction called surjective, if its range is the wholeco-domain
f : A� B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f(a) = b
A B
f
Also say f maps A onto B
Discrete Mathematics I – p. 190/292
FunctionsFunction called surjective, if its range is the wholeco-domain
f : A� B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f(a) = b
��
��
�
A
��
�
B
f
Also say f maps A onto B
Discrete Mathematics I – p. 190/292
FunctionsFunction called surjective, if its range is the wholeco-domain
f : A� B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f(a) = b
��
��
�
A
��
�
B
f
Also say f maps A onto B
Discrete Mathematics I – p. 190/292
FunctionsFunction called injective, if it maps different elementsto different elements
f : A� B ⇐⇒ ∀x, y : (f(x) = f(y)) ⇒ (x = y)
A B
f
Also say f maps A into B one-to-one
Discrete Mathematics I – p. 191/292
FunctionsFunction called injective, if it maps different elementsto different elements
f : A� B ⇐⇒ ∀x, y : (f(x) = f(y)) ⇒ (x = y)
A B
f
Also say f maps A into B one-to-one
Discrete Mathematics I – p. 191/292
FunctionsFunction called injective, if it maps different elementsto different elements
f : A� B ⇐⇒ ∀x, y : (f(x) = f(y)) ⇒ (x = y)
��
�
A
��
��
�
B
f
Also say f maps A into B one-to-one
Discrete Mathematics I – p. 191/292
FunctionsFunction called injective, if it maps different elementsto different elements
f : A� B ⇐⇒ ∀x, y : (f(x) = f(y)) ⇒ (x = y)
��
�
A
��
��
�
B
f
Also say f maps A into B one-to-one
Discrete Mathematics I – p. 191/292
FunctionsExamples:
f : Cards � {♠,♥,♣,♦} f : x 7→ suit of x
Function f surjective, but not injective
g : N� N g : m 7→ m2
Function g injective, but not surjective
Discrete Mathematics I – p. 192/292
FunctionsExamples:
f : Cards � {♠,♥,♣,♦} f : x 7→ suit of x
Function f surjective, but not injective
g : N� N g : m 7→ m2
Function g injective, but not surjective
Discrete Mathematics I – p. 192/292
FunctionsExamples:
f : Cards � {♠,♥,♣,♦} f : x 7→ suit of x
Function f surjective, but not injective
g : N� N g : m 7→ m2
Function g injective, but not surjective
Discrete Mathematics I – p. 192/292
FunctionsExamples:
f : Cards � {♠,♥,♣,♦} f : x 7→ suit of x
Function f surjective, but not injective
g : N� N g : m 7→ m2
Function g injective, but not surjective
Discrete Mathematics I – p. 192/292
FunctionsFunction called bijective, if it is both surjective andinjective
f : A��B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f(a) = b
A B
f
Also say f is a one-to-one correspondence between Aand B
Discrete Mathematics I – p. 193/292
FunctionsFunction called bijective, if it is both surjective andinjective
f : A��B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f(a) = b
A B
f
Also say f is a one-to-one correspondence between Aand B
Discrete Mathematics I – p. 193/292
FunctionsFunction called bijective, if it is both surjective andinjective
f : A��B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f(a) = b
��
��
A
��
��
B
f
Also say f is a one-to-one correspondence between Aand B
Discrete Mathematics I – p. 193/292
FunctionsFunction called bijective, if it is both surjective andinjective
f : A��B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f(a) = b
��
��
A
��
��
B
f
Also say f is a one-to-one correspondence between Aand B
Discrete Mathematics I – p. 193/292
FunctionsExamples:
idA : A��A a 7→ a
Function idA bijective for any set A
id−1
A = idA
f : Z��Z n 7→ n + 5
g : Z��Z n 7→ −n
Discrete Mathematics I – p. 194/292
FunctionsExamples:
idA : A��A a 7→ a
Function idA bijective for any set A
id−1
A = idA
f : Z��Z n 7→ n + 5
g : Z��Z n 7→ −n
Discrete Mathematics I – p. 194/292
FunctionsExamples:
idA : A��A a 7→ a
Function idA bijective for any set A
id−1
A = idA
f : Z��Z n 7→ n + 5
g : Z��Z n 7→ −n
Discrete Mathematics I – p. 194/292
FunctionsExamples:
idA : A��A a 7→ a
Function idA bijective for any set A
id−1
A = idA
f : Z��Z n 7→ n + 5
g : Z��Z n 7→ −n
Discrete Mathematics I – p. 194/292
FunctionsExamples:
idA : A��A a 7→ a
Function idA bijective for any set A
id−1
A = idA
f : Z��Z n 7→ n + 5
g : Z��Z n 7→ −n
Discrete Mathematics I – p. 194/292
Functionsf : Z��Z n 7→ n + 5
Function f bijective
f−1 : Z��Z m 7→ m− 5
f ◦ f−1 = f−1 ◦ f = idZ
For any set A, bijective f : A��A is a permutation
Discrete Mathematics I – p. 195/292
Functionsf : Z��Z n 7→ n + 5
Function f bijective
f−1 : Z��Z m 7→ m− 5
f ◦ f−1 = f−1 ◦ f = idZ
For any set A, bijective f : A��A is a permutation
Discrete Mathematics I – p. 195/292
Functionsf : Z��Z n 7→ n + 5
Function f bijective
f−1 : Z��Z m 7→ m− 5
f ◦ f−1 = f−1 ◦ f = idZ
For any set A, bijective f : A��A is a permutation
Discrete Mathematics I – p. 195/292
Functionsf : Z��Z n 7→ n + 5
Function f bijective
f−1 : Z��Z m 7→ m− 5
f ◦ f−1 = f−1 ◦ f = idZ
For any set A, bijective f : A��A is a permutation
Discrete Mathematics I – p. 195/292
Functionsf : Z��Z n 7→ n + 5
Function f bijective
f−1 : Z��Z m 7→ m− 5
f ◦ f−1 = f−1 ◦ f = idZ
For any set A, bijective f : A��A is a permutation
Discrete Mathematics I – p. 195/292
Functionsg : Z��Z n 7→ −n
Function g bijective
g−1 : Z��Z g−1 = g
g ◦ g−1 = g−1 ◦ g = g ◦ g = idZ
For any set A, a permutation g : A��A with g−1 = gis an involution
Discrete Mathematics I – p. 196/292
Functionsg : Z��Z n 7→ −n
Function g bijective
g−1 : Z��Z g−1 = g
g ◦ g−1 = g−1 ◦ g = g ◦ g = idZ
For any set A, a permutation g : A��A with g−1 = gis an involution
Discrete Mathematics I – p. 196/292
Functionsg : Z��Z n 7→ −n
Function g bijective
g−1 : Z��Z g−1 = g
g ◦ g−1 = g−1 ◦ g = g ◦ g = idZ
For any set A, a permutation g : A��A with g−1 = gis an involution
Discrete Mathematics I – p. 196/292
Functionsg : Z��Z n 7→ −n
Function g bijective
g−1 : Z��Z g−1 = g
g ◦ g−1 = g−1 ◦ g = g ◦ g = idZ
For any set A, a permutation g : A��A with g−1 = gis an involution
Discrete Mathematics I – p. 196/292
Functionsg : Z��Z n 7→ −n
Function g bijective
g−1 : Z��Z g−1 = g
g ◦ g−1 = g−1 ◦ g = g ◦ g = idZ
For any set A, a permutation g : A��A with g−1 = gis an involution
Discrete Mathematics I – p. 196/292
Functionsf : A → B g : B → C
If f , g surjective, then f ◦ g surjective
If f , g injective, then f ◦ g injective
If f , g bijective, then f ◦ g bijective
Discrete Mathematics I – p. 197/292
Functionsf : A → B g : B → C
If f , g surjective, then f ◦ g surjective
If f , g injective, then f ◦ g injective
If f , g bijective, then f ◦ g bijective
Discrete Mathematics I – p. 197/292
Functionsf : A → B g : B → C
If f , g surjective, then f ◦ g surjective
If f , g injective, then f ◦ g injective
If f , g bijective, then f ◦ g bijective
Discrete Mathematics I – p. 197/292
Functionsf : A → B g : B → C
If f , g surjective, then f ◦ g surjective
If f , g injective, then f ◦ g injective
If f , g bijective, then f ◦ g bijective
Discrete Mathematics I – p. 197/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒
∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒
∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒
f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒
∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒
∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒
f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if f bijective, then f−1 bijective.
Proof. Consider Rf : A ↔ B, Rf−1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : afb =⇒∀b ∈ B : ∃!a ∈ A : b(f−1)a =⇒ f−1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : afb =⇒∀a ∈ A : ∃!b ∈ B : b(f−1)a =⇒ f−1 bijective
Discrete Mathematics I – p. 198/292
FunctionsProve: if both f and f−1 are functions, then both fand f−1 are bijective
Proof (sketch). Let f : A → B, f−1 : B → A.
f a function ⇒ f−1 surjective
f a function ⇒ f−1 injective
f = (f−1)−1 ⇒ f surjective and injective
To prove f : A��B, only need f−1 : B → A
f ◦ f−1 = idA f−1 ◦ f = idB
Discrete Mathematics I – p. 199/292
FunctionsProve: if both f and f−1 are functions, then both fand f−1 are bijective
Proof (sketch). Let f : A → B, f−1 : B → A.
f a function ⇒ f−1 surjective
f a function ⇒ f−1 injective
f = (f−1)−1 ⇒ f surjective and injective
To prove f : A��B, only need f−1 : B → A
f ◦ f−1 = idA f−1 ◦ f = idB
Discrete Mathematics I – p. 199/292
FunctionsProve: if both f and f−1 are functions, then both fand f−1 are bijective
Proof (sketch). Let f : A → B, f−1 : B → A.
f a function ⇒ f−1 surjective
f a function ⇒ f−1 injective
f = (f−1)−1 ⇒ f surjective and injective
To prove f : A��B, only need f−1 : B → A
f ◦ f−1 = idA f−1 ◦ f = idB
Discrete Mathematics I – p. 199/292
FunctionsProve: if both f and f−1 are functions, then both fand f−1 are bijective
Proof (sketch). Let f : A → B, f−1 : B → A.
f a function ⇒ f−1 surjective
f a function ⇒ f−1 injective
f = (f−1)−1 ⇒ f surjective and injective
To prove f : A��B, only need f−1 : B → A
f ◦ f−1 = idA f−1 ◦ f = idB
Discrete Mathematics I – p. 199/292
FunctionsProve: if both f and f−1 are functions, then both fand f−1 are bijective
Proof (sketch). Let f : A → B, f−1 : B → A.
f a function ⇒ f−1 surjective
f a function ⇒ f−1 injective
f = (f−1)−1 ⇒ f surjective and injective
To prove f : A��B, only need f−1 : B → A
f ◦ f−1 = idA f−1 ◦ f = idB
Discrete Mathematics I – p. 199/292
FunctionsProve: if both f and f−1 are functions, then both fand f−1 are bijective
Proof (sketch). Let f : A → B, f−1 : B → A.
f a function ⇒ f−1 surjective
f a function ⇒ f−1 injective
f = (f−1)−1 ⇒ f surjective and injective
To prove f : A��B, only need f−1 : B → A
f ◦ f−1 = idA f−1 ◦ f = idB
Discrete Mathematics I – p. 199/292
FunctionsS — any set A ⊆ S B = {F, T}
Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}Set of all Boolean functions on S:
B(S) = {f | f : S → B}χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsS — any set A ⊆ S B = {F, T}Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}Set of all Boolean functions on S:
B(S) = {f | f : S → B}χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsS — any set A ⊆ S B = {F, T}Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}Set of all Boolean functions on S:
B(S) = {f | f : S → B}χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsS — any set A ⊆ S B = {F, T}Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}
Set of all Boolean functions on S:B(S) = {f | f : S → B}
χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsS — any set A ⊆ S B = {F, T}Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}Set of all Boolean functions on S:
B(S) = {f | f : S → B}
χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsS — any set A ⊆ S B = {F, T}Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}Set of all Boolean functions on S:
B(S) = {f | f : S → B}χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsS — any set A ⊆ S B = {F, T}Indicator function of A χA : S → B
∀x ∈ S : χA(x) =
{
T if x ∈ A
F if x 6∈ A
Set of all subsets of S P(S) = {A | A ⊆ S}Set of all Boolean functions on S:
B(S) = {f | f : S → B}χ : P(S)��B(S) ∀A ⊆ S : A 7→ χA
Subsets of S�� Boolean functions on S
Discrete Mathematics I – p. 200/292
FunctionsSets A, B are called equinumerous, if there is abijection between A and B
A ∼= B ⇐⇒ ∃f : A��B
A, B ⊆ S =⇒ R∼= an equivalence on P(S)
Discrete Mathematics I – p. 201/292
FunctionsSets A, B are called equinumerous, if there is abijection between A and B
A ∼= B ⇐⇒ ∃f : A��B
A, B ⊆ S =⇒ R∼= an equivalence on P(S)
Discrete Mathematics I – p. 201/292
FunctionsSets A, B are called equinumerous, if there is abijection between A and B
A ∼= B ⇐⇒ ∃f : A��B
A, B ⊆ S =⇒ R∼= an equivalence on P(S)
Discrete Mathematics I – p. 201/292
Functionsn ∈ N Nn = {x ∈ N | x < n}
N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Nn = {0, 1, 2, . . . , n− 1}Set A called finite, if A ∼= Nn for some n ∈ N
Otherwise, the set is called infinite
Discrete Mathematics I – p. 202/292
Functionsn ∈ N Nn = {x ∈ N | x < n}N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Nn = {0, 1, 2, . . . , n− 1}Set A called finite, if A ∼= Nn for some n ∈ N
Otherwise, the set is called infinite
Discrete Mathematics I – p. 202/292
Functionsn ∈ N Nn = {x ∈ N | x < n}N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Nn = {0, 1, 2, . . . , n− 1}
Set A called finite, if A ∼= Nn for some n ∈ N
Otherwise, the set is called infinite
Discrete Mathematics I – p. 202/292
Functionsn ∈ N Nn = {x ∈ N | x < n}N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Nn = {0, 1, 2, . . . , n− 1}Set A called finite, if A ∼= Nn for some n ∈ N
Otherwise, the set is called infinite
Discrete Mathematics I – p. 202/292
Functionsn ∈ N Nn = {x ∈ N | x < n}N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Nn = {0, 1, 2, . . . , n− 1}Set A called finite, if A ∼= Nn for some n ∈ N
Otherwise, the set is called infinite
Discrete Mathematics I – p. 202/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A
|A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsFor every finite set A, there is a unique n ∈ N, suchthat A ∼= Nn
Proof.
Let f : A��Nk. Then f−1 : Nk��A.
Let g : A��Nl.
f−1 ◦ g : Nk��Nl. Therefore k = l.
Number n called the cardinality of A |A| = n
A, B finite, A ∼= B =⇒ |A| = |B|
Discrete Mathematics I – p. 203/292
FunctionsN, Z, N2, N3, P(N), Neven — infinite
An infinite set is called countable, if it isequinumerous with N
In particular, N itself is countable
Discrete Mathematics I – p. 204/292
FunctionsN, Z, N2, N3, P(N), Neven — infinite
An infinite set is called countable, if it isequinumerous with N
In particular, N itself is countable
Discrete Mathematics I – p. 204/292
FunctionsN, Z, N2, N3, P(N), Neven — infinite
An infinite set is called countable, if it isequinumerous with N
In particular, N itself is countable
Discrete Mathematics I – p. 204/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsProve: set N+ = N \ {0} is countable.
Proof. Let f : N → N+ ∀n : n 7→ n + 1
∀n ∈ N+ : n = (n− 1) + 1 = f(n− 1)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (m + 1 6= n + 1)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 205/292
FunctionsN+ ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l1 2 3 4 5 6 7 8 · · ·
N+ ∼= N
A part is of the same size as the whole!
Discrete Mathematics I – p. 206/292
FunctionsN+ ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l1 2 3 4 5 6 7 8 · · ·
N+ ∼= N
A part is of the same size as the whole!
Discrete Mathematics I – p. 206/292
FunctionsN+ ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l1 2 3 4 5 6 7 8 · · ·
N+ ∼= N
A part is of the same size as the whole!
Discrete Mathematics I – p. 206/292
FunctionsN+ ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l1 2 3 4 5 6 7 8 · · ·
N+ ∼= N
A part is of the same size as the whole!
Discrete Mathematics I – p. 206/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsProve: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven ∀n : n 7→ 2n
∀n ∈ Neven : n = 2 · n/2 = f(n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
f surjective and injective =⇒ f bijective
Discrete Mathematics I – p. 207/292
FunctionsNeven ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l0 2 4 6 8 10 12 14 · · ·
Neven∼= N
In general, any subset of a countable set is finite orcountable. Any quotient set of a countable set is finiteor countable.
Discrete Mathematics I – p. 208/292
FunctionsNeven ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l0 2 4 6 8 10 12 14 · · ·
Neven∼= N
In general, any subset of a countable set is finite orcountable. Any quotient set of a countable set is finiteor countable.
Discrete Mathematics I – p. 208/292
FunctionsNeven ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l0 2 4 6 8 10 12 14 · · ·
Neven∼= N
In general, any subset of a countable set is finite orcountable. Any quotient set of a countable set is finiteor countable.
Discrete Mathematics I – p. 208/292
FunctionsNeven ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l0 2 4 6 8 10 12 14 · · ·
Neven∼= N
In general, any subset of a countable set is finite orcountable.
Any quotient set of a countable set is finiteor countable.
Discrete Mathematics I – p. 208/292
FunctionsNeven ⊆ N
0 1 2 3 4 5 6 7 · · ·l l l l l l l l0 2 4 6 8 10 12 14 · · ·
Neven∼= N
In general, any subset of a countable set is finite orcountable. Any quotient set of a countable set is finiteor countable.
Discrete Mathematics I – p. 208/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2 0 1 3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2 0 1 3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2 0 1 3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2
0
1 3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2
0 1
3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4
2 0 1
3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4
2 0 1 3
5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6
4 2 0 1 3
5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2 0 1 3 5 7 · · ·
f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: set Z is countable.
Proof. Let f : N → Z
∀n : n 7→{
(n + 1)/2 if n odd−n/2 if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·l l l l l l l l l
· · · 8 6 4 2 0 1 3 5 7 · · ·f bijective
Discrete Mathematics I – p. 209/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0 1 3 6 10
1 2 4 7 11 ·2 5 8 12 · ·3 9 13 · · ·4 14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0
0 1 3 6 10
1
2 4 7 11 ·
2
5 8 12 · ·
3
9 13 · · ·
4
14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0
1 3 6 10
1
2 4 7 11 ·
2
5 8 12 · ·
3
9 13 · · ·
4
14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0 1
3 6 10
1 2
4 7 11 ·
2
5 8 12 · ·
3
9 13 · · ·
4
14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0 1 3
6 10
1 2 4
7 11 ·
2 5
8 12 · ·
3
9 13 · · ·
4
14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0 1 3 6
10
1 2 4 7
11 ·
2 5 8
12 · ·
3 9
13 · · ·
4
14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0 1 3 6 10
1 2 4 7 11
·
2 5 8 12
· ·
3 9 13
· · ·
4 14
· · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N2 = N× N is countable.
Proof idea:
0 1 2 3 4
0 0 1 3 6 10
1 2 4 7 11 ·2 5 8 12 · ·3 9 13 · · ·4 14 · · · ·
Discrete Mathematics I – p. 210/292
FunctionsProve: Set N3 = N× N× N is countable.
Proof. N3 = (N× N)× N ∼= N× N ∼= N
In general, the Cartesian product of a finite number ofcountable sets is countable
Not true for an infinite Cartesian product!
Discrete Mathematics I – p. 211/292
FunctionsProve: Set N3 = N× N× N is countable.
Proof. N3 = (N× N)× N ∼= N× N ∼= N
In general, the Cartesian product of a finite number ofcountable sets is countable
Not true for an infinite Cartesian product!
Discrete Mathematics I – p. 211/292
FunctionsProve: Set N3 = N× N× N is countable.
Proof. N3 = (N× N)× N ∼= N× N ∼= N
In general, the Cartesian product of a finite number ofcountable sets is countable
Not true for an infinite Cartesian product!
Discrete Mathematics I – p. 211/292
FunctionsProve: Set N3 = N× N× N is countable.
Proof. N3 = (N× N)× N ∼= N× N ∼= N
In general, the Cartesian product of a finite number ofcountable sets is countable
Not true for an infinite Cartesian product!
Discrete Mathematics I – p. 211/292
FunctionsA digression on rational numbers
Fractions 1/2, −3/4, 355/113
Similar to Z2, but:
1/2 = 3/6 −5 = −10/2 = 30/(−6) . . .
Discrete Mathematics I – p. 212/292
FunctionsA digression on rational numbers
Fractions 1/2, −3/4, 355/113
Similar to Z2, but:
1/2 = 3/6 −5 = −10/2 = 30/(−6) . . .
Discrete Mathematics I – p. 212/292
FunctionsA digression on rational numbers
Fractions 1/2, −3/4, 355/113
Similar to Z2, but:
1/2 = 3/6 −5 = −10/2 = 30/(−6) . . .
Discrete Mathematics I – p. 212/292
Functionsa/b = c/d ⇐⇒ a · d = b · c b, d 6= 0
R∼ : Z2 ↔ Z2 (a, b) ∼ (c, d) ⇐⇒ a · d = b · cThe rational numbers: Q = Z2/R∼
Discrete Mathematics I – p. 213/292
Functionsa/b = c/d ⇐⇒ a · d = b · c b, d 6= 0
R∼ : Z2 ↔ Z2 (a, b) ∼ (c, d) ⇐⇒ a · d = b · c
The rational numbers: Q = Z2/R∼
Discrete Mathematics I – p. 213/292
Functionsa/b = c/d ⇐⇒ a · d = b · c b, d 6= 0
R∼ : Z2 ↔ Z2 (a, b) ∼ (c, d) ⇐⇒ a · d = b · cThe rational numbers: Q = Z2/R∼
Discrete Mathematics I – p. 213/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
0 11/21/3
5/12
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
1/21/3
5/12
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
1/3
5/12
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
�
1/3
5/12
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
�
1/3
�
5/12
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
�
1/3
�
5/12
� � � � � � � � � � � �
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
�
1/3
�
5/12
� � � � � � � � � � � �
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
�
1/3
�
5/12
� � � � � � � � � � � �
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSet Q is infinite, and also dense: for any two distinctrationals, there is a rational in between
�
0
�
1
�
1/2
�
1/3
�
5/12
� � � � � � � � � � � �
∀a, b ∈ Q :(
(a < b) ⇒ ∃x ∈ Q : a < x < b)
Still, set Q is countable
Z2 ∼= N =⇒ Q = Z2/R∼ ∼= N
Discrete Mathematics I – p. 214/292
FunctionsSets N, Z, Q countable: N ∼= Z ∼= Q
N ∼= N2 ∼= N3 ∼= N× Z×Q ∼= · · ·Are there any uncountable sets?
Discrete Mathematics I – p. 215/292
FunctionsSets N, Z, Q countable: N ∼= Z ∼= Q
N ∼= N2 ∼= N3 ∼= N× Z×Q ∼= · · ·
Are there any uncountable sets?
Discrete Mathematics I – p. 215/292
FunctionsSets N, Z, Q countable: N ∼= Z ∼= Q
N ∼= N2 ∼= N3 ∼= N× Z×Q ∼= · · ·Are there any uncountable sets?
Discrete Mathematics I – p. 215/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}
D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = D
Case d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCantor’s Theorem. For all sets A, A 6∼= P(A).
Proof. Suppose ∃f : A��P(A).
Let D = {a ∈ A | a 6∈ f(a)}D ⊆ A =⇒ D ∈ P(A) =⇒ ∃d ∈ A : f(d) = D
d ∈ D — true or false?
Case d ∈ D =⇒ d 6∈ f(d) = DCase d 6∈ D = f(d) =⇒ d ∈ D
Contradiction! Bijection f cannot exist.
Discrete Mathematics I – p. 216/292
FunctionsCorollary. Set P(N) is uncountable.
P(N) ∼= B(N) = {f : N → B} =⇒ B(N) 6∼= N
B = {F, T} ∼= {0, 1} = N2 ⊆ N
B(N) ∼= {f : N → N2} ⊆{f : N → N} = N× N× · · ·
B(N) uncountable =⇒ N× N× · · · uncountable
Discrete Mathematics I – p. 217/292
FunctionsCorollary. Set P(N) is uncountable.
P(N) ∼= B(N) = {f : N → B} =⇒ B(N) 6∼= N
B = {F, T} ∼= {0, 1} = N2 ⊆ N
B(N) ∼= {f : N → N2} ⊆{f : N → N} = N× N× · · ·
B(N) uncountable =⇒ N× N× · · · uncountable
Discrete Mathematics I – p. 217/292
FunctionsCorollary. Set P(N) is uncountable.
P(N) ∼= B(N) = {f : N → B} =⇒ B(N) 6∼= N
B = {F, T} ∼= {0, 1} = N2 ⊆ N
B(N) ∼= {f : N → N2} ⊆{f : N → N} = N× N× · · ·
B(N) uncountable =⇒ N× N× · · · uncountable
Discrete Mathematics I – p. 217/292
FunctionsCorollary. Set P(N) is uncountable.
P(N) ∼= B(N) = {f : N → B} =⇒ B(N) 6∼= N
B = {F, T} ∼= {0, 1} = N2 ⊆ N
B(N) ∼= {f : N → N2} ⊆{f : N → N} = N× N× · · ·
B(N) uncountable =⇒ N× N× · · · uncountable
Discrete Mathematics I – p. 217/292
FunctionsCorollary. Set P(N) is uncountable.
P(N) ∼= B(N) = {f : N → B} =⇒ B(N) 6∼= N
B = {F, T} ∼= {0, 1} = N2 ⊆ N
B(N) ∼= {f : N → N2} ⊆{f : N → N} = N× N× · · ·
B(N) uncountable =⇒ N× N× · · · uncountable
Discrete Mathematics I – p. 217/292
FunctionsA digression on real numbers
Rationals (20, −3/5, . . . ), irrationals (√
2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q0 ∪Q1 ∀x ∈ Q0, y ∈ Q1 : x < y
Q
Q0 Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/292
FunctionsA digression on real numbers
Rationals (20, −3/5, . . . ), irrationals (√
2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q0 ∪Q1 ∀x ∈ Q0, y ∈ Q1 : x < y
Q
Q0 Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/292
FunctionsA digression on real numbers
Rationals (20, −3/5, . . . ), irrationals (√
2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q0 ∪Q1 ∀x ∈ Q0, y ∈ Q1 : x < y
Q
Q0 Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/292
FunctionsA digression on real numbers
Rationals (20, −3/5, . . . ), irrationals (√
2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q0 ∪Q1 ∀x ∈ Q0, y ∈ Q1 : x < y
Q
Q0 Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/292
FunctionsA digression on real numbers
Rationals (20, −3/5, . . . ), irrationals (√
2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q0 ∪Q1 ∀x ∈ Q0, y ∈ Q1 : x < y
� � � � � � � � � � � � � � � � � � � � � � � �
Q
Q0 Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/292
FunctionsA digression on real numbers
Rationals (20, −3/5, . . . ), irrationals (√
2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q0 ∪Q1 ∀x ∈ Q0, y ∈ Q1 : x < y
� � � � � � � � � � � � � � � � � � � � � � � �
Q
Q0 Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/292
FunctionsThe real numbers R = {all Dedekind cuts of Q}
Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Q0 = {3, 3.1, 3.14, 3.141, 3.1415, 3.141592, . . .}Q1 = {4, 3.2, 3.15, 3.142, 3.1416, 3.141593, . . .}We approximate real by rationals using a positionalnumber system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/292
FunctionsThe real numbers R = {all Dedekind cuts of Q}Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Q0 = {3, 3.1, 3.14, 3.141, 3.1415, 3.141592, . . .}Q1 = {4, 3.2, 3.15, 3.142, 3.1416, 3.141593, . . .}We approximate real by rationals using a positionalnumber system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/292
FunctionsThe real numbers R = {all Dedekind cuts of Q}Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Q0 = {3, 3.1, 3.14, 3.141, 3.1415, 3.141592, . . .}Q1 = {4, 3.2, 3.15, 3.142, 3.1416, 3.141593, . . .}We approximate real by rationals using a positionalnumber system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/292
FunctionsThe real numbers R = {all Dedekind cuts of Q}Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Q0 = {3, 3.1, 3.14, 3.141, 3.1415, 3.141592, . . .}Q1 = {4, 3.2, 3.15, 3.142, 3.1416, 3.141593, . . .}We approximate real by rationals using a positionalnumber system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/292
FunctionsThe real numbers R = {all Dedekind cuts of Q}Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Q0 = {3, 3.1, 3.14, 3.141, 3.1415, 3.141592, . . .}Q1 = {4, 3.2, 3.15, 3.142, 3.1416, 3.141593, . . .}
We approximate real by rationals using a positionalnumber system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/292
FunctionsThe real numbers R = {all Dedekind cuts of Q}Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Q0 = {3, 3.1, 3.14, 3.141, 3.1415, 3.141592, . . .}Q1 = {4, 3.2, 3.15, 3.142, 3.1416, 3.141593, . . .}We approximate real by rationals using a positionalnumber system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/292
FunctionsIs set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
f(0) = 1 f(1) = 4 f(2) = 1 f(3) = 5 . . .
(For simplicity, ignore .1415000 . . . = .1414999 . . .)
Discrete Mathematics I – p. 220/292
FunctionsIs set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}
Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
f(0) = 1 f(1) = 4 f(2) = 1 f(3) = 5 . . .
(For simplicity, ignore .1415000 . . . = .1414999 . . .)
Discrete Mathematics I – p. 220/292
FunctionsIs set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
f(0) = 1 f(1) = 4 f(2) = 1 f(3) = 5 . . .
(For simplicity, ignore .1415000 . . . = .1414999 . . .)
Discrete Mathematics I – p. 220/292
FunctionsIs set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
f(0) = 1 f(1) = 4 f(2) = 1 f(3) = 5 . . .
(For simplicity, ignore .1415000 . . . = .1414999 . . .)
Discrete Mathematics I – p. 220/292
FunctionsIs set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
f(0) = 1 f(1) = 4 f(2) = 1 f(3) = 5 . . .
(For simplicity, ignore .1415000 . . . = .1414999 . . .)
Discrete Mathematics I – p. 220/292
FunctionsIs set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
f(0) = 1 f(1) = 4 f(2) = 1 f(3) = 5 . . .
(For simplicity, ignore .1415000 . . . = .1414999 . . .)
Discrete Mathematics I – p. 220/292
FunctionsB = {F, T} ∼= {0, 1} = N2 ⊆ N10 =⇒
B(N) = {f : N → B} ∼={f : N → N2} ⊆ {f : N → N10} ∼= [0, 1]
B(N) uncountable, hence [0, 1] uncountable
Therefore, R uncountable
Discrete Mathematics I – p. 221/292
FunctionsB = {F, T} ∼= {0, 1} = N2 ⊆ N10 =⇒B(N) = {f : N → B} ∼=
{f : N → N2} ⊆ {f : N → N10} ∼= [0, 1]
B(N) uncountable, hence [0, 1] uncountable
Therefore, R uncountable
Discrete Mathematics I – p. 221/292
FunctionsB = {F, T} ∼= {0, 1} = N2 ⊆ N10 =⇒B(N) = {f : N → B} ∼=
{f : N → N2} ⊆ {f : N → N10} ∼= [0, 1]
B(N) uncountable, hence [0, 1] uncountable
Therefore, R uncountable
Discrete Mathematics I – p. 221/292
FunctionsB = {F, T} ∼= {0, 1} = N2 ⊆ N10 =⇒B(N) = {f : N → B} ∼=
{f : N → N2} ⊆ {f : N → N10} ∼= [0, 1]
B(N) uncountable, hence [0, 1] uncountable
Therefore, R uncountable
Discrete Mathematics I – p. 221/292
FunctionsFinite sets:
n elements, n− 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Weird!
Discrete Mathematics I – p. 222/292
FunctionsFinite sets:
n elements, n− 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Weird!
Discrete Mathematics I – p. 222/292
FunctionsFinite sets:
n elements, n− 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Weird!
Discrete Mathematics I – p. 222/292
FunctionsFinite sets:
n elements, n− 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Weird!
Discrete Mathematics I – p. 222/292
FunctionsFinite sets:
n elements, n− 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Weird!
Discrete Mathematics I – p. 222/292
FunctionsFinite sets:
n elements, n− 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Weird!
Discrete Mathematics I – p. 222/292
FunctionsN, P(N), P(P(N)), . . . — uncountable
All of different cardinalities — and there any manymore. . .
So much more they don’t even form a set!
Discrete Mathematics I – p. 223/292
FunctionsN, P(N), P(P(N)), . . . — uncountable
All of different cardinalities — and there any manymore. . .
So much more they don’t even form a set!
Discrete Mathematics I – p. 223/292
FunctionsN, P(N), P(P(N)), . . . — uncountable
All of different cardinalities — and there any manymore. . .
So much more they don’t even form a set!
Discrete Mathematics I – p. 223/292
Induction
Discrete Mathematics I – p. 224/292
InductionNatural numbers: N = {0, 1, 2, 3, 4, 5, 6, 7, . . . }
God created the natural numbers, all the restis the work of man.
L. Kronecker (1823–1891)
Discrete Mathematics I – p. 225/292
InductionNatural numbers: N = {0, 1, 2, 3, 4, 5, 6, 7, . . . }
God created the natural numbers, all the restis the work of man.
L. Kronecker (1823–1891)
Discrete Mathematics I – p. 225/292
InductionThe only possible definition of N is self-referential:
• 0 ∈ N
• for all x ∈ N next(x) ∈ N
• everything else 6∈ N
This is an inductive definition
Discrete Mathematics I – p. 226/292
InductionThe only possible definition of N is self-referential:
• 0 ∈ N
• for all x ∈ N next(x) ∈ N
• everything else 6∈ N
This is an inductive definition
Discrete Mathematics I – p. 226/292
InductionThe only possible definition of N is self-referential:
• 0 ∈ N
• for all x ∈ N next(x) ∈ N
• everything else 6∈ N
This is an inductive definition
Discrete Mathematics I – p. 226/292
InductionThe only possible definition of N is self-referential:
• 0 ∈ N
• for all x ∈ N next(x) ∈ N
• everything else 6∈ N
This is an inductive definition
Discrete Mathematics I – p. 226/292
InductionThe only possible definition of N is self-referential:
• 0 ∈ N
• for all x ∈ N next(x) ∈ N
• everything else 6∈ N
This is an inductive definition
Discrete Mathematics I – p. 226/292
InductionStructure of inductive definition:
• induction base
• inductive step(s)
• completeness (sometimes implicit)
Discrete Mathematics I – p. 227/292
InductionStructure of inductive definition:
• induction base
• inductive step(s)
• completeness (sometimes implicit)
Discrete Mathematics I – p. 227/292
InductionStructure of inductive definition:
• induction base
• inductive step(s)
• completeness (sometimes implicit)
Discrete Mathematics I – p. 227/292
InductionStructure of inductive definition:
• induction base
• inductive step(s)
• completeness (sometimes implicit)
Discrete Mathematics I – p. 227/292
InductionFor example, a queue:
• the empty set ∅ is a queue;
• a queue with a new person behind is still a queue
• every queue is formed in this way
If we know what “behind” means, all works!
Discrete Mathematics I – p. 228/292
InductionFor example, a queue:
• the empty set ∅ is a queue;
• a queue with a new person behind is still a queue
• every queue is formed in this way
If we know what “behind” means, all works!
Discrete Mathematics I – p. 228/292
InductionFor example, a queue:
• the empty set ∅ is a queue;
• a queue with a new person behind is still a queue
• every queue is formed in this way
If we know what “behind” means, all works!
Discrete Mathematics I – p. 228/292
InductionFor example, a queue:
• the empty set ∅ is a queue;
• a queue with a new person behind is still a queue
• every queue is formed in this way
If we know what “behind” means, all works!
Discrete Mathematics I – p. 228/292
InductionFor example, a queue:
• the empty set ∅ is a queue;
• a queue with a new person behind is still a queue
• every queue is formed in this way
If we know what “behind” means, all works!
Discrete Mathematics I – p. 228/292
InductionAnother example: Boolean statements
• F , T are statements
• if A, B are statements, then ¬A, A ∧B, A ∨B,A ⇒ B, A ⇔ B are statements
• there are no other statements
Discrete Mathematics I – p. 229/292
InductionAnother example: Boolean statements
• F , T are statements
• if A, B are statements, then ¬A, A ∧B, A ∨B,A ⇒ B, A ⇔ B are statements
• there are no other statements
Discrete Mathematics I – p. 229/292
InductionAnother example: Boolean statements
• F , T are statements
• if A, B are statements, then ¬A, A ∧B, A ∨B,A ⇒ B, A ⇔ B are statements
• there are no other statements
Discrete Mathematics I – p. 229/292
InductionAnother example: Boolean statements
• F , T are statements
• if A, B are statements, then ¬A, A ∧B, A ∨B,A ⇒ B, A ⇔ B are statements
• there are no other statements
Discrete Mathematics I – p. 229/292
InductionIn general:
• induction base: initial objects
• inductive step(s): ways to make new objects
• completeness: no other objects allowed!
Discrete Mathematics I – p. 230/292
InductionIn general:
• induction base: initial objects
• inductive step(s): ways to make new objects
• completeness: no other objects allowed!
Discrete Mathematics I – p. 230/292
InductionIn general:
• induction base: initial objects
• inductive step(s): ways to make new objects
• completeness: no other objects allowed!
Discrete Mathematics I – p. 230/292
InductionIn general:
• induction base: initial objects
• inductive step(s): ways to make new objects
• completeness: no other objects allowed!
Discrete Mathematics I – p. 230/292
InductionInductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
• induction base: P (0)
• inductive step: ∀x ∈ N : P (x) ⇒ P (next(x))(here P (x) is the induction hypothesis)
• by completeness, P (x) true for all x ∈ N
Discrete Mathematics I – p. 231/292
InductionInductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
• induction base: P (0)
• inductive step: ∀x ∈ N : P (x) ⇒ P (next(x))(here P (x) is the induction hypothesis)
• by completeness, P (x) true for all x ∈ N
Discrete Mathematics I – p. 231/292
InductionInductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
• induction base: P (0)
• inductive step: ∀x ∈ N : P (x) ⇒ P (next(x))(here P (x) is the induction hypothesis)
• by completeness, P (x) true for all x ∈ N
Discrete Mathematics I – p. 231/292
InductionInductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
• induction base: P (0)
• inductive step: ∀x ∈ N : P (x) ⇒ P (next(x))(here P (x) is the induction hypothesis)
• by completeness, P (x) true for all x ∈ N
Discrete Mathematics I – p. 231/292
InductionInductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
• induction base: P (0)
• inductive step: ∀x ∈ N : P (x) ⇒ P (next(x))(here P (x) is the induction hypothesis)
• by completeness, P (x) true for all x ∈ N
Discrete Mathematics I – p. 231/292
InductionExample: plane colouring
Consider n lines in the plane.
Can always colour regions like a chessboard.
Discrete Mathematics I – p. 232/292
InductionExample: plane colouring
Consider n lines in the plane.
Can always colour regions like a chessboard.
Discrete Mathematics I – p. 232/292
InductionExample: plane colouring
Consider n lines in the plane.
Can always colour regions like a chessboard.
Discrete Mathematics I – p. 232/292
InductionExample: plane colouring
Consider n lines in the plane.
Can always colour regions like a chessboard.
Discrete Mathematics I – p. 232/292
InductionExample: plane colouring
Consider n lines in the plane.
Can always colour regions like a chessboard.
Discrete Mathematics I – p. 232/292
InductionProof.
Induction base: n = 0.
Paint the plane white.
Discrete Mathematics I – p. 233/292
InductionProof.
Induction base: n = 0. Paint the plane white.
Discrete Mathematics I – p. 233/292
InductionProof.
Induction base: n = 0. Paint the plane white.
Discrete Mathematics I – p. 233/292
InductionInductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
By induction, can colour for all n.
Discrete Mathematics I – p. 234/292
InductionInductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
By induction, can colour for all n.
Discrete Mathematics I – p. 234/292
InductionInductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
By induction, can colour for all n.
Discrete Mathematics I – p. 234/292
InductionInductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
By induction, can colour for all n.
Discrete Mathematics I – p. 234/292
InductionInductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
By induction, can colour for all n.
Discrete Mathematics I – p. 234/292
InductionInductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
By induction, can colour for all n.
Discrete Mathematics I – p. 234/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof.
Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base:
8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s.
Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s.
Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: Any postage ≥ 8p can be paid by 3p and 5pstamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Case 1: have used a 5. Replace 5 → 3 + 3.
Case 2: have only used 3s. Since n ≥ 8, there are atleast three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
By induction, can pay any n ≥ 8.
Discrete Mathematics I – p. 235/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof.
Induction base:
|A| = 0 =⇒ A = ∅ =⇒P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒
A = ∅ =⇒P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒
P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒P(A) = {∅} =⇒
|P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionProve: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒P(A) = {∅} =⇒ |P(A)| = 1 = 20
Inductive step. Suppose it holds for a given n:for all B |B| = n =⇒ |P(B)| = 2n
We need:for all A |A| = n + 1 =⇒ |P(A)| = 2n+1
Discrete Mathematics I – p. 236/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B)
Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}
P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q
P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅
|P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionLet a ∈ A B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n.
Let P = P(B) Q = {X ∪ {a} | X ∈ P}P(A) = P ∪Q P ∩Q = ∅ |P | = |Q| = 2n
Hence |P(A)| = |P |+ |Q| = 2n + 2n = 2n · 2 = 2n+1
By induction, statement true for all A
Discrete Mathematics I – p. 237/292
InductionConsider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:(
P (0) ∧ P (1) ∧ · · · ∧ P (n− 1))
⇒ P (n)
(Also covers T ⇒ P (0))
So-called “strong” induction(in fact, the implication has become weaker!)
Does P (n) still hold for all n?
Discrete Mathematics I – p. 238/292
InductionConsider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:(
P (0) ∧ P (1) ∧ · · · ∧ P (n− 1))
⇒ P (n)
(Also covers T ⇒ P (0))
So-called “strong” induction(in fact, the implication has become weaker!)
Does P (n) still hold for all n?
Discrete Mathematics I – p. 238/292
InductionConsider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:(
P (0) ∧ P (1) ∧ · · · ∧ P (n− 1))
⇒ P (n)
(Also covers T ⇒ P (0))
So-called “strong” induction(in fact, the implication has become weaker!)
Does P (n) still hold for all n?
Discrete Mathematics I – p. 238/292
InductionConsider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:(
P (0) ∧ P (1) ∧ · · · ∧ P (n− 1))
⇒ P (n)
(Also covers T ⇒ P (0))
So-called “strong” induction(in fact, the implication has become weaker!)
Does P (n) still hold for all n?
Discrete Mathematics I – p. 238/292
InductionConsider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:(
P (0) ∧ P (1) ∧ · · · ∧ P (n− 1))
⇒ P (n)
(Also covers T ⇒ P (0))
So-called “strong” induction(in fact, the implication has become weaker!)
Does P (n) still hold for all n?
Discrete Mathematics I – p. 238/292
InductionConsider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:(
P (0) ∧ P (1) ∧ · · · ∧ P (n− 1))
⇒ P (n)
(Also covers T ⇒ P (0))
So-called “strong” induction(in fact, the implication has become weaker!)
Does P (n) still hold for all n?
Discrete Mathematics I – p. 238/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0)
induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)
(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1)
inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionLet Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n) ( =⇒ ∀n ∈ N : P (n))
T ⇒ P (0) ⇐⇒ P (0) ⇐⇒ Q(0) induction base
Q(n) ⇐⇒ P (0)∧P (1)∧ · · · ∧P (n) =⇒ P (n+1)(
P (0) ∧ · · · ∧ P (n))
∧ P (n + 1) ⇐⇒ Q(n + 1)
Hence Q(n) ⇒ Q(n + 1) inductive step
By induction, ∀n : Q(n), therefore ∀n : P (n)
Discrete Mathematics I – p. 239/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof.
Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base:
2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | n
Case 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | n
Then ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | n
In both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
InductionProve: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base: 2 | 2 prime
Inductive step. Suppose true ∀m < n. True for n?
Case 1: n prime n | nCase 2: ∃m < n : m | nThen ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | nIn both cases n divisible by a prime
By induction, all n ≥ 2 divisible by a prime
Discrete Mathematics I – p. 240/292
Graphs
Discrete Mathematics I – p. 241/292
Graphs
The Königsberg Bridges (L. Euler, 1707–1783)
A tour crossing every bridge exactly once?
Discrete Mathematics I – p. 242/292
Graphs
The Königsberg Bridges (L. Euler, 1707–1783)
A tour crossing every bridge exactly once?
Discrete Mathematics I – p. 242/292
Graphs
The Königsberg Bridges (L. Euler, 1707–1783)
A tour crossing every bridge exactly once?
Discrete Mathematics I – p. 242/292
Graphs
The Königsberg Bridges graph
��
�
�
�� ��
� �
� ��
��
4 • nodes (islands) 7 ◦ nodes (bridges)
Discrete Mathematics I – p. 243/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
�G
FWC
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
�G
FWC
�
FG
WC
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
�G
FWC
�
FG
WC
�
FWGC
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
�G
FWC
�
FG
WC
�
FWGC
�
W
FGC
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
�G
FWC
�
FG
WC
�
FWGC
�
W
FGC
FGW
C
Discrete Mathematics I – p. 244/292
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the riverCan only take one item at a time
W eats G, G eats C — farmer must keep an eye
�
FWGC
�
WC
FG
� FWC
G
�
C
FWG �
FGC
W
�G
FWC
�
FG
WC
�
FWGC
�
W
FGC
FGW
C
Discrete Mathematics I – p. 244/292
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
�
H1
�
H2�
H3
�
W1
�
W2
�
W3
Discrete Mathematics I – p. 245/292
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
�
H1
�
H2�
H3
�
W1
�
W2
�
W3
Discrete Mathematics I – p. 245/292
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
�
H1
�
H2�
H3
�
W1
�
W2
�
W3
Discrete Mathematics I – p. 245/292
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
�
H1
�
H2�
H3
�
W1
�
W2
�
W3
Discrete Mathematics I – p. 245/292
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
�
H1
�
H2�
H3
�
W1
�
W2
�
W3
Discrete Mathematics I – p. 245/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
V — finite set, elements called nodes R⇀ : V ↔ V
R⇀ called irreflexive, if ∀a ∈ A : ¬(a ⇀ a)
R⇀ called symmetric, if ∀a, b ∈ A : a ⇀ b ⇒ b ⇀ a
A graph is an irreflexive, symmetric relationE = R⇀ : V ↔ V
Nodes u, v called adjacent, if u ⇀ v
Pairs in E called edges
Common notation: graph G = (V, E)
Discrete Mathematics I – p. 246/292
Graphs
The complete graph on V : K(V ) = (V, E)where E = {(u, v) ∈ V 2 | u 6= v}
0
1
2
3 4
K(N5)
The complete graph on n nodes: K(n)
Discrete Mathematics I – p. 247/292
Graphs
The complete graph on V : K(V ) = (V, E)where E = {(u, v) ∈ V 2 | u 6= v}
� 0
�
1
�2
�
3
�
4
K(N5)
The complete graph on n nodes: K(n)
Discrete Mathematics I – p. 247/292
Graphs
The complete graph on V : K(V ) = (V, E)where E = {(u, v) ∈ V 2 | u 6= v}
� 0
�
1
�2
�
3
�
4
K(N5)
The complete graph on n nodes: K(n)
Discrete Mathematics I – p. 247/292
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is abijection between their node sets, which preserves theedges
G1 = (V1, E1) G2 = (V2, E2)
G1∼= G2 ⇐⇒ ∃f : V1��V2 :
∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f(u), f(v)) ∈ E2
Bijection f is the isomorphism between G1, G2
Discrete Mathematics I – p. 248/292
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is abijection between their node sets, which preserves theedges
G1 = (V1, E1) G2 = (V2, E2)
G1∼= G2 ⇐⇒ ∃f : V1��V2 :
∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f(u), f(v)) ∈ E2
Bijection f is the isomorphism between G1, G2
Discrete Mathematics I – p. 248/292
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is abijection between their node sets, which preserves theedges
G1 = (V1, E1) G2 = (V2, E2)
G1∼= G2 ⇐⇒ ∃f : V1��V2 :
∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f(u), f(v)) ∈ E2
Bijection f is the isomorphism between G1, G2
Discrete Mathematics I – p. 248/292
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is abijection between their node sets, which preserves theedges
G1 = (V1, E1) G2 = (V2, E2)
G1∼= G2 ⇐⇒ ∃f : V1��V2 :
∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f(u), f(v)) ∈ E2
Bijection f is the isomorphism between G1, G2
Discrete Mathematics I – p. 248/292
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is abijection between their node sets, which preserves theedges
G1 = (V1, E1) G2 = (V2, E2)
G1∼= G2 ⇐⇒ ∃f : V1��V2 :
∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f(u), f(v)) ∈ E2
Bijection f is the isomorphism between G1, G2
Discrete Mathematics I – p. 248/292
Graphs
Example:
�
0
�
2
�
1
�
3
�
4
�
0
�
2
�
1
�
3
4
0
�
1
�
2
3
�
4
Discrete Mathematics I – p. 249/292
Graphs
Example:
�
0
�2 �1
�
3
�
4
�0
�2 �1�
3
4
0
�
1
�
2
3
�4
Discrete Mathematics I – p. 249/292
Graphs
G = (V, E) V = V1 ∪ V2 V1 ∩ V2 = ∅
G called bipartite (or two-coloured), if
• for all u, v ∈ V1, (u, v) 6∈ E
• for all u, v ∈ V2, (u, v) 6∈ E
Sets V1, V2 called colour classes of G
Discrete Mathematics I – p. 250/292
Graphs
G = (V, E) V = V1 ∪ V2 V1 ∩ V2 = ∅G called bipartite (or two-coloured), if
• for all u, v ∈ V1, (u, v) 6∈ E
• for all u, v ∈ V2, (u, v) 6∈ E
Sets V1, V2 called colour classes of G
Discrete Mathematics I – p. 250/292
Graphs
G = (V, E) V = V1 ∪ V2 V1 ∩ V2 = ∅G called bipartite (or two-coloured), if
• for all u, v ∈ V1, (u, v) 6∈ E
• for all u, v ∈ V2, (u, v) 6∈ E
Sets V1, V2 called colour classes of G
Discrete Mathematics I – p. 250/292
Graphs
Example:
��
�
�
�� ��
� �
� ��
��
The Königsberg Bridges graph is bipartite
Discrete Mathematics I – p. 251/292
Graphs
Example:
��
�
�
�� ��
� �
� ��
��
The Königsberg Bridges graph is bipartite
Discrete Mathematics I – p. 251/292
Graphs
Example:
� �� �
�� �
�� �
� �
The wolf/goat/cabbage graph is bipartite
Discrete Mathematics I – p. 252/292
Graphs
Example:
� �� �
�� �
�� �
� �
The wolf/goat/cabbage graph is bipartite
Discrete Mathematics I – p. 252/292
Graphs
V1 ∩ V2 = ∅
Bipartite graph with all possible edges between V1, V2
is called complete bipartite
K(V1, V2) = (V1 ∪ V2, (V1 × V2) ∪ (V2 × V1))
The complete bipartite graph on m + n nodes:K(m, n)
Can also define n-partite (n-coloured), and completen-partite graph
Discrete Mathematics I – p. 253/292
Graphs
V1 ∩ V2 = ∅Bipartite graph with all possible edges between V1, V2
is called complete bipartite
K(V1, V2) = (V1 ∪ V2, (V1 × V2) ∪ (V2 × V1))
The complete bipartite graph on m + n nodes:K(m, n)
Can also define n-partite (n-coloured), and completen-partite graph
Discrete Mathematics I – p. 253/292
Graphs
V1 ∩ V2 = ∅Bipartite graph with all possible edges between V1, V2
is called complete bipartite
K(V1, V2) = (V1 ∪ V2, (V1 × V2) ∪ (V2 × V1))
The complete bipartite graph on m + n nodes:K(m, n)
Can also define n-partite (n-coloured), and completen-partite graph
Discrete Mathematics I – p. 253/292
Graphs
V1 ∩ V2 = ∅Bipartite graph with all possible edges between V1, V2
is called complete bipartite
K(V1, V2) = (V1 ∪ V2, (V1 × V2) ∪ (V2 × V1))
The complete bipartite graph on m + n nodes:K(m, n)
Can also define n-partite (n-coloured), and completen-partite graph
Discrete Mathematics I – p. 253/292
Graphs
V1 ∩ V2 = ∅Bipartite graph with all possible edges between V1, V2
is called complete bipartite
K(V1, V2) = (V1 ∪ V2, (V1 × V2) ∪ (V2 × V1))
The complete bipartite graph on m + n nodes:K(m, n)
Can also define n-partite (n-coloured), and completen-partite graph
Discrete Mathematics I – p. 253/292
Graphs
Example:
�
H1
�
H2
�
H3
��
W1
��W2
��
W3
The houses/wells graph is complete bipartite
K({H1, H2, H3}, {W1, W2, W3})
Discrete Mathematics I – p. 254/292
Graphs
Example:
�
H1
�
H2
�
H3
��
W1
��W2
��
W3
The houses/wells graph is complete bipartite
K({H1, H2, H3}, {W1, W2, W3})
Discrete Mathematics I – p. 254/292
Graphs
Example:
�
H1
�
H2
�
H3
��
W1
��W2
��
W3
The houses/wells graph is complete bipartite
K({H1, H2, H3}, {W1, W2, W3})
Discrete Mathematics I – p. 254/292
Graphs
G = (V, E)
A walk: sequence (u, u1, . . . , uk−1, v), such that
(u ⇀ u1) ∧ (u1 ⇀ u2) ∧ · · · ∧ (uk−1 ⇀ v)
Nodes u, v connected by a walk: u# v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
A tour is a walk from a node to itself: u# u
Discrete Mathematics I – p. 255/292
Graphs
G = (V, E)
A walk: sequence (u, u1, . . . , uk−1, v), such that
(u ⇀ u1) ∧ (u1 ⇀ u2) ∧ · · · ∧ (uk−1 ⇀ v)
Nodes u, v connected by a walk: u# v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
A tour is a walk from a node to itself: u# u
Discrete Mathematics I – p. 255/292
Graphs
G = (V, E)
A walk: sequence (u, u1, . . . , uk−1, v), such that
(u ⇀ u1) ∧ (u1 ⇀ u2) ∧ · · · ∧ (uk−1 ⇀ v)
Nodes u, v connected by a walk: u# v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
A tour is a walk from a node to itself: u# u
Discrete Mathematics I – p. 255/292
Graphs
G = (V, E)
A walk: sequence (u, u1, . . . , uk−1, v), such that
(u ⇀ u1) ∧ (u1 ⇀ u2) ∧ · · · ∧ (uk−1 ⇀ v)
Nodes u, v connected by a walk: u# v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
A tour is a walk from a node to itself: u# u
Discrete Mathematics I – p. 255/292
Graphs
G = (V, E)
A walk: sequence (u, u1, . . . , uk−1, v), such that
(u ⇀ u1) ∧ (u1 ⇀ u2) ∧ · · · ∧ (uk−1 ⇀ v)
Nodes u, v connected by a walk: u# v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
A tour is a walk from a node to itself: u# u
Discrete Mathematics I – p. 255/292
Graphs
G = (V, E)
A walk: sequence (u, u1, . . . , uk−1, v), such that
(u ⇀ u1) ∧ (u1 ⇀ u2) ∧ · · · ∧ (uk−1 ⇀ v)
Nodes u, v connected by a walk: u# v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
A tour is a walk from a node to itself: u# u
Discrete Mathematics I – p. 255/292
Graphs
�2
�
3
�
4
�10
�
0
�
5
�
1
�
6
�7
8
9
0# 5 : 0 ⇀ 3 ⇀ 1 ⇀ 4 ⇀ 6 ⇀ 3 ⇀ 0 ⇀ 2 ⇀ 5
A tour: 0 ⇀ 3 ⇀ 1 ⇀ 4 ⇀ 6 ⇀ 3 ⇀ 5 ⇀ 2 ⇀ 0
Discrete Mathematics I – p. 256/292
Graphs
�2
�
3
�
4
�10
�
0
�
5
�
1
�
6
�7
8
9
0# 5 : 0 ⇀ 3 ⇀ 1 ⇀ 4 ⇀ 6 ⇀ 3 ⇀ 0 ⇀ 2 ⇀ 5
A tour: 0 ⇀ 3 ⇀ 1 ⇀ 4 ⇀ 6 ⇀ 3 ⇀ 5 ⇀ 2 ⇀ 0
Discrete Mathematics I – p. 256/292
Graphs
�2
�
3
�
4
�10
�
0
�
5
�
1
�
6
�7
8
9
0# 5 : 0 ⇀ 3 ⇀ 1 ⇀ 4 ⇀ 6 ⇀ 3 ⇀ 0 ⇀ 2 ⇀ 5
A tour: 0 ⇀ 3 ⇀ 1 ⇀ 4 ⇀ 6 ⇀ 3 ⇀ 5 ⇀ 2 ⇀ 0
Discrete Mathematics I – p. 256/292
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u# v) ⇒ (v # u)
For all u, v, w ∈ V , (u# v) ∧ (v # w) ⇒ (u# w)
Therefore R# : V ↔ V is an equivalence relation
Classes of R# called connected components
A graph is connected, if every two nodes areconnected
Discrete Mathematics I – p. 257/292
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u# v) ⇒ (v # u)
For all u, v, w ∈ V , (u# v) ∧ (v # w) ⇒ (u# w)
Therefore R# : V ↔ V is an equivalence relation
Classes of R# called connected components
A graph is connected, if every two nodes areconnected
Discrete Mathematics I – p. 257/292
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u# v) ⇒ (v # u)
For all u, v, w ∈ V , (u# v) ∧ (v # w) ⇒ (u# w)
Therefore R# : V ↔ V is an equivalence relation
Classes of R# called connected components
A graph is connected, if every two nodes areconnected
Discrete Mathematics I – p. 257/292
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u# v) ⇒ (v # u)
For all u, v, w ∈ V , (u# v) ∧ (v # w) ⇒ (u# w)
Therefore R# : V ↔ V is an equivalence relation
Classes of R# called connected components
A graph is connected, if every two nodes areconnected
Discrete Mathematics I – p. 257/292
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u# v) ⇒ (v # u)
For all u, v, w ∈ V , (u# v) ∧ (v # w) ⇒ (u# w)
Therefore R# : V ↔ V is an equivalence relation
Classes of R# called connected components
A graph is connected, if every two nodes areconnected
Discrete Mathematics I – p. 257/292
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u# v) ⇒ (v # u)
For all u, v, w ∈ V , (u# v) ∧ (v # w) ⇒ (u# w)
Therefore R# : V ↔ V is an equivalence relation
Classes of R# called connected components
A graph is connected, if every two nodes areconnected
Discrete Mathematics I – p. 257/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u v
u = u0 ⇀ u1 ⇀ u2 ⇀ . . . ⇀ uk−1 ⇀ uk = v
∀i, j ∈ Nk+1 : i 6= j ⇒ ui 6= uj
A cycle is a tour of length ≥ 3 where all nodes exceptthe final are distinct: u v ⇀ u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/292
Graphs
�2
�
3
�
4
�10
�
0
�
5
�
1
�
6
�7
8
9
0 5 : 0 ⇀ 2 ⇀ 7 ⇀ 10 ⇀ 8 ⇀ 3 ⇀ 5
A cycle: 3 ⇀ 8 ⇀ 10 ⇀ 9 ⇀ 4 ⇀ 6 ⇀ 3
Discrete Mathematics I – p. 259/292
Graphs
�2
�
3
�
4
�10
�
0
�
5
�
1
�
6
�7
8
9
0 5 : 0 ⇀ 2 ⇀ 7 ⇀ 10 ⇀ 8 ⇀ 3 ⇀ 5
A cycle: 3 ⇀ 8 ⇀ 10 ⇀ 9 ⇀ 4 ⇀ 6 ⇀ 3
Discrete Mathematics I – p. 259/292
Graphs
�2
�
3
�
4
�10
�
0
�
5
�
1
�
6
�7
8
9
0 5 : 0 ⇀ 2 ⇀ 7 ⇀ 10 ⇀ 8 ⇀ 3 ⇀ 5
A cycle: 3 ⇀ 8 ⇀ 10 ⇀ 9 ⇀ 4 ⇀ 6 ⇀ 3
Discrete Mathematics I – p. 259/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof. (u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof. (u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof. (u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof. (u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof.
(u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof. (u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
G = (V, E)
R : V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u v, iffthere is a walk u# v.
R , R# : V ↔ V R = R#
Proof. (u v) ⇒ (u# v): trivial
(u# v) ⇒ (u v): induction on walk length
Discrete Mathematics I – p. 260/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
Induction base: (u) is both u# u and u u
Inductive step: consider walk u# w ⇀ v
Assume statement holds for u# w: path u w
Case 1: path u w does not visit v
Then u w ⇀ v is a path
Case 2: path u w visits v: u v w ⇀ v
Take initial u v
Discrete Mathematics I – p. 261/292
Graphs
G = (V, E) v ∈ V
The degree of node v is the number of nodes adjacentto v
deg(v) = |{u ∈ V | v ⇀ u}|
a
b c
d
ef
deg(a) = deg(d) = 2
deg(b) = deg(c) = 4
deg(e) = deg(f) = 4
Discrete Mathematics I – p. 262/292
Graphs
G = (V, E) v ∈ V
The degree of node v is the number of nodes adjacentto v
deg(v) = |{u ∈ V | v ⇀ u}|
a
b c
d
ef
deg(a) = deg(d) = 2
deg(b) = deg(c) = 4
deg(e) = deg(f) = 4
Discrete Mathematics I – p. 262/292
Graphs
G = (V, E) v ∈ V
The degree of node v is the number of nodes adjacentto v
deg(v) = |{u ∈ V | v ⇀ u}|
a
b c
d
ef
deg(a) = deg(d) = 2
deg(b) = deg(c) = 4
deg(e) = deg(f) = 4
Discrete Mathematics I – p. 262/292
Graphs
G = (V, E) v ∈ V
The degree of node v is the number of nodes adjacentto v
deg(v) = |{u ∈ V | v ⇀ u}|
�a
�
b
�
c
�
d
�
e
�
f
deg(a) = deg(d) = 2
deg(b) = deg(c) = 4
deg(e) = deg(f) = 4
Discrete Mathematics I – p. 262/292
Graphs
G = (V, E) v ∈ V
The degree of node v is the number of nodes adjacentto v
deg(v) = |{u ∈ V | v ⇀ u}|
�a
�
b
�
c
�
d
�
e
�
f
deg(a) = deg(d) = 2
deg(b) = deg(c) = 4
deg(e) = deg(f) = 4
Discrete Mathematics I – p. 262/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
a
b c
d
ef
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a
⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b
⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c
⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f
⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e
⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d
⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c
⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e
⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f
⇀ a
Discrete Mathematics I – p. 263/292
Graphs
An Euler tour of graph G is a tour which visits everyedge in E exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ c ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b ⇀ f ⇀ a
Discrete Mathematics I – p. 263/292
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
• G is connected
• every node in V has even degree
Gives an efficient test for Euler tour existence
Discrete Mathematics I – p. 264/292
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
• G is connected
• every node in V has even degree
Gives an efficient test for Euler tour existence
Discrete Mathematics I – p. 264/292
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
• G is connected
• every node in V has even degree
Gives an efficient test for Euler tour existence
Discrete Mathematics I – p. 264/292
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
• G is connected
• every node in V has even degree
Gives an efficient test for Euler tour existence
Discrete Mathematics I – p. 264/292
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
• G is connected
• every node in V has even degree
Gives an efficient test for Euler tour existence
Discrete Mathematics I – p. 264/292
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Suppose v visited k times by Euler tour
Every visit uses 2 new edges (in and out)
Hence deg(v) = 2k
Discrete Mathematics I – p. 265/292
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Suppose v visited k times by Euler tour
Every visit uses 2 new edges (in and out)
Hence deg(v) = 2k
Discrete Mathematics I – p. 265/292
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Suppose v visited k times by Euler tour
Every visit uses 2 new edges (in and out)
Hence deg(v) = 2k
Discrete Mathematics I – p. 265/292
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Suppose v visited k times by Euler tour
Every visit uses 2 new edges (in and out)
Hence deg(v) = 2k
Discrete Mathematics I – p. 265/292
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Suppose v visited k times by Euler tour
Every visit uses 2 new edges (in and out)
Hence deg(v) = 2k
Discrete Mathematics I – p. 265/292
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Suppose v visited k times by Euler tour
Every visit uses 2 new edges (in and out)
Hence deg(v) = 2k
Discrete Mathematics I – p. 265/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
G connected ∧ every node has even degree⇒ G has an Euler tour
Take any v0 ∈ V
Consider any walk v0 ⇀ v1 ⇀ . . . ⇀ vk 6= v0
Node vk has an odd number of visited edges
deg(vk) is even ⇒ vk has an unvisited edge
Extend walk: v0 ⇀ v1 ⇀ . . . ⇀ vk ⇀ vk+1
Repeat until v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Discrete Mathematics I – p. 266/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Consider tour v0 ⇀ v1 ⇀ . . . ⇀ vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Extend walk: v0 ⇀ . . . ⇀ vk ⇀ vm = v0 ⇀ vm+1
Repeat until every vi has no unvisited edges
G connected =⇒ all edges in E visited
Therefore, G has an Euler tour
Discrete Mathematics I – p. 267/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a
⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b
⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c
⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f
⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b
⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f
⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e
⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d
⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c
⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e
⇀ b
Discrete Mathematics I – p. 268/292
Graphs
Example:
�a
�
b
�
c
�d
�e
�
f
a ⇀ b ⇀ c ⇀ f ⇀ a
b ⇀ c ⇀ f ⇀ a ⇀ b ⇀ f ⇀ e ⇀ d ⇀ c ⇀ e ⇀ b
Discrete Mathematics I – p. 268/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
a
b c
d
ef
a ⇀ b ⇀ e ⇀ d ⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ e ⇀ d ⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a
⇀ b ⇀ e ⇀ d ⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b
⇀ e ⇀ d ⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ e
⇀ d ⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ e ⇀ d
⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ e ⇀ d ⇀ c
⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ e ⇀ d ⇀ c ⇀ f
⇀ a
Discrete Mathematics I – p. 269/292
Graphs
A Hamiltonian cycle of graph G is a cycle whichvisits every node in V exactly once
�a
�
b
�
c
�
d
�
e�
f
a ⇀ b ⇀ e ⇀ d ⇀ c ⇀ f ⇀ a
Discrete Mathematics I – p. 269/292
Graphs
Exercise: find an efficient test for existence ofHamiltonian cycle. . .
. . . and claim your $1 000 000!
See www.claymath.org for details
Discrete Mathematics I – p. 270/292
Graphs
Exercise: find an efficient test for existence ofHamiltonian cycle. . .
. . . and claim your $1 000 000!
See www.claymath.org for details
Discrete Mathematics I – p. 270/292
Graphs
Exercise: find an efficient test for existence ofHamiltonian cycle. . .
. . . and claim your $1 000 000!
See www.claymath.org for details
Discrete Mathematics I – p. 270/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a subgraph of G, if V ′ ⊆ V , E ′ ⊆ E
0
1
2
3
4G 0
1
2
3
G′
G′ ⊆ G
Discrete Mathematics I – p. 271/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a subgraph of G, if V ′ ⊆ V , E ′ ⊆ E
0
1
2
3
4G 0
1
2
3
G′
G′ ⊆ G
Discrete Mathematics I – p. 271/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a subgraph of G, if V ′ ⊆ V , E ′ ⊆ E
�
0
�1
�
2
� 3
�4G
�
0
�1
�2
� 3
G′
G′ ⊆ G
Discrete Mathematics I – p. 271/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a subgraph of G, if V ′ ⊆ V , E ′ ⊆ E
�
0
�1
�
2
� 3
�4G
�
0
�1
�2
� 3
G′
G′ ⊆ G
Discrete Mathematics I – p. 271/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a spanning subgraph of G, if V ′ = V , E ′ ⊆ E
0
1
2
3
4G 0
1
2
3
4G′
G′ v G
Discrete Mathematics I – p. 272/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a spanning subgraph of G, if V ′ = V , E ′ ⊆ E
0
1
2
3
4G 0
1
2
3
4G′
G′ v G
Discrete Mathematics I – p. 272/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a spanning subgraph of G, if V ′ = V , E ′ ⊆ E
�
0
�1
�
2
� 3
�4G
�
0
�1
�2
� 3
4G′
G′ v G
Discrete Mathematics I – p. 272/292
Graphs
G = (V, E) G′ = (V ′, E ′)
G′ is a spanning subgraph of G, if V ′ = V , E ′ ⊆ E
�
0
�1
�
2
� 3
�4G
�
0
�1
�2
� 3
4G′
G′ v G
Discrete Mathematics I – p. 272/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G G v G
∀G, G′ : (G′ ⊆ G) ∧ (G ⊆ G′) ⇒ G = G′
∀G, G′, G′′ : (G′′ ⊆ G′) ∧ (G′ ⊆ G) ⇒ G′′ ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/292
Graphs
Recall: a graph is
• connected, if every two nodes connected
• acyclic, if there is no cycle
A connected acyclic graph is called a tree
Discrete Mathematics I – p. 274/292
Graphs
Recall: a graph is
• connected, if every two nodes connected
• acyclic, if there is no cycle
A connected acyclic graph is called a tree
Discrete Mathematics I – p. 274/292
Graphs
Recall: a graph is
• connected, if every two nodes connected
• acyclic, if there is no cycle
A connected acyclic graph is called a tree
Discrete Mathematics I – p. 274/292
Graphs
Recall: a graph is
• connected, if every two nodes connected
• acyclic, if there is no cycle
A connected acyclic graph is called a tree
Discrete Mathematics I – p. 274/292
Graphs
Recall: a graph is
• connected, if every two nodes connected
• acyclic, if there is no cycle
A connected acyclic graph is called a tree
� ��
�
��
��
�
�
Discrete Mathematics I – p. 274/292
Graphs
G = (V, E) — a tree
Prove: |V | = |E|+ 1.
Proof. Induction base: V = {v}, E = ∅|E| = 0 |V | = 1 = |E|+ 1
Discrete Mathematics I – p. 275/292
Graphs
G = (V, E) — a tree
Prove: |V | = |E|+ 1.
Proof. Induction base: V = {v}, E = ∅|E| = 0 |V | = 1 = |E|+ 1
Discrete Mathematics I – p. 275/292
Graphs
G = (V, E) — a tree
Prove: |V | = |E|+ 1.
Proof. Induction base: V = {v}, E = ∅
|E| = 0 |V | = 1 = |E|+ 1
Discrete Mathematics I – p. 275/292
Graphs
G = (V, E) — a tree
Prove: |V | = |E|+ 1.
Proof. Induction base: V = {v}, E = ∅|E| = 0 |V | = 1 = |E|+ 1
Discrete Mathematics I – p. 275/292
Graphs
Inductive step: assume statement holds for all propersubgraphs of G
Take any edge (u, v) ∈ E.
Let G′ = (V, E \ {(u, v), (v, u)}).
G′
u v
Consider R : V ↔ V in G′
Discrete Mathematics I – p. 276/292
Graphs
Inductive step: assume statement holds for all propersubgraphs of G
Take any edge (u, v) ∈ E.
Let G′ = (V, E \ {(u, v), (v, u)}).
G′
u v
Consider R : V ↔ V in G′
Discrete Mathematics I – p. 276/292
Graphs
Inductive step: assume statement holds for all propersubgraphs of G
Take any edge (u, v) ∈ E.
Let G′ = (V, E \ {(u, v), (v, u)}).
G′
u v
Consider R : V ↔ V in G′
Discrete Mathematics I – p. 276/292
Graphs
Inductive step: assume statement holds for all propersubgraphs of G
Take any edge (u, v) ∈ E.
Let G′ = (V, E \ {(u, v), (v, u)}).
G′
�u � v
Consider R : V ↔ V in G′
Discrete Mathematics I – p. 276/292
Graphs
Inductive step: assume statement holds for all propersubgraphs of G
Take any edge (u, v) ∈ E.
Let G′ = (V, E \ {(u, v), (v, u)}).
G′
�u � v
Consider R : V ↔ V in G′
Discrete Mathematics I – p. 276/292
Graphs
Suppose u v in G′
G′u v
Then u v ⇀ u a cycle in G — contradiction
Therefore u 6 v in G′
Discrete Mathematics I – p. 277/292
Graphs
Suppose u v in G′
G′
�u � v
Then u v ⇀ u a cycle in G — contradiction
Therefore u 6 v in G′
Discrete Mathematics I – p. 277/292
Graphs
Suppose u v in G′
G′
�u � v
Then u v ⇀ u a cycle in G — contradiction
Therefore u 6 v in G′
Discrete Mathematics I – p. 277/292
Graphs
Suppose u v in G′
G′
�u � v
Then u v ⇀ u a cycle in G — contradiction
Therefore u 6 v in G′
Discrete Mathematics I – p. 277/292
Graphs
Vu = [u] Vv = [v] (in G′)
Eu = {(x, y) | x, y ∈ Vu} Ev = {(x, y) | x, y ∈ Vv}Gu = (Vu, Eu) Gv = (Vv, Ev)
Gu Gvu v
G connected =⇒ Gu, Gv connected
G acyclic =⇒ Gu, Gv acyclic
Discrete Mathematics I – p. 278/292
Graphs
Vu = [u] Vv = [v] (in G′)
Eu = {(x, y) | x, y ∈ Vu} Ev = {(x, y) | x, y ∈ Vv}
Gu = (Vu, Eu) Gv = (Vv, Ev)
Gu Gvu v
G connected =⇒ Gu, Gv connected
G acyclic =⇒ Gu, Gv acyclic
Discrete Mathematics I – p. 278/292
Graphs
Vu = [u] Vv = [v] (in G′)
Eu = {(x, y) | x, y ∈ Vu} Ev = {(x, y) | x, y ∈ Vv}Gu = (Vu, Eu) Gv = (Vv, Ev)
Gu Gvu v
G connected =⇒ Gu, Gv connected
G acyclic =⇒ Gu, Gv acyclic
Discrete Mathematics I – p. 278/292
Graphs
Vu = [u] Vv = [v] (in G′)
Eu = {(x, y) | x, y ∈ Vu} Ev = {(x, y) | x, y ∈ Vv}Gu = (Vu, Eu) Gv = (Vv, Ev)
Gu Gv
�u � v
G connected =⇒ Gu, Gv connected
G acyclic =⇒ Gu, Gv acyclic
Discrete Mathematics I – p. 278/292
Graphs
Vu = [u] Vv = [v] (in G′)
Eu = {(x, y) | x, y ∈ Vu} Ev = {(x, y) | x, y ∈ Vv}Gu = (Vu, Eu) Gv = (Vv, Ev)
Gu Gv
�u � v
G connected =⇒ Gu, Gv connected
G acyclic =⇒ Gu, Gv acyclic
Discrete Mathematics I – p. 278/292
Graphs
Vu = [u] Vv = [v] (in G′)
Eu = {(x, y) | x, y ∈ Vu} Ev = {(x, y) | x, y ∈ Vv}Gu = (Vu, Eu) Gv = (Vv, Ev)
Gu Gv
�u � v
G connected =⇒ Gu, Gv connected
G acyclic =⇒ Gu, Gv acyclic
Discrete Mathematics I – p. 278/292
Graphs
By induction hypothesis:|Vu| = |Eu|+ 1 |Vv| = |Ev|+ 1
|V | = |Vu|+ |Vv| = (|Eu|+ 1) + (|Ev|+ 1) =
(|Eu|+ |Ev|+ 1) + 1 = |E|+ 1
Discrete Mathematics I – p. 279/292
Graphs
By induction hypothesis:|Vu| = |Eu|+ 1 |Vv| = |Ev|+ 1
|V | = |Vu|+ |Vv| = (|Eu|+ 1) + (|Ev|+ 1) =
(|Eu|+ |Ev|+ 1) + 1 = |E|+ 1
Discrete Mathematics I – p. 279/292
Graphs
By induction hypothesis:|Vu| = |Eu|+ 1 |Vv| = |Ev|+ 1
|V | = |Vu|+ |Vv| = (|Eu|+ 1) + (|Ev|+ 1) =
(|Eu|+ |Ev|+ 1) + 1 = |E|+ 1
Discrete Mathematics I – p. 279/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2.
|E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |
But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Suppose all degrees ≥ 2. |E| ≥ 2 · |V |/2 = |V |But |E| = |V | − 1. Hence assumption false.
Therefore G has a node of degree 1.
A node of degree 1 in a tree is called a leaf.
Discrete Mathematics I – p. 280/292
Graphs
G = (V, E) G′ = (V ′, E ′)
Recall: G′ is a spanning subgraph of G, if V ′ = V ,E ′ ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
• connected graphs in G(V )
• acyclic graphs in G(V )
Discrete Mathematics I – p. 281/292
Graphs
G = (V, E) G′ = (V ′, E ′)
Recall: G′ is a spanning subgraph of G, if V ′ = V ,E ′ ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
• connected graphs in G(V )
• acyclic graphs in G(V )
Discrete Mathematics I – p. 281/292
Graphs
G = (V, E) G′ = (V ′, E ′)
Recall: G′ is a spanning subgraph of G, if V ′ = V ,E ′ ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
• connected graphs in G(V )
• acyclic graphs in G(V )
Discrete Mathematics I – p. 281/292
Graphs
G = (V, E) G′ = (V ′, E ′)
Recall: G′ is a spanning subgraph of G, if V ′ = V ,E ′ ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
• connected graphs in G(V )
• acyclic graphs in G(V )
Discrete Mathematics I – p. 281/292
Graphs
G = (V, E) G′ = (V ′, E ′)
Recall: G′ is a spanning subgraph of G, if V ′ = V ,E ′ ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
• connected graphs in G(V )
• acyclic graphs in G(V )
Discrete Mathematics I – p. 281/292
Graphs
G = (V, E) G′ = (V ′, E ′)
Recall: G′ is a spanning subgraph of G, if V ′ = V ,E ′ ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
• connected graphs in G(V )
• acyclic graphs in G(V )
Discrete Mathematics I – p. 281/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of allconnected graphs on V
Proof. G connected
Need to prove: G acyclic iff G v-minimal
Equivalent to: G has a cycle iff G not v-minimal
Discrete Mathematics I – p. 282/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of allconnected graphs on V
Proof. G connected
Need to prove: G acyclic iff G v-minimal
Equivalent to: G has a cycle iff G not v-minimal
Discrete Mathematics I – p. 282/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of allconnected graphs on V
Proof. G connected
Need to prove: G acyclic iff G v-minimal
Equivalent to: G has a cycle iff G not v-minimal
Discrete Mathematics I – p. 282/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of allconnected graphs on V
Proof. G connected
Need to prove: G acyclic iff G v-minimal
Equivalent to: G has a cycle iff G not v-minimal
Discrete Mathematics I – p. 282/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of allconnected graphs on V
Proof. G connected
Need to prove: G acyclic iff G v-minimal
Equivalent to: G has a cycle iff G not v-minimal
Discrete Mathematics I – p. 282/292
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Remaining graph connected
Hence G not v-minimal
Discrete Mathematics I – p. 283/292
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Remaining graph connected
Hence G not v-minimal
Discrete Mathematics I – p. 283/292
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Remaining graph connected
Hence G not v-minimal
Discrete Mathematics I – p. 283/292
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Remaining graph connected
Hence G not v-minimal
Discrete Mathematics I – p. 283/292
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Remaining graph connected
Hence G not v-minimal
Discrete Mathematics I – p. 283/292
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u ⇀ v does notdisconnect the graph
Therefore there is another path u v
Hence G has a cycle
Discrete Mathematics I – p. 284/292
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u ⇀ v does notdisconnect the graph
Therefore there is another path u v
Hence G has a cycle
Discrete Mathematics I – p. 284/292
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u ⇀ v does notdisconnect the graph
Therefore there is another path u v
Hence G has a cycle
Discrete Mathematics I – p. 284/292
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u ⇀ v does notdisconnect the graph
Therefore there is another path u v
Hence G has a cycle
Discrete Mathematics I – p. 284/292
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u ⇀ v does notdisconnect the graph
Therefore there is another path u v
Hence G has a cycle
Discrete Mathematics I – p. 284/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of allacyclic graphs on V
Proof. G acyclic
Need to prove: G connected iff G v-maximal
Equivalent to:G disconnected iff G not v-maximal
Discrete Mathematics I – p. 285/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of allacyclic graphs on V
Proof. G acyclic
Need to prove: G connected iff G v-maximal
Equivalent to:G disconnected iff G not v-maximal
Discrete Mathematics I – p. 285/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of allacyclic graphs on V
Proof. G acyclic
Need to prove: G connected iff G v-maximal
Equivalent to:G disconnected iff G not v-maximal
Discrete Mathematics I – p. 285/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of allacyclic graphs on V
Proof. G acyclic
Need to prove: G connected iff G v-maximal
Equivalent to:G disconnected iff G not v-maximal
Discrete Mathematics I – p. 285/292
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of allacyclic graphs on V
Proof. G acyclic
Need to prove: G connected iff G v-maximal
Equivalent to:G disconnected iff G not v-maximal
Discrete Mathematics I – p. 285/292
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Resulting graph acyclic
Hence G not v-maximal
Discrete Mathematics I – p. 286/292
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Resulting graph acyclic
Hence G not v-maximal
Discrete Mathematics I – p. 286/292
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Resulting graph acyclic
Hence G not v-maximal
Discrete Mathematics I – p. 286/292
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Resulting graph acyclic
Hence G not v-maximal
Discrete Mathematics I – p. 286/292
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Resulting graph acyclic
Hence G not v-maximal
Discrete Mathematics I – p. 286/292
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u ⇀ v does notcreate cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/292
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u ⇀ v does notcreate cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/292
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u ⇀ v does notcreate cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/292
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u ⇀ v does notcreate cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/292
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u ⇀ v does notcreate cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/292
Graphs
A graph is called planar, if it can be drawn on theplane without edge crossings.
Examples: any tree, any cycle
Complete graphs:K(1), K(2), K(3), K(4). Not K(5).
Complete bipartite graphs: K(2, 3). Not K(3, 3).
Discrete Mathematics I – p. 288/292
Graphs
A graph is called planar, if it can be drawn on theplane without edge crossings.
Examples: any tree
, any cycle
Complete graphs:K(1), K(2), K(3), K(4). Not K(5).
Complete bipartite graphs: K(2, 3). Not K(3, 3).
Discrete Mathematics I – p. 288/292
Graphs
A graph is called planar, if it can be drawn on theplane without edge crossings.
Examples: any tree, any cycle
Complete graphs:K(1), K(2), K(3), K(4). Not K(5).
Complete bipartite graphs: K(2, 3). Not K(3, 3).
Discrete Mathematics I – p. 288/292
Graphs
A graph is called planar, if it can be drawn on theplane without edge crossings.
Examples: any tree, any cycle
Complete graphs:K(1), K(2), K(3), K(4).
Not K(5).
Complete bipartite graphs: K(2, 3). Not K(3, 3).
Discrete Mathematics I – p. 288/292
Graphs
A graph is called planar, if it can be drawn on theplane without edge crossings.
Examples: any tree, any cycle
Complete graphs:K(1), K(2), K(3), K(4). Not K(5).
Complete bipartite graphs: K(2, 3). Not K(3, 3).
Discrete Mathematics I – p. 288/292
Graphs
A graph is called planar, if it can be drawn on theplane without edge crossings.
Examples: any tree, any cycle
Complete graphs:K(1), K(2), K(3), K(4). Not K(5).
Complete bipartite graphs: K(2, 3).
Not K(3, 3).
Discrete Mathematics I – p. 288/292
Graphs
G = (V, E) How to test if G is planar?
Subdivision: Let u ⇀ v. Add new node x
Replace u ⇀ v by u ⇀ x ⇀ v
G non-planar ⇒ new graph non-planar
Discrete Mathematics I – p. 289/292
Graphs
G = (V, E) How to test if G is planar?
Subdivision: Let u ⇀ v.
Add new node x
Replace u ⇀ v by u ⇀ x ⇀ v
G non-planar ⇒ new graph non-planar
Discrete Mathematics I – p. 289/292
Graphs
G = (V, E) How to test if G is planar?
Subdivision: Let u ⇀ v. Add new node x
Replace u ⇀ v by u ⇀ x ⇀ v
G non-planar ⇒ new graph non-planar
Discrete Mathematics I – p. 289/292
Graphs
G = (V, E) How to test if G is planar?
Subdivision: Let u ⇀ v. Add new node x
Replace u ⇀ v by u ⇀ x ⇀ v
G non-planar ⇒ new graph non-planar
Discrete Mathematics I – p. 289/292
Graphs
G = (V, E) How to test if G is planar?
Subdivision: Let u ⇀ v. Add new node x
Replace u ⇀ v by u ⇀ x ⇀ v
G non-planar ⇒ new graph non-planar
Discrete Mathematics I – p. 289/292
Graphs
Only K(5) and K(3, 3) are “really” non-planar.
Theorem (Kuratowski). A graph is planar iff it has nosubgraph obtained from K(5) or K(3, 3) bysubdivisions.
Proof: difficult.
Discrete Mathematics I – p. 290/292
Graphs
Only K(5) and K(3, 3) are “really” non-planar.
Theorem (Kuratowski). A graph is planar iff it has nosubgraph obtained from K(5) or K(3, 3) bysubdivisions.
Proof: difficult.
Discrete Mathematics I – p. 290/292
Graphs
Only K(5) and K(3, 3) are “really” non-planar.
Theorem (Kuratowski). A graph is planar iff it has nosubgraph obtained from K(5) or K(3, 3) bysubdivisions.
Proof: difficult.
Discrete Mathematics I – p. 290/292
Graphs
Recall: if G = (V, E) a tree, then |V | = |E|+ 1.
Generalisation: G = (V, E) — planar
Drawing of G partitions the plane into faces
Let F be the set of all faces
Discrete Mathematics I – p. 291/292
Graphs
Recall: if G = (V, E) a tree, then |V | = |E|+ 1.
Generalisation: G = (V, E) — planar
Drawing of G partitions the plane into faces
Let F be the set of all faces
Discrete Mathematics I – p. 291/292
Graphs
Recall: if G = (V, E) a tree, then |V | = |E|+ 1.
Generalisation: G = (V, E) — planar
Drawing of G partitions the plane into faces
Let F be the set of all faces
Discrete Mathematics I – p. 291/292
Graphs
Recall: if G = (V, E) a tree, then |V | = |E|+ 1.
Generalisation: G = (V, E) — planar
Drawing of G partitions the plane into faces
Let F be the set of all faces
Discrete Mathematics I – p. 291/292
Graphs
Examples:
G is a tree: |V | = |E|+ 1 |F | = 1
G has one cycle: |V | = |E| |F | = 2
Theorem (Euler). For any planar graph G,|V | − |E|+ |F | = 2.
Proof: induction.
Discrete Mathematics I – p. 292/292
Graphs
Examples:
G is a tree: |V | = |E|+ 1 |F | = 1
G has one cycle: |V | = |E| |F | = 2
Theorem (Euler). For any planar graph G,|V | − |E|+ |F | = 2.
Proof: induction.
Discrete Mathematics I – p. 292/292
Graphs
Examples:
G is a tree: |V | = |E|+ 1 |F | = 1
G has one cycle: |V | = |E| |F | = 2
Theorem (Euler). For any planar graph G,|V | − |E|+ |F | = 2.
Proof: induction.
Discrete Mathematics I – p. 292/292
Graphs
Examples:
G is a tree: |V | = |E|+ 1 |F | = 1
G has one cycle: |V | = |E| |F | = 2
Theorem (Euler). For any planar graph G,|V | − |E|+ |F | = 2.
Proof: induction.
Discrete Mathematics I – p. 292/292