discrete math unit 6 set theory number theory graph theory
TRANSCRIPT
Discrete MathUnit 6
Set TheoryNumber TheoryGraph Theory
Understanding set theory helps people to …
see things in terms of systems
organize things into groups
begin to understand logic
Set Theory principles and methods used by
mathematicians to describe the relationships among sets.
Applications Internet search enginesBusinesses use databases built
from set theory to organize large amounts of data
Key MathematiciansThese mathematicians influenced
the development of set theory and logic:
Georg Cantor John Venn George Boole Augustus DeMorgan
Georg Cantor 1845 -1918 German mathematician
who developed set theory in 1879
set theory was very controversial because it was radically different
set theory today is widely accepted and is used in many areas of mathematics
John Venn 1834-1923
studied and taught logic and probability theory
articulated Boole’s algebra of logic
devised a simple way to diagram set operations (Venn Diagrams)
George Boole 1815-1864
British mathematician who taught himself Latin, Greek and mathematics and had an interest in logic
developed an algebra of logic (Boolean Algebra)
His work along with DeMorgan’s is the basis for the computer-based devises we use today.
Augustus De Morgan 1806-1871 developed two laws of
negation interested, like other
mathematicians, in using mathematics to demonstrate logic
furthered Boole’s work of incorporating logic and mathematics
formally stated the laws of set theory
Sets A set is a collection of objects.
An element or member of a set is an individual object.
Examples of sets:N = {x: x is a natural number}T = { x: x is a blood type}A = {red, white, blue}B = {3, 6, 9,12,15,18}
If every element of Set A is also contained in Set B, then Set A is a subset of Set B.A is a proper subset of B if B has
more elements than A does.
The universal set contains all of the elements relevant to a given discussion. Often denoted by the capital letter U.
A B
A B
Simple Set Example the universal set is
a deck of ordinary playing cards
each card is an element in the universal set
some subsets are: face cards (F) numbered cards (N) Suits (S) poker hands (P)
Set Theory NotationSymbol Meaning
Upper case designates set nameLower case designates set elements{ } enclose elements in set
or is (or is not) an element of
is a subset of (includes equal sets)
is a proper subset of
is not a subset of
is a superset of
| or : such that (if a condition is true)| | the cardinality of a set
Lesson 1.5 Set Operations
A U B = {x: x is a member of A or x is a member of B}
- A union BA B
- A intersect BA B
IF , then A and B are disj i o nt.A B
{x: x is a member of A x is a member of B} andA B
Unions & Intersections – Example 1 p.39 Sets:
M = activities that burn more than 650 cal/hr W = activities that can be done in all weather conditions E = activities that need special equipment L = activities that must have a special location
Find:
a)M U W b) E U L c) W U E d) M U W U E
e) f) g) h) M W E L W L M W E
Venn Diagrams Venn Diagrams can be used to represent
sets graphically.
Universal Set
Sets A & B
UBA
r4r3r2r1
Complement and Difference of Sets A’ – the complement of A
The difference of sets A and B B – A = {x: x is a member of B and x is not a member of A}
' { : but }A x x U x A
Find the complement of each set:a) U = {1, 2, 3, …, 10} and A = {1, 3, 5, 7, 9}; A’ =
b) U is the set of cards in a standard deck and F is the set of face cards.F’ =
Find B – A:a) A = {x: x is an odd integer}
B = {3, 6, 9,12}
B – A =
Order is importantU = {1, 2, 3, …, 10}E = {x: x is even}B = {1, 3, 4, 5, 8}A = {1, 2, 4, 7, 8}
Find:
( ) ' ( ' )A B E A
DeMorgan’s Law for Set Theory
( ) ' ' '
( ) ' ' '
A B A B
and
A B A B
A ={1, 2, 5, 7, 8, 9}
B = {2, 3, 5, 6, 7}
U = {1, 2, 3, …, 10}
Set Definition U = {1, 2, 3, 4, 5, 6, 7, 8}
A = {1, 2, 6, 7}B = {2, 3, 4, 7}C = {4, 5, 6, 7}
C
BA
C
BA
C
BA ( )A B C ( ) 'A B
( ) 'A B
Graph Theory – Chapter 3 Constructing models that describe the
relationships that occur among a collection of objects.
Applications: Determining routes Minimizing costs Scheduling
Can you place your pencil at any dot and trace it completely without lifting your pencil or tracing any part of any line twice?
C
D E
A B
Definitions Graph – consists of a finite set of points,
called vertices, and lines, called edges, that join pairs of vertices.
Koenigsberg bridge problem
A graph is connected if it is possible to travel from any vertex to any other vertex of the graph by moving along successive edges.
A bridge in a connected graph is an edge such that if it were removed the graph is no longer connected.
Odd or Even? A vertex of a graph is odd if it is an
endpoint of an odd number of edges of the graph.
A vertex is even if it is an endpoint of an even number of edges.
Euler’s Theorem A graph can be traced if:
1. It is connected and2. It has either no odd vertices or
two odd vertices.
Building a Graph Model If we have a collection of objects
with a relationship among them, then we develop a graph model as follows:1. Represent each object by a vertex.
Choose names that remind you what the vertices represent.
2. For each pair of related objects, join the two corresponding vertices with an edge.
More definitions
A path in a graph is a series of consecutive edges in which no edge is repeated.
The number of edges in a path is called its length.
Euler path – a path containing all the edges of the graph.
Euler Circuit – an Euler path that begins and ends at the same vertex.
Eulerian graph – a graph with all even vertices contains an Euler circuit.
How can you find an Euler circuit? Fleury’s Algorithm – Graph with all
even vertices will have an Euler circuit: Begin at any vertex and travel over consecutive edges according to the following rules:
1. After you have traveled over an edge, erase it. If all the edges for a particular vertex have been erased, then erase the vertex also.
2. Travel over an edge that is a bridge only if there is no other alternative.
Graph showing paths in a theme park.
C
J
D I
A
B
E
H
K
F
G
Eulerizing a graph We can eulerize a graph by duplicating some
edges to make an odd vertex even. Start andend here
A
C G
H
D E
B
F
Designing a Shuttle Bus Route
The Four Color Problem
B
FGSBG
VC
E
P
Bo
Ch A
PaU
Using at most 4 colors, is it possible to color a map so that any two regions sharing a common border receive different colors?
The United States in 4 colors.
Lesson 3.2 The Traveling Salesperson Problem Comes from the problem of determining
the most efficient way for a sales person to schedule a trip to a series of cities and then return home.
Hamilton Paths & Circuits A Hamilton path is a path that passes
through all the vertices of a graph exactly once
A Hamilton circuit is a Hamilton path that begins and ends at the same vertex.
In a Hamilton path you do not have to trace every edge as required by an Euler path.
A Complete Graph is one in which every pair of vertices is joined by an edge. Denoted by Kn where n is the number of vertices.
Number of Hamilton paths in Kn
Consider the complete graph Kn with n > 2. How many Hamilton circuits are there?
Select any vertex as the start vertex (because all vertices will belong to the circuit the choice doesn’t matter). From this vertex we can choose n-1 successor vertices, from each of them n-2 vertices, and so on, for a total of (n-1)! circuits. Because direction doesn’t matter, the distinct circuits are (n-1)!/2.
Weighted graphs A weighted graph is a graph where
numbers (weights or costs) have been attached to each edge.
Example: In a graph for flight connections, weights could represent time needed for each flight, distance traveled, or cost of traveling on that flight. In a computer network, costs could represent the delay for a message to travel through a link.
Path length In a graph without weights, we define the
length of a path as the number of edges in it.
In a weighted graph, the path length/weight is a function of the weights of the edges in the path, usually the sum of those weights.
The Traveling Salesman problem A traveling salesman needs to visit n
cities, going to each city exactly once, and return to his starting city. Assume every city is connected to every other city, but the cost of traveling differs for each city pair. What is the sequence of cities that minimizes the overall cost?
Equivalent formulation: Find the Hamilton circuit in Kn with shortest length.
The Brute Force Algorithm THE BRUTE FORCE ALGORITHM List all possible Hamilton circuits (leaving
out the exact reversals, if you wish) Find the weight of each Choose (the) one with the smallest weight.
VERY Time Consuming!!!! Only method known that will produce optimal solution
Brute-Force Algorithm Minuses: It can only be used for relatively small
graphs. For a computer doing 10,000 circuits/sec, it would take about 18 seconds to handle 10 vertices, 50 days to handle 15 vertices, 2 years for 16 vertices, 193,000 years for 20 vertices.
Mathematicians have not been able to prove that another such method exists nor have they been able to prove that one doesn’t exist.
This is one of the most important and famous unsolved problems in mathematics. If you can find an efficient solution to the TSP, you will be rich and famous!!
Although we do not have an efficient algorithm for solving TSPs, we do have several algorithms that produce results that may not be optimal; in this respect, we are willing to give up our requirement for an optimal solution in the interest of time and settle for a "good" solution which may not be optimal. We call this class of algorithms approximate algorithms. The remaining algorithms are approximate algorithms.
Nearest Neighbor Algorithm (NNA)1. Start at a vertex (think of it as your Home city) 2. Travel to the vertex (think of it as a city) that you
haven’t been to yet whose path has the smallest weight (think of it as the closest city) (If there is a tie, pick randomly.)
3. Continue until you travel to all vertices (cities) 4. Travel back to your starting vertex (your Home) The resulting path is a Hamilton Circuit.
The Best – Edge Algorithm1. Begin by choosing an edge with the
smallest weight.2. Choose any remaining edge in the graph
with the smallest weight.3. Keep repeating step 2 without allowing a
circuit to form until all vertices have been used.