Sets

Download as pdf or txt
Download as pdf or txt
You are on page 1of 72

Sets

Sets and
Membership
❑ A set is to be thought of as any collection of objects
whatsoever.
❑ The elements contained in each set need not have
anything in common.
❑ There is no restriction on the number of elements
allowed in a set.
❑ We should be able to decide (in principle) whether the
object belongs to the set.
Notation
❑ Use upper-case letters to denote sets and lower-case
letters to denote elements.
❑ The symbol ∈ denotes ‘belongs to’ or ‘is an element of’.
❑ For example:
a є A means the element a belongs to the set A.
and
a ∉ A means the element a does not belongs to set A
Defining Sets
❑ The basic is to list all the elements enclosed between
curly brackets.
❑ Example 1:

A = {stone, table, banana, coconut}


B = {2, 4, 6, 8, 10, …}
Cn = {1, 2, 3, …, n}

❑ Set B uses ‘…’ which means that the list continues


indefinitely based on the given pattern.
❑ The listing of elements is sometimes impractical,
especially if the elements are too many. Like, the set of
integers from 1 to 1,000,000.
❑ An alternative way is to define the elements of a set
with its property or predicate.
❑ A set could be defined as, A = {x : P(x)} – the set of all x
such that P(x) is true.
❑ Example 2:
Referring to set B in slide #5
B = {n : n is an even, positive integer}
B = {n : n = 2m, where m > 0 and m is an integer}
B = {2m: m > 0 and m is an integer}

referring to set C in slide #5


Cn = {p : p is an integer and 1 ≤ 𝑝 ≤ 𝑛}
The set {1, 2} could be defined as:
{x : x2 – 3x + 2 = 0}

An empty set A can be defined as:


A = {}, or
A = ∅, or
A = {x : x is an integer and 1 ≤ 𝑥 ≤ 2}
Equality of Sets
❑ Two sets are equal if and only if they contain the same
elements, A = B if ∀𝑥 𝑥 ∈ 𝐴 ↔ 𝑥 ∈ 𝐵
❑ The following sets are equal:
{1, - 1/2, 1066, π}
{- 1/2, π, 1066, 1}
{1, -1/2, -1/2, π, 1066, -1/2, 1}
❑ These two sets are also equal:
{x : (x - 1)2 = 4} = {x : (x + 1)(x - 3) = 0}
❑ If A is a finite set, its cardinality denoted by |A|, is the
number of distinct elements that the set contains.
❑ Example 3:
|∅| = 0
|{sugar, candy, table, tea}| = 4
X = {-1, 0, 1, 2, 3, …, n}, |X| = n + 2
|{1, 2, 3, 4, 5, …}| = ∞
|{{1, 2, 3},{a, b, c, d}}| = 2
Additional Examples
• Example 4: List the elements of each of the following sets,
using the ‘. . . ’ notation where necessary:

a. {x : x is an integer and −3 < x < 4}

b. {x : x = y2 and y is an integer}
• Example 5: Let X = {0, 1, 2}. List the elements of each of
the following sets:
a. {z : z = 2x and x ∈ X}

b. {z : z = x + y where x ∈ X and y ∈ X}

c. {z : x = z + y where x ∈ X and y ∈ X}
• Example 6: Determine the cardinality of each of the
following sets:
a. {x : x is an integer and 1/8 < x < 17/2}

b. {x : 𝑥 is an integer}
• Example 7: Use the notation {x : P(x)}, where P(x) is a
propositional function, to describe each of the following
sets.
a. {1, 2, 3, 4, 5}.

b. {3, 6, 9, 12, 15, . . ., 27, 30}.

c. {1, 3, 5, 7, 9, 11, . . .}.


