CS101 - Chapter3 Discrete Math
CS101 - Chapter3 Discrete Math
Page 2
Set
The concept of set is basic to all of mathematics
and mathematical applications.
All of mathematics, as well as subjects that rely
on mathematics, including computer science and
engineering, make use of some of the
fundamental concepts of mathematics such as
sets.
Discrete mathematics is concerned with
structures such as graphs (sets of vertices and
edges) and Boolean algebras (sets with certain
operations defined on them).
Page 3
Set
a collection of objects.
each object in a set is called an element or
member of the set. The elements or objects of
the set are enclosed by a pair of braces { }.
notations:
– capital or uppercase letters are usually used to
denote sets while small or lowercase letters
denote elements of a set.
– denotes "is an element of" or "belongs to“
– denotes "is not an element of" or "does not
belong to”
Page 4
Examples of Set
let A - the set of letters in the English
alphabet
B - the set of primary colors
C - the set of positive integers
– gA g is a member of set A
– white B white is not a member
of set B
– 100 C 100 is a member of set
C
Page 5
Set Builder
There are two ways to describe a set.
– the list (or roster) method
describes a set by enumerating the
elements of the set
– the rule method (or set builder)
describes the set by a statement or
a rule.
Page 6
Set Builder
Examples:
– Using the rule method the given sets
can be defined as:
• A = {xx is an English alphabet}
• B = {aa is a primary color}
• C = {yy is a positive integer}
– Using the roster method, we have:
• A = {a, b, c, d, e, ... , z}
• B = {red, blue, yellow}
• C = {1, 2, 3, 4, 5, ...}
Page 7
Cardinality of a Set
Definition. The cardinality of set A, or
the cardinal number of A, denoted as
n(A), is the number of elements in A.
Example.
Using the given sets
n(A) = 26, n(B) = 3 and n(C) = .
Page 8
Cardinality of a Set
Definition. A set is finite if there is one
counting number that indicates the total
number of elements in the set. It is
infinite if in counting the elements, we
never come to an end.
Example. Using the given sets,
– A is a finite set because it has 26
elements;
– B is also finite
– C is infinite
Page 9
Null and Singleton Sets
Definition.
- The null set or empty set, denoted by
the symbol , is the set that contains no
elements, that is, A is empty if and only if
(iff) n(A) = 0.
- A singleton set is a set that contains
only one element, that is, B is a singleton
set if and only if n(B) = 1.
Page 10
Null and Singleton Sets
Example.
– let D = { x | x is a month in the
Gregorian Calendar
with less than 28 days}
– let E = {y | y is a prime number,
24 < y < 30}
n(D) = 0, so D = .
E = {29}. n(E) = 1,
so E is a singleton set. Page 11
Subsets
Page 12
Subsets
Page 13
Examples of Subsets
Let G = {x/x is an integer}.
Let F = {x/x is a whole number}
Then, C G, where C as defined earlier
is the set of positive integers, because
every element of C is found in G, more
exactly, C G
However, F C because 0 F but 0 C.
But, C F.
Page 14
Universal Set
Definition. The set containing all of the
elements for any particular discussion is
called the universal set .
Remark: The universal set U does not
contain everything, only all things
pertinent to the discussion.
Page 15
Universal Set
Example.
Let
H = { x | x is an even number greater than 5
but less than or equal to 20}
I = { y| y is a letter in the word “Mississippi”}.
– Then, we can define the following universal
sets corresponding to H and I respectively.
U1 = {x/x is a natural number}
H U1.
U2 = {y/y is a letter in the English alphabet}
I U2.
Page 16
Intersection of sets
Union of sets
Difference of sets
Complement of a set
Cartesian product of two sets
Page 17
Set Union and Intersection
Definition. The intersection of two sets A
and B, denoted as A B, is the set
consisting of all elements common to both
or belonging to both A and B. In symbol,
A B = {x | xA and xB}.
Or, we can write x A B (xA xB).
Page 18
Set Union and Intersection
Definition. The union of sets A and B
denoted as A B is the set of all elements
which belong to A or B. In symbol,
A B = {x | xA or xB}
Or, we can write x A B (xA xB).
Page 19
Set Difference and Complement
Definition. The difference of sets A and B
is the set of elements which belong to A but
do not belong to B. We denote the
difference of A and B as A - B, which is read
as "A difference B" or "A minus B". Thus,
Page 20
Set Difference and Complement
Definition. The complement of set A,
denoted as A' (read "A prime") is the set
of elements found in the universal set
that are not in A. In symbol,
A' = {x/xU and xA}.
Or, we can write x A' (xU xA).
Page 21
Cartesian Product
Definition. The Cartesian product of two
sets A and B denoted by A x B (read as "A
cross B") is the set of ordered pairs (x, y) that
can be formed such that x is an element of A
and y is an element of B. In symbol
A x B = {(x, y) | xA and yB}.
Or, we can write (x, y) AxB (xA
yB).
Page 22
Cartesian Product
Page 23
Example
U = { 1, 2, 3, 4, 5 }
A = { 1, 2, 3 }
B = { 2, 4 }
a.) A B = { 2 }
b.) A B = { 1, 2, 3, 4 }
c.) A – B = { 1, 3 }
d.) A’ = { 4, 5 }
e.) A x B = { (1, 2), (1, 4), (2, 2), (2, 4),
(3, 2), (3, 4) }
Page 24
Venn Diagram
Represents the universal set U through a
rectangle.
Any set A belonging to U (or having U as
the universal is represented by a closed
region, usually circular, within the
rectangle.
The items (or points) inside and on the
circle represent elements of A, while those
outside represent objects not in A
(complement of A).
Page 25
Venn Diagram
used to depict the various unions, subsets,
complements, intersections of sets.
A' AB
A
B B'
C
U
Page 26
Venn Diagram
U = { 1, 2, 3, 4, 5 }
A = { 1, 2, 3 }
B = { 2, 4 }
A B
1 4
2
3
5
U
Page 27
Equality of Sets
Definition: Two sets X and Y are equal
and we write X = Y if X is a subset of Y
and Y is a subset of X, that is, X = Y iff
X Y and Y X. To put it another way,
X = Y if they have exactly the same
elements, that is, whenever x Y, then
x X.
Example :
If A = { x | x2 + x – 6 = 0 }, B = { 2, -3 },
then A = B
Page 28
Law 3.2 ( Properties of Set Union )
For any sets A, B, and C.
1. The union of any set with the null set is the set
itself. That is, A = A.
2. The union of any set with itself is the set itself.
That is, A A = A
3. Set Union is commutative, that is, A B = B A.
Page 29
Law 3.2 ( Properties of Set Union )
Page 30
Law 3.3 ( Properties of Set Intersection)
For any sets A, B, and C,
1. The intersection of any set with the
null set is the null set. That is, A
=
2. The intersection of any set with itself
is the set itself. That is, A A = A.
3. Set intersection is commutative, that
is, A B = B A.
Page 31
Law 3.3 ( Properties of Set Intersection)
4. Set intersection is associative, that is,
(A B) C = A (B C)
5. The intersection of any given set with
another set is a subset of the given set,
that is, (A B) A.
6. A (B C) = (A B) (A C)
A (B C) = (A B) (A C)
Page 32
Law 3.4 (Properties of Set Difference)
For any set A, B, C,
1. The removal of the null set from any set
has no effect on the set. That is, A - = A.
2. The removal of the elements of any set
from itself will leave the empty set. That is,
A – A = .
3. No elements can be removed from the
null set. That is, - A = .
Page 33
Law 3.4 (Properties of Set
Difference)
4. The result of removing the elements of a
set from any given set is a subset of the
given set, that is, A – B A.
5. A - (B C) = (A - B) (A - C)
A - (B C) = (A - B) (A - C)
Page 34
Law 3.5
Page 35
Power Set
Definition. The set of all subsets ( proper
or not ) of a set X, denoted (X), is called
the power set of X.
A method that we can consider in listing all
subsets of a given set is to start with
subsets of cardinality 0. In all cases, there
is only one, the null set. Then, we consider
all subsets of cardinality 1.
Page 36
Power Set
Next, we consider all subsets of cardinality
2. This process continues until subsets of
cardinality equal to that of the given set is
considered. Again, there will only be one
subset of this cardinality: the original set
itself.
Page 37
Power Set
Example 1
If A = {a, b, c}
(A) = {, {a}, {b}, {c}, {a, b}, {a, c},
{b, c}, {a, b, c} }.
All but {a, b, c} are proper subsets of A.
For this example,
n(A) = 3, n((A)) = 23 = 8.
Page 38
Power Set
Page 39