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

Set Theory

Chapter 2 introduces the concept of sets, including their definitions, types, operations, and identities. It covers methods for describing sets, such as roster and set-builder notation, and discusses important sets in mathematics. The chapter also explores set operations like union, intersection, and difference, along with concepts like subsets, cardinality, and Cartesian products.

Uploaded by

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

Set Theory

Chapter 2 introduces the concept of sets, including their definitions, types, operations, and identities. It covers methods for describing sets, such as roster and set-builder notation, and discusses important sets in mathematics. The chapter also explores set operations like union, intersection, and difference, along with concepts like subsets, cardinality, and Cartesian products.

Uploaded by

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

Chapter 2

Basic Structures: Sets


Presentation By,
Sushma Moily
Lecturer
NIPA
Chapter Summary
Sets
The Language of Sets
Types of Set
Set Operations
Set Identities
Sets
Section 2.1
Section Summary
Definition of sets
Describing Sets
Roster Method
Set-Builder Notation
Some Important Sets in Mathematics
Empty Set and Universal Set
Subsets and Set Equality
Cardinality of Sets
Tuples
Cartesian Product
Introduction
Sets are one of the basic building blocks for the
types of objects considered in discrete mathematics.
Important for counting.
Programming languages have set operations.
In this section, we study the fundamental discrete
structure on which all other discrete structures are
built,
namely, the set.
• Sets are used to group objects together. Often, but not
always, the objects in a set have similar properties.
Contd….
For instance, all the students who are currently
enrolled in your school make up a set. Likewise, all
the students currently taking a course in discrete
mathematics at any school make up a set.
In addition, those students enrolled in your school
who are taking a course in discrete mathematics
form a set that can be obtained by taking the
elements common to the first two collections.
The language of sets is a means to study such
collections in an organized fashion.
Sets
A set is an unordered collection of objects.
 the students in this class
 the chairs in this room
The objects in a set are called the elements,
or members of the set. A set is said to contain

The notation a ∈ A denotes that a is an


its elements.

element of the set A.


If a is not a member of A, write a ∉ A
Describing a Set: Roster Method
S = {a,b,c,d}

S = {a,b,c,d} = {b,c,a,d}
Order not important

Each distinct object is either a member or


not; listing more than once does not change

S = {a,b,c,d} = {a,b,c,b,c,d}
the set.

Elipses (…) may be used to describe a set


without listing all of the members when the
pattern is clear.
S = {a,b,c,d, ……,z }
Roster Method
V = {a,e,i,o,u}
Set of all vowels in the English alphabet:

Set of all odd positive integers less than 10:


O = {1,3,5,7,9}
Set of all positive integers less than 100:
S = {1,2,3,……..,99}
 Set of all integers less than 0:
S = {…., -3,-2,-1}
 S= {a, 2, Fred, New Jersey}
Some Important Sets
N = natural numbers = {0,1,2,3….}
Z = integers = {…,-3,-2,-1,0,1,2,3,…}
Z⁺ = positive integers = {1,2,3,…..}
R = set of real numbers
R+ = set of positive real numbers
C = set of complex numbers.
Q = set of rational numbers
Set-Builder Notation
Specify the property or properties that all

S = {x | x is a positive integer less than 100}


members must satisfy:

O = {x | x is an odd positive integer less than 10}


O = {x ∈ Z⁺ | x is odd and x < 10}

S = {x | P(x)}
A predicate may be used:

Example: S = {x | Prime(x)}

Q+ = {x ∈ R | x = p/q, for some positive integers


Positive rational numbers:

p ,q }
Interval Notation
[a,b] = {x | a ≤ x ≤ b}
[a,b) = {x | a ≤ x < b}
(a,b] = {x | a < x ≤ b}
(a,b) = {x | a < x < b}

closed interval [a,b]


open interval (a,b)
TYPES OF SET
Finite and Infinite Set
A set which contain md finite number of
elements known a finite set.
 Example1: :
 Example 2:
A set which contains infinite number of
elements known as a infinite set.
Example 1:

Singleton Set and Pair set
 A set with one element is called a singleton
set.
 Example1 Here, The single element of
the set {∅} is the empty set itself!
 Example 2:
A set contains only 2 elements is known as a
pair set
Example 1:
Example 2:
Universal Set
The universal set U is the set containing
everything currently under consideration.
Sometimes implicit
Sometimes explicitly stated.
Contents depend on the context. Venn Diagram
 Consider the following example,
U

V aei
ou

John Venn (1834-


1923)
Cambridge, UK
Empty Set
A special set that has no elements is called the
empty set, or null set, and is denoted by ∅. The
empty set can also be denoted by { }
 Example 1: ∅={ x | x is a month of the year
with 40 days}
 Example 2:
Some things to remember
A set which contains another set is known as

Example 1: {{1,2,3},a, {b,c}}


sets of sets.

Example 2: {N,Z,Q,R}
Example 3:

The empty set is different from a set

∅ ≠{∅}
containing the empty set.
Set Equality
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 .

{1,3,5} = {3, 5, 1}
We write A = B if A and B are equal sets.

{1,5,5,5,3,3,1} = {1,3,5}
Subsets
Definition: The set A is a subset of B, if and
only if every element of A is also an element

The notation A ⊆ B is used to indicate that A is


of B.

a subset of the set B.


A ⊆ B holds if and only if

Because a ∈ ∅ is always false, ∅ ⊆ S ,for every


is true.
1.

Because a ∈ S → a ∈ S, S ⊆ S, for every set S.


set S.
2.
Showing a Set is or is not a Subset of
Another Set
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.

that A is not a subset of B, A ⊈ B, find an element x


Showing that A is not a Subset of B: To show

∈ A with x ∉ B. (Such an x is a counterexample to


the claim that x ∈ A implies x ∈ B.)
Examples:
1. The set of all computer science majors at your school
is a subset of all students at your school.
2. The set of integers with squares less than 100 is not
a subset of the set of nonnegative integers.
Another look at Equality of Sets
Recall that two sets A and B are equal,
denoted by A = B, iff

Using logical equivalences we have that A =


B iff

 This is equivalent to
A⊆B and B⊆A
Proper Subsets
Definition: If A ⊆ B, but A ≠B, then we say A
is a proper subset of B, denoted by A ⊂ B. If A
⊂ B, then

is true.
U
B
Venn Diagram A
Contd..
Set Cardinality(The Size of a Set )
Definition: If there are exactly n distinct elements in S
where n is a nonnegative integer, we say that S is finite.
Otherwise it is infinite.
Definition: The cardinality of a finite set A, denoted by |
A|, is the number of (distinct) elements of A.

1. |ø| = 0
Examples:

26
2. Let S be the letters of the English alphabet. Then |S| =

3. |{1,2,3}| = 3
4. |{ø}| = 1
5. The set of integers is infinite.
6. Let A be the set of odd positive integers less than 10.
Then |A| = 5
Power Sets
Definition: The set of all subsets of a set A,
denoted P(A), is called the power set of A.
Example: If A = {a,b} then
P(A) = {ø, {a},{b},{a,b}}

the power set is 2ⁿ.