Subsets
❑ The set A is a subset of the set B, denoted A ⊆ B, if
every element of A is also an element of B. Symbolically,
A ⊆ B if ∀x[x ∈ A → x ∈ B] is true, and conversely.
❑ If A is a subset of B, we say that B is a superset of A,
and write B ⊇ A.
❑ Every set is a subset to itself, A ⊆ A.
❑ Set A is a proper subset of B, denoted by A ⊂ B, if and
only if A ⊆ B and A ≠ B.
❑ An empty set, denoted by ∅, is a subset of every set.
❑ Two set A and B are equal if and only if A ⊆ B and B ⊆ A.
• Example 8: if A = {x : 2x2 + 5x – 3 = 0} and B = {x : 2x2 +
7x + 2 = 3/x}, show that A ⊆ B
• Example 9: Let A = {{1}, {2}, {1, 2}} and let B be the set
of all non-empty subsets of {1, 2}. Show that A = B
Frequently Used as Universal Sets
❑ ℕ = {0, 1, 2, 3, . . .} the set of natural numbers.
❑ ℤ = {. . . , −2, −1, 0, 1, 2, . . .} the set of integers.
❑ ℚ = {p/q : p, q ∈ ℤ and q ≠ 0} the set of fractions or
rational numbers.
❑ ℝ = the set of real numbers; real numbers can be
thought of as corresponding to points on a number line
or as numbers written as (possibly infinite) decimals.
❑ ℂ = {x + iy : x, y ∈ ℝ and i2 = −1} the set of complex
numbers.
Additional Examples
• Example 10: State whether each of the following
statements is true or false.
a. 2 ∈ {1, 2, 3, 4, 5}

b. ∅⊆ {∅, {∅}}

c. {2} ∈ {1, 2, 3, 4, 5}

d. {∅} ⊆ {∅, {∅}}


e. 2 ⊆ {1, 2, 3, 4, 5}
• Example 11: List all the subsets of {a, b}.
• Example 12: Does the empty set have any subsets?
Explain your answer.

• Example 13: Given that X = {1, 2, 3, 4}, list the elements


of each of the following sets:
a. {A : A ⊆ X and |A| = 2}

b. {A : A is a proper subset of X}

c. {A : A ⊆ X and 1 ∈ A}
• Example 13: Let 𝒰= {x : x is an integer and 2 ≤ x ≤ 10}. In
each of the following cases, determine whether A ⊆ B, B ⊆
A, both or neither:
a. A = {x : x is odd} B = {x : x is a multiple of 3}

b. A = {x : x is even} B = {x : x2 is even}
Operations on Sets
❑ Venn diagram
❑ is a useful visual representation of sets.
❑ sets are represented as regions in the plane and elements
which belong to a given set are placed inside the region
representing it.
❑ All sets are placed inside a box which represents the
universal set.
❑ To show that an element(s) belong to more than one set;
the sets involve must overlap and the element(s) is/are
placed inside the overlap.
❑ Intersection
❑ The intersection of two sets A and B, denoted by A ⋂ B is
the set of all elements that belong to both set A and set B.
❑ A ∩ B = {x : x ∈ A and x ∈ B}
❑ Union
❑ The union of two sets A and B, denoted by A ⋃ B is the set
of all elements that belongs to set A or to set B or both.
❑ A ∪ B = {x : x ∈ A or x ∈ B or both}
❑ The generalized intersection – more than two sets
⋂𝑛𝑟=1 𝐴𝑟 = A1 ∩ A2 ∩ · · · ∩ An
= {x : x ∈ A1 and x ∈ A2 and . . . and x ∈ An}
= {x : x belongs to each set Ar, for r = 1, 2, . . . , n}.
❑ The generalized union – more than two sets.
❑ ⋃𝑛𝑟=1 𝐴𝑟 = A1 ∪ A2 ∪ · · · ∪ An
= {x : x ∈ A1 or x ∈ A2 or . . . or x ∈ An}
= {x : x belongs to at least one set Ar, r = 1, . . . , n}.
❑ Disjoint
❑ Sets A and B are disjoint if they have no common element.
❑ A∩B={}
❑ The complement of a set A, denoted by 𝐴 (or A’ or Ac),
consists of all elements in 𝒰 that are not found in set A.
❑ A = {x : P(x)}, A’ = {x : ~P(x)}
❑ The difference or relative complement of two sets A and
B, denoted A − B or A \ B.
❑ A - B = {x : x ∈ A and x ∉ B}
• Example 14: Let 𝒰 = {1, 2, 3, …, 10}, A = {n є 𝒰: 1 ≤ n ≤ 7},
B = {n є 𝒰: m is a multiple of 3}. Determine: A ⋂ B, A ⋃ B, A
– B, B – A, 𝐴, 𝐴 ∪ 𝐵, 𝐴 − 𝐵
• Example 14: For each of the following, draw the Venn
diagram and shade the region corresponding to the
indicated set.
a. A – (B ⋂ C)

