0% found this document useful (0 votes)
13 views

Set Theory

Uploaded by

Ahmed Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Set Theory

Uploaded by

Ahmed Ali
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

Discrete Structures

Set Theory
Ahsan Azhar
Introduction
Much of discrete mathematics is devoted to the study of discrete
structures, used to represent discrete objects. Many important discrete
structures are built using sets, which are collections of objects. Among
the discrete structures built from sets are combinations, unordered
collections of objects used extensively in counting; relations, sets of
ordered pairs that represent relationships between objects; graphs, sets of
vertices and edges that connect vertices; and finite state machines, used
to model computing machines.
Sets
Sets are used to group objects together. Often the objects in a set have
similar properties.

Data structures: Array, linked list, Boolean variables, …

DEFINITION
A set is an unordered collection of objects.
Sets
DEFINITION
The objects in a set are called the elements, or members, of the
set. A set is said to contain its elements.

aA: a is an element of the set A.


aA: a is not an element of the set A.
Note: lower case letters are used to denote elements.
Roster Method
There are several ways to describe a set. One way is to list all the members of a
set, when this is possible. We use a notation where all members of the set are
listed between braces. For example, the notation {a, b, c, d} represents the set
with the four elements a, b, c, and d. This way of describing a set is known as the
roster method.

EXAMPLE 1 The set V of all vowels in the English alphabet can


be written as V = {a, e, i, o, u}.
EXAMPLE 2 The set O of odd positive integers less than 10 can
be expressed by O = {1, 3, 5, 7, 9}.
Roster Method
EXAMPLE 3 Although sets are usually used to group together
elements with common properties, there is
nothing that prevents a set from having seemingly unrelated elements. For
instance, {a, 2, Fred, New Jersey} is the set containing the four elements a, 2,
Fred, and New Jersey. Sometimes the roster method is used to describe a set
without listing all its members. Some members of the set are listed, and then
ellipses (…) are used when the general pattern of the
elements is obvious.

EXAMPLE 4 The set of positive integers less than 100 can be denoted
by {1, 2, 3, … , 99}.
Roster Method
EXAMPLE 3 Although sets are usually used to group together
elements with common properties, there is
nothing that prevents a set from having seemingly unrelated elements. For
instance, {a, 2, Fred, New Jersey} is the set containing the four elements a, 2,
Fred, and New Jersey. Sometimes the roster method is used to describe a set
without listing all its members. Some members of the set are listed, and then
ellipses (…) are used when the general pattern of the
elements is obvious.

EXAMPLE 4 The set of positive integers less than 100 can be denoted
by {1, 2, 3, … , 99}.
Set Builder Notation
Another way to describe a set is to use set builder notation. We characterize all
those elements in the set by stating the property or properties they must have to
be members. The general form of this notation is {x ∣ x has property P} and is
read “the set of all x such that x has
property P.” For instance, the set O of all odd positive integers less than 10 can be
written as
O = {x ∣ x is an odd positive integer less than 10},

or, specifying the universe as the set of positive integers, as


O = {x ∈ Z+ ∣ x is odd and x < 10}.
Set Builder Notation
We often use this type of notation to describe sets when it is impossible to list all
the elements of the set. For instance, the set Q + of all positive rational numbers
can be written as
Q+ = {x ∈ R ∣ x = p/q, for some positive integers p and q}.

These sets, each denoted using a boldface letter, play an important role in discrete
mathematics:
N = {0, 1, 2, 3, …}, the set of all natural numbers
Z = {… , −2, −1, 0, 1, 2, …}, the set of all integers
Z+ = {1, 2, 3, …}, the set of all positive integers
Q = {p∕q ∣ p ∈ Z, q ∈ Z, and q ≠ 0},
the set of all rational numbers R, the set of all real numbers
Set Builder Notation
EXAMPLE 5 The set {N, Z, Q, R} is a set containing four elements, each
of which is a set. The four elements of this set are N, the
set of natural numbers; Z, the set of integers; Q, the set of
rational numbers; and R, the set of real numbers.
Equal Sets
DEFINITION
Two sets are equal if and only if they have the same elements.
Therefore, if A and B are sets, then A and B are equal if and only if We
write A = B if A and B are equal sets.

