UCCM 1353
Basic Algebra
0011 0010 1010 1101 0001 0100 1011
Chapter 3
Set Theory
1
2
4
Set
0011 0010 1010 1101 0001 0100 1011
♣ Well-defined list, collection, or class of objects.
♣ Objects in a set are called elements or
members.
♣ Describe:
1
2
4
List all (if possible)
State those properties which characterize the
elements, A = {x | x is even number}
Venn Diagram
Set (Cont…)
0011 0010 1010 1101 0001 0100 1011
╔ Empty Sets
╠ Equality Sets
╠ Finite and Infinite Sets
╠ Subsets
╠ Power Set
╚ Family of sets
1
2
4
Empty Set
0011 0010 1010 1101 0001 0100 1011
Also called Null Set
Contain no elements
Denoted by Ø
E.g: {x | x2 = 4, x is odd}
{x R | x2 = −1}
1
2
4
Finite and Infinite Sets
0011 0010 1010 1101 0001 0100 1011
͏ exactly n distinct elements in set S where n
is a nonnegative integer, then S is a finite
set and n is the cardinality of S.
͏ The cardinality of S is denoted by |S|.
͏ E.g:
S = {a, b, c, 1, 1, 3, 4}
|S| = 6 and S is a finite set.
1
2
4
Finite and Infinite Sets
(Cont…)
0011 0010 1010 1101 0001 0100 1011
Examples
Identify whether the following sets are finite
or infinite.
The set of odd numbers
The set of months of the year
S = { x R+ | −5 < x < 5}
S = {x Z | −5 < x < 5 }
1
2
4
Equality Sets
0011 0010 1010 1101 0001 0100 1011
Set A and B are equal if they have same
members. A = B
E.g:
1
a) {a, b, e, h, k} = {a, b, c, h, k} ?
b) {1, 2, 3} = {3, 2, 1} ?
c) {1, 2, 3} = {3, 2, 1, 1} ?
d) {x | x2 + 5x = −6} = {2, 3} ?
e) A = Set of all prime numbers
B = Set of all odd numbers
A=B?
2
4
Equality Sets (cont…)
0011 0010 1010 1101 0001 0100 1011
E.g:
A = {n Z | n = 2p for some integer p}
B = the set of all even integers
C = {m Z | m = 2q – 2 for some integer q}
D = {k Z | k = 3r + 1 for some integer r}
A = B? A = C? A = D?
1
A = {…, −4, −2, 0, 2, 4,…}
B = {…, −4, −2, 0, 2, 4,…}
C = {…, −4, −2, 0, 2, 4,…}
D = {…, −5, −2, 1, 4, 7,…}
2
4
Subsets
0011 0010 1010 1101 0001 0100 1011
A B, A subset of B, iff every element of A
is also an element of B.
For any set A, Ø A and A A
If A B and B C, then A C
E.g:
1
2
4
A = { x | x is a positive power of 2}
B = { x | x is even}
C = { x | x is a multiple of 4}
A B?
B C?
AC?
Subsets (Cont…)
0011 0010 1010 1101 0001 0100 1011
#
elements
Set
Subsets
#
subsets
0
{}
{}
1
1
{a}
{ }, {a}
2
{a, b}
{ }, {a}, {b}, {a, b}
3
{a, b, c}
{ }, {a}, {b}, {c}, {a, b}, {a, c}, {b, c},
{a, b, c}
4
{a, b, c, d}
……….
1
2
4
2
4
8
16
Subsets (Cont…)
0011 0010 1010 1101 0001 0100 1011
A B, A proper subset of B, iff every element
of A is in B (A B) but there is at least one
element of B that is not in A (A ≠ B).
E.g:
A = {x N | x is a prime # and x < 13}
B = {2, 3, 5, 7}
a) Is A B? If so is A B?
b) Is B A? If so is B A ?
1
2
4
Subsets (Cont…)
0011 0010 1010 1101 0001 0100 1011
E.g:
Let A = {B76, XR3, D54, ES2},
B = {B76, D54} and
C = {ES2, XL5}.
B A?
C A?
1
2
4
B B?
Subsets (Cont…)
0011 0010 1010 1101 0001 0100 1011
Difference between subset and proper subset:
A subset can be the set itself, like A is a subset of A. A
proper subset means that the subset is not the set itself.
So A is not a proper subset of A.
1
2
let A ={1, 2, 3}, B={1, 2, 3}, C={2, 3}
B even though is the same as A, it is also a subset of A.
(Every element of B is also an element of A.)
C is a proper subset of A. (Every element of C is also an
element of A, but C is not equal to A. There is no 1 in C.)
4
Venn Diagram
0011 0010 1010 1101 0001 0100 1011
Universal set, U
Set A
Elements
1
Set B
Proper
Subset
Elements
2
4
Sets of sets (Family of sets)
0011 0010 1010 1101 0001 0100 1011
• Elements of a set are sets themselves.
• E.g:
S = {{2, 5, 6}, {1, 3}, {6, 9}}
A = {{Physic, History}, {Math, English}}
B = {{x | x is a multiple of 2}, {x | x is a
multiple of 8}}
1
2
4
Power Set
0011 0010 1010 1101 0001 0100 1011
Power set of S, P(S) is the set of all subsets of
the set S.
1
2
Set
Subsets
Power Set P(S)
{}
{}
{Ø}
{a}
{ }, {a}
{Ø, {a}}
{a, b}
{ }, {a}, {b}, {a, b}
{Ø, {a}, {b}, {a, b}}
4
{ }, {a}, {b}, {c}, {a, b}, {Ø, {a}, {b}, {c}, {a, b},
{a, b, c}
{a, c}, {b, c}, {a, b, c}
{a, c}, {b, c}, {a, b, c}}
Questions
0011 0010 1010 1101 0001 0100 1011
Let A = {1, 3}, B = {3, 1}, C = {1, 3, 4}
State True / False
A = B True
A ⊂ B False
C ⊆ A False
A ⊆ B True
A ⊆ C True
C ⊂ C False
B ⊆ A True
A ⊂ C True
1
2
4
Questions
0011 0010 1010 1101 0001 0100 1011
1. {1, 2, 3, 4} {x N | x < 5} ?
2. {1, 2, 3, 4} {x N | x < 5} ?
3. {Ø} { } ?
4. {} {Ø} ?
5. {5} {1, 2, 3, 4, 5} ?
6. 6 {3, 6, 9, 12} ?
7. {1, 2, 3, 4, 5} = {a, b, c, d, e} ?
1
2
4
Cartesian Products
0011 0010 1010 1101 0001 0100 1011
A × B, Cartesian product of A and B, is the
set of all ordered pairs (a, b) where a A
and b B.
E.g:
A = {1, 2}, B = {a, b}
A × B = {(1, a), (1, b), (2, a), (2, b)}
B × A = {(a, 1), (a, 2), (b, 1), (b, 2)}
A×B≠B×A
1
2
4
Operations
0011 0010 1010 1101 0001 0100 1011
Union
Intersection
Difference
Complement
1
2
4
Union
0011 0010 1010 1101 0001 0100 1011
A B, A union B, is the set of all elements
which belong to A or to B or to both.
E.g:
A = {a, b, c, d}, B = {e, f, g, h}
A
A B = {a, b, c, d, e, f, g, h}
a
1
Note: A B = B A
A A B and B A B
2
4
c db
e f
g h
B
Intersection
0011 0010 1010 1101 0001 0100 1011
A B, A intersect B, is the set of elements
which are common to A and B.
E.g:
A = {a, b, c, d}, B = {e, b, d, f}
A
A B = {b, d}
a
1
2
4
c
Note: A B = B A
(A B) A and (A B) B
A B = Ø if A and B are disjoint
b
d
e
f
B
Difference
0011 0010 1010 1101 0001 0100 1011
A – B, difference of sets A and B, is the set
of elements which belong to A but do not
belong to B.
E.g:
A = {3, 5, 8, 10}
B = {1, 5, 7, 10}
A
A – B = {3, 8}
3
B
5
B – A = {1, 7}
8
1
1
10
7
2
4
Difference (Cont…)
0011 0010 1010 1101 0001 0100 1011
Note:
i. (A – B) A, (A – B) B = Ø
ii. (A – B) (A B) = (A – B) (B − A) =
(A B) (B – A) = Ø
1
A
2
4
B
Complement
0011 0010 1010 1101 0001 0100 1011
A∁, complement of set A, is the set of
elements which do not belong to A.
E.g:
Universal set ={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
A = {2, 5, 6, 8, 9}
A∁ ={1, 3, 4, 7, 10}
1
2
4
Complement (Cont…)
0011 0010 1010 1101 0001 0100 1011
Note:
i. A A∁ = U , A A∁ = Ø
ii. U∁ = Ø , Ø∁ = U
iii. (A∁)∁ = A
A
iv. A – B = A B∁
1
U
2
4
B
Extra
0011 0010 1010 1101 0001 0100 1011
Binary operation
Union () and intersection () which
combine two sets from within the same
universal set U to form a third set in U.
1
2
4
Unary operation
Operation on a single set A, such as forming
complement A, A∁
Comparable sets
0011 0010 1010 1101 0001 0100 1011
A and B are called comparable if A B or
B A.
U
B
‡ A B implies A B = A.
A
‡ A B implies A B = B.
‡ A B implies Bc Ac.
‡ A B implies A (B – A) = B.
1
2
4
U
A
B
B
Set Identities
U
A
C
0011 0010 1010 1101 0001 0100 1011
Associative Laws
(A B) C = A (B C)
(A B) C = A (B C)
Distributive Laws
A(BC) = (AB)(AC)
A(BC) = (AB)(AC)
1
(A B)∁ = A∁ B∁
Absorption Laws
2
4
De Morgan’s Laws (A B)∁ = A∁ B∁
A (A B) = A
A (A B) = A
Set Identities (Cont…)
0011 0010 1010 1101 0001 0100 1011
Idempotent Laws
AA=A
AA=A
Domination Laws
AØ=Ø
AU=U
Identity Laws
AU=A
AØ=A
1
2
4
Set Identities (Cont…)
0011 0010 1010 1101 0001 0100 1011
Complementation Law
A A∁ = U
Exclusion Law
A A∁ = Ø
Double Complementation Law
Alternate representation
1
2
4
(A∁)∁= A
A − B = A B∁
Set Identities (Cont…)
0011 0010 1010 1101 0001 0100 1011
E.g:
Prove (A B) – C = (A – C) (B – C)
1
2
(A B) – C = (A B) C∁ Alternate rep.
= C∁ (A B)
Associative
= (C∁ A) (C∁ B) Distributive
= (A C∁) (B C∁)
= (A − C) (B − C)
Alternate rep.
4
Set Identities (Cont…)
E.g: Prove (A B)c = Ac Bc
0011 0010 1010 1101 0001 0100 1011
Suppose x (A B)c
So x A B
x A and x B
x Ac and x Bc
x Ac Bc
(A B)c Ac Bc
Suppose
x Ac Bc
x Ac and x Bc
x A and x B
xAB
x (A B)c
1
2
4
Ac Bc (A B)c
(A B)c Ac Bc and Ac Bc (A B)c
Ac Bc = (A B)c
Partitions of Sets
0011 0010 1010 1101 0001 0100 1011
Nonempty sets {A1, A2, …, An} is a partition of a set A iff
(i) A = A1 A2 … An
(ii) A1, A2, …, An are mutually disjoint.
Disjoint
A
A1
A3
A2
A4
1
2
Two sets are called disjoint iff they have no elements in common.
Given A = {1, 3, 5} and B = {2, 4, 6}, A and B are disjoint.
Mutually Disjoint
4
The sets A1, A2, … , An are mutually disjoint iff no two sets Ai and Aj
with distinct subscripts have any elements in common.
Given X = {2, 4, 6}, Y = {3, 7} and Z = {4, 5}.
X, Y and Z are not mutually disjoint since X and Z are not disjoint.
(even though X and Y disjoint, Y and Z disjoint)
Russell’s Paradox
0011 0010 1010 1101 0001 0100 1011
Most sets are not elements of themselves.
Some sets are elements of themselves.
1
2
The container (Set) that contains all (containers)
that don't contain themselves.
4
If R is a member of itself, then by definition it
must not be a member of itself. Similarly, if R is
not a member of itself, then by definition it must
be a member of itself.
Russell’s Paradox (Cont…)
0011 0010 1010 1101 0001 0100 1011
Giving a person a piece of paper on which
is written: ‘The statement on the other side
of this paper is false.’ The person turns the
paper over, and finds on the other side: ‘The
statement on the other side of this paper is
true.’
1
2
4
Halting Problem
0011 0010 1010 1101 0001 0100 1011
Given a description of a program, decide whether
the program finishes running or continues to run,
and will thereby run forever. This is equivalent to
the problem of deciding, given a program and an
input, whether the program will eventually halt
when run with that input, or will run forever.
1
E.g: 1/3, 1/6
2
4
Halting Problem (Cont…)
0011 0010 1010 1101 0001 0100 1011
Potential solutions to halting problem
Run program for a really long time and see if it
stops
Analyze code to see if there are infinite loops
Check if loop exit conditions become closer to
being met over time
1
2
4
Halting Problem (Cont…)
0011 0010 1010 1101 0001 0100 1011
Halting behaviors
Program halts
Program loops but keeps repeating itself
1
2
Sometimes detectable, unless loop is really long
4
Program continues changing without repetition
Hard to tell if it will stop or start repeating or keep
changing forever
Computer Representation of Sets
0011 0010 1010 1101 0001 0100 1011
Method for storing elements using an arbitrary
ordering of the elements of the universal set.
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.
1
2
4
Computer Representation of Sets
(Cont…)
0011 0010 1010 1101 0001 0100 1011
E.g:
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Bit strings represent the subset of odd integers in U:
{1, 3, 5, 7, 9}, has a one bit in the first, third, fifth, seventh,
and ninth positions. It is 10 1010 1010.
1
2
4
Bit string that represent the subset of even integers in U :
{2, 4, 6, 8, 10}. It is 01 0101 0101.
All integers in U that do not exceed 5, {1, 2, 3, 4, 5}, is
represented by the string 11 1110 0000.
Computer Representation of Sets
(Cont…)
0011 0010 1010 1101 0001 0100 1011
E.g:
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Complement of {1, 3, 5, 7, 9}, replacing 0s with 1s for
10 1010 1010, yields 01 0101 0101 which corresponds
to the set {2, 4, 6, 8, 10}.
1
2
4
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.
The bit string for the union of these sets is 11 1110
0000 ∨ 10 1010 1010 = 11 1110 1010, which
corresponds to the set {1, 2, 3, 4, 5, 7, 9}.
Computer Representation of Sets
(Cont…)
0011 0010 1010 1101 0001 0100 1011
E.g:
Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
1
2
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.
4
The bit string for the intersection of these sets is
1111100000 ∧ 1010101010 = 10 1010 0000,
which corresponds to the set {1, 3, 5}.
Countably Infinite
0011 0010 1010 1101 0001 0100 1011
A countable set is a set with the same cardinality
(number of elements) as some subset of the set of
natural numbers.
A countable set is either a finite set or a countably
infinite set. Whether finite or infinite, the elements of a
countable set can always be counted one at a time and,
although the counting may never finish, every element of
the set is associated with a natural number.
1
E.g: {0, 1, −1, 2, −2, 3, −3, …}
2
4
Countably Infinite
0011 0010 1010 1101 0001 0100 1011
Countably infinite is in contrast to uncountable, which
describes a set that is so large, it cannot be counted even if
we kept counting forever.
A set is uncountable if it contains so many elements that
they cannot be put in one-to-one correspondence with the
set of natural numbers. In other words, there is no way that
one can count off all elements in the set in such a way that,
even though the counting will take forever, you will get to
any particular element in a finite amount of time.
E.g: The set of real numbers in the interval [0,1] is
uncountable
1
2
4
0011 0010 1010 1101 0001 0100 1011
End
of
Chapter 3
1
2
4