b. (A - B) ⋃ (A - C)
Counting
Techniques
❑ Counting Principle 1: if A and B are disjoint sets, then
|A ∪ B| = |A| + |B|.
❑ Counting Principle 2:If A1, A2, . . . , An are sets, no pair
of which have elements in common, then
|A1 ∪ A2 ∪ · · · ∪ An| = |A1| + |A2| + · · · + |An|.
❑ The Inclusion-Exclusion Principle: if A and B are finite
sets then
|A ∪ B| = |A| + |B| − |A ∩ B|.
❑ If A, B and C are finite sets, then
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |B ∩ C|
− |C ∩ A| + |A ∩ B ∩ C|
• Example 15:Each of the 100 students in the first year of
Utopia University’s Computer Science Department studies
at least one of the subsidiary subjects: mathematics,
electronics and accounting. Given that 65 study
mathematics, 45 study electronics, 42 study accounting, 20
study mathematics and electronics, 25 study mathematics
and accounting, and 15 study electronics and accounting,
find the number who study:
a. all three subsidiary subjects;
b. mathematics and electronics but not accounting;
c. only electronics as a subsidiary subject.
• Example 16: In a survey of 1000 households, 275
owned a home computer, 455 a video, 405 two cars,
and 265 households owned neither a home computer,
nor a video, nor two cars. Given that 145 households
owned both a home computer and a video, 195 both a
video and two cars, and 110 both two cars and a home
computer, find the number of households surveyed
which owned:
a. a video only;
b. two cars, a video but not a home computer;
c. a video, a home computer but not two cars.
Family of Sets
❑ Family of sets or collection of sets - a set of sets.
❑ {A1, A2, . . . , An}, the integers 1, 2, …, n are labels to
distinguish the different sets in the collection.
❑ The collection {A1, A2, . . . , An}, the indexing set is I = {1,
2, . . ., n}, the family of set can be written as
{Ai : i ∈ I} = {A1, A2, . . . , An}

{Ar : r ∈ ℤ+} = {A1, A2, . . . } – the index is infinite


❑ The union and intersection of a family of set
can be defined as:
⋂𝑖∈𝐼 𝐴𝑖 = {x : x ∈ Ai for all i ∈ I}
⋃𝑖∈𝐼 𝐴𝑖 = {x : x ∈ Ai for some i ∈ I}
• Example 17: Let I = {1, 2}, what are ⋂𝑖 ∈𝐼 𝐴𝑖 and ⋃𝑖∈𝐼 𝐴𝑖 ?

• Example 18: Let I = ℤ+ = {1, 2, 3, …}, and for each i є ℤ+ let


Ai = {i}. What are ⋂𝑖 ∈ 𝐼 𝐴𝑖 and ⋃𝑖 ∈ 𝐼 𝐴𝑖 ?

• Example 19: Let I = ℤ+ and for each n ∈ ℤ+ let An = {k ∈ ℤ: k


≤ n}. What are ⋂𝑖 ∈ 𝐼 𝐴𝑖 and ⋃𝑖 ∈ 𝐼 𝐴𝑖 ?
Power Set
❑ The power set of A, denoted (A), is the set of all subsets
of A: P(A) = {B : B ⊆ A}.
❑ Theorems on Power Sets: for all sets A and B
❑ A ⊆ B if and only if P(A) ⊆ P(B).
❑ P(A) ∩ P(B) = P(A ∩ B).
❑ P(A) ∪ P(B) ⊆ P(A ∪ B)
• Example 20: Let A = {1, 2, 3} and B = {1, 2}. Determine
whether each of the following is true or false and give a
brief justification.