EXAMPLE 6 The sets {1, 3, 5} and {3, 5, 1} are equal, because they
have the same elements. Note that the order in which the elements of a
set are listed does not matter. Note also that it does not matter
if an element of a set is listed more than once, so {1, 3, 3, 3, 5, 5, 5, 5} is
the same as the set {1, 3, 5} because they have the same elements.
Empty Set
There is a special set that has no elements. This set is called the empty set, or
null set, and is denoted by ∅. The empty set can also be denoted by { } (that
is, we represent the empty set with a pair of braces that encloses all the
elements in this set). Often, a set of elements with certain properties turns out
to be the null set. For instance, the set of all positive integers that are greater
than their squares is the null set.
Singleton Set
A set with one element is called a singleton set. A common error is to confuse
the empty set ∅ with the set {∅}, which is a singleton set. The single element
of the set {∅} is the empty set itself! A useful analogy for remembering this
difference is to think of folders in a computer file system. The empty set can
be thought of as an empty folder and the set consisting of just the empty set
can be thought of as a folder with exactly one folder inside, namely, the empty
folder.
Singleton Set
A set with one element is called a singleton set. A common error is to confuse
the empty set ∅ with the set {∅}, which is a singleton set. The single element
of the set {∅} is the empty set itself! A useful analogy for remembering this
difference is to think of folders in a computer file system. The empty set can
be thought of as an empty folder and the set consisting of just the empty set
can be thought of as a folder with exactly one folder inside, namely, the empty
folder.
Subsets
DEFINITION
The set A is a subset of B, and B is a superset of A, if and only if every
element of A is also an element of B. We use the notation A ⊆ B to
indicate that A is a subset of the set B. If, instead, we want to stress that B
is a superset of A, we use the equivalent notation B ⊇ A.
(So, A ⊆ Band B ⊇ A are equivalent statements.)

We see that A ⊆ B if and only if the quantification

is true. Note that to show that A is not a subset of B we need only find
one element x ∈ A with x ∉ B. Such an x is a counterexample to the
claim that x ∈ A implies x ∈ B.
Subsets
We have these useful rules for determining whether one set is a subset of another:

Showing that A is a Subset of B: To show that A ⊆ B, show that if x


belongs to A then x also belongs
to B.

Showing that A is Not a Subset of B: To show that A ⊈ B, find a single


x ∈ A such that x ∉ B.
Subsets
THEOREM
For every set S,
(i ) ∅ ⊆ S and (ii ) S ⊆ S.

When we wish to emphasize that a set A is a subset of a set B but that A ≠


B, we write A ⊂ B and say that A is a proper subset of B. For A ⊂ B to
be true, it must be the case that A ⊆ B and there must exist an element x
of B that is not an element of A. That is, A is a proper subset of B if and
only if
Subsets
We have these useful rule for determining two sets are equal:

Showing Two Sets are Equal: To show that two sets A and B are
equal, show that A ⊆ B and B ⊆ A.

Sets may have other sets as members. For instance, we have the sets
and

Note that these two sets are equal, that is, A = B.


Also note that {a} ∈ A, but a ∉ A.
The Size Of A Set
Sets are used extensively in counting problems, and for such applications
we need to discuss the sizes of sets.

DEFINITION
Let S be a set. If there are exactly n distinct elements in S where n is a
nonnegative integer, we say that S is a finite set and that n is the
cardinality of S. The cardinality of S is denoted by |S|.

Remark: The term cardinality comes from the common usage of the term
cardinal number as the size of a finite set.
The Size Of A Set
EXAMPLE 1 Let A be the set of odd positive integers less than
10. Then |A| = 5.

EXAMPLE 2 Let S be the set of letters in the English alphabet.


Then |S| = 26.

EXAMPLE 3 Because the null set has no elements, it follows


that |∅| = 0.
Power Sets
Many problems involve testing all combinations of elements of a set to
see if they satisfy some property. To consider all such combinations of
elements of a set S, we build a new set that has as its members all the
subsets of S.