If a set has n elements, then the cardinality of
Contd..
Contd..
P1: What is the power set of the set {0, 1, 2}?
Solution: The power set P ({0, 1, 2}) is the set of all subsets of
{0, 1, 2}. Hence,
Examples
P({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}.
Note that the empty set and the set itself are members of this set
of subsets
P2:
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,
P(∅) = {∅}.
The set {∅} has exactly two subsets, namely, ∅ and the set { ∅}
itself. Therefore,
P({∅}) = {∅, {∅}}.
Tuples
(a1,a2,…..,an) is the
ordered collection that has a1 as its first
The ordered n-tuple

element and a2 as its second element and so


on until an as its last element.
Two n-tuples are equal if and only if their

2-tuples are called ordered pairs.


corresponding elements are equal.

The ordered pairs (a,b) and (c,d) are equal if


and only if a = c and b = d.
Descartes
René

(1596-1650)
Cartesian Product
Definition: The Cartesian Product of two sets A
and B, denoted by A × B is the set of ordered pairs
(a,b) where a ∈ A and b ∈ B .

Example:
A = {a,b} B = {1,2,3}
A × B = {(a,1),(a,2),(a,3), (b,1),(b,2),(b,3)}

Definition: A subset R of the Cartesian product A ×

(Relations will be covered in depth in Chapter 9. )


B is called a relation from the set A to the set B.
Cartesian Product
Definition: The cartesian products of the sets A1,A2,
……,An, denoted by A1 × A2 × …… × An , is the set of
n-tuples (a1,a2,……,an) where ai
belongs to Ai for i = 1, … n.
ordered

Example: What is A × B × C where A = {0,1}, B =

Solution: A × B × C = {(0,1,0), (0,1,1), (0,1,2),(0,2,0),


{1,2} and C = {0,1,2}

(0,2,1), (0,2,2),(1,1,0), (1,1,1), (1,1,2), (1,2,0), (1,2,1),


(1,2,2)}
Exercise
1) Find the Cartesian product of A and B
where
A = {0, 1, 2} and B = {a, b, c}?
Using the same sets of A and B show that the
Cartesian product of B × A is not equal to the
Cartesian product of A × B
Set Operations
Section 2.2
Section Summary
Set Operations
Union
Intersection
Complementation
Difference
More on Set Cardinality
Set Identities
Proving Identities
Membership Tables
INTRODUCTION
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 majoring in mathematics, and
so on.
As always there must be a universal set U. All sets are
assumed to be subsets of U.
Union
the sets A and B, denoted by A ∪ B, is the
Definition: Let A and B be sets. The union of

set:

Example: What is {1,2,3} ∪Venn


{3,Diagram
4, 5}? for A ∪
B
U
Solution: {1,2,3,4,5} A B
Intersection
denoted by A ∩ B, is
Definition: The intersection of sets A and B,

Note if the intersection is empty, then A and

Example: What is? {1,2,3} ∩ {3,4,5} ?


B are said to be disjoint.
for A ∩B
Solution: {3}
Venn Diagram

U
Example:What is?
{1,2,3} ∩ {4,5,6} ?
A B

Solution: ∅
Complement
Definition: If A is a set, then the complement

the set U - A
of the A (with respect to U), denoted by Ā is

Ā = {x ∈ U | x ∉ A}
(The complement of A is sometimes denoted
by Ac .)

of {x | x > U
Example: If U is the positive integers
Venn less
Diagram for

70}
than 100, what is the complement
Complement

Solution: {x | x ≤ 70}
Ā
A
Difference
Definition: Let A and B be sets. The
difference of A and B, denoted by A – B, is the
set containing the elements of A that are not
in B. The difference of A and B is also called

A – B = {x | x ∈ A  x ∉ B} = A ∩B
the complement of B with respect to A.

U Venn Diagram for A − B


A
B
The Cardinality of the Union of Two
Sets
|A ∪ B| = |A| + | B| − |A ∩ B|
• Inclusion-Exclusion
U
A B

Venn Diagram for A, B, A ∩ B,


A∪B
• Example: Let A be the math majors in your class and B be the CS majors.
To count the number of students who are either math majors or CS
majors, add the number of math majors and the number of CS majors,
and subtract the number of joint CS/math majors.
• We will return to this principle in Chapter 6 and Chapter 8 where we will
derive a formula for the cardinality of the union of n sets, where n is a
positive integer.
Review Questions
Example: U = {0,1,2,3,4,5,6,7,8,9,10} A = {1,2,3,4,5}, B
={4,5,6,7,8}
1. A∪B

