0% found this document useful (0 votes)
11 views26 pages

Sets

Uploaded by

John Tucker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views26 pages

Sets

Uploaded by

John Tucker
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

SETS

Subtitle

E. Zimudzi
Department of Computer Science
University of Botswana

05 February, 2024

1 / 26
OUTLINE

1. INTRODUCTION
Subsets
Equality of sets
Set Compliment
The Size of the Set
Power Sets
Cartesian Products
Set Notation with Quantifiers

2 / 26
Set
An unordered collection of entities/objects (called set members/elements of a set).
• Many discrete structures we are going to study are built using sets.Examples include:
• Combinations- unordered collection of objects-used in counting.
• Relations- sets of ordered pairs that represent relationships,
• Graphs- sets of vertices and edges that connect vertices
• Finite state machines- used to model computing machines
• Sets group objects with similar properties together. e.g. set of csi131 students; set of odd
numbers, etc.
• The order of elements not significant, repeating elements also insignificant.

3 / 26
Set membership
Elements placed in curly brackets: A = {2, 4, 6, 8}.
We say 2 is an element of A, i.e. 2 ∈ A.

4 / 26
3 ways to specify sets
1. List all members of the set (roster method).
• V = {a, e, i, o, u}
2. Sometimes the roster method is used without listing all the members of the set. The
ellipses (...) are used when the general pattern of the elements is obvious.
• S = {2, 4, 6, 8, ...} - set of positive even numbers.
3. Give a property that characterizes the elements (set builder).
• B = {x/x is a 2 digit integer each of whose digit is 1 or 2 }.
B = {11, 12, 22, 21}
• C = {x/x is an odd integer > 1}. C = {3, 5, 7, 9, ...}

5 / 26
Notation:
x ∈ A means x is a member of set A, whereas x ∈
/ A means x is not a member of A.
1. Example: Let A = {1, 2, 3, 4, 5, 6} and D = {1, 2, 3} then D can be specified as:
• D = {x|x ∈ A ∧ x < 4} or D = {x ∈ A|x < 4}
• In words, D is a set of all x in A such that x < 4
2. Example: Let B = {x|x is an odd number > 1.} and Let
C = {3, 5, 7, 9, 11, 13}
• Then C = {x|x ∈ B ∧ x ≤ 13} or
C = {x ∈ B ∧ x ≤ 13}

6 / 26
Subsets
Let A and B be sets.
A is a subset of B, written as A ⊆ B, if all elements of A are in B.
B is a superset of A.
A ⊆ B if and only if the quantification ∀x(x ∈ A → x ∈ B) is true.
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.

7 / 26
Equality of sets
We write A = B (A and B are equal sets) if sets A and B have similar elements.
Therefore, if A and B are sets, then A and B are equal if and only if ∀x(x ∈ A ↔ x ∈ B)
To prove that A = B, show that A ⊆ B and B ⊆ A.

8 / 26
Set Complement
Let A be a set.
• The complement of set A, written as A is the set of everything that is not an element of
A.
• The complement in defined in the context of some universal set U containing all elements
of interest.
• A = {x|x ∈ U ∧ x ∈
/ A}.

9 / 26
The Empty Set
The empty set or null set is denoted by ∅ or { }

10 / 26
Theorem
For every set S,
(i) ∅ ⊆ S, (ii) S ⊆ S

11 / 26
The Size of the Set
Def
Let S be a set
If there are exactly n distinct elements in S, n ≥ 0, n ∈ Z, we say that S is a finite set and
that n is the cardinality of S, denoted | S |.
e.g. Let A be the set of odd positive integers less than 10. Then | A |= 5.
e.g. The null set has no elements, it follows that | ∅ |= 0. A set is said to be infinite if it is not
finite.

12 / 26
Power Sets
Def
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 P(S).
If a set has n elements, then its power set has 2n elements.

e.g What is the power set of the set {0, 1, 2}?


Sol
The power set P({0, 1, 2}) is the set of all subsets of {0, 1, 2}.
P({0, 1, 2}) = {∅, {0}, {1}, {2}, {0, 1}, {0, 2}, {1, 2}, {0, 1, 2}}

13 / 26
Cartesian Product
Def
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,
A × B = {(a, b)|a ∈ A ∧ b ∈ B}
Sol
What is the Cartesian product of A = {1, 2} and B = {a, b, c}.
The Cartesian product A × B is

A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2.c)}
Note: A × B and B × A are not equal.