DEFINITION
Given a set S, the power set of S is the set of all subsets of the set S.
The power set of S is denoted by .
Power Sets
EXAMPLE 1 What is the power set of the set {0, 1, 2}?

Solution : The power set is the set of all subsets of


{0, 1, 2}. Hence,

Note that the empty set and the set itself are members of this set
of subsets.
Power Sets
EXAMPLE 2 What is the power set of the empty set? What is the
power set of the set {∅}?

Solution: The empty set has exactly one subset, namely, itself.
Consequently,

The set {∅} has exactly two subsets, namely, ∅ and


the set {∅} itself. Therefore,
Venn Diagrams
Venn diagrams are abstract, graphical representations with which we can
represent relationships between different sets; the subset relation being a
prime example as shown
EXAMPLE Draw a Venn diagram that represents V, the set of
vowels in the English alphabet.
Set Operations
Two, or more, sets can be combined in many different ways. For instance,
starting with the set of mathematics majors at your school and the set of
computer science majors at your school, we can form the set of students who
are mathematics majors or computer science majors, the set of students who
are joint majors in mathematics and computer science, the set of all students
not Links majoring in mathematics, and so on.
Union Of The Sets
DEFINITION
Let A and B be sets. The union of the sets A and B, denoted
by A ∪ B, is the set that contains those elements that are either
in A or in B, or in both.

An element x belongs to the union of the sets A and B if and only if x


belongs to A or x belongs to B. This tells us that
Union Of The Sets
The Venn diagram shown in Figure 1 represents the union of two sets A
and B. The area that represents A ∪ B is the shaded area within either the
circle representing A or the circle representing B.
Union Of The Sets
EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set
{1, 2, 3, 5}; that is,

EXAMPLE 2 The union of the set of all computer science majors


at your school and the set of all mathematics majors at
your school is the set of students at your school who are
majoring either in mathematics or in computer science (or in
both)
Intersection Of The Sets
DEFINITION
Let A and B be sets. The intersection of the sets A and B,
denoted by A ∩ B, is the set containing those elements in both
A and B.

An element x belongs to the intersection of the sets A and B if and only if


x belongs to A and x belongs to B. This tells us that
Intersection Of The Sets
The Venn diagram shown in Figure 2 represents the intersection of two
sets A and B. The shaded area that is within both the circles representing
the sets A and B is the area that represents the intersection of A and B.
Intersection Of The Sets
EXAMPLE 1 The intersection of the sets {1, 3, 5} and {1, 2, 3} is
the set {1, 3}; that is,

EXAMPLE2 The intersection of the set of all computer science


majors at your school and the set of all mathematics
majors is the set of all students who are joint majors in
mathematics and computer science.
Disjoint Sets
DEFINITION
Two sets are called disjoint if their intersection is the empty set.

EXAMPLE Let A = {1, 3, 5, 7, 9} and B = {2, 4, 6, 8, 10}. Because A ∩ B =


∅, A and B are disjoint.
The Difference Of The Sets
DEFINITION
Let A and B be sets. The difference of A and B, denoted by A − B, is the
set containing those elements that are in A but not in B. The difference
of A and B is also called the complement of B with respect to A.

An element x belongs to the difference of A and B if and only if x ∈ A


and x ∉ B. This tells us that
The Difference Of The Sets
The Venn diagram shown in Figure 3 represents the difference of the
sets A and B. The shaded area inside the circle that represents A and
outside the circle that represents B is the area that represents A − B.
The Difference Of The Sets
EXAMPLE 1 The difference of {1, 3, 5} and {1, 2, 3} is the set {5}; that
is, {1, 3, 5} − {1, 2, 3} = {5}. This is different from the
difference of {1, 2, 3} and {1, 3, 5}, which is the set {2}.

EXAMPLE 2 The difference of the set of computer science majors


at your school and the set of mathematics majors at your
school is the set of all computer science majors at your school
who are not also mathematics majors.
Complement Of The Set
DEFINITION
Let U be the universal set. The complement of the set A, denoted by , is
the complement of A with respect to U. Therefore, the complement of
the set A is U − A.