2. A ∩ B
Solution: {1,2,3,4,5,6,7,8}

Solution: {4,5}
3. Ā
Solution: {0,6,7,8,9,10}
4.

5. A – B
Solution: {0,1,2,3,9,10}

6. B – A
Solution: {1,2,3}

Solution: {6,7,8}
Symmetric Difference (optional)
Definition: The symmetric difference of A and
B, denoted by ( is the set

Example:
U = {0,1,2,3,4,5,6,7,8,9,10}
A = {1,2,3,4,5} B ={4,5,6,7,8} U

Solution: {1,2,3,6,7,8}
What is : A B

Venn Diagram
PROBLEMS
1) Let U = {a, b, c, d, e, f, g}, A = {a, b, c, d}, B = {a, b, c, d, e, f}
and C = {a, b, g} find , , A – B, B – C, A B, (A B) and B C.

2) If  1,2,3,4,5,6,7,8,9,10, A x   | x is prime  , B x   | x is odd ,


C x   | x is even . Find the following:

i) ABC  ii) ( A  B)  ( A  B) iii) ( A  B)  (C  B)

iv) A  (B  C) v) B C
Solution of Q2)
Given, , }

i)

[{}-A]
[{
Solution to Q2) Contd..
ii)

iii)

iv)

v)
Problems
3) Find the sets A and B if

 and
Set Identities
Identity laws

Domination laws

Idempotent laws

Complementation law

Continued on next slide 


Set Identities
Commutative laws

Associative laws

Distributive laws

Continued on next slide 


Set Identities
De Morgan’s laws

Absorption laws

Complement laws
Proving Set Identities
 Different ways to prove set identities:
1. Prove that each set (side of the identity) is a
subset of the other.
2. Use set builder notation and propositional
logic.
3. Membership Tables: Verify that elements in
the same combination of sets always either

the identity. Use 1 to indicate it is in the set


belong or do not belong to the same side of

and a 0 to indicate that it is not.


Proof of Second De Morgan Law
Example: Prove that
Solution: We prove this identity by showing
that:

1) and

2)

Continued on next slide 


Proof of Second De Morgan Law
These steps show that:

Continued on next slide 


Proof of Second De Morgan Law
These steps show that:
Set-Builder Notation: Second De Morgan
Law
Associative law of Union
Associative law of Intersection
Distributive Law
Membership Table
Exampl Construct a membership table to show that the
e: distributive law holds.

Solutio
n:
A B C
0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 0
0 1 0 0 0 1 0 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1
1 0 1 0 1 1 1 1
1 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1
Computer Representation of Sets

There are various ways to represent sets using a


computer. One method is to store the elements of the set
in an unordered fashion.
However, if this is done, the operations of computing the
union, intersection, or difference of two sets would be
time consuming, because each of these operations would
require a large amount of searching for elements.
We will present a method for storing elements using an
arbitrary ordering of the elements of the universal set.
 This method of representing sets makes computing
combinations of sets easy
Contd…
Assume that the universal set U is finite (and of
reasonable size so that the number of
elements of U is not larger than the memory size of
the computer being used).
First, specify an
arbitrary ordering of the elements of U, for
instance a1, a2, … , an.
Represent a subset A of U with the bit string of
length n, where the ith bit in this string is 1 if ai
belongs to A and is 0 if ai does not belong to A.
 Example 2.1 illustrates this technique.
Problem1
EXAMPLE 2.1:
 Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, and the