14 / 26
Using Set Notation with Quantifiers
What do the statements ∀x ∈ R(x2 ≥ 0) and ∃x ∈ Z(x2 = 1) mean?
∀x ∈ R(x2 ≥ 0) can be expressed as “The square of every real number is nonnegative.” This
is a true statement.
The statement ∃x ∈ Z(x2 = 1) can be expressed as “There is an integer whose square is 1.”
This is also a true statement because x = 1 is such an integer (as is −1).

15 / 26
Set Operations

Let A, B be sets. Set A and B can be combined using set operations.


Union - ∪
A ∪ B = {x|x ∈ A ∨ x ∈ B}. e.g: {8, 7, 3, 2} ∪ {4, 8, 2} = {2, 3, 4, 7, 8}

Intersection - ∩
A ∩ B = {x|x ∈ A ∧ x ∈ B}. e.g: {8, 7, 3, 2} ∩ {2, 8} = {2, 3, 4, 7, 8}

Set difference
A − B = {x|x ∈ A ∧ x ∈ / B} which is the same as A ∩ B,
Example: {8, 7, 3, 2} − {4, 8, 2} = {3, 7}

16 / 26
Principle of inclusion-exclusion
• | A | + | B | - counts all elements in A, then add that count to that of all elements in B.
so an element that appears in both A and B is counted twice.
• So, to count elements in A ∪ B use the following:
| A ∪ B |= (| A | + | B |)− | A ∩ B |

The Symmetric difference - ⊕


is the set containing those elements in either A or B, but not in both A and B.
A ⊕ B = (A − B) ∪ (B − A) = (A ∪ B) − (A ∩ B)

17 / 26
Summary
• | A | + | B | - counts all elements in A, then add that count to that of all elements in B.
so an element that appears in both A and B is counted twice.
• So, to count elements in A ∪ B use the following:
| A ∪ B |= (| A | + | B |)− | A ∩ B |

18 / 26
Set Identities
Note the similarities with logical equivalences.

19 / 26
Methods of Proving Set Identities

20 / 26
If A and B are sets, then,

A × B = {(x, y) : x ∈ A, y ∈ B}
A ∪ B = {x : x ∈ A ∧ x ∈ B}
A ∩ B = {x : x ∈ A ∨ x ∈ B}
A − B = {x : x ∈ A ∧ x ∈
/ B}
A=U−A

21 / 26
Proof using the Subset Method
Example Prove that A ∩ B = A ∪ B
Solution We will prove that the two sets A ∩ B and A ∪ B are equal by showing that each set
is a subset of the other, i.e. A ∩ B ⊆ A ∪ B and A ∪ B ⊆ A ∩ B
First, show that A ∩ B ⊆ A ∪ B, i.e. if x is in A ∩ B, then it must must also be in A ∪ B.
• Suppose that x ∈ A ∩ B.
• By def of a complement x ∈ / A ∩ B.
• By def of intersection ¬((x ∈ A) ∧ (x ∈ B)).
• Applying De Morgan’s Law ¬(x ∈ A) or ¬(x ∈ B).
• By definition of negation x ∈
/ A or x ∈
/B
• By definition of complement x ∈ A or x ∈ B.
• x∈A∪B
Hence shown.

22 / 26
Showing that A ∪ B ⊆ A ∩ B
We do this by showing that if x ∈ A ∪ B, then it must be in A ∩ B.
• Suppose that x ∈ A ∪ B.
• By definition of union x ∈ A or x ∈ B
• By def of a complement x ∈ / A or x ∈
/ B.
• Consequently ¬((x ∈ A) ∨ (x ∈ B)) is true.
• Applying De Morgan’s Law ¬(x ∈ A) and ¬(x ∈ B) is true.
• By definition of intersection ¬(x ∈ (A ∩ B)) is true.
• By definition of complement x ∈ A ∩ B.
Hence shown.
∴A∩B =A∪B

23 / 26
Proof using the set builder notation
Example Use set builder notation and logical equivalences to establish the first De Morgan
law A ∩ B = A ∪ B.
We can prove this identity with the following steps.

A ∩ B = {x|x ∈
/ A ∩ B} by definition of complement
= {x|¬(x ∈ (A ∩ B))} by definition of does not belong symbol
= {x|¬(x ∈ A ∧ x ∈ B)} by definition of intersection
= {x|¬(x ∈ A) ∨ ¬(x ∈ B)} by the first De Morgan law for logical equivalences
= {x|x ∈
/ A∨x∈
/ B} by definition of does not belong symbol
= {x|x ∈ A ∨ x ∈ B} by definition of complement
= {x|x ∈ A ∪ B} by definition of union
=A∪B by meaning of set builder notation

Hence shown. 24 / 26
Proof using Membership Table
Example Use a membership table to show that A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).

25 / 26
The End

26 / 26

You might also like