a. B ∈ P(A)
b. B ∈ A

c. A ⊆ P(A)

d. {{1}, B} ⊆ P(A)

e. { } ∈ P(A)

f. { } ⊆ P(A).
Partitions of a Set
❑ Partition of a set is a set of non-interesting subsets of
any given set.
❑ Particularly useful when counting the elements of a set.
❑ Let A be a set. A partition of A is a family {Si : i є I} of
non-empty subsets of A such that:
❑ ⋃𝑖 ∈𝐼 𝑆𝑖 = A, and
❑ Si ⋂ Sj = ∅ if i ≠ j for all i, j є I.
❑ If the second condition (previous slide) is satisfied, then
the family of sets Si are pairwise disjoint.
❑ Example 21:
a. {{1}, {2, 3}, {4, 5, 6}} is a partition of {1, 2, 3, 4, 5, 6}.
b. Each of the following is a partition of , the set of
integers.
i. {ℤ−, {0}, ℤ+}, where − and + are the sets of negative
and positive integers, respectively.
ii. {{n} : n ∈ ℤ}
• Example 22: List the elements of ℘(A) in the following
cases:
a. A = {a, b, c, d}
b. A = {{1}, {1, 2}}
• Example 23: Which of the following are partitions of the
set {2, 3, 7, 9, 10}?
a. {{2, 3}, {3, 7, 9}, {10}}

b. {{2, 3, 4}, {7, 9, 10}}

c. {{2}, {3}, {7}, {9}, {10}}

d. {2, 3, 7, 9, 10}
The Cartesian
Product
❑ The Cartesian product, X ×Y , of two sets X and Y is the
set of all ordered pairs (x, y) where x belongs to X and y
belongs to Y :
X × Y = {(x, y) : x ∈ X and y ∈ Y}
❑ Ordered pair (x, y) of objects x and y, to be such that
(x, y) = (x’, y’) if and only if x = x’ and y = y’.
❑ If X = Y, X x X denoted by X2 read as ‘X two’
• If either X or Y (or both) is empty, then X x Y is also empty.
• If X and Y are non-empty sets then X x Y = Y x X if X = Y.
• Example 24: If X = {1, 2} and Y = {a, b, c} then
X × Y = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}.

• Example 25: If X = {1, 2} and Y = {a, b, c} then


Y x X = {(a,1), (a,2), (b,1), (b,2), (c,1), (c,2)}
• The Cartesian product of the sets X1, X2, . . . , Xn is
X1 x X2 x . . . x Xn
= {(x1, x2, . . . , xn ) : x1 ∈ X1 and x2 ∈ X2 and . . . and xn ∈ Xn}
= {(x1, x2, . . . , xn ) : xi ∈ Xi for i = 1, 2, . . . , n}.
• If A = {1, 2}, B = {a, b} and C = {α, β} then
A × B × C = {(1, a, α), (1, a, β), (1, b, α), (1, b, β), (2, a, α),
(2, a, β), (2, b, α), (2, b, β)}.
❑ For all sets A, X and Y
A × (X ∩ Y ) = (A × X) ∩ (A × Y )
and
(X ∩ Y ) × A = (X × A) ∩ (Y × A)
❑ For all sets A, X and Y
A × (X ∪ Y ) = (A × X) ∪ (A × Y )
and
(X ∪ Y ) × A = (X × A) ∪ (Y × A).
❑ For all sets A, B and X, A ⊆ B implies (A × X) ⊆ (B ×
X).

❑ If X is non-empty, then (A × X) ⊆ (B × X) implies A ⊆


B.
• Example 26: Let A = {1, 2, 3, 4}, B = {3, 4, 5}, X = {a, b}, Y
= {b, c, d}. List the elements of each of the following sets.
a. (A ∩ B) × (X ∩ Y )