An element belongs toif and only if x ∉ A. This tells us that


Complement Of The Set
The Venn diagram shown in Figure represents the shaded area outside
the circle representing A is the area representing .
Complement Of The Set
EXAMPLE 1 The difference of {1, 3, 5} and {1, 2, 3} is the set {5}; that
is, {1, 3, 5} − {1, 2, 3} = {5}. This is different from the
difference of {1, 2, 3} and {1, 3, 5}, which is the set {2}.

EXAMPLE 2 The difference of the set of computer science majors


at your school and the set of mathematics majors at your
school is the set of all computer science majors at your school
who are not also mathematics majors.
DE Morgan's Law
DeMorgan’s Law states
𝑨∩ ¿ ∪
DE Morgan's Law
Similarly DeMorgan’s Law states
Fuzzy Sets
Types of Uncertainty:
1. Randomness : Probability
Knowledge about the relative frequency of each event in some
domain.
Lack of knowledge which event will be in next time
2. Incompleteness : Imputation by EM (Expectation–maximization)
Lack of knowledge or insufficient data
3. Ambiguity : Dempster-Shafer’s Belief Theory Evidential
Reasoning
Uncertainty due to the lack of evidence
e.g “The criminal is left-handed or not”
Fuzzy Sets
Types of Uncertainty:
4. Imprecision :
Ambiguity due to the lack of accuracy of observed data
e.g. Character Recognition

5. Fuzziness (vagueness) :
Uncertainty due to the vagueness of boundary
e.g. Beautiful woman, Tall man
Fuzzy Sets
 The word “fuzzy” means “vagueness (ambiguity)”.
 Fuzziness occurs when the boundary of a piece of information is not
clear-cut.
 Fuzzy sets - 1965 Lotfi Zadeh as an extension of classical notation
set.
 Classical set theory allows the membership of the elements in the set
in binary terms.
 Fuzzy set theory permits membership function valued in the interval
[0,1].
Fuzzy Sets
Example:
Words like young, tall, good or high are fuzzy.

 There is no single quantitative value which defines the term young.


 For some people, age 25 is young, and for others, age 35 is young.
 The concept young has no clean boundary.
 Age 35 has some possibility of being young and usually depends on the
context in which it is being considered.

Fuzzy set theory is an extension of classical set theory where


elements have degree of membership.
Fuzzy Sets
 In real world, there exist much fuzzy knowledge (i.e. vague, uncertain
inexact etc).
 Human thinking and reasoning (analysis, logic, interpretation)
frequently involved fuzzy information.
 Human can give satisfactory answers, which are probably true.
 Our systems are unable to answer many question because the systems
are designed based upon classical set theory (Unreliable and
incomplete).
 We want, our system should be able to cope with unreliable and
incomplete information.
 Fuzzy system have been provide solution.
Fuzzy Sets
Classical set theory Fuzzy set theory
• Classes of objects with sharp • Classes of objects with un- sharp
boundaries. boundaries.
• A classical set is defined by • A fuzzy set is defined by its
crisp(exact) boundaries, i.e., ambiguous boundaries, i.e., there
there is no uncertainty about the exists uncertainty about the location
location of the set boundaries. of the set boundaries.
• Widely used in digital system • Used in fuzzy controllers.
design
Fuzzy Sets
 Fuzzy sets theory is an extension of classical set theory.
 Elements have varying degree of membership. A logic based on two
truth values,
 True and False is sometimes insufficient when describing human
reasoning.
 Fuzzy Logic uses the whole interval between 0 (false) and 1 (true) to
describe human reasoning.
 A Fuzzy Set is any set that allows its members to have different
degree of membership, called membership function, having interval
[0,1].
Fuzzy Sets

DEFINITION
Fuzzy set F on U, the universe of discourse can be represented with the
membership grade,for all , which is defined by

Note:
1) The membership function 𝝁𝑭 (𝒖) represents the degree of
belonginess of u to the set F.
2) A crisp set is a special case of a fuzzy set, where
Fuzzy Sets
Membership Function
 The membership function fully defines the fuzzy set
 A membership function provides a measure of the degree of similarity
of an element to a fuzzy set
Membership functions can
 either be chosen by the user arbitrarily, based on the user’s experience
(MF chosen by two users could be different depending upon their
experiences, perspectives, etc.)
 Or be designed using machine learning methods (e.g., artificial neural
networks, genetic algorithms, etc.)
Fuzzy Sets
Set membership function is a real valued function with output in the
range

Probability x is in F.
Probability x is not in F.
e.g.

Let be the probability that x is tall


Hereis the membership function
Fuzzy Sets
Fuzzy Sets
Fuzzy Sets
A fuzzy subset A of U is characterized by a membership function 
which associates with each element u of U a number in the interval

DEFINITION
Let and be two fuzzy subsets of . Also, let be the complement of .
Then,
Fuzzy Sets Applications
 Fuzzy Set is particularly good at handling uncertainty, vagueness
and imprecision.
 especially useful where a problem can be described linguistically
(using words).
 Applications include:
 robotics
 washing machine control
 nuclear reactors
 focusing a camcorder
 information retrieval
 train scheduling
Cartesian Products
The order of elements in a collection is often important. Because sets are
unordered, a different structure is needed to represent ordered
collections. This is provided by ordered n-tuples.

DEFINITION
The ordered n-tuple (a1, a2, … , an) is the ordered collection that has a1
as its first element, a2 as its second element, … , and an as its nth
element.
Cartesian Products
We say that two ordered n-tuples are equal if and only if each corresponding pair
of their elements is equal. In other words, (a1, a2, … , an) = (b1, b2, … , bn) if and
only if ai = bi, for i = 1, 2, … , n. In particular, ordered 2-tuples are called ordered
pairs. The ordered pairs (a, b) and (c, d) are equal if and only if a = c and b = d.
Note that (a, b) and (b, a) are not equal unless a = b.

DEFINITION
Let A and B be sets. The Cartesian product of A and B, denoted by A ×
B, is the set of all ordered pairs (a, b), where a ∈ A and b ∈ B. Hence,
Cartesian Products
EXAMPLE 1 Let A represent the set of all students at a university, and let
B represent the set of all courses offered at the university. What is the
Cartesian product A × B and how can it be used?

Solution: The Cartesian product A × B consists of all the ordered pairs of


the form (a, b), where a is a student at the university and b is a course
offered at the university. One way to use the set A × B is to represent all
possible enrollments of students in courses at the university. Furthermore,
observe that each subset of A × B represents one possible total enrollment
configuration, and P(A × B) represents all possible enrollment
configurations.
Cartesian Products
EXAMPLE 2 What is the Cartesian product of A = {1, 2} and B = {a, b,
c}?

Solution: The Cartesian product A × B is


Cartesian Products
EXAMPLE 3 Show that the Cartesian product B × A is not equal to the
Cartesian product A × B, where A and B are as in Example 2.

Solution: The Cartesian product B × A is

This is not equal to A × B, which was found in Example 2.


Cartesian Products
EXAMPLE 4 What is the Cartesian product A × B × C, where A = {0, 1},
B = {1, 2}, and C = {0, 1, 2}?

Solution: The Cartesian product A × B × C consists of all ordered triples


(a, b, c), where a ∈ A, b ∈ B, and c ∈ C. Hence,
Cartesian Products
Example 5 If A is a set of appetizers, E is a set of entrees, and D is a set of
desserts. What is the Cartesian product 𝐴 × 𝐸 × 𝐷 and how can it be used.
Solution: The Cartesian product 𝐴 × 𝐸 × 𝐷 lists all possible dinners consisting of
one appetizer, one entrée, and one dessert.

Example 6 Let A represent the set of all students at a university, and let B
represent the set of all courses offered at the university. What is the Cartesian
product 𝐴 × 𝐵 and how can it be used.
Solution: 𝐴 × 𝐵 represent all possible enrollments of students in
courses at university
Thanks!
Do you have any questions?
[email protected]
F301 - Cab 2- Building A
University of Central Punjab Lahore

CREDITS: This presentation template was created by Slidesgo, and includes


icons by Flaticon and infographics & images by Freepik

You might also like