Discrete Mathematics I
CS127
Lecturer: Dr. Alex Tiskin
http://www.dcs.warwick.ac.uk/˜tiskin
Department of Computer Science
University of Warwick
Discrete Mathematics I – p. 1/29
Discrete Mathematics I
Mathematics relevant to computer science
Used in other CS courses
29 lectures in Autumn Term
Weekly 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/29
Discrete Mathematics I
Class test in week 7 (new from 2002/03!)
Exam in week 1 of Summer Term
Results at the end of Summer Term
Discrete Mathematics I – p. 3/29
Discrete Mathematics I
Lecture notes available at lectures
Website: http://www.dcs.warwick.ac.uk/
~tiskin/teach/dm1.html
Forum: http://forums.warwick.ac.uk, then
click on Departments > Computer Science
> UGyear1 > CS127
Please participate!
Discrete Mathematics I – p. 4/29
Discrete Mathematics I
Discrete Maths II — a Summer Term option
Lecturer: Dr. Mike Joy
Discrete maths in depth, highly recommended!
Discrete Mathematics I – p. 5/29
Discrete Mathematics I
Recommended books:
Discrete Mathematics
Ross and Wright (Prentice Hall, 2003)
Discrete Mathematics and its Applications
Rosen (McGraw-Hill, 2003)
Discrete Mathematics for Computer Scientists
Truss (Addison-Wesley, 1999)
Discrete Mathematics I – p. 6/29
Discrete Mathematics I
Which is the best?
Discrete Mathematics I – p. 7/29
Discrete Mathematics I
Which is the best?
•
Ross and Wright: the most helpful. . .
Discrete Mathematics I – p. 7/29
Discrete Mathematics I
Which is the best?
•
Ross and Wright: the most helpful. . .
•
Rosen: the most interesting. . .
Discrete Mathematics I – p. 7/29
Discrete Mathematics I
Which is the best?
•
Ross and Wright: the most helpful. . .
•
Rosen: the most interesting. . .
•
Truss: the most advanced. . .
Discrete Mathematics I – p. 7/29
Discrete Mathematics I
Which 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/29
Discrete Mathematics I
Also:
Proofs and Fundamentals: a First Course in Abstract
Mathematics
Bloch (Birkhäuser, 2002)
Discrete Mathematics I – p. 8/29
Discrete Mathematics I
Also:
Proofs and Fundamentals: a First Course in Abstract
Mathematics
Bloch (Birkhäuser, 2002)
Does not cover whole course, but helps with proofs
Discrete Mathematics I – p. 8/29
Introduction
Discrete Mathematics I – p. 9/29
Introduction
Mathematics:
Discrete Mathematics I – p. 10/29
Introduction
Mathematics: the science of abstraction
Discrete Mathematics I – p. 10/29
Introduction
Mathematics: the science of abstraction
Natural numbers: 0, 1, 2, 3, 4, 5, 6, 7, . . .
What does “5” mean?
Discrete Mathematics I – p. 10/29
Introduction
Mathematics: 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
Discrete Mathematics I – p. 10/29
Introduction
Mathematics: 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?
Discrete Mathematics I – p. 10/29
Introduction
Mathematics: 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/29
Introduction
A set is any collection of elements
Discrete Mathematics I – p. 11/29
Introduction
A set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
Discrete Mathematics I – p. 11/29
Introduction
A set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠, ♥, ♣, ♦}
Discrete Mathematics I – p. 11/29
Introduction
A set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠, ♥, ♣, ♦}
{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N
natural numbers
Discrete Mathematics I – p. 11/29
Introduction
A set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠, ♥, ♣, ♦}
{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven
natural numbers
even naturals
Discrete Mathematics I – p. 11/29
Introduction
A set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠, ♥, ♣, ♦}
{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven
{. . . , −3, −2, −1, 0, 1, 2, 3, . . . } = Z
natural numbers
even naturals
integers
Discrete Mathematics I – p. 11/29
Introduction
A set is any collection of elements
{Peter Pan, Gingerbread Man, Wrestling Fan}
{♠, ♥, ♣, ♦}
{0, 1, 2, 3, 4, 5, 6, 7, . . . } = N
{0, 2, 4, 6, 8, 10, 12, 14, . . . } = Neven
{. . . , −3, −2, −1, 0, 1, 2, 3, . . . } = Z
natural numbers
even naturals
integers
First two sets finite, last three infinite
Discrete Mathematics I – p. 11/29
Introduction
The empty set: {} = ∅
Plays a role for sets similar to 0 for numbers
Discrete Mathematics I – p. 12/29
Introduction
Some “tough” questions:
Discrete Mathematics I – p. 13/29
Introduction
Some “tough” questions:
Do infinite sets have “sizes”?
Discrete Mathematics I – p. 13/29
Introduction
Some “tough” questions:
Do infinite sets have “sizes”?
Yes, but these are beyond natural numbers
Discrete Mathematics I – p. 13/29
Introduction
Some “tough” questions:
Do infinite sets have “sizes”?
Yes, but these are beyond natural numbers
Can infinite sets have different sizes?
Discrete Mathematics I – p. 13/29
Introduction
Some “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
Discrete Mathematics I – p. 13/29
Introduction
Some “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?
Discrete Mathematics I – p. 13/29
Introduction
Some “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
Discrete Mathematics I – p. 13/29
Introduction
Some “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?
Discrete Mathematics I – p. 13/29
Introduction
Some “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/29
Introduction
Natural sciences are based on evidence
Discrete Mathematics I – p. 14/29
Introduction
Natural sciences are based on evidence
Mathematics is based on proof
(but evidence helps to understand proofs)
Discrete Mathematics I – p. 14/29
Introduction
To 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/29
Introduction
All eagles can fly
Some pigs cannot fly
Discrete Mathematics I – p. 16/29
Introduction
All eagles can fly
Some pigs cannot fly
Therefore, some pigs are not eagles
Discrete Mathematics I – p. 16/29
Introduction
All eagles can fly
Some 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/29
Introduction
The 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/29
Introduction
Some concepts are basic, i.e. need no definition
Examples: set, natural number
Discrete Mathematics I – p. 18/29
Introduction
Some concepts are basic, i.e. need no definition
Examples: set, natural number
All other concepts must be defined
Examples: finite set, even number
Discrete Mathematics I – p. 18/29
Introduction
Some concepts are basic, i.e. need no definition
Examples: set, natural number
All other concepts must be defined
Examples: finite set, even number
Some facts are axioms, i.e. need no proof
Example: equal sets have the same elements
Discrete Mathematics I – p. 18/29
Introduction
Some concepts are basic, i.e. need no definition
Examples: set, natural number
All other concepts must be defined
Examples: finite set, even number
Some facts are axioms, i.e. need no proof
Example: equal sets have the same elements
All other facts must be proved
Example: the set of even numbers is infinite
Discrete Mathematics I – p. 18/29
Introduction
Some concepts are basic, i.e. need no definition
Examples: set, natural number
All other concepts must be defined
Examples: finite set, even number
Some facts are axioms, i.e. need no proof
Example: equal sets have the same elements
All other facts must be proved
Example: the set of even numbers is infinite
This is the axiomatic method
Discrete Mathematics I – p. 18/29
Introduction
Course structure:
•
Logic
•
Sets
•
More fun: relations, functions, graphs
Discrete Mathematics I – p. 19/29
Introduction
Course structure:
•
Logic
•
Sets
•
More fun: relations, functions, graphs
Any questions?
Discrete Mathematics I – p. 19/29
Logic
Discrete Mathematics I – p. 20/29
Logic
In everyday life, we use all sorts of sentences:
Discrete Mathematics I – p. 21/29
Logic
In everyday life, we use all sorts of sentences:
Five is less than ten.
Pigs can fly.
There is life on Mars.
Discrete Mathematics I – p. 21/29
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. . .
Discrete Mathematics I – p. 21/29
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/29
Logic
False and true are Boolean values: B = {F, T }
Discrete Mathematics I – p. 22/29
Logic
False and true are Boolean values: B = {F, T }
(After G. Boole, 1815–1864)
Discrete Mathematics I – p. 22/29
Logic
False and true are Boolean values: B = {F, T }
(After G. Boole, 1815–1864)
value(5 < 10) = T
value(“Pigs can fly”) = F
Discrete Mathematics I – p. 22/29
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”) — ?
Discrete Mathematics I – p. 22/29
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/29
Logic
Often need compound statements:
(5 < 10) AND (Pigs can fly)
Discrete Mathematics I – p. 23/29
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/29
Logic
Boolean operators on B:
Discrete Mathematics I – p. 24/29
Logic
Boolean operators on B:
¬A
NOT A
negation
Discrete Mathematics I – p. 24/29
Logic
Boolean operators on B:
¬A
A∧B
NOT A
A AND B
negation
conjunction
Discrete Mathematics I – p. 24/29
Logic
Boolean operators on B:
¬A
A∧B
A∨B
NOT A
A AND B
A OR B
negation
conjunction
disjunction
Discrete Mathematics I – p. 24/29
Logic
Boolean operators on B:
¬A
A∧B
A∨B
A⇒B
NOT A
A AND B
A OR B
IF A THEN B
negation
conjunction
disjunction
implication
Discrete Mathematics I – p. 24/29
Logic
Boolean operators on B:
¬A
A∧B
A∨B
A⇒B
A⇔B
NOT A
A AND B
A OR B
IF A THEN B
A ⇒ B AND B ⇒ A
negation
conjunction
disjunction
implication
equivalence
Discrete Mathematics I – p. 24/29
Logic
Boolean operators on B:
¬A
A∧B
A∨B
A⇒B
A⇔B
NOT A
A AND B
A OR B
IF A THEN B
A ⇒ B AND B ⇒ A
negation
conjunction
disjunction
implication
equivalence
Definition: by truth tables
Discrete Mathematics I – p. 24/29
Logic
Negation (NOT A): ¬A
True if A false, false if A true
Discrete Mathematics I – p. 25/29
Logic
Negation (NOT A): ¬A
True if A false, false if A true
A
F
T
¬A
T
F
Discrete Mathematics I – p. 25/29
Logic
Examples:
¬[5 < 10]
Discrete Mathematics I – p. 26/29
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T
Discrete Mathematics I – p. 26/29
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
Discrete Mathematics I – p. 26/29
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly]
Discrete Mathematics I – p. 26/29
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F
Discrete Mathematics I – p. 26/29
Logic
Examples:
¬[5 < 10] ⇐⇒ ¬T ⇐⇒ F
¬[Pigs can fly] ⇐⇒ ¬F ⇐⇒ T
Discrete Mathematics I – p. 26/29
Logic
Conjunction (A AND B): A ∧ B
True if both A and B true
Discrete Mathematics I – p. 27/29
Logic
Conjunction (A AND B): A ∧ B
True if both A and B true
A
F
F
T
T
B
F
T
F
T
A∧B
F
F
F
T
Discrete Mathematics I – p. 27/29
Logic
Example:
[5 < 10] ∧ [Pigs can fly]
Discrete Mathematics I – p. 28/29
Logic
Example:
[5 < 10] ∧ [Pigs can fly] ⇐⇒ T ∧ F
Discrete Mathematics I – p. 28/29
Logic
Example:
[5 < 10] ∧ [Pigs can fly] ⇐⇒ T ∧ F ⇐⇒ F
Discrete Mathematics I – p. 28/29
Logic
Disjunction (A OR B): A ∨ B
True if either A or B true (or both)
Discrete Mathematics I – p. 29/29
Logic
Disjunction (A OR B): A ∨ B
True if either A or B true (or both)
A
F
F
T
T
B
F
T
F
T
A∨B
F
T
T
T
Discrete Mathematics I – p. 29/29
Logic
Example:
[5 < 10] ∨ [Pigs can fly]
Discrete Mathematics I – p. 30/29
Logic
Example:
[5 < 10] ∨ [Pigs can fly] ⇐⇒ T ∨ F
Discrete Mathematics I – p. 30/29
Logic
Example:
[5 < 10] ∨ [Pigs can fly] ⇐⇒ T ∨ F ⇐⇒ T
Discrete Mathematics I – p. 30/29
Logic
Implication (IF A THEN B)
Discrete Mathematics I – p. 31/29
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Discrete Mathematics I – p. 31/29
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Happy — definitely sings
Unhappy — ?
Discrete Mathematics I – p. 31/29
Logic
Implication (IF A THEN B)
In everyday life, often ambiguous:
If the bird is happy, then it sings loud
Happy — definitely sings
Unhappy — may or may not sing
Discrete Mathematics I – p. 31/29
Logic
Implication (IF A THEN B): A ⇒ B
True if A false; true if B true; false otherwise
Discrete Mathematics I – p. 32/29
Logic
Implication (IF A THEN B): A ⇒ B
True if A false; true if B true; false otherwise
A
F
F
T
T
B
F
T
F
T
A⇒B
T
T
F
T
Discrete Mathematics I – p. 32/29
Logic
Implication (IF A THEN B): A ⇒ B
True if A false; true if B true; false otherwise
A
F
F
T
T
B
F
T
F
T
A⇒B
T
T
F
T
Everything implies truth; false implies anything
Discrete Mathematics I – p. 32/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly]
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ]
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ] ⇐⇒ F
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ] ⇐⇒ F
[Pigs fly] ⇒ [5 < 10]
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ] ⇐⇒ F
[Pigs fly] ⇒ [5 < 10] ⇐⇒ [F ⇒ T ]
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ] ⇐⇒ F
[Pigs fly] ⇒ [5 < 10] ⇐⇒ [F ⇒ T ] ⇐⇒ T
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ] ⇐⇒ F
[Pigs fly] ⇒ [5 < 10] ⇐⇒ [F ⇒ T ] ⇐⇒ T
[Pigs fly] ⇒ [5 > 10]
Discrete Mathematics I – p. 33/29
Logic
Examples:
[5 < 10] ⇒ [Pigs fly] ⇐⇒ [T ⇒ F ] ⇐⇒ F
[Pigs fly] ⇒ [5 < 10] ⇐⇒ [F ⇒ T ] ⇐⇒ T
[Pigs fly] ⇒ [5 > 10] ⇐⇒ [F ⇒ F ]
Discrete Mathematics I – p. 33/29
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/29
Logic
Example (by G. Hardy):
2 + 2 = 5 =⇒ I am Count Dracula
Discrete Mathematics I – p. 34/29
Logic
Example (by G. Hardy):
2 + 2 = 5 =⇒ I am Count Dracula
“Proof”:
2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒ 2 = 1
Discrete Mathematics I – p. 34/29
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/29
Logic
Example: 2 + 2 = 5 =⇒ Grass is green
Discrete Mathematics I – p. 35/29
Logic
Example: 2 + 2 = 5 =⇒ Grass is green
Proof:
2 + 2 = 5 =⇒ 4 = 5 =⇒ 5 = 4 =⇒
4 + 5 = 5 + 4 =⇒ T
Discrete Mathematics I – p. 35/29
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/29
Logic
Implication A ⇒ B can have many disguises:
Discrete Mathematics I – p. 36/29
Logic
Implication A ⇒ B can have many disguises:
A implies B
Discrete Mathematics I – p. 36/29
Logic
Implication A ⇒ B can have many disguises:
A implies B
B is implied by A
Discrete Mathematics I – p. 36/29
Logic
Implication A ⇒ B can have many disguises:
A implies B
A leads to B
B is implied by A
Discrete Mathematics I – p. 36/29
Logic
Implication A ⇒ B can have many disguises:
A implies B
A leads to B
B is implied by A
B follows from A
Discrete Mathematics I – p. 36/29
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
Discrete Mathematics I – p. 36/29
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
Discrete Mathematics I – p. 36/29
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
Discrete Mathematics I – p. 36/29
Logic
Implication A ⇒ B can have many disguises:
A implies B
A leads to B
A is stronger than B
A is sufficient for B
B is implied by A
B follows from A
B is weaker than A
B is necessary for A
Discrete Mathematics I – p. 36/29
Logic
Examples:
For a number to be divisible by 4, it is
it is even
that
Discrete Mathematics I – p. 37/29
Logic
Examples:
For a number to be divisible by 4, it is necessary that
it is even
Discrete Mathematics I – p. 37/29
Logic
Examples:
For a number to be divisible by 4, it is necessary that
it is even
For a triangle to be isosceles, it is
equilateral
that it is
Discrete Mathematics I – p. 37/29
Logic
Examples:
For a number to be divisible by 4, it is necessary that
it is even
For a triangle to be isosceles, it is sufficient that it is
equilateral
Discrete Mathematics I – p. 37/29
Logic
Equivalence (A IF AND ONLY IF B): A ⇔ B
True if A and B agree; false otherwise
Discrete Mathematics I – p. 38/29
Logic
Equivalence (A IF AND ONLY IF B): A ⇔ B
True if A and B agree; false otherwise
A
F
F
T
T
B
F
T
F
T
A⇔B
T
F
F
T
Discrete Mathematics I – p. 38/29
Logic
Equivalence (A IF AND ONLY IF B): A ⇔ B
True if A and B agree; false otherwise
A
F
F
T
T
B
F
T
F
T
A⇔B
T
F
F
T
IF AND ONLY IF often contracted to IFF
Discrete Mathematics I – p. 38/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly]
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ]
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ] ⇐⇒ F
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ] ⇐⇒ F
[Pigs fly] ⇔ [5 < 10]
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ] ⇐⇒ F
[Pigs fly] ⇔ [5 < 10] ⇐⇒ [F ⇔ T ]
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ] ⇐⇒ F
[Pigs fly] ⇔ [5 < 10] ⇐⇒ [F ⇔ T ] ⇐⇒ F
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ] ⇐⇒ F
[Pigs fly] ⇔ [5 < 10] ⇐⇒ [F ⇔ T ] ⇐⇒ F
[Pigs fly] ⇔ [5 > 10]
Discrete Mathematics I – p. 39/29
Logic
Examples:
[5 < 10] ⇔ [Pigs fly] ⇐⇒ [T ⇔ F ] ⇐⇒ F
[Pigs fly] ⇔ [5 < 10] ⇐⇒ [F ⇔ T ] ⇐⇒ F
[Pigs fly] ⇔ [5 > 10] ⇐⇒ [F ⇔ F ]
Discrete Mathematics I – p. 39/29
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/29
Logic
Implication and equivalence are often used to state
theorems
Discrete Mathematics I – p. 40/29
Logic
Implication and equivalence are often used to state
theorems
Examples:
Axiom. If n is in N, then n + 1 is in N.
Discrete Mathematics I – p. 40/29
Logic
Implication and equivalence are often used to state
theorems
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]
Discrete Mathematics I – p. 40/29
Logic
Implication and equivalence are often used to state
theorems
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.
Discrete Mathematics I – p. 40/29
Logic
Implication and equivalence are often used to state
theorems
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/29
Logic
More examples (from geometry):
Axiom. If two points are distinct, then there is exactly
one line connecting them.
Discrete Mathematics I – p. 41/29
Logic
More examples (from geometry):
Axiom. If two points are distinct, then there is exactly
one line connecting them.
Theorem. A triangle has two equal sides, if and only
if it has two equal angles.
Discrete Mathematics I – p. 41/29
Logic
Implication and equivalence are used in proofs
Example:
Discrete Mathematics I – p. 42/29
Logic
Implication and equivalence are used in proofs
Example:
Theorem. If number n is even, then n + 2 is even.
Discrete Mathematics I – p. 42/29
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/29
Logic
When proving “⇔”, must prove both “⇒” and “⇐”!
Discrete Mathematics I – p. 43/29
Logic
When proving “⇔”, must prove both “⇒” and “⇐”!
Example (a stronger theorem):
Theorem. Number n is even, iff n + 2 is even.
Discrete Mathematics I – p. 43/29
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/29
Logic
To cut down on brackets, we use priorities
Highest priority: ¬, then ∧, ∨, then ⇒, ⇔
Discrete Mathematics I – p. 44/29
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/29
Logic
Truth table completely define logical operators.
Discrete Mathematics I – p. 45/29
Logic
Truth table completely define logical operators.
Not always convenient:
(¬(T ∧ F ) ∨ ¬(F ⇒ T )) ⇔ (¬¬(F ∨ T ) ∨ F )
— true or false?
Discrete Mathematics I – p. 45/29
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?
Discrete Mathematics I – p. 45/29
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/29
Logic
Laws of Boolean logic (hold for any A, B, C):
¬¬A ⇐⇒ A
double negation
Discrete Mathematics I – p. 46/29
Logic
Laws of Boolean logic (hold for any A, B, C):
¬¬A ⇐⇒ A
A ∧ A ⇐⇒ A
A ∨ A ⇐⇒ A
double negation
∧ idempotent
∨ idempotent
Discrete Mathematics I – p. 46/29
Logic
Laws of Boolean logic (hold for any A, B, C):
¬¬A ⇐⇒ A
A ∧ A ⇐⇒ A
A ∨ A ⇐⇒ A
A ∧ B ⇐⇒ B ∧ A
A ∨ B ⇐⇒ B ∨ A
double negation
∧ idempotent
∨ idempotent
∧ commutative
∨ commutative
Discrete Mathematics I – p. 46/29
Logic
More laws of Boolean logic:
Discrete Mathematics I – p. 47/29
Logic
More laws of Boolean logic:
(A ∧ B) ∧ C ⇐⇒ A ∧ (B ∧ C)
(A ∨ B) ∨ C ⇐⇒ A ∨ (B ∨ C)
∧ associative
∨ associative
Discrete Mathematics I – p. 47/29
Logic
More laws of Boolean logic:
(A ∧ B) ∧ C ⇐⇒ A ∧ (B ∧ C)
(A ∨ B) ∨ C ⇐⇒ A ∨ (B ∨ C)
∧ associative
∨ associative
A ∧ (B ∨ C) ⇐⇒ (A ∧ B) ∨ (A ∧ C)
∧ distributes over ∨
A ∨ (B ∧ C) ⇐⇒ (A ∨ B) ∧ (A ∨ C)
∨ distributes over ∧
Discrete Mathematics I – p. 47/29
Logic
More laws of Boolean logic:
(A ∧ B) ∧ C ⇐⇒ A ∧ (B ∧ C)
(A ∨ B) ∨ C ⇐⇒ A ∨ (B ∨ C)
∧ associative
∨ 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/29
Logic
De Morgan’s laws:
¬(A ∧ B) ⇐⇒ ¬A ∨ ¬B
¬(A ∨ B) ⇐⇒ ¬A ∧ ¬B
Discrete Mathematics I – p. 48/29
Logic
De Morgan’s laws:
¬(A ∧ B) ⇐⇒ ¬A ∨ ¬B
¬(A ∨ B) ⇐⇒ ¬A ∧ ¬B
Thus, A ∧ B ⇐⇒ ¬(¬A ∨ ¬B),
so ∧ can be expressed via ¬, ∨
Discrete Mathematics I – p. 48/29
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 ¬, ∧
Discrete Mathematics I – p. 48/29
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/29
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A
A ∨ F ⇐⇒ A
identity laws
Discrete Mathematics I – p. 49/29
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A
A ∧ F ⇐⇒ F
A ∨ F ⇐⇒ A
A ∨ T ⇐⇒ T
identity laws
annihilation laws
Discrete Mathematics I – p. 49/29
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A
A ∧ F ⇐⇒ F
A ∧ ¬A ⇐⇒ F
A ∨ F ⇐⇒ A
A ∨ T ⇐⇒ T
identity laws
annihilation laws
A ∨ ¬A ⇐⇒ T
laws of excluded middle
Discrete Mathematics I – p. 49/29
Logic
Still more laws of Boolean logic:
A ∧ T ⇐⇒ A
A ∧ F ⇐⇒ F
A ∧ ¬A ⇐⇒ F
A ∨ F ⇐⇒ A
A ∨ T ⇐⇒ T
identity laws
annihilation laws
A ∨ ¬A ⇐⇒ T
laws of excluded middle
A ∧ (A ∨ B) ⇐⇒ A ⇐⇒ A ∨ (A ∧ B)
absorption laws
Discrete Mathematics I – p. 49/29
Logic
Finally,
(A ⇒ B) ⇐⇒ (¬A ∨ B) ⇐⇒ ¬(A ∧ ¬B)
Discrete Mathematics I – p. 50/29
Logic
Finally,
(A ⇒ B) ⇐⇒ (¬A ∨ B) ⇐⇒ ¬(A ∧ ¬B)
(A ⇔ B) ⇐⇒ (A ⇒ B) ∧ (B ⇒ A) ⇐⇒
(A ∧ B) ∨ (¬A ∧ ¬B)
Discrete Mathematics I – p. 50/29
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/29
Logic
All these laws can be verified by truth tables
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
A
T
T
F
F
B
T
F
T
F
A ∧ B ¬(A ∧ B)
¬A ¬B (¬A ∨ ¬B)
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
A
T
T
F
F
B
T
F
T
F
A ∧ B ¬(A ∧ B)
T
F
F
F
¬A ¬B (¬A ∨ ¬B)
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
A
T
T
F
F
B
T
F
T
F
A ∧ B ¬(A ∧ B)
T
F
F
T
F
T
F
T
¬A ¬B (¬A ∨ ¬B)
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
A
T
T
F
F
B
T
F
T
F
A ∧ B ¬(A ∧ B)
T
F
F
T
F
T
F
T
¬A ¬B (¬A ∨ ¬B)
F
F
F
T
T
F
T
T
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
A
T
T
F
F
B
T
F
T
F
A ∧ B ¬(A ∧ B)
T
F
F
T
F
T
F
T
¬A ¬B (¬A ∨ ¬B)
F
F
F
F
T
T
T
F
T
T
T
T
Discrete Mathematics I – p. 51/29
Logic
All these laws can be verified by truth tables
Example: ¬(A ∧ B) ⇐⇒ (¬A ∨ ¬B)
A
T
T
F
F
B
T
F
T
F
A ∧ B ¬(A ∧ B)
T
F
F
T
F
T
F
T
?
¬A ¬B (¬A ∨ ¬B)
F
F
F
F
T
T
T
F
T
T
T
T
?
Discrete Mathematics I – p. 51/29
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Discrete Mathematics I – p. 52/29
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A)
Discrete Mathematics I – p. 52/29
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A)
Discrete Mathematics I – p. 52/29
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒
(B ∨ ¬A)
Discrete Mathematics I – p. 52/29
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒
(B ∨ ¬A) ⇐⇒ (¬A ∨ B)
Discrete Mathematics I – p. 52/29
Logic
Using laws of logic
Prove: (A ⇒ B) ⇐⇒ (¬B ⇒ ¬A).
Proof.
(¬B ⇒ ¬A) ⇐⇒ (¬¬B ∨ ¬A) ⇐⇒
(B ∨ ¬A) ⇐⇒ (¬A ∨ B) ⇐⇒ (A ⇒ B)
Discrete Mathematics I – p. 52/29
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
Discrete Mathematics I – p. 52/29
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 by
contradiction
Discrete Mathematics I – p. 52/29
Logic
Holmes: I see our visitor was absent-minded. . .
Discrete Mathematics I – p. 53/29
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Discrete Mathematics I – p. 53/29
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Holmes: Elementary, my dear Watson! Alert people
never leave things behind. But he left his walking
stick. Therefore, he must be absent-minded.
Discrete Mathematics I – p. 53/29
Logic
Holmes: I see our visitor was absent-minded. . .
Watson: But why!??
Holmes: Elementary, my dear Watson! Alert people
never leave things behind. But he left his walking
stick. 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/29
Logic
Sign in a restaurant:
Good food is not cheap.
Cheap food is not good.
Is it repeating the same thing twice?
Discrete Mathematics I – p. 54/29
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/29
Logic
Somebody walks into a pub and says:
If I drink, everybody drinks!
Can this statement be true?
Discrete Mathematics I – p. 55/29
Logic
Answer: yes, it can!
Discrete Mathematics I – p. 56/29
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose everybody in the world drinks. Then
every person can say that.
Discrete Mathematics I – p. 56/29
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose everybody in the world drinks. Then
every person can say that.
Case 2: Suppose Joe does not drink. Then Joe can say
that.
Discrete Mathematics I – p. 56/29
Logic
Somebody walks into a pub and says:
If anybody drinks, I drink!
Can this statement be true?
Discrete Mathematics I – p. 57/29
Logic
Answer: yes, it can!
Discrete Mathematics I – p. 58/29
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose nobody in the world drinks. Then
every person can say that.
Discrete Mathematics I – p. 58/29
Logic
Answer: yes, it can!
Proof. We know the world is nonempty.
Case 1: Suppose nobody in the world drinks. Then
every person can say that.
Case 2: Suppose Jack drinks. Then Jack can say
that.
Discrete Mathematics I – p. 58/29
Logic
So far — statements about individual objects:
Five is less than ten
The pie is not as bad as it looks
Discrete Mathematics I – p. 59/29
Logic
So far — statements about individual objects:
Five is less than ten
The pie is not as bad as it looks
Often need to say more:
Some natural numbers are less than ten
All pies are not as bad as they look
Discrete Mathematics I – p. 59/29
Logic
Some natural numbers are less than ten
Discrete Mathematics I – p. 60/29
Logic
Some natural numbers are less than ten
Could try to specify an instance:
Five is less than ten
Discrete Mathematics I – p. 60/29
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/29
Logic
Could try to use Boolean operators:
Discrete Mathematics I – p. 61/29
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
Discrete Mathematics I – p. 61/29
Logic
Could try to use Boolean operators:
Some natural numbers are less than ten
(0 < 10) ∨ (1 < 10) ∨ (2 < 10) ∨ (3 < 10) ∨ · · ·
Discrete Mathematics I – p. 61/29
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
Discrete Mathematics I – p. 61/29
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. . . ) ∧ · · ·
Discrete Mathematics I – p. 61/29
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/29
Logic
A predicate is a sentence with variables
Becomes true or false when values are substituted for
variables
Discrete Mathematics I – p. 62/29
Logic
A predicate is a sentence with variables
Becomes true or false when values are substituted for
variables
Values are taken from a particular set (the range)
Always assume range is nonempty
Discrete Mathematics I – p. 62/29
Logic
Examples:
x < 10
(x in N)
Discrete Mathematics I – p. 63/29
Logic
Examples:
x < 10
(x in N)
“Pie p is not as bad as it looks”
(p in Pies)
Discrete Mathematics I – p. 63/29
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/29
Logic
A predicate can have more than one variable
Discrete Mathematics I – p. 64/29
Logic
A predicate can have more than one variable
Examples:
x<y
(x, y in N)
Discrete Mathematics I – p. 64/29
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/29
Logic
Predicate with no variables: ordinary statement
Discrete Mathematics I – p. 65/29
Logic
Predicate with no variables: ordinary statement
Examples:
5 < 10
Discrete Mathematics I – p. 65/29
Logic
Predicate with no variables: ordinary statement
Examples:
5 < 10
“My pie is better than your pie”
Discrete Mathematics I – p. 65/29
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Discrete Mathematics I – p. 66/29
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)):
∃x : P (x)
Discrete Mathematics I – p. 66/29
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)):
Universal (FOR ALL x, P (x)):
∃x : P (x)
∀x : P (x)
Discrete Mathematics I – p. 66/29
Logic
Let P (x) be a predicate with variable x
Can make statements by quantifiers
Existential (FOR SOME x, P (x)):
Universal (FOR ALL x, P (x)):
∃x : P (x)
∀x : P (x)
A particular range of x always assumed
Discrete Mathematics I – p. 66/29
Logic
Range often made explicit
Discrete Mathematics I – p. 67/29
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
Discrete Mathematics I – p. 67/29
Logic
Range often made explicit
Examples:
∃x ∈ N : x < 10
∀p ∈ Pies : “p is not as bad as it looks”
Discrete Mathematics I – p. 67/29
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
Discrete Mathematics I – p. 67/29
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/29
Logic
Quantifier variable can be changed
Discrete Mathematics I – p. 68/29
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒
Discrete Mathematics I – p. 68/29
Logic
Quantifier variable can be changed
∀p ∈ Pies : “p is not as bad as it looks” ⇐⇒
∀π ∈ Pies : “π is not as bad as it looks”
Discrete Mathematics I – p. 68/29
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
Discrete Mathematics I – p. 68/29
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
Discrete Mathematics I – p. 68/29
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/29
Logic
P (x, y) ⇐⇒ x > y
x, y free
Discrete Mathematics I – p. 69/29
Logic
P (x, y) ⇐⇒ x > y
P (u, v) ⇐⇒ u > v
x, y free
u, v free
Discrete Mathematics I – p. 69/29
Logic
P (x, y) ⇐⇒ x > y
P (u, v) ⇐⇒ u > v
Q1 (x) ⇐⇒ P (x, 5) ⇐⇒ x > 5
x, y free
u, v free
x free
Discrete Mathematics I – p. 69/29
Logic
P (x, y) ⇐⇒ x > y
P (u, v) ⇐⇒ u > v
Q1 (x) ⇐⇒ P (x, 5) ⇐⇒ x > 5
Q2 (z) ⇐⇒ P (3, z) ⇐⇒ 3 > z
x, y free
u, v free
x free
z free
Discrete Mathematics I – p. 69/29
Logic
P (x, y) ⇐⇒ x > y
P (u, v) ⇐⇒ u > v
Q1 (x) ⇐⇒ P (x, 5) ⇐⇒ x > 5
Q2 (z) ⇐⇒ P (3, z) ⇐⇒ 3 > z
x, y free
u, v free
x free
z free
Q3 (y) ⇐⇒ ∀x : P (x, y) ⇐⇒ ∀u : P (u, y)
⇐⇒ ∀u : u > y
y free x, u bound
Discrete Mathematics I – p. 69/29
Logic
P (x, y) ⇐⇒ x > y
P (u, v) ⇐⇒ u > v
Q1 (x) ⇐⇒ P (x, 5) ⇐⇒ x > 5
Q2 (z) ⇐⇒ P (3, z) ⇐⇒ 3 > z
x, y free
u, v free
x free
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/29
Logic
P (x, y) ⇐⇒ x > y
x, y free
Discrete Mathematics I – p. 70/29
Logic
P (x, y) ⇐⇒ x > y
Q5 ⇐⇒ ∃z : P (0, z)
⇐⇒ ∃z : 0 > z ⇐⇒ F
x, y free
z bound
Discrete Mathematics I – p. 70/29
Logic
P (x, y) ⇐⇒ x > y
Q5 ⇐⇒ ∃z : P (0, z)
⇐⇒ ∃z : 0 > z ⇐⇒ F
Q6 ⇐⇒ ∀y : ∃x : P (x, y)
⇐⇒ ∀y : ∃x : x > y ⇐⇒ T
x, y free
z bound
x, y bound
Discrete Mathematics I – p. 70/29
Logic
P (x, y) ⇐⇒ x > y
Q5 ⇐⇒ ∃z : P (0, z)
⇐⇒ ∃z : 0 > z ⇐⇒ F
Q6 ⇐⇒ ∀y : ∃x : P (x, y)
⇐⇒ ∀y : ∃x : x > y ⇐⇒ T
x, y free
z bound
x, y bound
Q7 ⇐⇒ P (3, 5) ⇐⇒ 3 > 5 ⇐⇒ F
Discrete Mathematics I – p. 70/29
Logic
Suppose set S finite: S = {a1 , . . . , an }
Discrete Mathematics I – p. 71/29
Logic
Suppose set S finite: S = {a1 , . . . , an }
∀x ∈ S : P (x) ⇐⇒ P (a1 ) ∧ · · · ∧ P (an )
∃x ∈ S : P (x) ⇐⇒ P (a1 ) ∨ · · · ∨ P (an )
Discrete Mathematics I – p. 71/29
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 by
Boolean operators
Discrete Mathematics I – p. 71/29
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 by
Boolean operators
Not so on an infinite range
Discrete Mathematics I – p. 71/29
Logic
Laws of predicate logic:
Discrete Mathematics I – p. 72/29
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T
(∀x : F ) ⇐⇒ F
Discrete Mathematics I – p. 72/29
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T
(∃x : T ) ⇐⇒ T
(∀x : F ) ⇐⇒ F
(∃x : F ) ⇐⇒ F
Discrete Mathematics I – p. 72/29
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T
(∃x : T ) ⇐⇒ T
(∀x : F ) ⇐⇒ F
(∃x : F ) ⇐⇒ F
∀x : (P (x) ∧ Q) ⇐⇒ (∀x : P (x)) ∧ Q
Discrete Mathematics I – p. 72/29
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T
(∃x : T ) ⇐⇒ T
(∀x : F ) ⇐⇒ F
(∃x : F ) ⇐⇒ F
∀x : (P (x) ∧ Q) ⇐⇒ (∀x : P (x)) ∧ Q
(if Q does not contain free x)
Discrete Mathematics I – p. 72/29
Logic
Laws of predicate logic:
(∀x : T ) ⇐⇒ T
(∃x : T ) ⇐⇒ T
(∀x : F ) ⇐⇒ F
(∃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/29
Logic
De Morgan’s laws for predicates:
¬∀x : P (x) ⇐⇒ ∃x : ¬P (x)
¬∃x : P (x) ⇐⇒ ∀x : ¬P (x)
Discrete Mathematics I – p. 73/29
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))
Discrete Mathematics I – p. 74/29
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))
Discrete Mathematics I – p. 74/29
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)
Discrete Mathematics I – p. 74/29
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))
Discrete Mathematics I – p. 74/29
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/29
Logic
Using quantifiers — an example
P (x) true for at least one x in S: ∃x ∈ S : P (x)
Discrete Mathematics I – p. 75/29
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:
Discrete Mathematics I – p. 75/29
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) ∧
Discrete Mathematics I – p. 75/29
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))
Discrete Mathematics I – p. 75/29
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))
Discrete Mathematics I – p. 75/29
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))
Discrete Mathematics I – p. 75/29
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
∃x ∈ S
∃x ∈ S
∃x ∈ S
: (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒
: (P (x) ∧ ∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒
: (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒
: (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Discrete Mathematics I – p. 75/29
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
∃x ∈ S
∃x ∈ S
∃x ∈ S
: (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒
: (P (x) ∧ ∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒
: (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒
: (P (x) ∧ ¬∃y ∈ S : (x 6= y) ∧ P (y))
Notation: ∃!x ∈ S : P (x)
Discrete Mathematics I – p. 75/29
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
∃x ∈ S
∃x ∈ S
∃x ∈ S
: (P (x) ∧ ∀y ∈ S : P (y) ⇒ (x = y)) ⇐⇒
: (P (x) ∧ ∀y ∈ S : (x 6= y) ⇒ ¬P (y)) ⇐⇒
: (P (x) ∧ ∀y ∈ S : (x = y) ∨ ¬P (y)) ⇐⇒
: (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/29
Sets
Discrete Mathematics I – p. 76/29
Sets
Set: a basic (undefined) concept
Discrete Mathematics I – p. 77/29
Sets
Set: a basic (undefined) concept
By a set we shall understand any collection
into a whole M of definite, distinct objects of
our intuition or of our thought. These objects
are called the elements of M .
G. Cantor (1845–1918)
Discrete Mathematics I – p. 77/29
Sets
Anything can be an element of a set
Discrete Mathematics I – p. 78/29
Sets
Anything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}
Discrete Mathematics I – p. 78/29
Sets
Anything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}
Neven = {0, 2, 4, 6, 8, 10, . . .}
Discrete Mathematics I – p. 78/29
Sets
Anything can be an element of a set
Planets = {Mercury, Venus, . . . , Pluto}
Neven = {0, 2, 4, 6, 8, 10, . . .}
Junk = {239, banana, ace of spades}
Discrete Mathematics I – p. 78/29
Sets
Anything 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
Discrete Mathematics I – p. 78/29
Sets
Anything 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/29
Sets
Order of elements does not matter
Junk = {banana, ace of spades, 239}
Discrete Mathematics I – p. 79/29
Sets
Order 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/29
Sets
The empty set: ∅ = {}
Discrete Mathematics I – p. 80/29
Sets
The empty set: ∅ = {}
A singleton: any one-element set
Discrete Mathematics I – p. 80/29
Sets
The empty set: ∅ = {}
A singleton: any one-element set
MorningStars = {Venus}
Discrete Mathematics I – p. 80/29
Sets
The empty set: ∅ = {}
A singleton: any one-element set
MorningStars = {Venus}
NonpositiveNaturals = {0}
Discrete Mathematics I – p. 80/29
Sets
The empty set: ∅ = {}
A singleton: any one-element set
MorningStars = {Venus}
NonpositiveNaturals = {0}
EmptySets = {∅} 6= ∅
Discrete Mathematics I – p. 80/29
Sets
Element x is in set A: x ∈ A
Discrete Mathematics I – p. 81/29
Sets
Element x is in set A: x ∈ A
Jupiter ∈ Planets, orange 6∈ Junk
Discrete Mathematics I – p. 81/29
Sets
Element 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 also
elements of B (but not necessarily the other way
round)
Discrete Mathematics I – p. 81/29
Sets
Element 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 also
elements of B (but not necessarily the other way
round)
A ⊆ B ⇐⇒ ∀x : x ∈ A ⇒ x ∈ B
Discrete Mathematics I – p. 81/29
Sets
In particular, for any set A:
A⊆A
∅⊆A
Discrete Mathematics I – p. 82/29
Sets
In particular, for any set A:
∅⊆∅
A⊆A
∅⊆A
Discrete Mathematics I – p. 82/29
Sets
In particular, for any set A:
∅⊆∅
A⊆A
∅⊆A
Neven ⊆ N
Discrete Mathematics I – p. 82/29
Sets
In particular, for any set A:
∅⊆∅
A⊆A
∅⊆A
Neven ⊆ N
∅ ⊆ {banana} ⊆ {banana, 239} ⊆ Junk
Discrete Mathematics I – p. 82/29
Sets
What are the axioms of set theory?
Discrete Mathematics I – p. 83/29
Sets
What are the axioms of set theory?
The Law of Extensionality:
Two sets with all the same elements are equal
Discrete Mathematics I – p. 83/29
Sets
What 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
Discrete Mathematics I – p. 83/29
Sets
What 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/29
Sets
Let P (x) be a predicate
Discrete Mathematics I – p. 84/29
Sets
Let P (x) be a predicate
{x | P (x)}: the set of all x, such that P (x) is true
Discrete Mathematics I – p. 84/29
Sets
Let 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)}
Discrete Mathematics I – p. 84/29
Sets
Let 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 } =
Discrete Mathematics I – p. 84/29
Sets
Let 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
Discrete Mathematics I – p. 84/29
Sets
Let 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/29
Sets
Let 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/29
Sets
Examples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}
Discrete Mathematics I – p. 85/29
Sets
Examples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}
{x ∈ Planets | x is red} = {Mars}
Discrete Mathematics I – p. 85/29
Sets
Examples:
{x ∈ N | x > 0} = {1, 2, 3, 4, 5, 6, . . .}
{x ∈ Planets | x is red} = {Mars}
{x ∈ N | x ≥ 0} = N
Discrete Mathematics I – p. 85/29
Sets
Examples:
{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/29
Sets
Another axiom of set theory
Discrete Mathematics I – p. 86/29
Sets
Another 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/29
Sets
Another 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/29
Sets
Another 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/29
Sets
Russell’s paradox
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. Who shaves the barber?
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. Who shaves the barber?
Let P (x) = x 6∈ x
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. Who shaves the barber?
Let P (x) = x 6∈ x
Let B = {x | P (x)} = {x | x 6∈ x}
B ∈ B — true or false?
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. 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
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. 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
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox
A barber shaves everyone who does not shave
himself. 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
Contradiction!
B 6∈ B =⇒ B ∈ B
Discrete Mathematics I – p. 87/29
Sets
Russell’s paradox can only be explained by
inconsistency of axioms
Discrete Mathematics I – p. 88/29
Sets
Russell’s paradox can only be explained by
inconsistency of axioms
Set theory can be fixed — no details here
Discrete Mathematics I – p. 88/29
Sets
Russell’s paradox can only be explained by
inconsistency of axioms
Set theory can be fixed — no details here
Extensionality + Abstraction =
Discrete Mathematics I – p. 88/29
Sets
Russell’s paradox can only be explained by
inconsistency of axioms
Set theory can be fixed — no details here
Extensionality + Abstraction = Naive set theory
Discrete Mathematics I – p. 88/29
Sets
Operations on sets:
Discrete Mathematics I – p. 89/29
Sets
Operations on sets:
Intersection: A ∩ B = {x | (x ∈ A) ∧ (x ∈ B)}
Discrete Mathematics I – p. 89/29
Sets
Operations on sets:
Intersection: A ∩ B = {x | (x ∈ A) ∧ (x ∈ B)}
Union: A ∪ B = {x | (x ∈ A) ∨ (x ∈ B)}
Discrete Mathematics I – p. 89/29
Sets
Operations on sets:
Intersection: A ∩ B = {x | (x ∈ A) ∧ (x ∈ B)}
Union: A ∪ B = {x | (x ∈ A) ∨ (x ∈ B)}
Venn diagrams (illustration only!):
A
B
Discrete Mathematics I – p. 89/29
Sets
Operations 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
Discrete Mathematics I – p. 89/29
Sets
Operations 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
Discrete Mathematics I – p. 89/29
Sets
Operations 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/29
Sets
More operations on sets:
Difference: A \ B = {x | (x ∈ A) ∧ (x 6∈ B)}
Discrete Mathematics I – p. 90/29
Sets
More operations on sets:
Difference: A \ B = {x | (x ∈ A) ∧ (x 6∈ B)}
A
B
Discrete Mathematics I – p. 90/29
Sets
More operations on sets:
Difference: A \ B = {x | (x ∈ A) ∧ (x 6∈ B)}
A
B
A\B
Discrete Mathematics I – p. 90/29
Sets
More operations on sets:
Difference: A \ B = {x | (x ∈ A) ∧ (x 6∈ B)}
A
B
A\B
B\A
Discrete Mathematics I – p. 90/29
Sets
More 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/29
Sets
Let S be a fixed (universal) set, A ⊆ S
Complement of A (with respect to S): Ā = S \ A
Discrete Mathematics I – p. 91/29
Sets
Let S be a fixed (universal) set, A ⊆ S
Complement of A (with respect to S): Ā = S \ A
A
S
Discrete Mathematics I – p. 91/29
Sets
Let S be a fixed (universal) set, A ⊆ S
Complement of A (with respect to S): Ā = S \ A
A
S
Ā
Discrete Mathematics I – p. 91/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A∪B =
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A∩B =
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A ∩ B = {a, c}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A\B =
A ∩ B = {a, c}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A \ B = {b}
A ∩ B = {a, c}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A \ B = {b}
B\A=
A ∩ B = {a, c}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A \ B = {b}
A ∩ B = {a, c}
B \ A = {f, g}
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A \ B = {b}
A ∩ B = {a, c}
B \ A = {f, g}
Note: A ∪ B = (A ∩ B) ∪ (A \ B) ∪ (B \ A)
Discrete Mathematics I – p. 92/29
Sets
Examples:
A = {a, b, c}, B = {c, a, f, g}
A ∪ B = {a, b, c, f, g}
A \ B = {b}
A ∩ B = {a, c}
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/29
Sets
Laws of set operations (hold for any A, B, C):
 = A
double complement
Discrete Mathematics I – p. 93/29
Sets
Laws of set operations (hold for any A, B, C):
 = A
double complement
A∩A=A
A∪A=A
∩ idempotent
∪ idempotent
Discrete Mathematics I – p. 93/29
Sets
Laws of set operations (hold for any A, B, C):
 = A
double complement
A∩A=A
A∪A=A
A∩B =B∩A
A∪B =B∪A
∩ idempotent
∪ idempotent
∩ commutative
∪ commutative
Discrete Mathematics I – p. 93/29
Sets
More laws of set operations:
Discrete Mathematics I – p. 94/29
Sets
More laws of set operations:
(A ∩ B) ∩ C = A ∩ (B ∩ C)
(A ∪ B) ∪ C = A ∪ (B ∪ C)
∩ associative
∪ associative
Discrete Mathematics I – p. 94/29
Sets
More laws of set operations:
(A ∩ B) ∩ C = A ∩ (B ∩ C)
(A ∪ B) ∪ C = A ∪ (B ∪ C)
∩ associative
∪ associative
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
∩ distributes over ∪
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C)
∪ distributes over ∩
Discrete Mathematics I – p. 94/29
Sets
More laws of set operations:
(A ∩ B) ∩ C = A ∩ (B ∩ C)
(A ∪ B) ∪ C = A ∪ (B ∪ C)
∩ associative
∪ 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/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
AB
C
Discrete Mathematics I – p. 95/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
AB
C
B∪C
Discrete Mathematics I – p. 95/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
AB
C
B∪C
A ∩ (B ∪ C)
Discrete Mathematics I – p. 95/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
AB
C
B∪C
A ∩ (B ∪ C)
A∩B
Discrete Mathematics I – p. 95/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
AB
C
B∪C
A∩B
A∩C
A ∩ (B ∪ C)
Discrete Mathematics I – p. 95/29
Sets
A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
AB
C
B∪C
A ∩ (B ∪ C)
A∩B
A∩C
(A ∩ B) ∪ (A ∩ C)
Discrete Mathematics I – p. 95/29
Sets
Prove A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Discrete Mathematics I – p. 96/29
Sets
Prove A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Proof. Consider any x.
Discrete Mathematics I – p. 96/29
Sets
Prove A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B ∪C) ⇐⇒
Discrete Mathematics I – p. 96/29
Sets
Prove A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Proof. Consider any x.
x ∈ A∩(B ∪C) ⇐⇒ (x ∈ A)∧(x ∈ (B ∪C)) ⇐⇒
Discrete Mathematics I – p. 96/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 96/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 96/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 96/29
Sets
Prove 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)
Discrete Mathematics I – p. 96/29
Sets
Prove 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/29
Sets
De Morgan’s laws:
A ∩ B = Ā ∪ B̄
A ∪ B = Ā ∩ B̄
Discrete Mathematics I – p. 97/29
Sets
De Morgan’s laws:
A ∩ B = Ā ∪ B̄
A ∪ B = Ā ∩ B̄
Thus, A ∩ B = Ā ∪ B̄,
so ∩ can be expressed via ¯, ∪
Discrete Mathematics I – p. 97/29
Sets
De Morgan’s laws:
A ∩ B = Ā ∪ B̄
A ∪ B = Ā ∩ B̄
Thus, A ∩ B = Ā ∪ B̄,
so ∩ can be expressed via ¯, ∪
Alternatively, A ∪ B = Ā ∩ B̄,
so ∪ can be expressed via ¯, ∩
Discrete Mathematics I – p. 97/29
Sets
De Morgan’s laws:
A ∩ B = Ā ∪ B̄
A ∪ B = Ā ∩ B̄
Thus, A ∩ B = Ā ∪ B̄,
so ∩ can be expressed via ¯, ∪
Alternatively, A ∪ B = Ā ∩ B̄,
so ∪ can be expressed via ¯, ∩
(Cannot remove both ∩, ∪ at the same time!)
Discrete Mathematics I – p. 97/29
Sets
A ∩ B = Ā ∪ B̄
Discrete Mathematics I – p. 98/29
Sets
A ∩ B = Ā ∪ B̄
A
B
S
Discrete Mathematics I – p. 98/29
Sets
A ∩ B = Ā ∪ B̄
A
B
S
A∩B
Discrete Mathematics I – p. 98/29
Sets
A ∩ B = Ā ∪ B̄
A
B
S
A∩B
A∩B
Discrete Mathematics I – p. 98/29
Sets
A ∩ B = Ā ∪ B̄
A
B
S
A∩B
A∩B
Ā
Discrete Mathematics I – p. 98/29
Sets
A ∩ B = Ā ∪ B̄
A
B
S
A∩B
Ā
B̄
A∩B
Discrete Mathematics I – p. 98/29
Sets
A ∩ B = Ā ∪ B̄
A
B
S
A∩B
A∩B
Ā
B̄
Ā ∪ B̄
Discrete Mathematics I – p. 98/29
Sets
Prove A ∩ B = Ā ∪ B̄
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒ x 6∈ A ∩ B ⇐⇒
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒ x 6∈ A ∩ B ⇐⇒
¬(x ∈ A ∧ x ∈ B) ⇐⇒
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒ x 6∈ A ∩ B ⇐⇒
¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒ x 6∈ A ∩ B ⇐⇒
¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒
(x ∈ Ā) ∨ (x ∈ B̄) ⇐⇒
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒ x 6∈ A ∩ B ⇐⇒
¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒
(x ∈ Ā) ∨ (x ∈ B̄) ⇐⇒ x ∈ (Ā ∪ B̄)
Discrete Mathematics I – p. 99/29
Sets
Prove A ∩ B = Ā ∪ B̄
Proof. Consider any x ∈ S.
x ∈ A ∩ B ⇐⇒ x 6∈ A ∩ B ⇐⇒
¬(x ∈ A ∧ x ∈ B) ⇐⇒ (x 6∈ A) ∨ (x 6∈ B) ⇐⇒
(x ∈ Ā) ∨ (x ∈ B̄) ⇐⇒ x ∈ (Ā ∪ B̄)
Hence A ∩ B = Ā ∪ B̄
Discrete Mathematics I – p. 99/29
Sets
Still more laws:
Let A ⊆ S
A∩S =A
A∪∅=A
identity laws
Discrete Mathematics I – p. 100/29
Sets
Still more laws:
Let A ⊆ S
A∩S =A
A∩∅=∅
A∪∅=A
A∪S =S
identity laws
annihilation laws
Discrete Mathematics I – p. 100/29
Sets
Still more laws:
Let A ⊆ S
A∩S =A
A∩∅=∅
A ∩ Ā = ∅
A∪∅=A
A∪S =S
A ∪ Ā = S
identity laws
annihilation laws
laws of excluded middle
Discrete Mathematics I – p. 100/29
Sets
Still more laws:
Let A ⊆ S
A∩S =A
A∩∅=∅
A ∩ Ā = ∅
A∪∅=A
identity laws
A∪S =S
A ∪ Ā = S
annihilation laws
laws of excluded middle
A ∩ (A ∪ B) = A = A ∪ (A ∩ B)
absorption laws
Discrete Mathematics I – p. 100/29
Sets
A structure with such properties is called a Boolean
algebra
Discrete Mathematics I – p. 101/29
Sets
A structure with such properties is called a Boolean
algebra
Examples:
B = {F, T }
operations ∧, ∨, ¬
identities F , T
Discrete Mathematics I – p. 101/29
Sets
A structure with such properties is called a Boolean
algebra
Examples:
B = {F, T }
operations ∧, ∨, ¬
identities F , T
Set of all subsets of fixed S
operations ∩, ∪, ¯
identities ∅, S
Discrete Mathematics I – p. 101/29
Sets
The 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/29
Sets
Examples:
P(∅) =
Discrete Mathematics I – p. 103/29
Sets
Examples:
P(∅) = {∅}
Discrete Mathematics I – p. 103/29
Sets
Examples:
P(∅) = {∅}
(note: P(∅) 6= ∅!)
Discrete Mathematics I – p. 103/29
Sets
Examples:
P(∅) = {∅}
P({Bunty}) =
(note: P(∅) 6= ∅!)
Discrete Mathematics I – p. 103/29
Sets
Examples:
P(∅) = {∅}
P({Bunty}) = {∅, {Bunty}}
(note: P(∅) 6= ∅!)
Discrete Mathematics I – p. 103/29
Sets
Examples:
P(∅) = {∅}
P({Bunty}) = {∅, {Bunty}}
(note: P(∅) 6= ∅!)
P({a, b, c}) =
Discrete Mathematics I – p. 103/29
Sets
Examples:
P(∅) = {∅}
P({Bunty}) = {∅, {Bunty}}
(note: P(∅) 6= ∅!)
P({a, b, c}) =
{∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}
Discrete Mathematics I – p. 103/29
Sets
If S finite, P(S) finite
Discrete Mathematics I – p. 104/29
Sets
If S finite, P(S) finite
If S has n elements, P(S) has 2n elements
Discrete Mathematics I – p. 104/29
Sets
If S finite, P(S) finite
If S has n elements, P(S) has 2n elements
If S infinite, P(S) infinite
Discrete Mathematics I – p. 104/29
Sets
If 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/29
Sets
Properties of P:
P(A ∩ B) = P(A) ∩ P(B)
Discrete Mathematics I – p. 105/29
Sets
Properties of P:
P(A ∩ B) = P(A) ∩ P(B)
In general, P(A ∪ B) 6= P(A) ∪ P(B)
(but ⊇ holds)
Discrete Mathematics I – p. 105/29
Sets
Properties of P:
P(A ∩ B) = P(A) ∩ P(B)
In general, P(A ∪ B) 6= P(A) ∪ P(B)
In general, P(A \ B) 6= P(A) \ P(B)
(but ⊇ holds)
(but ⊆ holds)
Discrete Mathematics I – p. 105/29
Sets
Prove or disprove: For all A, B,
P(A) ∪ P(B) ⊆ P(A ∪ B).
Discrete Mathematics I – p. 106/29
Sets
Prove or disprove: For all A, B,
P(A) ∪ P(B) ⊆ P(A ∪ B). True
Discrete Mathematics I – p. 106/29
Sets
Prove or disprove: For all A, B,
P(A) ∪ P(B) ⊆ P(A ∪ B). True
Proof. Consider any X.
Discrete Mathematics I – p. 106/29
Sets
Prove or disprove: For all A, B,
P(A) ∪ P(B) ⊆ P(A ∪ B). True
Proof. Consider any X.
X ∈ P(A) ∪ P(B) ⇐⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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)) ⇐⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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)
=⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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) ⇐⇒
=⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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) ⇐⇒
=⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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 ⇐⇒
=⇒
Discrete Mathematics I – p. 106/29
Sets
Prove 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/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B).
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ P(A ∪ B), X 6∈ P(A) ∪ P(B).
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ P(A ∪ B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}.
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ P(A ∪ B), X 6∈ P(A) ∪ P(B).
Let A = {0}, B = {1}. Let X = {0, 1}.
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ 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)
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ 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}}
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ 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}}
Discrete Mathematics I – p. 107/29
Sets
Prove or disprove: For all A, B,
P(A ∪ B) ⊆ P(A) ∪ P(B). False
Proof. Need to find A, B, X such that
X ∈ 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/29
Sets
Let x1 , x2 , . . . , xn be any elements (n ∈ N)
Discrete Mathematics I – p. 108/29
Sets
Let x1 , x2 , . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1 , x2 , . . . , xn )
Discrete Mathematics I – p. 108/29
Sets
Let x1 , x2 , . . . , xn be any elements (n ∈ N)
A (finite) sequence: (x1 , x2 , . . . , xn )
JunkSeq1 = (239, banana, ace of spades)
Discrete Mathematics I – p. 108/29
Sets
Let 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)
Discrete Mathematics I – p. 108/29
Sets
Let 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
Discrete Mathematics I – p. 108/29
Sets
Let 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!
Discrete Mathematics I – p. 108/29
Sets
Let 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/29
Sets
For sequences, repetitions and order matter
Discrete Mathematics I – p. 109/29
Sets
For sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Discrete Mathematics I – p. 109/29
Sets
For sequences, repetitions and order matter
(x, y) 6= (y, x) 6= (y, x, x)
Number n is sequence length
Discrete Mathematics I – p. 109/29
Sets
For 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
Discrete Mathematics I – p. 109/29
Sets
For 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
Discrete Mathematics I – p. 109/29
Sets
For 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/29
Sets
The Cartesian product of sets A, B is the set of all
ordered pairs (a, b), where a ∈ A, b ∈ B
Discrete Mathematics I – p. 110/29
Sets
The Cartesian product of sets A, B is the set of all
ordered pairs (a, b), where a ∈ A, b ∈ B
(After R. Descartes, 1596–1650)
Discrete Mathematics I – p. 110/29
Sets
The Cartesian product of sets A, B is the set of all
ordered pairs (a, b), where a ∈ A, b ∈ B
(After R. Descartes, 1596–1650)
A × B = {(a, b) | (a ∈ A) ∧ (b ∈ B)}
Discrete Mathematics I – p. 110/29
Sets
The Cartesian product of sets A, B is the set of all
ordered 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/29
Sets
Examples:
∅×A=
Discrete Mathematics I – p. 111/29
Sets
Examples:
∅×A=A×∅=
Discrete Mathematics I – p. 111/29
Sets
Examples:
∅×A=A×∅=∅
for any set A
Discrete Mathematics I – p. 111/29
Sets
Examples:
∅×A=A×∅=∅
for any set A
{Bunty} × {Fowler} =
Discrete Mathematics I – p. 111/29
Sets
Examples:
∅×A=A×∅=∅
for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}
Discrete Mathematics I – p. 111/29
Sets
Examples:
∅×A=A×∅=∅
for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}
{Fowler} × {Bunty} =
Discrete Mathematics I – p. 111/29
Sets
Examples:
∅×A=A×∅=∅
for any set A
{Bunty} × {Fowler} = {(Bunty, Fowler)}
{Fowler} × {Bunty} = {(Fowler, Bunty)}
Discrete Mathematics I – p. 111/29
Sets
More examples:
{a, b, c} × {d, e} =
Discrete Mathematics I – p. 112/29
Sets
More examples:
{a, b, c} × {d, e} =
{(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}
Discrete Mathematics I – p. 112/29
Sets
More examples:
{a, b, c} × {d, e} =
{(a, d), (a, e), (b, d), (b, e), (c, d), (c, e)}
N × Planets =
Discrete Mathematics I – p. 112/29
Sets
More 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)} =
Discrete Mathematics I – p. 112/29
Sets
More 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), . . .}
Discrete Mathematics I – p. 112/29
Sets
More 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/29
Sets
If A, B finite, A × B finite
Discrete Mathematics I – p. 113/29
Sets
If A, B finite, A × B finite
If A has m elements, B has n elements, then A × B
has m · n elements
Discrete Mathematics I – p. 113/29
Sets
If A, B finite, A × B finite
If A has m elements, B has n elements, then A × B
has m · n elements
(. . . hence the “×” sign)
Discrete Mathematics I – p. 113/29
Sets
If A, B finite, A × B finite
If A has m elements, B has n elements, then A × B
has m · n elements
(. . . hence the “×” sign)
If A infinite, B nonempty, then A × B, B × A infinite
Discrete Mathematics I – p. 113/29
Sets
Properties of ×:
Discrete Mathematics I – p. 114/29
Sets
Properties of ×:
In general, A × B 6= B × A
Discrete Mathematics I – p. 114/29
Sets
Properties of ×:
In general, A × B 6= B × A
In general, (A × B) × C 6= A × (B × C)
Discrete Mathematics I – p. 114/29
Sets
Properties 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/29
Sets
A × (B ∩ C) = (A × B) ∩ (A × C)
(A ∩ B) × C = (A × C) ∩ (B × C)
Discrete Mathematics I – p. 115/29
Sets
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)
Discrete Mathematics I – p. 115/29
Sets
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)
A × (B \ C) = (A × B) \ (A × C)
(A \ B) × C = (A × C) \ (B × C)
Discrete Mathematics I – p. 115/29
Sets
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)
A × (B \ C) = (A × B) \ (A × C)
(A \ B) × C = (A × C) \ (B × C)
× distributes over ∩, ∪, \
Discrete Mathematics I – p. 115/29
Sets
Prove A × (B ∪ C) = (A × B) ∪ (A × C)
Discrete Mathematics I – p. 116/29
Sets
Prove A × (B ∪ C) = (A × B) ∪ (A × C)
Proof. Consider any (x, y).
Discrete Mathematics I – p. 116/29
Sets
Prove A × (B ∪ C) = (A × B) ∪ (A × C)
Proof. Consider any (x, y).
(x, y) ∈ A × (B ∪ C) ⇐⇒
Discrete Mathematics I – p. 116/29
Sets
Prove A × (B ∪ C) = (A × B) ∪ (A × C)
Proof. Consider any (x, y).
(x, y) ∈ A × (B ∪ C) ⇐⇒
(x ∈ A) ∧ (y ∈ (B ∪ C)) ⇐⇒
Discrete Mathematics I – p. 116/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 116/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 116/29
Sets
Prove 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) ⇐⇒
Discrete Mathematics I – p. 116/29
Sets
Prove 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)
Discrete Mathematics I – p. 116/29
Sets
Prove 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/29
Sets
The Cartesian product of sets A1 , A2 , . . . , An is the
set of all ordered sequences (a1 , a2 , . . . , an ), where
ai ∈ Ai for all i ∈ {1, . . . , n}
Discrete Mathematics I – p. 117/29
Sets
The Cartesian product of sets A1 , A2 , . . . , An is the
set of all ordered sequences (a1 , a2 , . . . , an ), where
ai ∈ Ai for all i ∈ {1, . . . , n}
A1 × · · · × A n =
{(a1 , . . . , an ) | ∀i ∈ {1, . . . , n} : ai ∈ Ai }
Discrete Mathematics I – p. 117/29
Sets
The Cartesian product of sets A1 , A2 , . . . , An is the
set of all ordered sequences (a1 , a2 , . . . , an ), where
ai ∈ Ai for all i ∈ {1, . . . , n}
A1 × · · · × A n =
{(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/29
Sets
If A1 , A2 , . . . , An finite, A1 × A2 × · · · × An finite
Discrete Mathematics I – p. 118/29
Sets
If A1 , A2 , . . . , An finite, A1 × A2 × · · · × An finite
If for all i, Ai has ni elements, A1 × · · · × Ak has
n1 · . . . · nk elements
Discrete Mathematics I – p. 118/29
Sets
If A1 , A2 , . . . , An finite, A1 × A2 × · · · × An finite
If for all i, Ai has ni elements, A1 × · · · × Ak has
n1 · . . . · nk elements
If one of A1 , A2 , . . . , An infinite, A1 × A2 × · · · × An
infinite (unless one of them is empty)
Discrete Mathematics I – p. 118/29
Sets
Therefore:
If A finite, An finite
If A has k elements, An has k n elements
If A infinite, An infinite
Discrete Mathematics I – p. 119/29
Relations
Discrete Mathematics I – p. 120/29
Relations
Consider P (x, y) = x ≤ y
x, y ∈ N
Discrete Mathematics I – p. 121/29
Relations
Consider P (x, y) = x ≤ y
x, y ∈ N
{(x, y) | x ≤ y} ⊆ N × N = N2
Discrete Mathematics I – p. 121/29
Relations
A relation between sets A, B is a subset of A × B
Discrete Mathematics I – p. 122/29
Relations
A relation between sets A, B is a subset of A × B
Rp : A ↔ B ⇐⇒ Rp ⊆ A × B
Discrete Mathematics I – p. 122/29
Relations
A 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
Discrete Mathematics I – p. 122/29
Relations
A 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/29
Relations
Examples of relations:
Equality relation R=A : A ↔ A
Discrete Mathematics I – p. 123/29
Relations
Examples of relations:
Equality relation R=A : A ↔ A
R=A = {(a, a) | a ∈ A}
Discrete Mathematics I – p. 123/29
Relations
Examples of relations:
Equality relation R=A : A ↔ A
R=A = {(a, a) | a ∈ A}
Usually drop A : a = a
Discrete Mathematics I – p. 123/29
Relations
Examples of relations:
Equality relation R=A : A ↔ A
R=A = {(a, a) | a ∈ A}
Usually drop A : a = a
Empty relation ∅ : A ↔ A
Discrete Mathematics I – p. 123/29
Relations
Examples 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/29
Relations
More examples of relations:
R< , R ≤ , R > , R ≥
N↔N
Discrete Mathematics I – p. 124/29
Relations
More examples of relations:
R< , R ≤ , R > , R ≥
R| : N ↔ N
N↔N
m | n ⇐⇒ m divides n
Discrete Mathematics I – p. 124/29
Relations
More examples of relations:
R< , R ≤ , R > , R ≥
R| : N ↔ N
N↔N
m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k · m = n
Discrete Mathematics I – p. 124/29
Relations
More examples of relations:
R< , R ≤ , R > , R ≥
R| : N ↔ N
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
Discrete Mathematics I – p. 124/29
Relations
More examples of relations:
R< , R ≤ , R > , R ≥
R| : N ↔ N
N↔N
m | n ⇐⇒ m divides n
m | n ⇐⇒ ∃k ∈ N : k · m = n
Rq : People ↔ People
Rt : People ↔ Animals
x q y ⇐⇒ x is a child of y
x t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 124/29
Relations
More examples of relations:
Rs : N ↔ N
m s n ⇐⇒ m2 = n
Discrete Mathematics I – p. 125/29
Relations
More examples of relations:
Rs : N ↔ N
m s n ⇐⇒ m2 = n
Rm : People ↔ People
x m y ⇐⇒ the mother of x is y
Discrete Mathematics I – p. 125/29
Relations
More examples of relations:
Rs : N ↔ N
m s n ⇐⇒ m2 = n
Rm : People ↔ People
x m y ⇐⇒ the mother of x is y
In these relations, for every x ∈ A, there is a unique
y ∈ B, such that x is related to y
Discrete Mathematics I – p. 125/29
Relations
More examples of relations:
Rs : N ↔ N
m s n ⇐⇒ m2 = n
Rm : People ↔ People
x m y ⇐⇒ the mother of x is y
In these relations, for every x ∈ A, there is a unique
y ∈ B, such that x is related to y
Such relations are called functions
Discrete Mathematics I – p. 125/29
Relations
Rp , R q : A ↔ B
Discrete Mathematics I – p. 126/29
Relations
Rp , R q : A ↔ B
Rp ∩ R q ,
Rp ∪ Rq ,
Rp \ Rq :
A↔B
Discrete Mathematics I – p. 126/29
Relations
Rp : A ↔ B
Rq : B ↔ C
Discrete Mathematics I – p. 127/29
Relations
Rp : A ↔ B
Rq : B ↔ C
The composition of p and q Rp ◦ q : A ↔ C
Discrete Mathematics I – p. 127/29
Relations
Rp : 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/29
Relations
Examples:
Rq : People ↔ People
Rt : People ↔ Animals
x q y ⇐⇒ x is a child of y
x t y ⇐⇒ x has y as a pet
Discrete Mathematics I – p. 128/29
Relations
Examples:
Rq : People ↔ People
Rt : People ↔ Animals
x q y ⇐⇒ x is a child of y
x t y ⇐⇒ x has y as a pet
Rq ◦ t : People ↔ Animals
x(q ◦ t)z ⇐⇒ x has a parent with pet z
Discrete Mathematics I – p. 128/29
Relations
Examples:
Rq : People ↔ People
Rt : People ↔ Animals
x q y ⇐⇒ x is a child of y
x 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/29
Relations
Rp : A ↔ B
Rq : B ↔ C
Discrete Mathematics I – p. 129/29
Relations
Rp : A ↔ B
Rq : B ↔ C
Prove: if Rp , Rq functions, then Rp ◦ q a function
Discrete Mathematics I – p. 129/29
Relations
Rp : A ↔ B
Rq : B ↔ C
Prove: if Rp , Rq functions, then Rp ◦ q a function
Proof. Consider any x ∈ A.
Discrete Mathematics I – p. 129/29
Relations
Rp : 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
Discrete Mathematics I – p. 129/29
Relations
Rp : 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
Discrete Mathematics I – p. 129/29
Relations
Rp : 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
Discrete Mathematics I – p. 129/29
Relations
Rp : 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/29
Relations
Rp : A ↔ B
Discrete Mathematics I – p. 130/29
Relations
Rp : A ↔ B
The inverse of p Rp−1 : B ↔ A
Discrete Mathematics I – p. 130/29
Relations
Rp : A ↔ B
The inverse of p Rp−1 : B ↔ A
∀(b, a) ∈ B × A : b(p−1 )a ⇐⇒ a p b
Discrete Mathematics I – p. 130/29
Relations
Rp : 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
Discrete Mathematics I – p. 130/29
Relations
Rp : 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/29
Relations
Relation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Discrete Mathematics I – p. 131/29
Relations
Relation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R=
Discrete Mathematics I – p. 131/29
Relations
Relation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R=
A2
Discrete Mathematics I – p. 131/29
Relations
Relation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R=
A2
R≤
Discrete Mathematics I – p. 131/29
Relations
Relation Rp : A ↔ A is reflexive, if ∀a ∈ A : a p a
Examples: R=
A2
R≤
R|
Discrete Mathematics I – p. 131/29
Relations
Relation 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/29
Relations
Relation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Discrete Mathematics I – p. 132/29
Relations
Relation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R=
Discrete Mathematics I – p. 132/29
Relations
Relation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R=
A2
Discrete Mathematics I – p. 132/29
Relations
Relation Rp : A ↔ A is symmetric, if
∀a, b ∈ A : a p b ⇒ b p a
Examples: R=
A2
∅
Discrete Mathematics I – p. 132/29
Relations
Relation 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)
Discrete Mathematics I – p. 132/29
Relations
Relation 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/29
Relations
Relation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Discrete Mathematics I – p. 133/29
Relations
Relation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R=
Discrete Mathematics I – p. 133/29
Relations
Relation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R=
∅
Discrete Mathematics I – p. 133/29
Relations
Relation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R=
∅
R≤
Discrete Mathematics I – p. 133/29
Relations
Relation Rp : A ↔ A is antisymmetric, if
∀a, b ∈ A : (a p b ∧ b p a) ⇒ a = b
Examples: R=
∅
R≤
R<
Discrete Mathematics I – p. 133/29
Relations
Relation 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=
Discrete Mathematics I – p. 133/29
Relations
Relation 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/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Discrete Mathematics I – p. 134/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
Discrete Mathematics I – p. 134/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
A2
Discrete Mathematics I – p. 134/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
A2
∅
Discrete Mathematics I – p. 134/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
A2
∅
R≤
Discrete Mathematics I – p. 134/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
A2
∅
R≤
R<
Discrete Mathematics I – p. 134/29
Relations
Relation Rp : A ↔ A is transitive, if
∀a, b, c ∈ A : (a p b ∧ b p c) ⇒ a p c
Examples: R=
A2
∅
Rp transitive iff Rp ◦ p ⊆ Rp
R≤
R<
Discrete Mathematics I – p. 134/29
Relations
Relation R∼ : A ↔ A is an equivalence relation,
if it is reflexive, symmetric and transitive
Discrete Mathematics I – p. 135/29
Relations
Relation 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/29
Relations
Examples of equivalence relations:
R=
Discrete Mathematics I – p. 136/29
Relations
Examples of equivalence relations:
R=
Rp : People ↔ People
a p b ⇐⇒ a and b share a birthday
Discrete Mathematics I – p. 136/29
Relations
{. . . , −3, −2, −1, 0, 1, 2, 3, . . . } = Z
integers
Discrete Mathematics I – p. 137/29
Relations
{. . . , −3, −2, −1, 0, 1, 2, 3, . . . } = Z
R| : N ↔ Z
integers
a divides b
a | b ⇐⇒ ∃k ∈ Z : k · a = b
Discrete Mathematics I – p. 137/29
Relations
{. . . , −3, −2, −1, 0, 1, 2, 3, . . . } = Z
R| : N ↔ Z
a | b ⇐⇒ ∃k ∈ Z : k · a = b
R≡ n : Z ↔ Z
integers
a divides b
a ≡n b ⇐⇒ n|(a − b)
Discrete Mathematics I – p. 137/29
Relations
{. . . , −3, −2, −1, 0, 1, 2, 3, . . . } = Z
R| : N ↔ Z
a | b ⇐⇒ ∃k ∈ Z : k · a = b
R≡ n : Z ↔ Z
integers
a divides b
a ≡n b ⇐⇒ n|(a − b)
R≡n is called congruence modulo n
Discrete Mathematics I – p. 137/29
Relations
Prove: R≡n is an equivalence for all n ∈ N, n ≥ 1.
Discrete Mathematics I – p. 138/29
Relations
Prove: R≡n is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Discrete Mathematics I – p. 138/29
Relations
Prove: R≡n is an equivalence for all n ∈ N, n ≥ 1.
Proof. Let n ∈ N, n ≥ 1.
Let x ∈ Z.
Discrete Mathematics I – p. 138/29
Relations
Prove: 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)
Discrete Mathematics I – p. 138/29
Relations
Prove: 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≡n reflexive.
Discrete Mathematics I – p. 138/29
Relations
Let x, y ∈ Z.
Discrete Mathematics I – p. 139/29
Relations
Let x, y ∈ Z.
x ≡n y =⇒ n | (x − y) =⇒ ∃k : k · n = x − y
Discrete Mathematics I – p. 139/29
Relations
Let 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
Discrete Mathematics I – p. 139/29
Relations
Let 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≡n symmetric.
Discrete Mathematics I – p. 139/29
Relations
Let x, y, z ∈ Z.
Discrete Mathematics I – p. 140/29
Relations
Let x, y, z ∈ Z.
x ≡n y =⇒ n | (x − y) =⇒ ∃k : k · n = x − y
Discrete Mathematics I – p. 140/29
Relations
Let 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
Discrete Mathematics I – p. 140/29
Relations
Let 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
Discrete Mathematics I – p. 140/29
Relations
Let 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≡n transitive.
Discrete Mathematics I – p. 140/29
Relations
Let 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≡n transitive.
R≡n reflexive, symmetric and transitive, therefore
R≡n is an equivalence relation.
Discrete Mathematics I – p. 140/29
Relations
R∼ : A ↔ A — an equivalence relation
Discrete Mathematics I – p. 141/29
Relations
R∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set of
all elements related to a
Discrete Mathematics I – p. 141/29
Relations
R∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set of
all elements related to a
[a]∼ = {x ∈ A | x ∼ a}
Discrete Mathematics I – p. 141/29
Relations
R∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set of
all elements related to a
[a]∼ = {x ∈ A | x ∼ a}
By reflexivity, a ∈ [a]∼
Discrete Mathematics I – p. 141/29
Relations
R∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set of
all elements related to a
[a]∼ = {x ∈ A | x ∼ a}
By reflexivity, a ∈ [a]∼
Every a is a representative of [a]∼
Discrete Mathematics I – p. 141/29
Relations
R∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set of
all 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 quotient
set of A with respect to R∼
Discrete Mathematics I – p. 141/29
Relations
R∼ : A ↔ A — an equivalence relation
For any a ∈ A, the equivalence class of a is the set of
all 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 quotient
set of A with respect to R∼
A/R∼ = {[a]∼ | a ∈ A}
Discrete Mathematics I – p. 141/29
Relations
Example:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Discrete Mathematics I – p. 142/29
Relations
Example:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Size ofPeople/Rp =
Discrete Mathematics I – p. 142/29
Relations
Example:
Rp : People ↔ People
x p y ⇐⇒ x and y share a birthday
Size ofPeople/Rp = 366
Discrete Mathematics I – p. 142/29
Relations
Example:
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/29
Relations
Let Fred, George ∈ People
Suppose Fred was born on 1 November
Discrete Mathematics I – p. 143/29
Relations
Let Fred, George ∈ People
Suppose Fred was born on 1 November
[Fred]p = {x ∈ People | x born on 1 November}
Discrete Mathematics I – p. 143/29
Relations
Let 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
Discrete Mathematics I – p. 143/29
Relations
Let 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
Discrete Mathematics I – p. 143/29
Relations
Let 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}
Discrete Mathematics I – p. 143/29
Relations
Let 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/29
Relations
Another example:
R≡ 5 : Z ↔ Z
a ≡5 b ⇐⇒ 5 | (a − b)
Discrete Mathematics I – p. 144/29
Relations
Another example:
R≡ 5 : Z ↔ Z
[0]≡5 =
a ≡5 b ⇐⇒ 5 | (a − b)
Discrete Mathematics I – p. 144/29
Relations
Another example:
R≡ 5 : Z ↔ Z
a ≡5 b ⇐⇒ 5 | (a − b)
[0]≡5 = {. . . , −10, −5, 0, 5, 10, . . . }
Discrete Mathematics I – p. 144/29
Relations
Another example:
R≡ 5 : Z ↔ Z
a ≡5 b ⇐⇒ 5 | (a − b)
[0]≡5 = {. . . , −10, −5, 0, 5, 10, . . . }
[1]≡5 =
Discrete Mathematics I – p. 144/29
Relations
Another 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, . . . }
Discrete Mathematics I – p. 144/29
Relations
Another 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, . . . }
Discrete Mathematics I – p. 144/29
Relations
Another example:
R≡ 5 : Z ↔ Z
[0]≡5
[1]≡5
[2]≡5
[3]≡5
a ≡5 b ⇐⇒ 5 | (a − b)
= {. . . , −10, −5, 0, 5, 10, . . . }
= {. . . , −9, −4, 1, 6, 11, . . . }
= {. . . , −8, −3, 2, 7, 12, . . . }
= {. . . , −7, −2, 3, 8, 13, . . . }
Discrete Mathematics I – p. 144/29
Relations
Another example:
R≡ 5 : Z ↔ Z
[0]≡5
[1]≡5
[2]≡5
[3]≡5
[4]≡5
a ≡5 b ⇐⇒ 5 | (a − b)
= {. . . , −10, −5, 0, 5, 10, . . . }
= {. . . , −9, −4, 1, 6, 11, . . . }
= {. . . , −8, −3, 2, 7, 12, . . . }
= {. . . , −7, −2, 3, 8, 13, . . . }
= {. . . , −6, −1, 4, 9, 14, . . . }
Discrete Mathematics I – p. 144/29
Relations
Another example:
R≡ 5 : Z ↔ Z
[0]≡5
[1]≡5
[2]≡5
[3]≡5
[4]≡5
a ≡5 b ⇐⇒ 5 | (a − b)
= {. . . , −10, −5, 0, 5, 10, . . . }
= {. . . , −9, −4, 1, 6, 11, . . . }
= {. . . , −8, −3, 2, 7, 12, . . . }
= {. . . , −7, −2, 3, 8, 13, . . . }
= {. . . , −6, −1, 4, 9, 14, . . . }
[a]≡5 called residue classes modulo 5 (can be any n)
Discrete Mathematics I – p. 144/29
Relations
R∼ : A ↔ A — an equivalence relation
Discrete Mathematics I – p. 145/29
Relations
R∼ : A ↔ A — an equivalence relation
Theorem.
The equivalence classes of R∼ are pairwise disjoint.
∀a, b ∈ A : ([a]∼ = [b]∼ ) ∨ ([a]∼ ∩ [b]∼ = ∅)
Discrete Mathematics I – p. 145/29
Relations
R∼ : 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.
S
a∈A [a]∼ = A
Discrete Mathematics I – p. 145/29
Relations
R∼ : 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.
S
a∈A [a]∼ = A
A is partitioned by R∼ into a disjoint union of
equivalence classes
Discrete Mathematics I – p. 145/29
Relations
Proof. For all a, b, we need:
([a]∼ = [b]∼ ) ∨ ([a]∼ ∩ [b]∼ = ∅)
Discrete Mathematics I – p. 146/29
Relations
Proof. For all a, b, we need:
([a]∼ = [b]∼ ) ∨ ([a]∼ ∩ [b]∼ = ∅)
Consider two cases: a ∼ b, a 6∼ b.
Discrete Mathematics I – p. 146/29
Relations
Case a ∼ b. Take any x ∈ [a]∼ .
Discrete Mathematics I – p. 147/29
Relations
Case a ∼ b. Take any x ∈ [a]∼ .
(x ∼ a) ∧ (a ∼ b) =⇒ x ∼ b =⇒ x ∈ [b]∼
Discrete Mathematics I – p. 147/29
Relations
Case a ∼ b. Take any x ∈ [a]∼ .
(x ∼ a) ∧ (a ∼ b) =⇒ x ∼ b =⇒ x ∈ [b]∼
Hence [a]∼ ⊆ [b]∼ . Similarly [b]∼ ⊆ [a]∼ .
Discrete Mathematics I – p. 147/29
Relations
Case 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/29
Relations
Case a 6∼ b. Suppose ∃x : x ∈ [a]∼ ∩ [b]∼ .
Discrete Mathematics I – p. 148/29
Relations
Case a 6∼ b. Suppose ∃x : x ∈ [a]∼ ∩ [b]∼ .
(x ∼ a) ∧ (x ∼ b) =⇒ a ∼ b — contradiction.
Discrete Mathematics I – p. 148/29
Relations
Case a 6∼ b. Suppose ∃x : x ∈ [a]∼ ∩ [b]∼ .
(x ∼ a) ∧ (x ∼ b) =⇒ a ∼ b — contradiction.
Therefore [a]∼ ∩ [b]∼ = ∅.
Discrete Mathematics I – p. 148/29
Relations
Case a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅
Discrete Mathematics I – p. 149/29
Relations
Case a ∼ b =⇒ [a]∼ = [b]∼
Case a 6∼ b =⇒ [a]∼ ∩ [b]∼ = ∅
Therefore ([a]∼ = [b]∼ ) ∨ ([a]∼ ∩ [b]∼ = ∅)
Discrete Mathematics I – p. 149/29
Relations
Case 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.
Discrete Mathematics I – p. 149/29
Relations
Case 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.
S
Hence A ⊆ a∈A [a]∼ ⊆ A.
Discrete Mathematics I – p. 149/29
Relations
Case 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.
S
Hence A ⊆ a∈A [a]∼ ⊆ A.
S
Therefore a∈A [a]∼ = A.
Discrete Mathematics I – p. 149/29
Relations
If A finite, A/R∼ finite
Discrete Mathematics I – p. 150/29
Relations
If 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
Discrete Mathematics I – p. 150/29
Relations
If 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/29
Relations
Relation 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. 151/29
Relations
Relation 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/29
Relations
Examples:
R≤ , R ≥ : N ↔ N
Discrete Mathematics I – p. 152/29
Relations
Examples:
R≤ , R ≥ : N ↔ N
4
Hasse diagram (illustration only):
3
2
1
0
R≤
Discrete Mathematics I – p. 152/29
Relations
Examples:
R≤ , R ≥ : N ↔ N
2
2
3
1
4
0
R≤
3
1
4
0
Hasse diagram (illustration only):
R≥
Discrete Mathematics I – p. 152/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is an descendant of y
Discrete Mathematics I – p. 153/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is an descendant of y
(Everyone is his/her own descendant)
Discrete Mathematics I – p. 153/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is an descendant of y
(Everyone is his/her own descendant)
Shem
Ham
Naamah
Noah
Bitenosh
Lamech
Japheth
Discrete Mathematics I – p. 153/29
Relations
R| : N ↔ N
x | y ⇐⇒ ∃k : k · x = y
Discrete Mathematics I – p. 154/29
Relations
R| : N ↔ N
x | y ⇐⇒ ∃k : k · x = y
8
0
9
3
2
6
5
4
10
7
1
Discrete Mathematics I – p. 154/29
Relations
Prove: R| is a partial order.
Discrete Mathematics I – p. 155/29
Relations
Prove: R| is a partial order.
Proof. Let x ∈ N.
Discrete Mathematics I – p. 155/29
Relations
Prove: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Discrete Mathematics I – p. 155/29
Relations
Prove: R| is a partial order.
Proof. Let x ∈ N.
x | x ⇐⇒ ∃k : k · x = x ⇐⇒ T (since 1 · x = x)
Hence R| reflexive.
Discrete Mathematics I – p. 155/29
Relations
Prove: 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.
Discrete Mathematics I – p. 155/29
Relations
Prove: 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
Discrete Mathematics I – p. 155/29
Relations
Prove: 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
Discrete Mathematics I – p. 155/29
Relations
Prove: 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
Discrete Mathematics I – p. 155/29
Relations
Prove: 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/29
Relations
Let x, y, z ∈ N.
Discrete Mathematics I – p. 156/29
Relations
Let x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
Discrete Mathematics I – p. 156/29
Relations
Let x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
Discrete Mathematics I – p. 156/29
Relations
Let x, y, z ∈ N.
x | y =⇒ ∃k : k · x = y
y | z =⇒ ∃l : l · y = z
z = l · y = (k · l) · x =⇒ x | z
Discrete Mathematics I – p. 156/29
Relations
Let 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.
Discrete Mathematics I – p. 156/29
Relations
Let 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, therefore
R| is a partial order.
Discrete Mathematics I – p. 156/29
Relations
R⊆ : P(S) ↔ P(S)
A⊆B
Discrete Mathematics I – p. 157/29
Relations
R⊆ : P(S) ↔ P(S)
S = {0, 1, 2}
A⊆B
Discrete Mathematics I – p. 157/29
Relations
R⊆ : P(S) ↔ P(S)
A⊆B
S = {0, 1, 2}
1
0
02
12
012
01
2
∅
Discrete Mathematics I – p. 157/29
Relations
R : A ↔ A — a partial order
R is called a total order, if for all a, b ∈ A,
either a b or b a
Discrete Mathematics I – p. 158/29
Relations
R : 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/29
Relations
Examples:
R≤
R≥ — total (but still a partial order!)
Discrete Mathematics I – p. 159/29
Relations
Examples:
R≤
RE
R≥ — total (but still a partial order!)
R|
R⊆ — not total
Discrete Mathematics I – p. 159/29
Relations
R : A ↔ A — a partial order (need not be total)
Discrete Mathematics I – p. 160/29
Relations
R : A ↔ A — a partial order (need not be total)
a∈A
Discrete Mathematics I – p. 160/29
Relations
R : 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/29
Relations
a, b ∈ A
Discrete Mathematics I – p. 161/29
Relations
a, 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/29
Relations
a, b ∈ A
Discrete Mathematics I – p. 162/29
Relations
a, b ∈ A
c ∈ A is the least upper bound of a, b, if
Discrete Mathematics I – p. 162/29
Relations
a, b ∈ A
c ∈ A is the least upper bound of a, b, if
•
c is an upper bound of a, b
Discrete Mathematics I – p. 162/29
Relations
a, 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)
Discrete Mathematics I – p. 162/29
Relations
a, 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/29
Relations
a, b ∈ A
Discrete Mathematics I – p. 163/29
Relations
a, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
Discrete Mathematics I – p. 163/29
Relations
a, b ∈ A
d ∈ A is the greatest lower bound of a, b, if
•
d is a lower bound of a, b
Discrete Mathematics I – p. 163/29
Relations
a, 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)
Discrete Mathematics I – p. 163/29
Relations
a, 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/29
Relations
Example:
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
Discrete Mathematics I – p. 164/29
Relations
Example:
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
lub(x, y) = youngest common ancestor(x, y)
Discrete Mathematics I – p. 164/29
Relations
Example:
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
lub(x, y) = youngest common ancestor(x, y)
glb(x, y) = oldest common descendant(x, y)
Discrete Mathematics I – p. 164/29
Relations
Example:
RE : People ↔ People
x E 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/29
Relations
R| : N ↔ N
x | y ⇐⇒ x divides y
Discrete Mathematics I – p. 165/29
Relations
R| : N ↔ N
x | y ⇐⇒ x divides y
lub(a, b) =
Discrete Mathematics I – p. 165/29
Relations
R| : N ↔ N
x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)
Discrete Mathematics I – p. 165/29
Relations
R| : N ↔ N
x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)
always exists
Discrete Mathematics I – p. 165/29
Relations
R| : N ↔ N
x | y ⇐⇒ x divides y
lub(a, b) = least common multiple(a, b)
always exists
glb(a, b) =
Discrete Mathematics I – p. 165/29
Relations
R| : 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)
Discrete Mathematics I – p. 165/29
Relations
R| : 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/29
Relations
R≤ : N ↔ N
Discrete Mathematics I – p. 166/29
Relations
R≤ : N ↔ N
lub(a, b) =
Discrete Mathematics I – p. 166/29
Relations
R≤ : N ↔ N
lub(a, b) = max(a, b)
Discrete Mathematics I – p. 166/29
Relations
R≤ : N ↔ N
lub(a, b) = max(a, b)
always exists
Discrete Mathematics I – p. 166/29
Relations
R≤ : N ↔ N
lub(a, b) = max(a, b)
always exists
glb(a, b) =
Discrete Mathematics I – p. 166/29
Relations
R≤ : N ↔ N
lub(a, b) = max(a, b)
always exists
glb(a, b) = min(a, b)
Discrete Mathematics I – p. 166/29
Relations
R≤ : N ↔ N
lub(a, b) = max(a, b)
always exists
glb(a, b) = min(a, b)
always exists
Discrete Mathematics I – p. 166/29
Relations
R≤ : 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}
Discrete Mathematics I – p. 166/29
Relations
R≤ : 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/29
Relations
R⊆ : P(S) ↔ P(S)
Discrete Mathematics I – p. 167/29
Relations
R⊆ : P(S) ↔ P(S)
lub(A, B) =
Discrete Mathematics I – p. 167/29
Relations
R⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪ B
Discrete Mathematics I – p. 167/29
Relations
R⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪ B
always exists
Discrete Mathematics I – p. 167/29
Relations
R⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪ B
always exists
glb(A, B) =
Discrete Mathematics I – p. 167/29
Relations
R⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪ B
always exists
glb(A, B) = A ∩ B
Discrete Mathematics I – p. 167/29
Relations
R⊆ : P(S) ↔ P(S)
lub(A, B) = A ∪ B
glb(A, B) = A ∩ B
always exists
always exists
Discrete Mathematics I – p. 167/29
Relations
R : A ↔ A — a partial order
Discrete Mathematics I – p. 168/29
Relations
R : A ↔ A — a partial order
R is called a lattice, if for all a, b ∈ A,
lub(a, b) and glb(a, b) exist
Discrete Mathematics I – p. 168/29
Relations
R : 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/29
Relations
Examples:
any total order (e.g. R≤ , R≥ )
Discrete Mathematics I – p. 169/29
Relations
Examples:
any total order (e.g. R≤ , R≥ )
R|
Discrete Mathematics I – p. 169/29
Relations
Examples:
any total order (e.g. R≤ , R≥ )
R|
R⊆ for any S
Discrete Mathematics I – p. 169/29
Relations
R : A ↔ A — a partial order
Discrete Mathematics I – p. 170/29
Relations
R : A ↔ A — a partial order
a ∈ A is maximal:
b ∈ A is minimal:
∀x ∈ A : (a x) ⇒ (a = x)
∀x ∈ A : (x b) ⇒ (b = x)
Discrete Mathematics I – p. 170/29
Relations
R : A ↔ A — a partial order
a ∈ A is maximal:
b ∈ A is minimal:
∀x ∈ A : (a x) ⇒ (a = x)
∀x ∈ A : (x b) ⇒ (b = x)
Can have many maximal/minimal elements
Discrete Mathematics I – p. 170/29
Relations
R : A ↔ A — a partial order
a ∈ A is maximal:
b ∈ A is minimal:
∀x ∈ A : (a x) ⇒ (a = x)
∀x ∈ A : (x b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest:
b ∈ A is the least:
∀x ∈ A : x a
∀x ∈ A : b x
Discrete Mathematics I – p. 170/29
Relations
R : A ↔ A — a partial order
a ∈ A is maximal:
b ∈ A is minimal:
∀x ∈ A : (a x) ⇒ (a = x)
∀x ∈ A : (x b) ⇒ (b = x)
Can have many maximal/minimal elements
a ∈ A is the greatest:
b ∈ A is the least:
∀x ∈ A : x a
∀x ∈ A : b x
Can have at most one greatest/least element
Discrete Mathematics I – p. 170/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
∅ least
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
∅ least
S greatest
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
∅ least
S greatest
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
∅ least
S greatest
0 least
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
∅ least
0 least
S greatest
no greatest
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
∅ least
0 least
S greatest
no greatest
R≥ : N ↔ N
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
R≥ : N ↔ N
∅ least
0 least
S greatest
no greatest
no least
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
R≥ : N ↔ N
∅ least
S greatest
0 least
no greatest
no least
0 greatest
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
R≥ : N ↔ N
∅ least
S greatest
0 least
no greatest
no least
0 greatest
R| : N ↔ N
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
R≥ : N ↔ N
R| : N ↔ N
∅ least
S greatest
0 least
no greatest
no least
0 greatest
1 least
Discrete Mathematics I – p. 171/29
Relations
Examples:
R⊆ : P(S) ↔ P(S)
R≤ : N ↔ N
R≥ : N ↔ N
R| : N ↔ N
∅ least
S greatest
0 least
no greatest
no least
0 greatest
1 least
0 greatest
Discrete Mathematics I – p. 171/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
Discrete Mathematics I – p. 172/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
minimal elements: childless people
Discrete Mathematics I – p. 172/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
Discrete Mathematics I – p. 172/29
Relations
RE : People ↔ People
x E y ⇐⇒ x is a descendant of y
minimal elements: childless people
no least elements
no maximal elements (Adam and Eve? GE?)
Discrete Mathematics I – p. 172/29
Relations
RE : People ↔ People
x E 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/29
Relations
R| : N \ {0, 1} ↔ N \ {0, 1}
Discrete Mathematics I – p. 173/29
Relations
R| : N \ {0, 1} ↔ N \ {0, 1}
minimal elements: prime numbers
Discrete Mathematics I – p. 173/29
Relations
R| : N \ {0, 1} ↔ N \ {0, 1}
minimal elements: prime numbers
no least elements
Discrete Mathematics I – p. 173/29
Relations
R| : N \ {0, 1} ↔ N \ {0, 1}
minimal elements: prime numbers
no least elements
no maximal ⇒ no greatest
Discrete Mathematics I – p. 173/29
Relations
R⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}
Discrete Mathematics I – p. 174/29
Relations
R⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}
minimal elements: singletons
Discrete Mathematics I – p. 174/29
Relations
R⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}
minimal elements: singletons
no least elements
Discrete Mathematics I – p. 174/29
Relations
R⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}
minimal elements: singletons
no least elements
maximal elements: singleton complements
Discrete Mathematics I – p. 174/29
Relations
R⊆ : P(S) \ {∅, S} ↔ P(S) \ {∅, S}
minimal elements: singletons
no least elements
maximal elements: singleton complements
no greatest elements
Discrete Mathematics I – p. 174/29
Relations
A partially ordered set may have no greatest or least
element (even if the set is finite)
Discrete Mathematics I – p. 175/29
Relations
A partially ordered set may have no greatest or least
element (even if the set is finite)
A finite, totally ordered set must have the greatest and
the least elements
Discrete Mathematics I – p. 175/29
Relations
A partially ordered set may have no greatest or least
element (even if the set is finite)
A finite, totally ordered set must have the greatest and
the least elements
A finite, partially ordered set must have maximal and
minimal elements (but may not have the greatest and
the least)
Discrete Mathematics I – p. 175/29
Relations
A partially ordered set may have no greatest or least
element (even if the set is finite)
A finite, totally ordered set must have the greatest and
the least elements
A finite, partially ordered set must have maximal and
minimal elements (but may not have the greatest and
the least)
A maximal or minimal element may not be unique
Discrete Mathematics I – p. 175/29
Relations
A partially ordered set may have no greatest or least
element (even if the set is finite)
A finite, totally ordered set must have the greatest and
the least elements
A finite, partially ordered set must have maximal and
minimal elements (but may not have the greatest and
the 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/29
Functions
Discrete Mathematics I – p. 176/29
Functions
A function from set A to set B is a relation
Rf : A ↔ B, where for every a ∈ A, there is a unique
b ∈ B, such that af b
Discrete Mathematics I – p. 177/29
Functions
B
A
A function from set A to set B is a relation
Rf : A ↔ B, where for every a ∈ A, there is a unique
b ∈ B, such that af b
f
Discrete Mathematics I – p. 177/29
Functions
f : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : af b)
Discrete Mathematics I – p. 178/29
Functions
f : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : af b)
f maps A into B
Discrete Mathematics I – p. 178/29
Functions
f : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : af b)
f maps A into B
Instead of af b, write f (a) = b or f : a 7→ b
Discrete Mathematics I – p. 178/29
Functions
f : A → B ⇐⇒
(Rf : A ↔ B) ∧ (∀a ∈ A : ∃!b ∈ B : af b)
f maps A into B
Instead of af b, write f (a) = b or f : a 7→ b
f maps a to b
Discrete Mathematics I – p. 178/29
Functions
f :A→B
Discrete Mathematics I – p. 179/29
Functions
f :A→B
A is the domain of f
B is the co-domain of f
Domf = A
Codomf = B
Discrete Mathematics I – p. 179/29
Functions
f :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
Discrete Mathematics I – p. 179/29
Functions
f :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 is the image of a
b∈B
a is the pre-image of b
Discrete Mathematics I – p. 179/29
Functions
Examples:
Identity function
idA : A → A
idA = {(a, a) | a ∈ A} = R=A
Discrete Mathematics I – p. 180/29
Functions
Examples:
A
A
idA : A → A
idA = {(a, a) | a ∈ A} = R=A
Identity function
idA
Discrete Mathematics I – p. 180/29
Functions
f :N→N
f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}
Discrete Mathematics I – p. 181/29
Functions
f :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)}
Discrete Mathematics I – p. 181/29
Functions
f :N→N
f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}
g : {0, 1, 2} → N
g⊆f
g = {(0, 0), (1, 1), (2, 4)}
Discrete Mathematics I – p. 181/29
Functions
f :N→N
f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}
g : {0, 1, 2} → N
g⊆f
g = {(0, 0), (1, 1), (2, 4)}
Domg ⊆ Domf
Codomg ⊆ Codomf
Discrete Mathematics I – p. 181/29
Functions
f :N→N
f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}
g : {0, 1, 2} → N
g⊆f
g = {(0, 0), (1, 1), (2, 4)}
Domg ⊆ Domf
Codomg ⊆ Codomf
Function g called a restriction of f
Discrete Mathematics I – p. 181/29
Functions
f :N→N
f = {(m, n) ∈ N2 | m2 = n}
= {(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), . . .}
g : {0, 1, 2} → N
g⊆f
g = {(0, 0), (1, 1), (2, 4)}
Domg ⊆ Domf
Codomg ⊆ Codomf
Function g called a restriction of f
Function f called an extension of g
Discrete Mathematics I – p. 181/29
Functions
An infinite sequence of elements of set A is any
function a : N → A
Discrete Mathematics I – p. 182/29
Functions
An infinite sequence of elements of set A is any
function a : N → A
Integer sequence N → Z, Boolean sequence N → B,
etc.
Discrete Mathematics I – p. 182/29
Functions
An infinite sequence of elements of set A is any
function a : N → A
Integer sequence N → Z, Boolean sequence N → B,
etc.
Instead of a(k) write ak : a = (a0 , a1 , a2 , a3 , . . . )
Discrete Mathematics I – p. 182/29
Functions
An infinite sequence of elements of set A is any
function 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, . . . )
Discrete Mathematics I – p. 182/29
Functions
An infinite sequence of elements of set A is any
function 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
b:N→B
a = (0, 1, 4, 9, 16, . . . )
b = (F, T, F, T, F, . . . )
Discrete Mathematics I – p. 182/29
Functions
Let n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n − 1}
Discrete Mathematics I – p. 183/29
Functions
Let n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n − 1}
A finite sequence of elements of set A is any function
a : Nn → A
Discrete Mathematics I – p. 183/29
Functions
Let n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n − 1}
A finite sequence of elements of set A is any function
a : Nn → A
Example: g = (0, 1, 4)
Discrete Mathematics I – p. 183/29
Functions
Let n ∈ N
Nn = {x ∈ N | x < n} = {0, 1, 2, . . . , n − 1}
A finite sequence of elements of set A is any function
a : Nn → A
Example: g = (0, 1, 4)
Number n is the sequence length
Discrete Mathematics I – p. 183/29
Functions
f :A→B
g:B→C
Discrete Mathematics I – p. 184/29
Functions
f :A→B
g:B→C
The composition of f and g
f ◦g :A→C
Discrete Mathematics I – p. 184/29
Functions
f :A→B
g:B→C
The composition of f and g
Same as relation composition Rf ◦g
f ◦g :A→C
Rf , Rg functions =⇒ Rf ◦g a function
Discrete Mathematics I – p. 184/29
Functions
f :A→B
g:B→C
The composition of f and g
Same as relation composition Rf ◦g
f ◦g :A→C
Rf , Rg functions =⇒ Rf ◦g a function
∀a ∈ A : (f ◦ g)(a) = g(f (a))
Discrete Mathematics I – p. 184/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
n 7→ n2
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
(f ◦ f )(n) =
n 7→ n + 1
n 7→ n2
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
n 7→ n2
(f ◦ f )(n) = (n + 1) + 1 = n + 2
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
n 7→ n2
(f ◦ f )(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) =
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
n 7→ n2
(f ◦ f )(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
n 7→ n2
(f ◦ f )(n) = (n + 1) + 1 = n + 2
(f ◦ g)(n) = (n + 1)2 = n2 + 2n + 1
(g ◦ f )(n) =
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
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
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
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) =
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
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
Discrete Mathematics I – p. 185/29
Functions
Examples:
f :Z→Z
g:Z→Z
n 7→ n + 1
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/29
Functions
f :A→B
Discrete Mathematics I – p. 186/29
Functions
f :A→B
The (functional) inverse of f
f −1 : B → A
Discrete Mathematics I – p. 186/29
Functions
f :A→B
The (functional) inverse of f
f −1 : B → A
Same as relation inverse Rf −1 , but may not be a
function
(we say “functional inverse may not exist”)
Discrete Mathematics I – p. 186/29
Functions
f :A→B
The (functional) inverse of f
f −1 : B → A
Same as relation inverse Rf −1 , but may not be a
function
(we say “functional inverse may not exist”)
∀a ∈ A, b ∈ B : (f (a) = b) ⇔ (f −1 (b) = a)
Discrete Mathematics I – p. 186/29
Functions
Examples:
f :Z→Z
n 7→ n + 1
Discrete Mathematics I – p. 187/29
Functions
Examples:
f :Z→Z
f −1 (n) =
n 7→ n + 1
Discrete Mathematics I – p. 187/29
Functions
Examples:
f :Z→Z
n 7→ n + 1
f −1 (n) = n − 1
Discrete Mathematics I – p. 187/29
Functions
Examples:
f :Z→Z
n 7→ n + 1
g:Z→Z
n 7→ n2
f −1 (n) = n − 1
Discrete Mathematics I – p. 187/29
Functions
Examples:
f :Z→Z
n 7→ n + 1
g:Z→Z
n 7→ n2
f −1 (n) = n − 1
g −1
Discrete Mathematics I – p. 187/29
Functions
Examples:
f :Z→Z
n 7→ n + 1
g:Z→Z
n 7→ n2
f −1 (n) = n − 1
g −1 does not exist (i.e. Rg−1 is not a function)
Discrete Mathematics I – p. 187/29
Functions
f :A→B
Discrete Mathematics I – p. 188/29
Functions
f :A→B
The range of f is the set of all elements in B that have
a pre-image in A
Discrete Mathematics I – p. 188/29
Functions
f :A→B
The range of f is the set of all elements in B that have
a pre-image in A
f (A) = {b ∈ B | ∃a ∈ A : f (a) = b}
Discrete Mathematics I – p. 188/29
Functions
f :A→B
The range of f is the set of all elements in B that have
a pre-image in A
f (A)
B
A
f (A) = {b ∈ B | ∃a ∈ A : f (a) = b}
f
Discrete Mathematics I – p. 188/29
Functions
Examples:
f :N→N
n 7→ n + 1
Discrete Mathematics I – p. 189/29
Functions
Examples:
f :N→N
f (N) =
n 7→ n + 1
Discrete Mathematics I – p. 189/29
Functions
Examples:
f :N→N
f (N) = N \ {0} = {1, 2, 3, 4, . . . }
n 7→ n + 1
Discrete Mathematics I – p. 189/29
Functions
Examples:
f :N→N
f (N) = N \ {0} = {1, 2, 3, 4, . . . }
g : {0, 1, 2} → N
n 7→ n + 1
n 7→ n2
Discrete Mathematics I – p. 189/29
Functions
Examples:
f :N→N
f (N) = N \ {0} = {1, 2, 3, 4, . . . }
g : {0, 1, 2} → N
g({0, 1, 2}) =
n 7→ n + 1
n 7→ n2
Discrete Mathematics I – p. 189/29
Functions
Examples:
f :N→N
f (N) = N \ {0} = {1, 2, 3, 4, . . . }
g : {0, 1, 2} → N
g({0, 1, 2}) = {0, 1, 4}
n 7→ n + 1
n 7→ n2
Discrete Mathematics I – p. 189/29
Functions
Function called surjective, if its range is the whole
co-domain
Discrete Mathematics I – p. 190/29
Functions
Function called surjective, if its range is the whole
co-domain
f : A B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f (a) = b
Discrete Mathematics I – p. 190/29
Functions
Function called surjective, if its range is the whole
co-domain
B
A
f : A B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f (a) = b
f
Discrete Mathematics I – p. 190/29
Functions
Function called surjective, if its range is the whole
co-domain
B
A
f : A B ⇐⇒ ∀b ∈ B : ∃a ∈ A : f (a) = b
f
Also say f maps A onto B
Discrete Mathematics I – p. 190/29
Functions
Function called injective, if it maps different elements
to different elements
Discrete Mathematics I – p. 191/29
Functions
Function called injective, if it maps different elements
to different elements
f : A B ⇐⇒ ∀x, y : (f (x) = f (y)) ⇒ (x = y)
Discrete Mathematics I – p. 191/29
Functions
Function called injective, if it maps different elements
to different elements
B
A
f : A B ⇐⇒ ∀x, y : (f (x) = f (y)) ⇒ (x = y)
f
Discrete Mathematics I – p. 191/29
Functions
Function called injective, if it maps different elements
to different elements
B
A
f : A B ⇐⇒ ∀x, y : (f (x) = f (y)) ⇒ (x = y)
f
Also say f maps A into B one-to-one
Discrete Mathematics I – p. 191/29
Functions
Examples:
f : Cards {♠, ♥, ♣, ♦}
f : x 7→ suit of x
Discrete Mathematics I – p. 192/29
Functions
Examples:
f : Cards {♠, ♥, ♣, ♦}
f : x 7→ suit of x
Function f surjective, but not injective
Discrete Mathematics I – p. 192/29
Functions
Examples:
f : Cards {♠, ♥, ♣, ♦}
f : x 7→ suit of x
Function f surjective, but not injective
g:NN
g : m 7→ m2
Discrete Mathematics I – p. 192/29
Functions
Examples:
f : Cards {♠, ♥, ♣, ♦}
f : x 7→ suit of x
Function f surjective, but not injective
g:NN
Function g injective, but not surjective
g : m 7→ m2
Discrete Mathematics I – p. 192/29
Functions
Function called bijective, if it is both surjective and
injective
Discrete Mathematics I – p. 193/29
Functions
Function called bijective, if it is both surjective and
injective
f : A
B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f (a) = b
Discrete Mathematics I – p. 193/29
Functions
Function called bijective, if it is both surjective and
injective
B
A
f : A
B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f (a) = b
f
Discrete Mathematics I – p. 193/29
Functions
Function called bijective, if it is both surjective and
injective
B
A
f : A
B ⇐⇒ ∀b ∈ B : ∃!a ∈ A : f (a) = b
f
Also say f is a one-to-one correspondence between A
and B
Discrete Mathematics I – p. 193/29
Functions
Examples:
idA : A A
a 7→ a
Discrete Mathematics I – p. 194/29
Functions
Examples:
idA : A A
Function idA bijective for any set A
a 7→ a
Discrete Mathematics I – p. 194/29
Functions
Examples:
idA : A A
Function idA bijective for any set A
a 7→ a
id−1
A = idA
Discrete Mathematics I – p. 194/29
Functions
Examples:
idA : A A
Function idA bijective for any set A
a 7→ a
id−1
A = idA
f : Z
Z
n 7→ n + 5
Discrete Mathematics I – p. 194/29
Functions
Examples:
idA : A A
Function idA bijective for any set A
a 7→ a
id−1
A = idA
f : Z
Z
g : Z
Z
n 7→ n + 5
n 7→ −n
Discrete Mathematics I – p. 194/29
Functions
f : Z
Z
n 7→ n + 5
Discrete Mathematics I – p. 195/29
Functions
f : Z
Z
Function f bijective
n 7→ n + 5
Discrete Mathematics I – p. 195/29
Functions
f : Z
Z
Function f bijective
Z
f −1 : Z n 7→ n + 5
m 7→ m − 5
Discrete Mathematics I – p. 195/29
Functions
f : Z
Z
Function f bijective
Z
f −1 : Z f ◦ f −1 = f −1 ◦ f = idZ
n 7→ n + 5
m 7→ m − 5
Discrete Mathematics I – p. 195/29
Functions
f : Z
Z
Function f bijective
Z
f −1 : Z f ◦ f −1 = f −1 ◦ f = idZ
n 7→ n + 5
m 7→ m − 5
For any set A, bijective f : A A is a permutation
Discrete Mathematics I – p. 195/29
Functions
g : Z
Z
n 7→ −n
Discrete Mathematics I – p. 196/29
Functions
g : Z
Z
Function g bijective
n 7→ −n
Discrete Mathematics I – p. 196/29
Functions
g : Z
Z
Function g bijective
Z
g −1 : Z n 7→ −n
g −1 = g
Discrete Mathematics I – p. 196/29
Functions
g : Z
Z
Function g bijective
Z
g −1 : Z n 7→ −n
g −1 = g
g ◦ g −1 = g −1 ◦ g = g ◦ g = idZ
Discrete Mathematics I – p. 196/29
Functions
g : Z
Z
Function g bijective
Z
g −1 : Z n 7→ −n
g −1 = g
g ◦ g −1 = g −1 ◦ g = g ◦ g = idZ
For any set A, a permutation g : A A with g −1 = g
is an involution
Discrete Mathematics I – p. 196/29
Functions
f :A→B
g:B→C
Discrete Mathematics I – p. 197/29
Functions
f :A→B
g:B→C
If f , g surjective, then f ◦ g surjective
Discrete Mathematics I – p. 197/29
Functions
f :A→B
g:B→C
If f , g surjective, then f ◦ g surjective
If f , g injective, then f ◦ g injective
Discrete Mathematics I – p. 197/29
Functions
f :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/29
Functions
Prove: if f bijective, then f −1 bijective.
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
∀b ∈ B : ∃!a ∈ A : b(f −1 )a =⇒
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
∀b ∈ B : ∃!a ∈ A : b(f −1 )a =⇒ f −1 a function
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
∀b ∈ B : ∃!a ∈ A : b(f −1 )a =⇒ f −1 a function
f a function =⇒
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
∀b ∈ B : ∃!a ∈ A : b(f −1 )a =⇒ f −1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : af b =⇒
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
∀b ∈ B : ∃!a ∈ A : b(f −1 )a =⇒ f −1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : af b =⇒
∀a ∈ A : ∃!b ∈ B : b(f −1 )a =⇒
Discrete Mathematics I – p. 198/29
Functions
Prove: if f bijective, then f −1 bijective.
Proof. Consider Rf : A ↔ B, Rf −1 : B ↔ A
f bijective =⇒ ∀b ∈ B : ∃!a ∈ A : af b =⇒
∀b ∈ B : ∃!a ∈ A : b(f −1 )a =⇒ f −1 a function
f a function =⇒ ∀a ∈ A : ∃!b ∈ B : af b =⇒
∀a ∈ A : ∃!b ∈ B : b(f −1 )a =⇒ f −1 bijective
Discrete Mathematics I – p. 198/29
Functions
Prove: if both f and f −1 are functions, then both f
and f −1 are bijective
Discrete Mathematics I – p. 199/29
Functions
Prove: if both f and f −1 are functions, then both f
and f −1 are bijective
Proof (sketch). Let f : A → B, f −1 : B → A.
Discrete Mathematics I – p. 199/29
Functions
Prove: if both f and f −1 are functions, then both f
and f −1 are bijective
Proof (sketch). Let f : A → B, f −1 : B → A.
f a function ⇒ f −1 surjective
Discrete Mathematics I – p. 199/29
Functions
Prove: if both f and f −1 are functions, then both f
and 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
Discrete Mathematics I – p. 199/29
Functions
Prove: if both f and f −1 are functions, then both f
and 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
Discrete Mathematics I – p. 199/29
Functions
Prove: if both f and f −1 are functions, then both f
and 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/29
Functions
S — any set
A⊆S
B = {F, T }
Discrete Mathematics I – p. 200/29
Functions
S — any set
A⊆S
Indicator function of A
B = {F, T }
χA : S → B
Discrete Mathematics I – p. 200/29
Functions
S — any set
A⊆S
Indicator function of A
B = {F, T }
χA : S → B
T
∀x ∈ S : χA (x) =
F
if x ∈ A
if x 6∈ A
Discrete Mathematics I – p. 200/29
Functions
S — any set
A⊆S
Indicator function of A
B = {F, T }
χA : S → B
T
∀x ∈ S : χA (x) =
F
Set of all subsets of S
if x ∈ A
if x 6∈ A
P(S) = {A | A ⊆ S}
Discrete Mathematics I – p. 200/29
Functions
S — any set
A⊆S
Indicator function of A
B = {F, T }
χA : S → B
T
∀x ∈ S : χA (x) =
F
Set of all subsets of S
if x ∈ A
if x 6∈ A
P(S) = {A | A ⊆ S}
Set of all Boolean functions on S:
B(S) = {f | f : S → B}
Discrete Mathematics I – p. 200/29
Functions
S — any set
A⊆S
Indicator function of A
B = {F, T }
χA : S → B
T
∀x ∈ S : χA (x) =
F
Set of all subsets of S
if x ∈ A
if x 6∈ A
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
Discrete Mathematics I – p. 200/29
Functions
S — any set
A⊆S
Indicator function of A
B = {F, T }
χA : S → B
T
∀x ∈ S : χA (x) =
F
Set of all subsets of S
if x ∈ A
if x 6∈ A
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/29
Functions
Sets A, B are called equinumerous, if there is a
bijection between A and B
Discrete Mathematics I – p. 201/29
Functions
Sets A, B are called equinumerous, if there is a
bijection between A and B
A∼
B
= B ⇐⇒ ∃f : A Discrete Mathematics I – p. 201/29
Functions
Sets A, B are called equinumerous, if there is a
bijection between A and B
A∼
B
= B ⇐⇒ ∃f : A A, B ⊆ S =⇒ R∼
= an equivalence on P(S)
Discrete Mathematics I – p. 201/29
Functions
n∈N
Nn = {x ∈ N | x < n}
Discrete Mathematics I – p. 202/29
Functions
n∈N
Nn = {x ∈ N | x < n}
N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Discrete Mathematics I – p. 202/29
Functions
n∈N
Nn = {x ∈ N | x < n}
N0 = ∅ N1 = {0} N2 = {0, 1} . . .
Nn = {0, 1, 2, . . . , n − 1}
Discrete Mathematics I – p. 202/29
Functions
n∈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
Discrete Mathematics I – p. 202/29
Functions
n∈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/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
A.
Let f : A Nk . Then f −1 : Nk Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
A.
Let f : A Nk . Then f −1 : Nk Let g : A Nl .
Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
A.
Let f : A Nk . Then f −1 : Nk Let g : A Nl .
f −1 ◦ g : Nk Nl . Therefore k = l.
Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
A.
Let f : A Nk . Then f −1 : Nk Let g : A Nl .
f −1 ◦ g : Nk Nl . Therefore k = l.
Number n called the cardinality of A
Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
A.
Let f : A Nk . Then f −1 : Nk Let g : A Nl .
f −1 ◦ g : Nk Nl . Therefore k = l.
Number n called the cardinality of A
|A| = n
Discrete Mathematics I – p. 203/29
Functions
For every finite set A, there is a unique n ∈ N, such
that A ∼
= Nn
Proof.
A.
Let f : A Nk . Then f −1 : Nk Let g : A Nl .
f −1 ◦ g : Nk Nl . Therefore k = l.
Number n called the cardinality of A
A, B finite, A ∼
= B =⇒ |A| = |B|
|A| = n
Discrete Mathematics I – p. 203/29
Functions
N, Z, N2 , N3 , P(N), Neven — infinite
Discrete Mathematics I – p. 204/29
Functions
N, Z, N2 , N3 , P(N), Neven — infinite
An infinite set is called countable, if it is
equinumerous with N
Discrete Mathematics I – p. 204/29
Functions
N, Z, N2 , N3 , P(N), Neven — infinite
An infinite set is called countable, if it is
equinumerous with N
In particular, N itself is countable
Discrete Mathematics I – p. 204/29
Functions
Prove: set N+ = N \ {0} is countable.
Discrete Mathematics I – p. 205/29
Functions
Prove: set N+ = N \ {0} is countable.
Proof. Let f : N → N+
∀n : n 7→ n + 1
Discrete Mathematics I – p. 205/29
Functions
Prove: 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)
Discrete Mathematics I – p. 205/29
Functions
Prove: 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
Discrete Mathematics I – p. 205/29
Functions
Prove: 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)
Discrete Mathematics I – p. 205/29
Functions
Prove: 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
Discrete Mathematics I – p. 205/29
Functions
Prove: 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/29
Functions
N+ ⊆ N
Discrete Mathematics I – p. 206/29
Functions
N+ ⊆ N
0 1 2 3 4 5 6 7···
l l l l l l l l
1 2 3 4 5 6 7 8···
Discrete Mathematics I – p. 206/29
Functions
N+ ⊆ N
N+ ∼
=N
0 1 2 3 4 5 6 7···
l l l l l l l l
1 2 3 4 5 6 7 8···
Discrete Mathematics I – p. 206/29
Functions
N+ ⊆ N
0 1 2 3 4 5 6 7···
l l l l l l l l
1 2 3 4 5 6 7 8···
N+ ∼
=N
A part is of the same size as the whole!
Discrete Mathematics I – p. 206/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
Discrete Mathematics I – p. 207/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven
∀n : n 7→ 2n
Discrete Mathematics I – p. 207/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven
∀n ∈ Neven : n = 2 · n/2 = f (n/2)
∀n : n 7→ 2n
Discrete Mathematics I – p. 207/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
Proof. Let f : N → Neven
∀n ∈ Neven : n = 2 · n/2 = f (n/2)
∀n : n 7→ 2n
Hence f surjective
Discrete Mathematics I – p. 207/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
∀n : n 7→ 2n
Proof. Let f : N → Neven
∀n ∈ Neven : n = 2 · n/2 = f (n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Discrete Mathematics I – p. 207/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
∀n : n 7→ 2n
Proof. Let f : N → Neven
∀n ∈ Neven : n = 2 · n/2 = f (n/2)
Hence f surjective
∀m, n ∈ N : (m 6= n) ⇒ (2m 6= 2n)
Hence f injective
Discrete Mathematics I – p. 207/29
Functions
Prove: set Neven = {0, 2, 4, 6, . . . } is countable.
∀n : n 7→ 2n
Proof. Let f : N → Neven
∀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/29
Functions
Neven ⊆ N
Discrete Mathematics I – p. 208/29
Functions
Neven ⊆ N
0 1 2 3 4
5
6
7···
l l l l l l l l
0 2 4 6 8 10 12 14 · · ·
Discrete Mathematics I – p. 208/29
Functions
Neven ⊆ N
Neven ∼
=N
0 1 2 3 4
5
6
7···
l l l l l l l l
0 2 4 6 8 10 12 14 · · ·
Discrete Mathematics I – p. 208/29
Functions
Neven ⊆ N
0 1 2 3 4
5
6
7···
l l l l l l l l
0 2 4 6 8 10 12 14 · · ·
Neven ∼
=N
In general, any subset of a countable set is finite or
countable.
Discrete Mathematics I – p. 208/29
Functions
Neven ⊆ N
0 1 2 3 4
5
6
7···
l l l l l l l l
0 2 4 6 8 10 12 14 · · ·
Neven ∼
=N
In general, any subset of a countable set is finite or
countable. Any quotient set of a countable set is finite
or countable.
Discrete Mathematics I – p. 208/29
Functions
Prove: set Z is countable.
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
l
l
l
l l l l l l
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
l
l
l
l l l l l l
0
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
l
l
l
l l l l l l
0 1
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
l
l
l
l l l l l l
2 0 1
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
l
l
l
l l l l l l
2 0 1 3
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
l
l
l
4
l l l l l l
2 0 1 3
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
···
l
8
l
6
l
4
l l l l l l
2 0 1 3 5 7···
Discrete Mathematics I – p. 209/29
Functions
Prove: set Z is countable.
Proof. Let f : N → Z
(n + 1)/2 if n odd
∀n : n 7→
−n/2
if n even
· · · −4 −3 −2 −1 0 1 2 3 4 · · ·
···
l
8
l
6
l
4
l l l l l l
2 0 1 3 5 7···
f bijective
Discrete Mathematics I – p. 209/29
Functions
Prove: Set N2 = N × N is countable.
Discrete Mathematics I – p. 210/29
Functions
Prove: Set N2 = N × N is countable.
Proof idea:
0
1
2
3
4
0
1
2
3
4
Discrete Mathematics I – p. 210/29
Functions
Prove: Set N2 = N × N is countable.
Proof idea:
0
0
1
2
3
4
0
1
2
3
4
Discrete Mathematics I – p. 210/29
Functions
Prove: Set N2 = N × N is countable.
Proof idea:
0
1
0
0
1
1
2
2
3
4
2
3
4
Discrete Mathematics I – p. 210/29
Functions
Prove: Set N2 = N × N is countable.
Proof idea:
0
1
2
0
0
1
3
1
2
4
2
5
3
4
3
4
Discrete Mathematics I – p. 210/29
Functions
Prove: Set N2 = N × N is countable.
Proof idea:
0
1
2
3
0
0
1
3
6
1
2
4
7
2
5
8
3
9
4
4
Discrete Mathematics I – p. 210/29
Functions
Prove: 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/29
Functions
Prove: 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/29
Functions
Prove: Set N3 = N × N × N is countable.
Discrete Mathematics I – p. 211/29
Functions
Prove: Set N3 = N × N × N is countable.
Proof. N3 = (N × N) × N ∼
=N×N∼
=N
Discrete Mathematics I – p. 211/29
Functions
Prove: Set N3 = N × N × N is countable.
Proof. N3 = (N × N) × N ∼
=N×N∼
=N
In general, the Cartesian product of a finite number of
countable sets is countable
Discrete Mathematics I – p. 211/29
Functions
Prove: Set N3 = N × N × N is countable.
Proof. N3 = (N × N) × N ∼
=N×N∼
=N
In general, the Cartesian product of a finite number of
countable sets is countable
Not true for an infinite Cartesian product!
Discrete Mathematics I – p. 211/29
Functions
A digression on rational numbers
Discrete Mathematics I – p. 212/29
Functions
A digression on rational numbers
Fractions 1/2, −3/4, 355/113
Discrete Mathematics I – p. 212/29
Functions
A 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/29
Functions
a/b = c/d ⇐⇒ a · d = b · c
b, d 6= 0
Discrete Mathematics I – p. 213/29
Functions
a/b = c/d ⇐⇒ a · d = b · c
R∼ : Z 2 ↔ Z 2
b, d 6= 0
(a, b) ∼ (c, d) ⇐⇒ a · d = b · c
Discrete Mathematics I – p. 213/29
Functions
a/b = c/d ⇐⇒ a · d = b · c
R∼ : Z 2 ↔ Z 2
b, d 6= 0
(a, b) ∼ (c, d) ⇐⇒ a · d = b · c
The rational numbers: Q = Z2 /R∼
Discrete Mathematics I – p. 213/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
Discrete Mathematics I – p. 214/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
0
1
Discrete Mathematics I – p. 214/29
Functions
0
1/2
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
1
Discrete Mathematics I – p. 214/29
Functions
0
1/3 1/2
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
1
Discrete Mathematics I – p. 214/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
0
1/3 1/2
5/12
1
Discrete Mathematics I – p. 214/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
0
1/3 1/2
5/12
1
Discrete Mathematics I – p. 214/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
0
1/3 1/2
5/12
1
∀a, b ∈ Q : (a < b) ⇒ ∃x ∈ Q : a < x < b
Discrete Mathematics I – p. 214/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
0
1/3 1/2
5/12
1
∀a, b ∈ Q : (a < b) ⇒ ∃x ∈ Q : a < x < b
Still, set Q is countable
Discrete Mathematics I – p. 214/29
Functions
Set Q is infinite, and also dense: for any two distinct
rationals, there is a rational in between
0
1/3 1/2
5/12
1
∀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/29
Functions
Sets N, Z, Q countable: N ∼
=Z∼
=Q
Discrete Mathematics I – p. 215/29
Functions
Sets N, Z, Q countable: N ∼
=Z∼
=Q
N∼
= N3 ∼
=N×Z×Q∼
= ···
= N2 ∼
Discrete Mathematics I – p. 215/29
Functions
Sets N, Z, Q countable: N ∼
=Z∼
=Q
N∼
= N3 ∼
=N×Z×Q∼
= ···
= N2 ∼
Are there any uncountable sets?
Discrete Mathematics I – p. 215/29
Functions
Cantor’s Theorem. For all sets A, A 6∼
= P(A).
Discrete Mathematics I – p. 216/29
Functions
Cantor’s Theorem. For all sets A, A 6∼
= P(A).
Proof. Suppose ∃f : A P(A).
Discrete Mathematics I – p. 216/29
Functions
Cantor’s Theorem. For all sets A, A 6∼
= P(A).
Proof. Suppose ∃f : A P(A).
Let D = {a ∈ A | a 6∈ f (a)}
Discrete Mathematics I – p. 216/29
Functions
Cantor’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
Discrete Mathematics I – p. 216/29
Functions
Cantor’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?
Discrete Mathematics I – p. 216/29
Functions
Cantor’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
Discrete Mathematics I – p. 216/29
Functions
Cantor’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
Discrete Mathematics I – p. 216/29
Functions
Cantor’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/29
Functions
Corollary. Set P(N) is uncountable.
Discrete Mathematics I – p. 217/29
Functions
Corollary. Set P(N) is uncountable.
P(N) ∼
= B(N) = {f : N → B} =⇒ B(N) 6∼
=N
Discrete Mathematics I – p. 217/29
Functions
Corollary. Set P(N) is uncountable.
P(N) ∼
= B(N) = {f : N → B} =⇒ B(N) 6∼
=N
B = {F, T } ∼
= {0, 1} = N2 ⊆ N
Discrete Mathematics I – p. 217/29
Functions
Corollary. 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 × · · ·
Discrete Mathematics I – p. 217/29
Functions
Corollary. 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/29
Functions
A digression on real numbers
Discrete Mathematics I – p. 218/29
Functions
A digression on real numbers
√
Rationals (20, −3/5, . . . ), irrationals ( 2, π, . . . )
Discrete Mathematics I – p. 218/29
Functions
A digression on real numbers
√
Rationals (20, −3/5, . . . ), irrationals ( 2, π, . . . )
Definition: Dedekind cuts of Q
Discrete Mathematics I – p. 218/29
Functions
A digression on real numbers
√
Rationals (20, −3/5, . . . ), irrationals ( 2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q 0 ∪ Q1
∀x ∈ Q0 , y ∈ Q1 : x < y
Discrete Mathematics I – p. 218/29
Functions
A digression on real numbers
√
Rationals (20, −3/5, . . . ), irrationals ( 2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q 0 ∪ Q1
Q
Q0
∀x ∈ Q0 , y ∈ Q1 : x < y
Q1
Discrete Mathematics I – p. 218/29
Functions
A digression on real numbers
√
Rationals (20, −3/5, . . . ), irrationals ( 2, π, . . . )
Definition: Dedekind cuts of Q
Q = Q 0 ∪ Q1
Q
Q0
∀x ∈ Q0 , y ∈ Q1 : x < y
Q1
Every Dedekind cut defines a real number
Discrete Mathematics I – p. 218/29
Functions
The real numbers R = {all Dedekind cuts of Q}
Discrete Mathematics I – p. 219/29
Functions
The real numbers R = {all Dedekind cuts of Q}
Irrationals are “gaps between rationals”
Discrete Mathematics I – p. 219/29
Functions
The real numbers R = {all Dedekind cuts of Q}
Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Discrete Mathematics I – p. 219/29
Functions
The real numbers R = {all Dedekind cuts of Q}
Irrationals are “gaps between rationals”
Example: π = 3.1415926536 . . .
Number π defined by
Discrete Mathematics I – p. 219/29
Functions
The 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, . . .}
Discrete Mathematics I – p. 219/29
Functions
The 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 positional
number system (decimal, binary, etc.)
Discrete Mathematics I – p. 219/29
Functions
Is set R countable?
Discrete Mathematics I – p. 220/29
Functions
Is set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}
Discrete Mathematics I – p. 220/29
Functions
Is set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}
Decimal representation of a: sequence N → N10
Discrete Mathematics I – p. 220/29
Functions
Is set R countable?
Consider [0, 1] = {a ∈ R : 0 ≤ a < 1}
Decimal representation of a: sequence N → N10
For example, π − 3 = .141592
Discrete Mathematics I – p. 220/29
Functions
Is 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
...
Discrete Mathematics I – p. 220/29
Functions
Is 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/29
Functions
B = {F, T } ∼
= {0, 1} = N2 ⊆ N10 =⇒
Discrete Mathematics I – p. 221/29
Functions
B = {F, T } ∼
= {0, 1} = N2 ⊆ N10 =⇒
B(N) = {f : N → B} ∼
=
{f : N → N2 } ⊆ {f : N → N10 } ∼
= [0, 1]
Discrete Mathematics I – p. 221/29
Functions
B = {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
Discrete Mathematics I – p. 221/29
Functions
B = {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/29
Functions
Finite sets:
Discrete Mathematics I – p. 222/29
Functions
Finite sets:
Discrete Mathematics I – p. 222/29
Functions
Finite sets:
n elements, n − 1 gaps
Discrete Mathematics I – p. 222/29
Functions
Finite sets:
n elements, n − 1 gaps
Infinite sets:
Discrete Mathematics I – p. 222/29
Functions
Finite sets:
n elements, n − 1 gaps
Infinite sets:
R are gaps in Q, but R is much bigger than Q
Discrete Mathematics I – p. 222/29
Functions
Finite 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/29
Functions
N, P(N), P(P(N)), . . . — uncountable
Discrete Mathematics I – p. 223/29
Functions
N, P(N), P(P(N)), . . . — uncountable
All of different cardinalities — and there any many
more. . .
Discrete Mathematics I – p. 223/29
Functions
N, P(N), P(P(N)), . . . — uncountable
All of different cardinalities — and there any many
more. . .
So much more they don’t even form a set!
Discrete Mathematics I – p. 223/29
Induction
Discrete Mathematics I – p. 224/29
Induction
Natural numbers: N = {0, 1, 2, 3, 4, 5, 6, 7, . . . }
Discrete Mathematics I – p. 225/29
Induction
Natural numbers: N = {0, 1, 2, 3, 4, 5, 6, 7, . . . }
God created the natural numbers, all the rest
is the work of man.
L. Kronecker (1823–1891)
Discrete Mathematics I – p. 225/29
Induction
The only possible definition of N is self-referential:
Discrete Mathematics I – p. 226/29
Induction
The only possible definition of N is self-referential:
•
0∈N
Discrete Mathematics I – p. 226/29
Induction
The only possible definition of N is self-referential:
•
•
0∈N
for all x ∈ N next(x) ∈ N
Discrete Mathematics I – p. 226/29
Induction
The only possible definition of N is self-referential:
•
•
•
0∈N
for all x ∈ N next(x) ∈ N
everything else 6∈ N
Discrete Mathematics I – p. 226/29
Induction
The 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/29
Induction
Structure of inductive definition:
Discrete Mathematics I – p. 227/29
Induction
Structure of inductive definition:
•
induction base
Discrete Mathematics I – p. 227/29
Induction
Structure of inductive definition:
•
induction base
•
inductive step(s)
Discrete Mathematics I – p. 227/29
Induction
Structure of inductive definition:
•
induction base
•
inductive step(s)
•
completeness (sometimes implicit)
Discrete Mathematics I – p. 227/29
Induction
For example, a queue:
Discrete Mathematics I – p. 228/29
Induction
For example, a queue:
•
the empty set ∅ is a queue;
Discrete Mathematics I – p. 228/29
Induction
For example, a queue:
•
the empty set ∅ is a queue;
•
a queue with a new person behind is still a queue
Discrete Mathematics I – p. 228/29
Induction
For 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
Discrete Mathematics I – p. 228/29
Induction
For 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/29
Induction
Another example: Boolean statements
Discrete Mathematics I – p. 229/29
Induction
Another example: Boolean statements
•
F , T are statements
Discrete Mathematics I – p. 229/29
Induction
Another example: Boolean statements
•
F , T are statements
•
if A, B are statements, then ¬A, A ∧ B, A ∨ B,
A ⇒ B, A ⇔ B are statements
Discrete Mathematics I – p. 229/29
Induction
Another 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/29
Induction
In general:
Discrete Mathematics I – p. 230/29
Induction
In general:
•
induction base: initial objects
Discrete Mathematics I – p. 230/29
Induction
In general:
•
induction base: initial objects
•
inductive step(s): ways to make new objects
Discrete Mathematics I – p. 230/29
Induction
In general:
•
induction base: initial objects
•
inductive step(s): ways to make new objects
•
completeness: no other objects allowed!
Discrete Mathematics I – p. 230/29
Induction
Inductive proofs: “the domino principle”
Discrete Mathematics I – p. 231/29
Induction
Inductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
Discrete Mathematics I – p. 231/29
Induction
Inductive proofs: “the domino principle”
Need to prove ∀x ∈ N : P (x) for some P
•
induction base: P (0)
Discrete Mathematics I – p. 231/29
Induction
Inductive 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)
Discrete Mathematics I – p. 231/29
Induction
Inductive 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/29
Induction
Example: plane colouring
Discrete Mathematics I – p. 232/29
Induction
Example: plane colouring
Discrete Mathematics I – p. 232/29
Induction
Example: plane colouring
Discrete Mathematics I – p. 232/29
Induction
Example: plane colouring
Consider n lines in the plane.
Discrete Mathematics I – p. 232/29
Induction
Example: plane colouring
Consider n lines in the plane.
Can always colour regions like a chessboard.
Discrete Mathematics I – p. 232/29
Induction
Proof.
Induction base: n = 0.
Discrete Mathematics I – p. 233/29
Induction
Proof.
Induction base: n = 0. Paint the plane white.
Discrete Mathematics I – p. 233/29
Induction
Proof.
Induction base: n = 0. Paint the plane white.
Discrete Mathematics I – p. 233/29
Induction
Inductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Discrete Mathematics I – p. 234/29
Induction
Inductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Discrete Mathematics I – p. 234/29
Induction
Inductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Discrete Mathematics I – p. 234/29
Induction
Inductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Discrete Mathematics I – p. 234/29
Induction
Inductive step. Suppose can colour for n lines.
Need to color for n + 1 lines.
Add another line, invert all colours on one side.
Discrete Mathematics I – p. 234/29
Induction
Inductive 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/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
Proof.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
Proof. Induction base:
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
Proof. Induction base: 8 = 3 + 5.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
Proof. Induction base: 8 = 3 + 5.
Inductive step. Suppose can pay n (n ≥ 8).
We need: can pay n + 1
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
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.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
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.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
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 at
least three 3s.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
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 at
least three 3s. Replace 3 + 3 + 3 → 5 + 5.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
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 at
least three 3s. Replace 3 + 3 + 3 → 5 + 5.
In both cases have paid n + 1.
Discrete Mathematics I – p. 235/29
Induction
Prove: Any postage ≥ 8p can be paid by 3p and 5p
stamps.
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 at
least 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/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Discrete Mathematics I – p. 236/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof.
Discrete Mathematics I – p. 236/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
Discrete Mathematics I – p. 236/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒
Discrete Mathematics I – p. 236/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒
Discrete Mathematics I – p. 236/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒
P(A) = {∅} =⇒
Discrete Mathematics I – p. 236/29
Induction
Prove: For any finite set A,
|A| = n =⇒ |P(A)| = 2n
Proof. Induction base:
|A| = 0 =⇒ A = ∅ =⇒
P(A) = {∅} =⇒ |P(A)| = 1 = 20
Discrete Mathematics I – p. 236/29
Induction
Prove: 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/29
Induction
Let a ∈ A
B = A \ {a}.
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
Q = {X ∪ {a} | X ∈ P }
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
P(A) = P ∪ Q
Q = {X ∪ {a} | X ∈ P }
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
P(A) = P ∪ Q
Q = {X ∪ {a} | X ∈ P }
P ∩Q=∅
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
P(A) = P ∪ Q
Q = {X ∪ {a} | X ∈ P }
P ∩Q=∅
|P | = |Q| = 2n
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
P(A) = P ∪ Q
Q = {X ∪ {a} | X ∈ P }
P ∩Q=∅
|P | = |Q| = 2n
Hence |P(A)| = |P | + |Q| = 2n + 2n = 2n · 2 = 2n+1
Discrete Mathematics I – p. 237/29
Induction
Let a ∈ A
B = A \ {a}.
We have |B| = n, therefore |P(B)| = 2n .
Let P = P(B)
P(A) = P ∪ Q
Q = {X ∪ {a} | X ∈ P }
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/29
Induction
Consider induction on n ∈ N
Discrete Mathematics I – p. 238/29
Induction
Consider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Discrete Mathematics I – p. 238/29
Induction
Consider induction on n ∈ N
Inductive step: P (n) ⇒ P (n + 1)
Suppose can only prove:
P (0) ∧ P (1) ∧ · · · ∧ P (n − 1) ⇒ P (n)
Discrete Mathematics I – p. 238/29
Induction
Consider 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))
Discrete Mathematics I – p. 238/29
Induction
Consider 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!)
Discrete Mathematics I – p. 238/29
Induction
Consider 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/29
Induction
Let Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
Discrete Mathematics I – p. 239/29
Induction
Let Q(n) ⇐⇒ P (0) ∧ P (1) ∧ · · · ∧ P (n)
We need: ∀n ∈ N : Q(n)
( =⇒ ∀n ∈ N : P (n))
Discrete Mathematics I – p. 239/29
Induction
Let 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)
Discrete Mathematics I – p. 239/29
Induction
Let 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
Discrete Mathematics I – p. 239/29
Induction
Let 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)
Discrete Mathematics I – p. 239/29
Induction
Let 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)
Discrete Mathematics I – p. 239/29
Induction
Let 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)
Discrete Mathematics I – p. 239/29
Induction
Let 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
Discrete Mathematics I – p. 239/29
Induction
Let 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/29
Induction
Prove: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof.
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base:
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀n ∈ N : n ≥ 2 ⇒ n is divisible by a prime
Proof. Induction base:
2 | 2 prime
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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?
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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 | n
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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 | n
Then ∃p : (p prime) ∧ (p | m)
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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 | n
Then ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | n
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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 | n
Then ∃p : (p prime) ∧ (p | m)
(p | m) ∧ (m | n) =⇒ p | n
In both cases n divisible by a prime
Discrete Mathematics I – p. 240/29
Induction
Prove: ∀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 | n
Then ∃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/29
Graphs
Discrete Mathematics I – p. 241/29
Graphs
The Königsberg Bridges (L. Euler, 1707–1783)
Discrete Mathematics I – p. 242/29
Graphs
The Königsberg Bridges (L. Euler, 1707–1783)
Discrete Mathematics I – p. 242/29
Graphs
The Königsberg Bridges (L. Euler, 1707–1783)
A tour crossing every bridge exactly once?
Discrete Mathematics I – p. 242/29
Graphs
4 • nodes (islands)
The Königsberg Bridges graph
7 ◦ nodes (bridges)
Discrete Mathematics I – p. 243/29
Graphs
Wolf, goat and cabbage
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
WC
FG
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
WC
FG
FWC
G
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
C
FWG
WC
FG
FWC
G
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
WC
FG
FWC
G
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
FWC
G
G
FWC
WC
FG
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
G
FWC
FWC
G
FG
WC
WC
FG
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
F W GC
G
FWC
FWC
G
FG
WC
WC
FG
F W GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
F W GC
G
FWC
FWC
G
FG
WC
WC
FG
F W GC
W
F GC
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
F W GC
G
FWC
FWC
G
FG
WC
WC
FG
W
F GC
F W GC
F GW
C
Discrete Mathematics I – p. 244/29
Graphs
Wolf, goat and cabbage
Farmer wants to take W , G, C across the river
Can only take one item at a time
W eats G, G eats C — farmer must keep an eye
F GC
W
C
FWG
F W GC
G
FWC
FWC
G
FG
WC
WC
FG
W
F GC
F W GC
F GW
C
Discrete Mathematics I – p. 244/29
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
W1
W2
H3
H2
H1
W3
Discrete Mathematics I – p. 245/29
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
W1
W2
H3
H2
H1
W3
Discrete Mathematics I – p. 245/29
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
W1
W2
H3
H2
H1
W3
Discrete Mathematics I – p. 245/29
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
W1
W2
H3
H2
H1
W3
Discrete Mathematics I – p. 245/29
Graphs
Houses and wells
Each of 3 houses needs a path to each of 3 wells
Paths must not cross
W1
W2
H3
H2
H1
W3
Discrete Mathematics I – p. 245/29
Graphs
V — finite set, elements called nodes
R* : V ↔ V
Discrete Mathematics I – p. 246/29
Graphs
V — finite set, elements called nodes
R* : V ↔ V
R* called irreflexive, if ∀a ∈ A : ¬(a * a)
Discrete Mathematics I – p. 246/29
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
Discrete Mathematics I – p. 246/29
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 relation
E = R* : V ↔ V
Discrete Mathematics I – p. 246/29
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 relation
E = R* : V ↔ V
Nodes u, v called adjacent, if u * v
Discrete Mathematics I – p. 246/29
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 relation
E = R* : V ↔ V
Nodes u, v called adjacent, if u * v
Pairs in E called edges
Discrete Mathematics I – p. 246/29
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 relation
E = 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/29
Graphs
The complete graph on V : K(V ) = (V, E)
where E = {(u, v) ∈ V 2 | u 6= v}
Discrete Mathematics I – p. 247/29
Graphs
The complete graph on V : K(V ) = (V, E)
where E = {(u, v) ∈ V 2 | u 6= v}
1
0
2
3
K(N5 )
4
Discrete Mathematics I – p. 247/29
Graphs
The complete graph on V : K(V ) = (V, E)
where E = {(u, v) ∈ V 2 | u 6= v}
1
0
2
3
K(N5 )
4
The complete graph on n nodes: K(n)
Discrete Mathematics I – p. 247/29
Graphs
Different graphs may be “similar”
Discrete Mathematics I – p. 248/29
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is a
bijection between their node sets, which preserves the
edges
Discrete Mathematics I – p. 248/29
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is a
bijection between their node sets, which preserves the
edges
G1 = (V1 , E1 )
G2 = (V2 , E2 )
Discrete Mathematics I – p. 248/29
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is a
bijection between their node sets, which preserves the
edges
G1 = (V1 , E1 ) G2 = (V2 , E2 )
V2 :
G1 ∼
= G2 ⇐⇒ ∃f : V1 ∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f (u), f (v)) ∈ E2
Discrete Mathematics I – p. 248/29
Graphs
Different graphs may be “similar”
Two graphs are called isomorphic, if there is a
bijection between their node sets, which preserves the
edges
G1 = (V1 , E1 ) G2 = (V2 , E2 )
V2 :
G1 ∼
= G2 ⇐⇒ ∃f : V1 ∀u, v ∈ V1 : (u, v) ∈ E1 ⇔ (f (u), f (v)) ∈ E2
Bijection f is the isomorphism between G1 , G2
Discrete Mathematics I – p. 248/29
Graphs
Example:
Discrete Mathematics I – p. 249/29
Graphs
0
3
1
4
2
1
2
4
Example:
0
3
0
4
3
2
1
Discrete Mathematics I – p. 249/29
Graphs
G = (V, E)
V = V 1 ∪ V2
V1 ∩ V 2 = ∅
Discrete Mathematics I – p. 250/29
Graphs
G = (V, E)
V = V 1 ∪ 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
V1 ∩ V 2 = ∅
Discrete Mathematics I – p. 250/29
Graphs
G = (V, E)
V = V 1 ∪ 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
V1 ∩ V 2 = ∅
Sets V1 , V2 called colour classes of G
Discrete Mathematics I – p. 250/29
Graphs
Example:
Discrete Mathematics I – p. 251/29
Graphs
Example:
The Königsberg Bridges graph is bipartite
Discrete Mathematics I – p. 251/29
Graphs
Example:
Discrete Mathematics I – p. 252/29
Graphs
Example:
The wolf/goat/cabbage graph is bipartite
Discrete Mathematics I – p. 252/29
Graphs
V1 ∩ V 2 = ∅
Discrete Mathematics I – p. 253/29
Graphs
V1 ∩ V 2 = ∅
Bipartite graph with all possible edges between V1 , V2
is called complete bipartite
Discrete Mathematics I – p. 253/29
Graphs
V1 ∩ V 2 = ∅
Bipartite graph with all possible edges between V1 , V2
is called complete bipartite
K(V1 , V2 ) = (V1 ∪ V2 , (V1 × V2 ) ∪ (V2 × V1 ))
Discrete Mathematics I – p. 253/29
Graphs
V1 ∩ V 2 = ∅
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)
Discrete Mathematics I – p. 253/29
Graphs
V1 ∩ V 2 = ∅
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 complete
n-partite graph
Discrete Mathematics I – p. 253/29
Graphs
Example:
W1
W2
H3
H2
H1
W3
Discrete Mathematics I – p. 254/29
Graphs
Example:
W1
W2
H3
H2
H1
W3
The houses/wells graph is complete bipartite
Discrete Mathematics I – p. 254/29
Graphs
Example:
W1
W2
H3
H2
H1
W3
The houses/wells graph is complete bipartite
K({H1 , H2 , H3 }, {W1 , W2 , W3 })
Discrete Mathematics I – p. 254/29
Graphs
G = (V, E)
Discrete Mathematics I – p. 255/29
Graphs
G = (V, E)
A walk: sequence (u, u1 , . . . , uk−1 , v), such that
Discrete Mathematics I – p. 255/29
Graphs
G = (V, E)
A walk: sequence (u, u1 , . . . , uk−1 , v), such that
(u * u1 ) ∧ (u1 * u2 ) ∧ · · · ∧ (uk−1 * v)
Discrete Mathematics I – p. 255/29
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
Discrete Mathematics I – p. 255/29
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
Discrete Mathematics I – p. 255/29
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/29
Graphs
7
4
8
10
6
1
3
5
0
2
9
Discrete Mathematics I – p. 256/29
Graphs
7
4
10
6
8
1
3
5
0
2
9
0#5:0*3*1*4*6*3*0*2*5
Discrete Mathematics I – p. 256/29
Graphs
7
4
10
6
8
1
3
5
0
2
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/29
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
Discrete Mathematics I – p. 257/29
Graphs
For all v ∈ V , (v) is a walk v # v of length 0
For all u, v ∈ V , (u # v) ⇒ (v # u)
Discrete Mathematics I – p. 257/29
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)
Discrete Mathematics I – p. 257/29
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
Discrete Mathematics I – p. 257/29
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
Discrete Mathematics I – p. 257/29
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 are
connected
Discrete Mathematics I – p. 257/29
Graphs
G = (V, E)
Discrete Mathematics I – p. 258/29
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Discrete Mathematics I – p. 258/29
Graphs
G = (V, E)
A path is a walk where all nodes are distinct
Nodes u, v connected by a path: u
v
Discrete Mathematics I – p. 258/29
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
Discrete Mathematics I – p. 258/29
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
Discrete Mathematics I – p. 258/29
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 except
the final are distinct: u
v*u
Discrete Mathematics I – p. 258/29
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 except
the final are distinct: u
v*u
A graph without cycles called acyclic
Discrete Mathematics I – p. 258/29
Graphs
7
4
8
10
6
1
3
5
0
2
9
Discrete Mathematics I – p. 259/29
Graphs
7
4
0
10
6
8
1
3
5
0
2
9
5 : 0 * 2 * 7 * 10 * 8 * 3 * 5
Discrete Mathematics I – p. 259/29
Graphs
7
4
0
10
6
8
1
3
5
0
2
9
5 : 0 * 2 * 7 * 10 * 8 * 3 * 5
A cycle: 3 * 8 * 10 * 9 * 4 * 6 * 3
Discrete Mathematics I – p. 259/29
Graphs
G = (V, E)
Discrete Mathematics I – p. 260/29
Graphs
G = (V, E)
R
: V ↔ V — equivalence relation?
Discrete Mathematics I – p. 260/29
Graphs
G = (V, E)
R
: V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u
there is a walk u # v.
v, iff
Discrete Mathematics I – p. 260/29
Graphs
G = (V, E)
R
: V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u
there is a walk u # v.
R , R# : V ↔ V
v, iff
R
= R#
Discrete Mathematics I – p. 260/29
Graphs
G = (V, E)
R
: V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u
there is a walk u # v.
Proof.
R , R# : V ↔ V
v, iff
R
= R#
Discrete Mathematics I – p. 260/29
Graphs
G = (V, E)
R
: V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u
there is a walk u # v.
Proof. (u
R , R# : V ↔ V
v, iff
R
= R#
v) ⇒ (u # v): trivial
Discrete Mathematics I – p. 260/29
Graphs
G = (V, E)
R
: V ↔ V — equivalence relation?
Prove: For all u, v ∈ V , there is a path u
there is a walk u # v.
Proof. (u
R , R# : V ↔ V
v, iff
R
= R#
v) ⇒ (u # v): trivial
(u # v) ⇒ (u
v): induction on walk length
Discrete Mathematics I – p. 260/29
Graphs
Induction base: (u) is both u # u and u
u
Discrete Mathematics I – p. 261/29
Graphs
Induction base: (u) is both u # u and u
u
Inductive step: consider walk u # w * v
Discrete Mathematics I – p. 261/29
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
Discrete Mathematics I – p. 261/29
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
Case 1: path u
w
w does not visit v
Discrete Mathematics I – p. 261/29
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
Case 1: path u
w
w does not visit v
Then u
w * v is a path
Discrete Mathematics I – p. 261/29
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
Case 1: path u
w does not visit v
Then u
Case 2: path u
w
w visits v: u
w * v is a path
v
w*v
Discrete Mathematics I – p. 261/29
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
Case 1: path u
w does not visit v
Then u
Case 2: path u
w
w visits v: u
w * v is a path
v
w*v
Take initial u
v
Discrete Mathematics I – p. 261/29
Graphs
G = (V, E)
v∈V
Discrete Mathematics I – p. 262/29
Graphs
G = (V, E)
v∈V
The degree of node v is the number of nodes adjacent
to v
Discrete Mathematics I – p. 262/29
Graphs
G = (V, E)
v∈V
The degree of node v is the number of nodes adjacent
to v
deg(v) = |{u ∈ V | v * u}|
Discrete Mathematics I – p. 262/29
Graphs
v∈V
G = (V, E)
The degree of node v is the number of nodes adjacent
to v
c
b
deg(v) = |{u ∈ V | v * u}|
f
d
a
e
Discrete Mathematics I – p. 262/29
Graphs
v∈V
G = (V, E)
The degree of node v is the number of nodes adjacent
to v
c
deg(a) = deg(d) = 2
b
deg(v) = |{u ∈ V | v * u}|
a
d
deg(b) = deg(c) = 4
f
deg(e) = deg(f ) = 4
e
Discrete Mathematics I – p. 262/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e*d
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e*d*c
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e*d*c*e
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e*d*c*e*b
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e*d*c*e*b*f
Discrete Mathematics I – p. 263/29
Graphs
An Euler tour of graph G is a tour which visits every
edge in E exactly once
c
b
f
d
a
e
a*b*c*f *e*d*c*e*b*f *a
Discrete Mathematics I – p. 263/29
Graphs
G = (V, E)
Discrete Mathematics I – p. 264/29
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
Discrete Mathematics I – p. 264/29
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
•
G is connected
Discrete Mathematics I – p. 264/29
Graphs
G = (V, E)
Theorem: Graph G has an Euler tour iff
•
G is connected
•
every node in V has even degree
Discrete Mathematics I – p. 264/29
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/29
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
Discrete Mathematics I – p. 265/29
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Discrete Mathematics I – p. 265/29
Graphs
Proof.
G has Euler tour ⇒ G connected: trivial
G has Euler tour ⇒ every node has even degree
Consider v ∈ V
Discrete Mathematics I – p. 265/29
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
Discrete Mathematics I – p. 265/29
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)
Discrete Mathematics I – p. 265/29
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/29
Graphs
G connected ∧ every node has even degree
⇒ G has an Euler tour
Discrete Mathematics I – p. 266/29
Graphs
G connected ∧ every node has even degree
⇒ G has an Euler tour
Take any v0 ∈ V
Discrete Mathematics I – p. 266/29
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
Discrete Mathematics I – p. 266/29
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
Discrete Mathematics I – p. 266/29
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
Discrete Mathematics I – p. 266/29
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
Discrete Mathematics I – p. 266/29
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/29
Graphs
Consider tour v0 * v1 * . . . * vm = v0
Discrete Mathematics I – p. 267/29
Graphs
Consider tour v0 * v1 * . . . * vm = v0
Suppose some vi has unvisited edge to vm+1
Discrete Mathematics I – p. 267/29
Graphs
Consider tour v0 * v1 * . . . * vm = v0
Suppose some vi has unvisited edge to vm+1
By symmetry, let vi = v0
Discrete Mathematics I – p. 267/29
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
Discrete Mathematics I – p. 267/29
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
Discrete Mathematics I – p. 267/29
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
Discrete Mathematics I – p. 267/29
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/29
Graphs
Example:
c
b
f
d
a
e
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b*f
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b*f *e
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b*f *e*d
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b*f *e*d*c
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b*f *e*d*c*e
Discrete Mathematics I – p. 268/29
Graphs
Example:
c
b
f
d
a
e
a*b*c*f *a
b*c*f *a*b*f *e*d*c*e*b
Discrete Mathematics I – p. 268/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a*b
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a*b*e
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a*b*e*d
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a*b*e*d*c
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a*b*e*d*c*f
Discrete Mathematics I – p. 269/29
Graphs
A Hamiltonian cycle of graph G is a cycle which
visits every node in V exactly once
c
b
f
d
a
e
a*b*e*d*c*f *a
Discrete Mathematics I – p. 269/29
Graphs
Exercise: find an efficient test for existence of
Hamiltonian cycle. . .
Discrete Mathematics I – p. 270/29
Graphs
Exercise: find an efficient test for existence of
Hamiltonian cycle. . .
. . . and claim your $1 000 000!
Discrete Mathematics I – p. 270/29
Graphs
Exercise: find an efficient test for existence of
Hamiltonian cycle. . .
. . . and claim your $1 000 000!
See www.claymath.org for details
Discrete Mathematics I – p. 270/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Discrete Mathematics I – p. 271/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
G0 is a subgraph of G, if V 0 ⊆ V , E 0 ⊆ E
Discrete Mathematics I – p. 271/29
Graphs
G0 = (V 0 , E 0 )
G = (V, E)
G0 is a subgraph of G, if V 0 ⊆ V , E 0 ⊆ E
0
G
4
1
3
3
1
2
2
0
G0
Discrete Mathematics I – p. 271/29
Graphs
G0 = (V 0 , E 0 )
G = (V, E)
G0 is a subgraph of G, if V 0 ⊆ V , E 0 ⊆ E
0
G
4
1
3
3
1
2
2
0
G0
G0 ⊆ G
Discrete Mathematics I – p. 271/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Discrete Mathematics I – p. 272/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
G0 is a spanning subgraph of G, if V 0 = V , E 0 ⊆ E
Discrete Mathematics I – p. 272/29
Graphs
G0 = (V 0 , E 0 )
G = (V, E)
G0 is a spanning subgraph of G, if V 0 = V , E 0 ⊆ E
0
G
4
0
3
1
3
1
2
2
G0
4
Discrete Mathematics I – p. 272/29
Graphs
G0 = (V 0 , E 0 )
G = (V, E)
G0 is a spanning subgraph of G, if V 0 = V , E 0 ⊆ E
0
G
4
0
3
1
3
1
2
2
G0
4
G0 v G
Discrete Mathematics I – p. 272/29
Graphs
V — a finite set G(V ) — set of all graphs on V
Discrete Mathematics I – p. 273/29
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
Discrete Mathematics I – p. 273/29
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G
GvG
Discrete Mathematics I – p. 273/29
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G
GvG
∀G, G0 : (G0 ⊆ G) ∧ (G ⊆ G0 ) ⇒ G = G0
Discrete Mathematics I – p. 273/29
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G
GvG
∀G, G0 : (G0 ⊆ G) ∧ (G ⊆ G0 ) ⇒ G = G0
∀G, G0 , G00 : (G00 ⊆ G0 ) ∧ (G0 ⊆ G) ⇒ G00 ⊆ G
Discrete Mathematics I – p. 273/29
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G
GvG
∀G, G0 : (G0 ⊆ G) ∧ (G ⊆ G0 ) ⇒ G = G0
∀G, G0 , G00 : (G00 ⊆ G0 ) ∧ (G0 ⊆ G) ⇒ G00 ⊆ G
Therefore, R⊆ is a partial order
Discrete Mathematics I – p. 273/29
Graphs
V — a finite set G(V ) — set of all graphs on V
R⊆ : G(V ) ↔ G(V )
∀G : G ⊆ G
GvG
∀G, G0 : (G0 ⊆ G) ∧ (G ⊆ G0 ) ⇒ G = G0
∀G, G0 , G00 : (G00 ⊆ G0 ) ∧ (G0 ⊆ G) ⇒ G00 ⊆ G
Therefore, R⊆ is a partial order
Similarly, Rv is a partial order
Discrete Mathematics I – p. 273/29
Graphs
Recall: a graph is
Discrete Mathematics I – p. 274/29
Graphs
Recall: a graph is
•
connected, if every two nodes connected
Discrete Mathematics I – p. 274/29
Graphs
Recall: a graph is
•
connected, if every two nodes connected
•
acyclic, if there is no cycle
Discrete Mathematics I – p. 274/29
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/29
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/29
Graphs
G = (V, E) — a tree
Discrete Mathematics I – p. 275/29
Graphs
G = (V, E) — a tree
Prove: |V | = |E| + 1.
Discrete Mathematics I – p. 275/29
Graphs
G = (V, E) — a tree
Prove: |V | = |E| + 1.
Proof. Induction base: V = {v}, E = ∅
Discrete Mathematics I – p. 275/29
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/29
Graphs
Inductive step: assume statement holds for all proper
subgraphs of G
Discrete Mathematics I – p. 276/29
Graphs
Inductive step: assume statement holds for all proper
subgraphs of G
Take any edge (u, v) ∈ E.
Discrete Mathematics I – p. 276/29
Graphs
Inductive step: assume statement holds for all proper
subgraphs of G
Take any edge (u, v) ∈ E.
Let G0 = (V, E \ {(u, v), (v, u)}).
Discrete Mathematics I – p. 276/29
Graphs
Inductive step: assume statement holds for all proper
subgraphs of G
Take any edge (u, v) ∈ E.
Let G0 = (V, E \ {(u, v), (v, u)}).
u
G0
v
Discrete Mathematics I – p. 276/29
Graphs
Inductive step: assume statement holds for all proper
subgraphs of G
Take any edge (u, v) ∈ E.
Let G0 = (V, E \ {(u, v), (v, u)}).
u
Consider R
G0
v
: V ↔ V in G0
Discrete Mathematics I – p. 276/29
Graphs
Suppose u
v in G0
Discrete Mathematics I – p. 277/29
Graphs
v in G0
G0
u
Suppose u
v
Discrete Mathematics I – p. 277/29
Graphs
v in G0
G0
Then u
u
Suppose u
v
v * u a cycle in G — contradiction
Discrete Mathematics I – p. 277/29
Graphs
G0
Then u
u
v in G0
Suppose u
v
v * u a cycle in G — contradiction
Therefore u 6
v in G0
Discrete Mathematics I – p. 277/29
Graphs
Vu = [u]
Vv = [v]
(in G0 )
Discrete Mathematics I – p. 278/29
Graphs
Vu = [u]
Vv = [v]
(in G0 )
Eu = {(x, y) | x, y ∈ Vu }
Ev = {(x, y) | x, y ∈ Vv }
Discrete Mathematics I – p. 278/29
Graphs
Vu = [u]
Vv = [v]
(in G0 )
Eu = {(x, y) | x, y ∈ Vu }
Gu = (Vu , Eu )
Ev = {(x, y) | x, y ∈ Vv }
Gv = (Vv , Ev )
Discrete Mathematics I – p. 278/29
Graphs
(in G0 )
Vv = [v]
Eu = {(x, y) | x, y ∈ Vu }
Gu = (Vu , Eu )
Ev = {(x, y) | x, y ∈ Vv }
Gv = (Vv , Ev )
Gu
u
Vu = [u]
v
Gv
Discrete Mathematics I – p. 278/29
Graphs
(in G0 )
Vv = [v]
Eu = {(x, y) | x, y ∈ Vu }
Gu = (Vu , Eu )
Ev = {(x, y) | x, y ∈ Vv }
Gv = (Vv , Ev )
Gu
u
Vu = [u]
v
Gv
G connected =⇒ Gu , Gv connected
Discrete Mathematics I – p. 278/29
Graphs
(in G0 )
Vv = [v]
Eu = {(x, y) | x, y ∈ Vu }
Gu = (Vu , Eu )
Ev = {(x, y) | x, y ∈ Vv }
Gv = (Vv , Ev )
Gu
u
Vu = [u]
v
Gv
G connected =⇒ Gu , Gv connected
G acyclic =⇒ Gu , Gv acyclic
Discrete Mathematics I – p. 278/29
Graphs
By induction hypothesis:
|Vu | = |Eu | + 1 |Vv | = |Ev | + 1
Discrete Mathematics I – p. 279/29
Graphs
By induction hypothesis:
|Vu | = |Eu | + 1 |Vv | = |Ev | + 1
|V | = |Vu | + |Vv | = (|Eu | + 1) + (|Ev | + 1) =
Discrete Mathematics I – p. 279/29
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/29
Graphs
G = (V, E) — a tree
Discrete Mathematics I – p. 280/29
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Discrete Mathematics I – p. 280/29
Graphs
G = (V, E) — a tree
Corollary: G has a node of degree 1.
Proof. G connected ⇒ no nodes of degree 0.
Discrete Mathematics I – p. 280/29
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.
Discrete Mathematics I – p. 280/29
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 |
Discrete Mathematics I – p. 280/29
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.
Discrete Mathematics I – p. 280/29
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.
Discrete Mathematics I – p. 280/29
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/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Discrete Mathematics I – p. 281/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Recall: G0 is a spanning subgraph of G, if V 0 = V ,
E0 ⊆ E
Discrete Mathematics I – p. 281/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Recall: G0 is a spanning subgraph of G, if V 0 = V ,
E0 ⊆ E
Rv : G(V ) ↔ G(V )
Discrete Mathematics I – p. 281/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Recall: G0 is a spanning subgraph of G, if V 0 = V ,
E0 ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
Discrete Mathematics I – p. 281/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Recall: G0 is a spanning subgraph of G, if V 0 = V ,
E0 ⊆ E
Rv : G(V ) ↔ G(V )
Consider restricting Rv to the set of all
•
connected graphs in G(V )
Discrete Mathematics I – p. 281/29
Graphs
G = (V, E)
G0 = (V 0 , E 0 )
Recall: G0 is a spanning subgraph of G, if V 0 = V ,
E0 ⊆ 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/29
Graphs
G = (V, E)
Discrete Mathematics I – p. 282/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of all
connected graphs on V
Discrete Mathematics I – p. 282/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of all
connected graphs on V
Proof. G connected
Discrete Mathematics I – p. 282/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of all
connected graphs on V
Proof. G connected
Need to prove: G acyclic iff G v-minimal
Discrete Mathematics I – p. 282/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-minimal in the set of all
connected 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/29
Graphs
G has a cycle ⇒ G not v-minimal
Discrete Mathematics I – p. 283/29
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Discrete Mathematics I – p. 283/29
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Discrete Mathematics I – p. 283/29
Graphs
G has a cycle ⇒ G not v-minimal
Suppose G has a cycle
Remove any edge from cycle
Remaining graph connected
Discrete Mathematics I – p. 283/29
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/29
Graphs
G not v-minimal ⇒ G has a cycle
Discrete Mathematics I – p. 284/29
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
Discrete Mathematics I – p. 284/29
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u * v does not
disconnect the graph
Discrete Mathematics I – p. 284/29
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u * v does not
disconnect the graph
Therefore there is another path u
v
Discrete Mathematics I – p. 284/29
Graphs
G not v-minimal ⇒ G has a cycle
Suppose G not v-minimal
For some u, v ∈ V , removing edge u * v does not
disconnect the graph
Therefore there is another path u
v
Hence G has a cycle
Discrete Mathematics I – p. 284/29
Graphs
G = (V, E)
Discrete Mathematics I – p. 285/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of all
acyclic graphs on V
Discrete Mathematics I – p. 285/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of all
acyclic graphs on V
Proof. G acyclic
Discrete Mathematics I – p. 285/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of all
acyclic graphs on V
Proof. G acyclic
Need to prove: G connected iff G v-maximal
Discrete Mathematics I – p. 285/29
Graphs
G = (V, E)
Prove: G is a tree iff G is v-maximal in the set of all
acyclic 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/29
Graphs
G disconnected ⇒ G not v-maximal
Discrete Mathematics I – p. 286/29
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Discrete Mathematics I – p. 286/29
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Discrete Mathematics I – p. 286/29
Graphs
G disconnected ⇒ G not v-maximal
Suppose G disconnected
Add any edge between two connected components
Resulting graph acyclic
Discrete Mathematics I – p. 286/29
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/29
Graphs
G not v-maximal ⇒ G disconnected
Discrete Mathematics I – p. 287/29
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u * v does not
create cycle
Discrete Mathematics I – p. 287/29
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u * v does not
create cycle
Therefore u, v are in different connected components
Discrete Mathematics I – p. 287/29
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u * v does not
create cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/29
Graphs
G not v-maximal ⇒ G disconnected
Suppose G not v-maximal
For some u, v ∈ V , adding edge u * v does not
create cycle
Therefore u, v are in different connected components
Hence G disconnected
Discrete Mathematics I – p. 287/29
Graphs
A graph is called planar, if it can be drawn on the
plane without edge crossings.
Discrete Mathematics I – p. 288/29
Graphs
A graph is called planar, if it can be drawn on the
plane without edge crossings.
Examples: any tree
Discrete Mathematics I – p. 288/29
Graphs
A graph is called planar, if it can be drawn on the
plane without edge crossings.
Examples: any tree, any cycle
Discrete Mathematics I – p. 288/29
Graphs
A graph is called planar, if it can be drawn on the
plane without edge crossings.
Examples: any tree, any cycle
Complete graphs:
K(1), K(2), K(3), K(4).
Discrete Mathematics I – p. 288/29
Graphs
A graph is called planar, if it can be drawn on the
plane without edge crossings.
Examples: any tree, any cycle
Complete graphs:
K(1), K(2), K(3), K(4). Not K(5).
Discrete Mathematics I – p. 288/29
Graphs
A graph is called planar, if it can be drawn on the
plane 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).
Discrete Mathematics I – p. 288/29
Graphs
G = (V, E)
How to test if G is planar?
Discrete Mathematics I – p. 289/29
Graphs
G = (V, E)
How to test if G is planar?
Subdivision: Let u * v.
Discrete Mathematics I – p. 289/29
Graphs
G = (V, E)
How to test if G is planar?
Subdivision: Let u * v. Add new node x
Discrete Mathematics I – p. 289/29
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
Discrete Mathematics I – p. 289/29
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/29
Graphs
Only K(5) and K(3, 3) are “really” non-planar.
Discrete Mathematics I – p. 290/29
Graphs
Only K(5) and K(3, 3) are “really” non-planar.
Theorem (Kuratowski). A graph is planar iff it has no
subgraph obtained from K(5) or K(3, 3) by
subdivisions.
Discrete Mathematics I – p. 290/29
Graphs
Only K(5) and K(3, 3) are “really” non-planar.
Theorem (Kuratowski). A graph is planar iff it has no
subgraph obtained from K(5) or K(3, 3) by
subdivisions.
Proof: difficult.
Discrete Mathematics I – p. 290/29
Graphs
Recall: if G = (V, E) a tree, then |V | = |E| + 1.
Discrete Mathematics I – p. 291/29
Graphs
Recall: if G = (V, E) a tree, then |V | = |E| + 1.
Generalisation: G = (V, E) — planar
Discrete Mathematics I – p. 291/29
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
Discrete Mathematics I – p. 291/29
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/29
Graphs
Examples:
G is a tree: |V | = |E| + 1 |F | = 1
Discrete Mathematics I – p. 292/29
Graphs
Examples:
G is a tree: |V | = |E| + 1 |F | = 1
G has one cycle: |V | = |E|
|F | = 2
Discrete Mathematics I – p. 292/29
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.
Discrete Mathematics I – p. 292/29
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/29
© Copyright 2026 Paperzz