
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to set theory, focusing on set operations such as union, intersection, complement, and difference. It also covers power sets and De Morgan's laws. Students will learn how to find the cardinality of sets and power sets, as well as how to prove De Morgan's laws using set logic.
Typology: Exercises
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















PROGRAM TITLE: BTEC Computing in Software Engineering
UNIT TITLE: Unit 18: Discrete Maths
ASSIGNMENT NAME: ASSIGNMENT 1- Set theory and functions- Graph theory
TUTORIAL LECTURER: Lưu Thị Hương Giang
STUDENT NAME: Phạm Minh Tùng
Summative Feedback:
Internal verification:
I, Introduction
Digital computer technologies operate in separate stages, storing data as individual bits.
This method of finite operation is called "discrete"
The division of mathematics that describes computer science concepts such as software
development, programming languages, and cryptography is known as "discrete mathematics".
This branch of mathematics is an integral part of computer science courses.
II, Contents
1, Set theory
A set is a collection of objects, called elements, in which the order is not important and an
object cannot appear twice in the same set
Example:
Explicit definitions of sets, that is, where each element is listed, are:
A = {a, b, c}
a ∈ A means ‘a is an element of A’ or ‘a belongs to A’
A set is a collection of objects, called elements, in which the order is not important and an
object cannot appear twice in the same set
The universal set is the set of all objects we are interested in and will depend on the problem
under consideration. It is represented by E.
The empty set (or null set) is the set with no elements. It is represented by ∅ or { }.
Sets can be represented diagrammatically – generally as circular shapes. The universal set is
represented as a rectangle. These are called Venn diagrams
Example:
Let E ={1,2,3,4,5,6,7,8}
→A Venn diagrams set E ={1,2,3,4,5,6,7,8}, A ={1,2,3}, B ={4,5,6}
We shall mainly be concerned with sets of numbers as these are more often used as inputs to
functions.
Some important sets of numbers are (where ‘...’ means continue in the same manner):
The set of natural numbers N = {1, 2, 3, 4, 5, ...}
The set of integers Z = {... −3, −2, −1, 0, 1, 2, 3 ...}
The set of rational number (which includes fractional numbers) Q
The set of reals (all the numbers necessary to represent points on a line) R
Example:
Define the set A explicitly where E = Z and A = {x | -2 < x < 5}
Solution:
The A = {x | -2 < x < 5}is read as ‘A is the set of elements x, such that x is less than 5 and
more than -2’. Therefore, as the universal set is the set of natural numbers, A = {-1, 0, 1, 2, 3,
●Subset
Set Operations
Set operations is a concept similar to fundamental operations on numbers. Sets in math deal
with a finite collection of objects, be it numbers, alphabets, or any real-world objects.
Sometimes a necessity arises wherein we need to establish the relationship between two or
more sets. There comes the concept of set operations.
There are four main set operations which include set union, set intersection, set complement,
and set difference. In this article, we will learn the various set operations, notations of
representing sets, how to operate on sets, and their usage in real life.
What are Set Operations?
A set is defined as a collection of objects. Each object inside a set is called an 'Element'. A set
can be represented in three forms. They are statement form, roster form, and set builder
notation. Set operations are the operations that are applied on two or more sets to develop a
relationship between them. There are four main kinds of set operations which are as follows.
Union of sets
Intersection of sets
set B denoted as A − B lists all the elements that are in set A but not in set B. To understand
this set operation of set difference better, let us consider an example: If A = {1, 2, 3, 4} and B
= {3, 4, 5, 7}, then the difference between sets A and B is given by A - B = {1, 2}.
Complement of Sets
The complement of a set A denoted as A′ or Ac (read as A complement) is defined as the set
of all the elements in the given universal set(U) that are not present in set A. To understand
this set operation of complement of sets better, let us consider an example: If U = {1, 2, 3, 4,
5, 6, 7, 8, 9} and A = {1, 2, 3, 4}, then the complement of set A is given by A' = {5, 6, 7, 8,
Set Operations
The above image shows various set operations with the help of Venn diagrams. When the
elements of one set B completely lie in the other set A, then B is said to be a proper subset of
A. When two sets have no elements in common, then they are said to be disjoint sets. Now, let
us explore the properties of the set operations.
Properties of Set Operations
The properties of set operations are similar to the properties of fundamental operations on
numbers. The important properties on set operations are stated below:
Commutative Law - For any two given sets A and B, the commutative property is defined as,
This means that the set operation of union of two sets is commutative.
This means that the set operation of intersection of two sets is commutative.
Associative Law - For any three given sets A, B and C the associative property is defined as,
This means the set operation of union of sets is associative.
This means the set operation of intersection of sets is associative.
De-Morgan's Law - The De Morgan's law states that for any two sets A and B, we have (A ∪
B)' = A' ∩ B' and (A ∩ B)' = A' ∪ B'
Important Notes on Set Operations
Set operation formula for union of sets is n(A∪B) = n(A) + n(B) − n(A∩B) and set operation
formula for intersection of sets is n(A∩B) = n(A)+n(B)−n(A∪B).
The union of any set with the universal set gives the universal set and the intersection of any
set A with the universal set give
●Power Set
A power set includes all the subsets of a given set including the empty set. The power set is
denoted by the notation P(S) and the number of elements of the power set is given by 2n. A
power set can be imagined as a place holder of all the subsets of a given set, or, in other
words, the subsets of a set are the members or elements of a power set.
A set, in simple words, is a collection of distinct objects. If there are two sets A and B, then
set A will be the subset of set B, if all the elements of set A are present in the set B. Let us
learn more about the properties of power set, the cardinality of a power set, and the power set
of an empty set, with the help of examples, FAQs.
Power Set Definition
A power set is defined as the set or group of all subsets for any given set, including the empty
set, which is denoted by {}, or, ϕ. A set that has 'n' elements has 2n subsets in all. For
example, let Set A = {1,2,3}, therefore, the total number of elements in the set is 3. Therefore,
there are 23 elements in the power set. Let us find the power set of set A.
Set A = {1,2,3}
Subsets of set A = {}, {1}, {2}, {3}, {1,2}, {2,3}, {1,3}, {1,2,3}
Power set P(A) = { {}, {1}, {2}, {3}, {1,2}, {2,3}, {1,3}, {1,2,3} }
Cardinality of a Power Set
The cardinality of a set is the total number of elements in the set. A power set contains the list
of all the subsets of a set. The total number of subsets for a set of 'n' elements is given by 2n.
Since the subsets of a set are the elements of a power set, the cardinality of a power set is
given by |P(A)| = 2n. Here, n = the total number of elements in the given set.
Example: Set A = {1,2}; n = 2
|P(A)| = 2n = 22 = 4.
Subsets of A = {}, {1},{2},{1,2}
Therefore, |P(A)| = 4.
B2 = {B n(B)=2}
A
2
10
2
n(B2) = 45
Suppose that |B| = 3. Then cardinality of the set A = {3, 3} = {3} is equal to 1, and therefore
the set B = {1, |A|, |B|} = {1, 1, 3} = {1, 3} has cardinality 2. And we have a contradiction
with |B| = 3.
Therefore, |B| ≠ 3, and hence |B| < 3. It follows that |A| = 2. Then,
B = {1, |A|, |B|} = {1, 2, |B|}, and hence |B| = 2.
Conclusion: A = {3, 2} and B = {1, 2}.
2, Multi-sets
A multiset (mset, for short) is an unordered collection of objects (called the elements) in
which, unlike a standard (Cantorian) set, elements are allowed to repeat. In other words, an
mset is a set to which elements may belong more than once, and hence it is a non-Cantorian
set.
The number of distinct elements in an mset M (which need not be finite) and their
multiplicities jointly determine its cardinality, denoted by C(M). In other words, the
cardinality of an mset is the sum of multiplicities of all its elements.
●Basic of Mutil-sets
•Representations of Multisets
•Multiplicative form
Following Meyer and McRobbie, the use of square brackets to represent an mset has become
almost standard. Thus, an mset containing one occurrence of a, two occurrences of b, and
three occurrences of c is notationally written as [[a, b, b, c, c, c]] or [a, b, b, c, c, c] or ["[a, b,
c]"]_1,2,3 or [𝑎^1 , 𝑏^2 , 𝑐^3 ] or [a1, b2, c3], depending on one’s taste and convenience.
Exercise
Part 2
1.Write the multi-sets of prime factors of given
numbers.
a. 750
b. 3250
2.Find the cardinalities of each multiset in part 2-1.
3.Present the application of set and multiset in software engineering? Give specific
programming example.
Answer
1,a, multi-sets of prime factors 750 = A
3
b, multi-sets of prime factors 3250 = B
3
2, A ={2,3,5,5,5} => n(A)=
B = {2,5,5,5,13} => n(B) = 3
In software engineering, sets and multisets are frequently used to hold variables that are
thought to be unique data, such as citizen ID, phone number, email, etc. To store information
that can be duplicated, such as first and last names, grades, and dates of birth, Multiset was
exited once again. Here is an illustration of how to use set and multiset on a database.
Exercise
Part 3
the rule of the inverse f
(x)
a. f: 𝑅 → 𝑅
c. f: 𝑅
2
2
b. f: 𝑅
d. f: [0, 𝜋] → [−2,2]
Answer
a. f: 𝑅 → 𝑅
2
The function 𝑓(𝑥) = 𝑥
2
is not injective in domain D(f) = R, since
2
2
, but -3 ≠ 3
Conclusion
f: 𝑅 → 𝑅
2
⇒ no inverse function
b. f: 𝑅
This function is surjective and injective, so the function has an inverse function.
y = ⇒ x =
c. f: 𝑅
2
This function is surjective and injective, so the function has an inverse function.
y = x
2
-> x =
y
2
x
d. f: [0, 𝜋] → [−2,2]
𝑓(𝑥) = 2 𝑐𝑜𝑠x
This function is surjective and injective, so the function has an inverse function.
y= 2 𝑐𝑜𝑠x -> x= 𝑐𝑜𝑠
𝑓(𝑥) = 2 𝑐𝑜𝑠x -> 𝑓
for opposite conversion?
Answer
Given f(x) = (x-32) ⇒ y = (x-32) ⇒ x = (y) + 32
Hence, Opposite function for the opposite conversion is 𝑓
(𝑥) = (x) + 32
Exercise
Part 4
sets.
Answer
Therefore, M ⊂ N …………….. (i)
Again, let y be an arbitrary element of N then y ∈ N ⇒ y ∈ A' U B'
⇒ y ∈ A' or y ∈ B'
⇒ y ∉ A or y ∉ B
⇒ y ∉ (A ∩ B)
⇒ y ∈ (A ∩ B)'
⇒ y ∈ M
Therefore, N ⊂ M …………….. (ii)
Now combine (i) and (ii) we get; M = N i.e. (A ∩ B)' = A' U B'
Use indirect method
Let A, B, C be sets. If A ⊆ B and B ∩ C = then A C =
If we assume the conclusion is false and we get a contradiction --- then the theorem must be
true.
Suppose A ⊆ B and B ∩ C = ∅, and A ∩ C ≠ ∅. Assume A⊆B and NOR = ∅, and A∩C ≠ ∅.
To prove that this cannot happen, let x ∈ A∩C.
x ∈ A ∩ C ⇒ x ∈ A and x ∈ C ⇒ x ∈ B and x ∈ C ⇒ x ∈ B ∩ C x ∈ A ∩ C ⇒ x ∈ A and
x ∈ C ⇒ x ∈ B and x ∈ C⇒x B C
But this contradicts the second premise. Therefore, the theorem has been proved.
4. Graph theory
Graph Theory, in discrete mathematics, is the study of the graph. A graph is determined as a
mathematical structure that represents a particular function by connecting a set of points. It is
used to create a pairwise relationship between objects.
The graph is made up of vertices (nodes) that are connected by the edges (lines). The
applications of the linear graph are used not only in Maths but also in other fields such as
Computer Science, Physics and Chemistry, Linguistics, Biology, etc. In real-life also the best
example of graph structure is GPS, where you can track the path or know the direction of the
road.
● What is Graph?
In Mathematics, a graph is a pictorial representation of any data in an organised manner. The
graph shows the relationship between variable quantities. In a graph theory, the graph
represents the set of objects, that are related in some sense to each other. The objects are
basically mathematical concepts, expressed by vertices or nodes and the relation between the
pair of nodes, are expressed by edges.
History
The history of graph theory states it was introduced by the famous Swiss mathematician
named Leonhard Euler, to solve many mathematical problems by constructing graphs based
on given data or a set of points. The graphical representation shows different types of data in
the form of bar graphs, frequency tables, line graphs, circle graphs, line plots, etc.
Definition
Graph Theory is the study of points and lines. In Mathematics, it is a sub-field that deals with
the study of graphs. It is a pictorial representation that represents the Mathematical truth.
Graph theory is the study of relationship between the vertices (nodes) and edges (lines).
Formally, a graph is denoted as a pair G(V, E).
Where V represents the finite set vertices and E represents the finite set edges.
Therefore, we can say a graph includes non-empty set of vertices V and set of edges E.
Example
Suppose, a Graph G=(V,E), where
Vertices, V={a,b,c,d}
Edges, E={{a,b},{a,c},{b,c},{c,d}}
● Types of Graph
The graphs are basically of two types, directed and undirected. It is best understood by the
figure given below. The arrow in the figure indicates the direction.
Directed Graph
In graph theory, a directed graph is a graph made up of a set of vertices connected by edges,
in which the edges have a direction associated with them.
● Undirected Graph
The undirected graph is defined as a graph where the set of nodes are connected together, in
which all the edges are bidirectional. Sometimes, this type of graph is known as the
undirected network.
● Other types of graphs
formed.
called a complete graph
Exercise
Part 5
Discuss using two examples on binary trees both quantitatively and qualitatively.
BINARY TREE :Each node can have atmost two children.maximum number of nodes
possible at any level i is 2
i
. Binary tree play a vital role in a software application.one of the
most application of binary
tree is searching algorithm.
Binary tree is a special data structure used for data storage purpose. Binary tree are used to
represent a nonlinear data structure.
First example Quantitative binary tree
Complete binary tree: A binary tree is a complete binary tree if all levels are completely filled
(except possibly the last level and the last level has nodes as left as possible.
Maximum nodes =
h+
Minimum nodes =
h
maximum height=log n
Second Example Qualitative binary tree
FULL BINARY TREE: Each node have either 0 or 2 children.Each node will contain exactly
two children
except leaf node
number of leaf nodes= number of internal node +1.
maximum nodes=
h+
minimum nodes=
h
maximum height =
( n − 1 )
Array especially suited for full binary tree
Exercise
Part 6
weights.
D, and E given using Dijkstra's algorithm.
Answer
Dijkstra's algorithm solves the shortest path problem for directed weighted graphs with non-
negative weights. Therefore, the weights are non-negative, so we assume that w(e) ≥ 0 for all
e ∈ E.
The algorithm maintains a priority queue minQ that is used to store raw vertices with shortest
path estimates est(v) as key values. Then we iteratively extract the vertex u with the smallest
est(u) from minQ and relax all edges that fall from u to any vertex in minQ. Once a vertex has
been extracted from minQ and all relaxations through it have been completed, the algorithm
treats that vertex as processed and does not consider it again. The algorithm stops when the
priority queue (minQ) is empty or each node is examined exactly once.
We start at E
v= E, S = {E}
v= D, S = {E, D}
v= A, S = {E, D,A}
v= A, S = {E, D,A,C}
v= A, S = {E, D,A,C,B}
The spanning tree of the graph is: E – D – A– C – B