b. (A × X) ∩ (B × Y )
Types and Typed Set
Theory
❑ In software engineering, the notion of ‘types’ plays an
important role in the various phases of software
development: specification, design and implementation.
❑ Each operation defined on ℤ has a ‘signature’ which
describes the ‘inputs’ and ‘outputs’ of the operation. The
operations of addition, subtraction, multiplication each
take two integers as ‘input’ and give a single integer as
‘output’.
❑ Integer , Integer → Integer
❑ Examples:
1. Addition _+_ : Integer , Integer → Integer
2. Subtraction _−_ : Integer , Integer → Integer
3. Multiplication _×_ : Integer , Integer → Integer
4. Negation −_ : Integer → Integer .
5. Less than _ ≤ _: Integer , Integer → Boolean .
6. Divides _|_ : Integer , Integer → Boolean (m|n reads ‘m divides
n’)
Typed Set Theory
❑ In typed set theory, all the elements of a set are
required to have the same type.
❑ We use the notation {x : T | P(x)} to define the set of all
elements of type T for which the propositional function
P(x) is true.
❑ We read {x : T | P(x)} as ‘the set of all x of type T such that
P(x) (is true)’
❑ Thus, a set of the form {x : T | P(x)} has type Set [T ].
• Example 27: Let A = {n : Integer | −2 ≤ n ≤ 3}, then A has the
type Set[integer]

• Example28: A = {x : Person | x is/was Philippine President


during part of the period 2010 – 2020}
A = {Arroyo, Aquino, Duterte}
Operations on Typed Sets
❑ only sets of the same type can ‘participate in
intersection, union, complement, and so on.
Intersection _ ∩ _ : Set [T ], Set [T ] → Set [T ]
Union _ ∪ _ : Set [T ], Set [T ] → Set [T ]
Difference _ − _ : Set [T ], Set [T ] → Set [T ]
Subset _ ⊆ _ : Set [T ], Set [T ] → Boolean
Membership _ ∈ _ : T , Set [T ] → Boolean
Type Checking
❑ if A : Set [S ] and B : Set [T ] then A ∩ B is meaningless in
typed set theory unless S = T.
❑ if x : S and A : Set [T ] then x ∈ A is also meaningless
unless S = T. However, it has meaning if S is a subtype of
T.
• Example 29: Suppose the following type declarations have
been made:
k, n, m : Integer
x, y : Real
P, Q : Boolean
Anne, Brian : Person
For each of the statement or terms, which one is
meaningful. If so, what is the type of the expression?
a. n ≥ m
b. (n ≥ m) + k
c. n + x
d. Anne IsOlderThan Brian
e. n + Age(Anne)

f. (x < y) ⅴ (P → Q)

g. Age(Anne) + 5 = Brian
• Example 30: Suppose the following type declarations have been
made. k, m, n : Integer; x, y, z : Real; P, Q : Boolean . Where
necessary, assume that Integer is a subtype of Real ; for example,
the division operation for real numbers _ /_ : Real , Real → Real
can take integer arguments (although the result will always be of
type Real ).
a. State the type of each of the following terms
i. m + (k × n)

ii. x (y − z)
b. Determine whether each of the following expressions is
meaningful (that is, ‘type checks’).
i. x × (k/n)

ii. (n = m) → (P ∨ Q)

iii. P ∧ (x ≥ y)

iv. ¬(m < k)


End of
Presentation
Source:
• Epp, Susanna S. (2011). Discrete Mathematics With
Applications, Fourth Edition. Brooks/Cole Cengage
Learning
• Garnier Rowan and John Taylor (2002). Discrete Mathematics
for New Technology, Second Edition. IOP Publishing Ltd.
• Haggard, Gary, John Schlipf, and Sue Whitesides (2009).
Discrete Mathematics for Engineers and Scientists,
Cengage Learning Asia Pte Ltd.
• Rosen, Kenneth H.. (2008) Discrete Mathematics and Its
Applications, 6th ed. McGraw Hill.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy