You are on page 1of 49

Unit 18:

Discrete Maths
LESSON OUTLINE
 Introduction to Unit 18
 Learning outcome
 Assessment criteria
 Recommended resources and
Prerequisite topic

2
Introduction to Unit 18
 Digital computer technologies operate with distinct steps, and
data is stored within as separate bits.
 This method of finite operation is known as ‘discrete’
 The division of mathematics describes computer science
concepts such as
 software development
 programming languages and
 cryptography is known as ‘discrete mathematics’.
 This branch of mathematics is a major part of computer
science courses
Introduction to Unit 18
This unit introduces students to the discrete
mathematical principles and theory that underpin
software engineering.
A series of case studies, scenarios and tasked-based
assessments s
 Explore set theory and functions
 Analysis using graph theory
 Boolean algebra
 Explore additional concepts within abstract
algebra
Introduction to Unit 18
 Among the topics included in this unit are: set
theory and functions, Eulerian and Hamiltonian
graphs, binary problems, Boolean equations,
Algebraic structures and group theory.
Learning outcome
Examine set theory and functions applicable to
LO1
software engineering

Analyse mathematical structures of objects


LO2 using graph theory.

Investigate solutions to problem situations


LO3 using the application of Boolean algebra.

Explore applicable concepts within abstract


LO4
algebra.

6
Assessment criteria
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 1.1
Explicit definitions of sets, that is, where each element is
listed, are:
A = {a, b, c}
B = {3, 4, 6, 7, 8, 9}
C = {Linda, Raka, Sue, Joe, Nigel, Mary}
a ∈ A means ‘a is an element of A’ or ‘a belongs to A’;
therefore in the above examples:
3 ∈B
Linda ∈ C
8
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
 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

9
Set theory
 Sets can be represented diagrammatically – generally as
circular shapes. The universal set is represented as a
rectangle. These are called Venn diagrams

10
Set
 Example 1.2
theory
E = {a, b, c, d, e, f, g},
A = {a, b, c},
B = {d, e}

11
Set theory
 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 rationals (which includes fractional
numbers) Q
 The set of reals (all the numbers necessary to
represent points on a line) R

12
Set theory
 Sets can also be defined using some rule, instead of
explicitly.

13
Set theory
 Example 1.3
Define the set A explicitly where E = N and
A = {x | x < 3}

Solution:
The A = {x | x < 3} is read as ‘A is the set of
elements x, such that x is less than 3’. Therefore, as
the universal set is the set of natural numbers, A =
{1, 2}

14
Set theory
 Example 1.3
Define the set A explicitly where E = N and
A = {x | x < 3}

Solution:
The A = {x | x < 3} is read as ‘A is the set of
elements x, such that x is less than 3’. Therefore, as
the universal set is the set of natural numbers, A =
{1, 2}

15
Set theory

 Example 1.4
E = days of the week
A = {x | x is after Thursday and before Sunday}.
Then A = {Friday, Saturday}.

16
Set theory
Subset
We may wish to refer to only a part of some set.
This is said to be a subset of the original set.
A ⊆ B is read as ‘A is a subset of B’ and it means
that every element of A is an element of B
 Example 1.5
E=N
A = {1, 2, 3}, B = {1, 2, 3, 4, 5}
Then A ⊆ B

17
Set theory
Subset
Note the following points:
 All sets must be subsets of the universal set, that
is, A ⊆ E and B ⊆ E
 A set is a subset of itself, that is, A ⊆ A
 If A ⊆ B and B ⊆ A, then A = B

Ví dụ. A = {1, 2} và B = {x | −3x + 2 = 0} là hai tập


hợp bằng nhau, vì sao?

18
Set theory
Subset
 Tập hợp ∅ được qui định là tập hợp con của tất cả
các tập hợp.
 Cho trước tập hợp A, ta ký hiệu tập hợp tất cả các
tập hợp con của A là P(A). Tập hợp các tập hợp con
của tập hợp A cho trước luôn chứa tập hợp ∅ và A
làm phần tử.
Ví dụ. Với A = {1, 2} thì P(A) = {∅, {1}, {2}, {1, 2}}.

19
Set theory
Proper Subset
A ⊂ B is read as ‘A is a
proper subset of B’ and
means that A is a subset
of B but A is not equal to
B. Hence, A ⊂ B and
simultaneously B ⊂ A are
impossible.

20
Operations on sets
Complement
or A’ represents the
complement of the set A.
The complement of A is the
set of everything in the
universal set which is not in
A, this is pictured in Figure
1.4

21
Operations on sets
Complement
Example 1.6
E=N
A = {x | x > 5} then = {1, 2, 3, 4, 5}

22
Operations on sets
Complement
Example 1.7 The universal set is the set of real
numbers represented by a real number line. If A is the
set of numbers less than 5, A = {x | x < 5} then A
is the set of numbers greater than or equal to 5. A
= {x | x 5}. These sets are shown in Figure 1.5

23
Operations on sets
Intersection
A ∩ B represents the
intersection of the sets A
and B.
The intersection contains
those elements that are in A
and also in B, this can be
represented as in Figure 1.6
and examples are given in
Figures 1.7–1.10.
24
Operations on sets
Intersection

25
Operations on sets
Intersection

26
Operations on sets
Intersection
Note the following important points:
 If A ⊆ B then A∩B = A. This is the situation in the
example given in Figure 1.8.
 If A and B have no elements in common then A ∩ B = ∅
and they are called disjoint. This is the situation given in
the example in Figure 1.9.
Two sets which are known to be disjoint can be shown on
the Venn diagram as in Figure 1.10

27
Operations on sets
Union
A∪B represents the union of A and B, that is, the set
containing elements which are in A or B or in both A and B.
On a Venn diagram, the union can be shown as in Figure
1.11 and examples are given in Figures 1.12–1.15.

28
Operations on sets
Union

29
Operations on sets
Union

30
Operations on sets
Union
Note the following important
points: If A ⊆ B, then A ∪ B = B.
This is the situation in the
example given in Figure 1.13.
The union of any set with its
complement gives the universal
set, that is, A ∪ A’= E, the
universal set. This is pictured in
Figure 1.15.
31
Operations on sets

32
Operations on sets
Difference
¿ 𝐴 ∩ 𝐵′

33
Operations on sets
Note the following points:
1. Law for complement: = A.
2. De Morgan’s Law for intersections :

3. De Morgan’s Law for union :

34
Cardinality of a finite set
The number of elements in a set is called the cardinality
of the set and is written as n(A) or |A|
Example 1.8
n(∅) = 0, n({2}) = 1, n({a, b}) = 2
For finite sets, the cardinality must be a natural
number

35
Cardinality of a finite set
Example 1.9
In a survey, 100 people were students and 720 owned a
video recorder; 794 people owned a video recorder or
were students. How many students owned a video
recorder?

36
Cardinality of a finite set
Example 1.9
E = {x | x is a person
included in the survey}
Setting S = {x | x is a
student}
and V = {x | x owns a
video recorder},
we can solve this
problem using a Venn
diagram as in Figure
1.16..
37
Cardinality of a finite set
Example 1.9
x is the number of students who own a video recorder.
From the diagram we get
100 − x + x + 720 − x = 794
⇔ 820 − x = 794
⇔ x = 26
Therefore, 26 students own a video recorde

38
Cardinality of a finite set
1. Find an example of sets A and B such that |A| =4,
|B|=5, and |A ∪ B|=9.
2. Find an example of sets A and B such that |A|=3,
|B|=4, and |A ∪ B|=5.
3. Are there sets A and B such that |A| =|B|, |A∪B|=10,
and |A∩B|=5? Explain.

39
Cardinality of a finite set
1. Let A and B be two non-empty finite sets. If cardinalities of
the sets A, B, and A ∩ B are 83, 26 and 18 respectively, find
the cardinality of the set A ∪ B.

2. If n(A - B) = 45, n(A ∪ B) = 110 and n(A ∩ B) = 15, then


find n(B).

3. If n(A) = 33, n(B) = 36 and n(C) = 28, find n(A ∪ B ∩ C).

40
41
42
Summary
1. A set is a collection of objects called elements.
2. E is the universal set, the set of all objects we are
interested in.
3. ∅ is the empty set, the set with no elements.
4. The three most important operations on sets are:
(a) intersection: A ∩B is the set containing every
element in both A and B;
(b) union: A ∪ B is the set of elements in A or in B or
both;
(c) complement: A’ is the set of everything, in the
universal set, not in A.
43
44
45
Laws of set algebra

46
Laws of set algebra

47
Laws of set algebra

48
Laws of set algebra

49

You might also like