ASM1 DM NguyenTuTrinh BS00411
ASM1 DM NguyenTuTrinh BS00411
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand
that making a false declaration is a form of malpractice.
Grading grid
P1 P2 P3 P4 M1 M2 D1 D2
❒ Summative Feedback: ❒ Resubmission Feedback:
List of Figure:
List of table
INTRODUCTION
In mathematics and computer science, graph theory plays a crucial role in modeling and analyzing
real-world problems. From network routing algorithms to social network analysis, graphs are
powerful tools for abstracting and solving complex systems. In this assignment, we explore a variety
of graph-theoretic concepts and algorithms. We cover fundamental properties like cardinality,
prime factorization, and function invertibility, as well as advanced topics such as Hamiltonian paths,
Dijkstra's Algorithm, and the Five Color Theorem. This exploration aims to sharpen our problem-
solving skills, deepen our understanding of graph theory, and appreciate the elegant solutions that
underpin the intricate web of interconnected systems around us.
1. Let 𝑨 and 𝑩 be two non-empty finite sets. Assume that cardinalities of the sets 𝑨, 𝑩 and
𝑨 ∩ 𝑩 are 𝟗𝒃, 𝟐𝒂 and 𝒂 + 𝒃, respectively. Determine the cardinality of the set 𝑨 ∪ 𝑩.
To find the cardinality of the set 𝐴∪𝐵, we can use the principle of inclusion-exclusion. The principle
states that for any two sets 𝐴 and 𝐵,
|𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵|
̅̅̅
The cardinality of 𝛢 is 9𝑏
Substitute the given values 𝑎 = 1 and 𝑏 = 4 into the expressions for the cardinalities of the sets:
Cardinality of 𝐴: 𝛢 =̅̅̅̅
9𝑏 = 9b
̅̅̅̅ = 2𝑎
Cardinality of 𝐵: 𝐵 = 2𝑎
Cardinality of 𝐴∩𝐵: 𝐴 ∩ 𝐵 = 𝑎 + 𝑏
|𝐴| = 9𝑏 = 9.4 = 3𝑏
|𝐵| = ̅̅
2𝑎̅̅ = 2.1 = 2
|𝐴 ∩ 𝐵| = 𝑎 + 𝑏 = 1 + 4 = 5
|𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵|
Substitute thecalculated values:
|𝐴 ∪ 𝐵| = 36 + 2 − 5 = 33
To determine the cardinality of the set ∣𝐵∣, we are given the following information:
|𝐴 − 𝐵| = ̅̅
3𝑎̅̅
̅̅̅̅̅
|𝐴𝑈𝐵| = 11𝑏
̅̅̅̅
|𝐴 ∩ 𝐵| = 1𝑎
Given Values
|𝐴 − 𝐵| = 3𝑎 = 3 × 1 = 3
|𝐴 ∪ 𝐵| = 11𝑏 = 11 × 4 = 44
|𝐴 ∩ 𝐵| = 1𝑎 = 1 × 1 = 1
From the given information, we can use the following set relationships:
• Cardinality of 𝐴:
Given |𝐴 − 𝐵| = 3 and |𝐴 ∩ 𝐵| = 1:
|𝐴| = |𝐴 − 𝐵| + |𝐴 ∩ 𝐵| = 3 + 1 = 4
• Inclusion-Exclusion Principle:
|𝐵| = |𝐴 ∪ 𝐵| − |𝐴| + |𝐴 ∩ 𝐵|
3. At a local market, there are 𝟑𝟓𝒃 customers. Suppose 𝟏𝟏𝒂 have purchased fruits, 𝟗𝒃 have
purchased vegetables, 𝟖𝒂 have purchased bakery items, 𝟒𝒃 have purchased both fruits
and vegetables, 𝟑𝒃 have purchased both vegetables and bakery items, 𝟐𝒂 have
purchased both fruits and bakery items, and 𝟏𝒂 have purchased all three categories.
How many customers have not purchased anything?
IV. Use Dijkstra’s algorithm to find a shortest path spanning tree in graph (P4)
Part II.
Dijkstra's algorithm is a well-known algorithm for finding the shortest path between nodes in a graph,
which can represent, for example, road networks. It was conceived by computer scientist Edsger W.
Dijkstra in 1956 and published in 1959.
Initialization:
+ Start with a graph 𝐺 = (𝑉, 𝐸), where 𝑉 is a set of vertices (or nodes) and 𝐸 is a set of edges,
each with an associated non-negative weight.
+ Choose a source vertex 𝑠 from which to calculate the shortest paths to all other vertices.
+ Set the distance to the source 𝑠 as 0: 𝑑(𝑠) = 0.
+ Set the distance to all other vertices as infinity: 𝑑 (𝑣) = ∞ for all 𝑣≠𝑠.
+ Initialize an empty set 𝑆 to keep track of vertices with known shortest paths.
+ Create a priority queue (min-heap) and insert the source vertex with a distance of 0.
Algorithm Execution:
While the priority queue is not empty, do the following:
Extract the vertex 𝑢 from the priority queue with the minimum distance:
+ This ensures that we are processing the vertex with the current known shortest distance.
Termination:
+ The algorithm terminates once the priority queue is empty. At this point, 𝑑 (𝑣) contains the
shortest distance from the source vertex 𝑠 to every other vertex 𝑣 in the graph.
Important Considerations:
+ Non-Negative Weights: Dijkstra's algorithm only works correctly with graphs that have
non-negative edge weights. If the graph has negative weights, algorithms like the Bellman-
Ford algorithm are required.
+ Graph Representation: The graph can be represented using adjacency lists or adjacency
matrices. The choice of representation can impact the efficiency of the algorithm.
2. Apply Dijkstra’s algorithm to determine the shortest path length between vertices 𝑨 and
𝒁 in the provided weighted graph.
As, we can see we have the shortest path from:
- Node 0 to Node 1,
- From Node 0 to Node 2,
- From Node 0 to Node 3,
- From Node 0 to Node 4,
- From Node 0 to Node 6.
Apply Dijkstra’s algorithm to determine the shortest path length between vertices A and Z in the
provided weighted graph.
Figure 3 : Dijkstra’s algorithm
We have a = 1 , b = 4
Round A B C D E F G Z
1 (0, - ) ∞, - ∞, - ∞, - ∞, - ∞, - ∞, - ∞, -
2 - (1,A) (4,A) ∞, - ∞, - ∞, - ∞, - ∞, -
3 - - (4,A) (7,B) ∞, - ∞, - ∞, - ∞, -
4 - - - (7,B) (11,C) ∞, - ∞, - ∞, -
5 - - - - (8,D) (13,D) ∞, - ∞, -
6 - - - - - (12,E) (14,E) ∞, -
7 - - - - - - (14,E) (20,G)
8 - - - - - - - (19,G)
Table 1 : Table 1 MEMBERSHIP TABLE
Activity 1
1. Ascertain whether the given functions are invertible. If they are, identify the rule for the
inverse function 𝒇−𝟏 .
a. 𝒇: ℝ → ℝ with 𝒇(𝒙) = 𝒃𝒙 + 𝒂.
Given: 𝑓(𝑥) = 4𝑥 + 1.
Injectivity (One-to-One):
To check injectivity, assume 𝑓(𝑥1 ) = 𝑓(𝑥2 ) and verify if 𝑥1 = 𝑥2 .
𝑓(𝑥1 ) = 4𝑥1 + 1
𝑓(𝑥2 ) = 4𝑥2 + 1
If 𝑓(𝑥1 ) = 𝑓(𝑥2 ):
4𝑥1 + 1 = 4𝑥2 + 1
4𝑥1 = 4𝑥2
𝑥1 = 𝑥2
Since 𝑥1 = 𝑥2 whenever 𝑓(𝑥1 ) = 𝑓(𝑥2 ), the function 𝑓(𝑥) = 4𝑥 + 1 is injective.
Surjectivity (Onto):
To check surjectivity, we need to determine if every real number 𝑦 can be expressed as 𝑓(𝑥)for some
𝑥.
Given 𝑓(𝑥) = 4𝑥 + 1
𝑦 = 4𝑥 + 1
4𝑥 = 𝑦 − 1
𝑦−1
𝑥=
4
Since 𝑥 can take any real number and 𝑦 is any real number, 𝑓(𝑥) = 4𝑥 + 1 covers all real numbers 𝑦.
Therefore, 𝑓(𝑥) = 4𝑥 + 1 is surjective.
Conclusion
Since 𝑓(𝑥) = 4𝑥 + 1 is both injective and surjective, it is invertible.
Inverse Function 𝒇−𝟏 (𝒙)
To find the inverse function 𝑓 −1 (𝑥):
𝑦 = 4𝑥 + 1
𝑦 − 1 = 4𝑥
𝑦−1
𝑥=
4
So, the inverse function 𝑓 −1 (𝑥):
𝑥−1
𝑓 −1 (𝑥) =
4
𝑥−1
Therefore, the inverse function of 𝑓(𝑥) = 4𝑥 + 1 is 𝑓 −1 (𝑥) = .
4
One-to-one (Injective):
- The function f(x) = √𝑥 + 4 is one-to-one if for every x1 , x2 in ít domain [ -4, +∞), if f(x1) = f(x2)
, then x1 = x2
- To check this :
- Assume f(x1) = f(x2) .
- This implies √𝑥1 + 4 = √𝑥2 + 4
- Squaring both sides gives x1 + 4 = x2 + 4
- Hence, x1 = x2
- Therefore, f(x) = √𝑥 + 4 is one-to-one on its domain [−4, +∞) because it does not map
different x1 and x2 to the same f(x).
Onto (Surjective):
- The function f(x) = √𝑥 + 4 is onto if for every y in its codomain [0,+∞), there exists at least
one xxx in its domain [−4,+∞) such that f(x) = √𝑥 + 4 = y
- To check this:
- For every y ≥ 0 in [0,+∞), we need to find x ≥ −4x such that √𝑥 + 4 = y .
- Squaring both sides, we get x + 4 = y2 .
- Therefore, x = y2 – 4
- The condition x ≥ -4 is valid for y ≥ 0
- Thus , f(x) = √𝑥 + 4 is onto on its domain [−4, +∞).
Therefore, with a = 1 and b = 4, the function , f(x) = √𝑥 + 4 is invertible on its domain [−4,+∞) . It is
both one-to-one and onto, allowing us to construct its inverse function f-1(y) = y2 – 4 on its codomain
[0,+∞).
𝟐𝒙 + 𝒂, 𝒙 < 𝟎
2. Let 𝒇, 𝒈: ℝ → ℝ be defined as 𝒇(𝒙) = { and 𝒈(𝒙) = 𝒃𝒙 − 𝒂. Find 𝒈 ∘ 𝒇.
𝒙𝟑 + 𝒃, 𝒙 ≥ 𝟎
For 𝑔 ° 𝑓 :
2𝑥 + 𝑎, 𝑥 < 0
- Let 𝑓(𝑥) = { 3 and 𝑔(𝑥) = 𝑏𝑥 − 𝑎.
𝑥 + 𝑏, 𝑥 ≥ 0
2𝑥 + 3, 𝑥 < 0
- With a = 1 and b = 4, 𝑓(𝑥) = { 3 and 𝑔(𝑥) = 4𝑥 − 1.
𝑥 + 4, 𝑥 ≥ 0
- (𝑔 ° 𝑓)(𝑥) = 𝑔(𝑓(𝑥))
- (𝑔 ° 𝑓)(𝑥) = g(2x + 1) = b(2x + 1) − 1 = 2bx + b − 1 for 𝑥 < 0
- (𝑔 ° 𝑓)(𝑥) = 𝑔(𝑥 3 + 4) for 𝑥 ≥ 0
= g( x3 + 4 ) = b( x3 + 4 ) – 1 = bx3 + 4b − 1
- (𝑔 ° 𝑓)(𝑥) = 2𝑏𝑥 + 𝑏 − 1 for 𝑥 < 0
- (𝑔 ° 𝑓)(𝑥) = bx 3 + 4b − 1 for 𝑥 ≥ 0
- (𝑔 ° 𝑓)(𝑥) = 2(4)𝑥 + (4)(1) − 1 for 𝑥 < 0
- (𝑔 ° 𝑓)(𝑥) = 4𝑥 3 + (4)2 - 1 for 𝑥 ≥ 0
- (𝑔 ° 𝑓)(𝑥) = 8𝑥 + 3 for 𝑥 < 0
- (𝑔 ° 𝑓)(𝑥) = 4𝑥 3 + 15 for 𝑥 ≥ 0
8𝑥 + 3, 𝑥 < 0
- So, (𝑔 ° 𝑓)(𝑥) = {
4𝑥 3 + 15,
V. Assess whether a Eulerian and Hamiltonian circuit exists in an undirected graph
(M2).
ACTIVITY 2
Part 3 :
Does the following graph have a Hamilton path? If so, find such a path. If it does not, give an
argument to show why no such path exists.
- A Hamilton path is a path that visits every node in the graph exactly once. For a graph to have
a Hamiltonian path, each node must have an even degree (the number of edges connected to
that node).
- In the graph in the figure, node d has degree 1 and node b has degree 3. Therefore, the graph
cannot have a Hamiltonian path.
Explain:
- Node d has only one edge connected to it, so it cannot be the start or end of a Hamiltonian
path.
- Node b has three edges connected to it. To have a Hamiltonian path, one of these three edges
must be used twice, but this would violate the rule of visiting each node only once.
Conclude:
- Because the graph does not meet the necessary conditions to have a Hamiltonian path, we
can confirm that the graph does not have a Hamiltonian path.
VI. Formulate corresponding proof principles to prove properties about defined sets
(D1).
ACTIVITY 1
Part 4:
a. ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴 ∪ 𝐵 ∪ 𝐶 ⊆ 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅
b. 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅ ⊆ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴∪𝐵∪𝐶.
Proof of ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴 ∪ 𝐵 ∪ 𝐶 ⊆ 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅
- Let x ∈ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴∪𝐵∪𝐶
- This means x ∉ A ∪ B ∪ C
- Therefore, x ∉ A , x ∉ B, and x ∉ C.
- ̅ x ∈ ∩ 𝐵,
Hence, x ∈ 𝐴, ̅ x ∈ ∩ 𝐶̅
- Thus, x ∈ 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅
Proof of 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅ ⊆ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴∪𝐵∪𝐶
- Let x ∈ 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅ .
- This means x ∈ 𝐴, ̅ x ∈ ∩ 𝐵,
̅ x ∈ ∩ 𝐶̅
- Therefore, x ∉ A, x ∉ B, x ∉ C
- Hence x ∉ A ∪ B ∪ C
- Thus, x ∈ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴∪𝐵∪𝐶
- Therefore, 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅ ⊆ ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴∪𝐵∪𝐶
Let's create a membership table for sets A, B, and C and check the expressions for ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴 ∪ 𝐵 ∪ 𝐶 ⊆ 𝐴̅ ∩
𝐵̅ ∩ 𝐶̅
A B C AUBUC 𝐴 ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
∪ 𝐵 ∪ 𝐶 𝐴̅ 𝐵̅ 𝐶̅ 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅
0 0 0 0 1 1 1 1 1
0 0 1 1 0 1 1 0 0
0 1 0 1 0 1 0 1 0
0 1 1 1 0 1 0 0 0
1 0 0 1 0 0 1 1 0
1 0 1 1 0 0 1 0 0
1 1 0 1 0 0 0 1 0
1 1 1 1 0 0 0 0 0
Table 2 : SHORTEST LENGTH
From the membership table, we see that the columns for ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴 ∪ 𝐵 ∪ 𝐶 and 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅ are identical,
verifying the equality.
Thus, ̅̅̅̅̅̅̅̅̅̅̅̅̅̅
𝐴 ∪ 𝐵 ∪ 𝐶 = 𝐴̅ ∩ 𝐵̅ ∩ 𝐶̅ is proven both by subset inclusion and by the membership table.
ACTIVITY 2
Part 4:
- Planar Graph: A graph that can be drawn on a plane without any edges crossing.
- Vertex: A point or node in the graph.
- Edge: A line connecting two vertices.
- Face: A region of the plane bounded by edges of the graph.
- Chromatic Number: The smallest number of colors needed to color the vertices of a graph such
that no two adjacent vertices share the same color.
Proof Outline
The proof proceeds by induction on the number of vertices nnn in the planar graph.
Case 1: G is 5-colorable:
Case 2: G is 4-colorable:
- Assume G is 4-colorable. Remove a vertex v and its incident edges, reducing G to a graph G′
with n vertices.
- By the inductive hypothesis, G′ can be colored with at most 5 colors.
- Re-insert vertex v back into G′. Since v is adjacent to at most 4 vertices in G′, one of the 5
available colors (from the 5-coloring of G′) can be used for v without conflicting with
adjacent vertices' colors.
By induction, every planar graph G can be colored with at most 5 colors. This completes the proof of
the Five Color Theorem.
This theorem is fundamental in graph theory and has various applications, particularly in map
coloring problems and in understanding the structure of planar graphs.
CONCLUSION
As we wrap up this assignment journey, we look back on the wealth of knowledge gained and the
obstacles overcome in the realm of graph theory. From delving into the intricacies of set sizes to
navigating the complexities of graph traversal algorithms, each task has shed light on new dimensions
of mathematical elegance and computational efficiency. Through rigorous analysis and creative
problem-solving, we've uncovered the mysteries of Hamiltonian paths, mapped out optimal routes
using Dijkstra's Algorithm, and appreciated the elegant yet profound implications of the Five Color
Theorem. Armed with these tools and insights, we move forward with renewed confidence, prepared
to confront real-world challenges with the grace and precision that graph theory offers.
REFERENCES