ordering of elements of U has the elements in
increasing order; that is, ai = i. Answer the
following,
i) What bit strings represent the subset of all odd
integers in U
Ans: O={1,3,5,79} , Bit String is 1010101010
ii) The subset of all even integers in U, and
Ans: E={2,4,6,8,10}, Bit String is 0101010101
iii) The subset of integers not exceeding 5 in U?
Ans: A={1,2,3,4,5}, Bit String is 1111100000
Problem2
EXAMPLE 2.2
 We have seen that the bit string for the set
{1, 3, 5, 7, 9} (with universal set {1, 2, 3, 4,
5, 6, 7, 8, 9, 10}) is
10 1010 1010.
What is the bit string for the complement of
this set?
Solution: Complement of 1010101010 is
0101010101
Problem3
EXAMPLE 1.3
 The bit strings for the sets {1, 2, 3, 4, 5} and
{1, 3, 5, 7, 9} are 11 1110 0000 and 10 1010
1010, respectively. Use bit strings to find the
union and intersection of these sets.
Solution:
Applications of set
Example 1
Example 2:
A travel agent surveyed 100 people to find out how many of them
had visited the cities of Melbourne and Brisbane. Thirty-one
people had visited Melbourne, 26 people had been to Brisbane,
and 12 people had visited both cities. Draw a Venn diagram to
find the number of people who had visited:

a) Melbourne or Brisbane

b) Brisbane but not Melbourne

c) only one of the two cities

d) neither city.
Solution to example 2
Let M be the set of people who

had visited Melbourne,


and let B be the set of people

who had visited Brisbane.


 Let the universal set U be the

set of people surveyed


The information given in the

question can now be rewritten as


Contd..
a) Number visiting Melbourne or Brisbane = 19 + 14
+12 = 45.
b) Number visiting Brisbane only = 14.

c) Number visiting only one city = 19 + 14 = 33.

d) Number visiting neither city = 100 – 45 = 55.


Example 3
In a class there are 110 students, 40 likes basketball, 45 likes
football, 33 likes golf, 11 likes both basketball and football, 8
likes football and golf, 5 likes basketball and golf only. 4 like all
the three sports. Using the formula of cardinality and Venn
diagram find the following.
1) How many of them take at least one sport?
(24+5+4+7+4+30+20)= 94
2) How many does not take any of the sports?
110-(24+5+4+7+4+30+20)=16
Example 3 contd..
3) How may take exactly one sports?
24+30+20=74
4) How many takes exactly 2 sports?
7+5+4=16
5)How many likes foot ball and basketball only?

7
Example 4:
A car dealer has 160 new cars. 50 cars have automatic
transmission, 80 have the tilt steering and 30 have power
windows. 42 have both automatic transmission and tilt steering.
18 of them have both automatic transmission and power
windows. 15 cars have all 3 features. 65 cars have none of the
above mentioned features. Using Venn diagram find the
following:
Example 4 contd..
1) How many have tilt steering and power windows only?
15+5=20
2) How many have at least one of the features?
160-65=95
3) How many have exactly 2 of the features?
27+3+5=35
4) How many have exactly one of the features?

5+33+7=45
Exercises
1) Twenty-four people go on holidays. If 15 go swimming, 12 go
fishing, and 6 do neither, how many go swimming and fishing? Draw
a Venn diagram and fill in the number of people in all four regions.

2) In a certain school, there are 180 pupils in Year 7. One hundred


and ten pupils study French, 88 study German and 65 study
Indonesian. Forty pupils study both French and German, 38 study
German and German only. Find the number of pupils who study:
 All three languages

 Indonesian only

 None of the languages

 At least one language

 Either one or two of the three languages.


Exercises Contd..
Exercises Contd..
5) In a certain school, there are 100 pupils in Grade
7. Thirty-five pupils study French, 50 study German
and 29 study Indonesian. Seven pupils’ study both
French and German only, Six pupils study German
and Indonesian only. 5 pupils study all 3 languages.
12 pupils do not study any of the language. Using
Venn diagram, Find the number of pupils who:

i. Study at least one language


ii. Study either one or two of the three languages.
iii. does not study French?
iv. Study French or German but not Indonesian?
v. Study both French and Indonesian only

You might also like