Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Chapter 2 - Sets
Definitions
- A set is a collection of objects
- An element/member is an object in a
set
Examples of sets
- The collection of whole numbers
- The collection of people who have
been in a movie with Kevin Bacon
- The collection of people who wrote a
whole book on a Thursday, speak
multiple languages, and have a last
name starting with ‘A’.
There are two common ways to list sets:
- Roster Notation
lists every element in the set
- Set Builder
provides a rule to find all elements in
a set
Both notations are placed within braces
{
}
Roster Notation (lists every element)
Examples:
{ 1, 2, 3, 4, 5 }
{ Cincinnati, Cleveland, Columbus }
Ellipsis “…” can be used to show that
elements continue in the same manner.
Examples:
{ 1, 2, 3, 4, 5, … , 10 }
{ 0, 1, 2, 3, 4, 5, 6, … }
{ … , -3, -2, -1, 0, 1, 2, 3, … }
{ Washington, Adams, … , Bush, Obama }
Representing Sets
• Set-builder notation:
•
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.1, Slide 7
Examples of sets in Set Builder Notation
A = { x : x is a whole number and
1 <= x and x <= 10 }
B = { x : x was in a movie with Kevin Bacon }
C = { x : x is a complete graph }
Representing Sets
• A set is well-defined if we are able to tell
whether any particular object is an
element of the set.
• Example: Which sets are well-defined?
(a) A = { x : x is a winner of an Academy Award}
(b) T = { x : x is tall}
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.1, Slide 9
Pop Quiz!!!!!
How many elements are in the set
A)
{ x : x is a day of the week }
B)
{ 4, 6, 8, … 14 }
C)
{ x : x is a student at UT and
x is a space alien }
How do we represent the following set in
Roster Form?
{ x : x is a student at UT and
x is a space alien }
{
}
A set with no entries is known as the
empty set. It can also be written as
∅
Representing Sets
• Do ∅ and {∅} mean the same thing?
– ∅ is the empty set – a set with no members
– {∅} is a set with a member object, namely, the
empty set
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.1, Slide 12
The previous example shows that is possible
to have a set of sets. (And sets of sets of
sets, and … )
Examples:
{ 1, { 1 } }
{ { 1, 2, 3, 4, 5, … } , {-1, -2, -3, -4, -5, … } }
{ { { 3, 5 }, { 1 } } , { Kevin Bacon } }
The Element Symbol
∈ means "is an element of"
∉ means "is not an element of"
• Example:
K4
3 ∈ { 2,3, 4,5}
6 ∉ { 2,3,4,5}
{ x : x is a complete graph }
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.1, Slide 14
Representing Sets
• Example: Consider female consumers living in the
U.S. The universal set is
U = { x : x is a female cosumer living in the U.S.}
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.1, Slide 15
Cardinal Number
• Example: State the cardinal number of the set.
X=
{ { 1,2,3} ,{ 1,4,5} ,{ 3} }
n( X ) = 3
(the set X contains 3 objects, each of which is also a set)
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.1, Slide 16
Section 2.2 Comparing two sets.
Examples:
{ x : x is an odd whole number }
{ x : x is an Euler path}
{ 1, 2, 3 }
{ 3, 2, 1 }
{ 1, 3, 5, … }
{ x : x is a Ham. path}
{ 1, 2, 3 }
{ x : x is a whole number }
{ 2, 4, 6, 8 }
{ … , -4, -2, 0, 2, 4, … }
{ 1, 2, 3, 4, 5, ... }
∅
{ 1, 2, 3 }
{ 1, 2, 3, … , 10}
Venn Diagrams and Proper Subsets
• A Venn diagram is used to visualize relationships
among sets.
• Here is the Venn diagram for A B.
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.2, Slide 19
The Venn Diagram of the different types
of numbers
Real Numbers
Rational Numbers
Integers
Whole Numbers
Natural Numbers
What are all of the subsets of { a, b, c} ?
How many are there?
Venn Diagrams and Proper Subsets
• How many subsets exist for the given set?
A = { Bill, Gill, Jill, Will}
2k = 24 = 16
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.2, Slide 22
Equivalent Sets
• The sets {1, 2, 3} and {A, B, C} are equivalent because
they both have 3 members.
• The sets { x : x is a pancreas in a UT student } and
{ x : x is a medulla oblongata in a UT student } are
equivalent. Why?
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.2, Slide 23
Section 2.3 Operations on Sets
For numbers we have operations like:
+, -, x, etc.
Sets also have operations on them.
First, we will look at Venn Diagrams for
the 4 ways that two sets A and B can be
related.
A and B could have no
elements in common.
B
A
U
A
B is a subset
B
A
U
A=B
A=B
U
A and B overlap, not
equal but contain
some of the same
elements
A
B
U
The last Venn Diagram can be used to
represent the others, so use it from now on.
A
B
U
Different regions represent different types of
elements.
A
B
I
IV
I = elements in A, not B
II = elements in A and B
II
III
U
III = elements in B, not A
IV = elements not in A nor B
Find the sets U, A, B.
A
1
B
5
3
2
4
6
U
U=
A=
B=
Find the sets U, A, B.
A
1
B
5
3
2
4
6
U
U=
A=
B=
Fill in the Venn diagram knowing U, A, B.
A
B
U
U = { 1, 2, 3, 4, 5, 6, 7 }
A = { 1, 2, 3, 4 }
B = { 1, 3, 5, 7 }
Union of Sets
• Example: Find the union of the
two sets.
A =
B =
AUB =
{ 1, 3, 5, 6, 8}
{ 2, 3, 6, 7, 8}
{ 1, 2, 3, 5, 6, 7, 8}
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.3, Slide 32
Intersection of Sets
• Example: Find the intersection
of the two sets.
{ 1, 3, 5, 6, 8}
B = { 2, 3, 6, 7, 8}
A ∩ B = { 3, 6, 8}
A =
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.3, Slide 33
Set Complement
• Example: Given U, find the
complement of A.
{ 1, 2, 3, , 10}
A = { 1, 3, 5, 7, 9}
A′ = { 2, 4, 6, 8, 10}
U =
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.3, Slide 34
Set Difference
• Example: Find the difference.
{ 3, 6, 9, 12} − { x : x is an odd integer }
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.3, Slide 35
Order of Set Operations
U = { 1, 2,3, ,10} , E = { x : x is even } ,
• Example: Let
B = { 1,3,4,5,8} , and A = { 1,2,4,7,8} .
′
Find ( A U B ) ∩( E ′ U A ) .
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.3, Slide 36
Order of Set Operations
• Intersection distributes over union.
A ∩( B U C ) =
© 2010 Pearson Education, Inc. All rights reserved.
( A ∩ B ) U ( A ∩C )
Section 2.3, Slide 37
Order of Set Operations
© 2010 Pearson Education, Inc. All rights reserved.
Section 2.3, Slide 38