0% found this document useful (0 votes)
18 views19 pages

Week 5 - Sets

Module for week 5

Uploaded by

Cyril James
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)
18 views19 pages

Week 5 - Sets

Module for week 5

Uploaded by

Cyril James
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/ 19

Sets

4 SETS
Why do you need to learn Set Theory? Why is it important to learn Computer Science? Set Theory and
Logic is indivisible. Set Theory is as important as Logic in Computer Science. Almost all mathematics can
be formalized in Set Theory. This module will introduce you to Set Theory that would facilitate your
ability to think abstractly. This module will also provide you with a foundation on which to build a firm
understanding and analysis of the new ideas in Computer Science.

Objectives:

After completing this module, you should be able to:

1. Identify elements or members of a set.


2. Classify sets as to finite and infinite sets.
3. Explain sets using Set Representations.
4. Identify subset, proper subset, and null set of sets.
5. Construct a Venn Diagram for a given set.
6. Identify the different set operations.
7. Demonstrate familiarity on the applications of set operations.
8. Explain and apply power set and Cartesian product in sets.
9. Apply Set Identities to prove validity of the equation.

DISCRETE STRUCTURES 1 22
Sets

Set and Set Elements

• The words set and element are undefined terms of set theory just as sentence, true, and false
are undefined terms of logic.

• A set is a collection of objects called elements or members of the set.

Characteristics of Sets

– The elements of a set must be distinct, unordered and well-defined.

It means that a set should not contain duplicates; the ordering of elements is
insignificant; and you should be able to determine whether or not a certain element belongs to
the set.

Example:

Letters = {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z}

Vowels = {a, e, i, o, u}

Bits = {0, 1}

Students = {John, Don, Liza, Peter, Kathy}

Set and Set Elements

• Sets are denoted by capital letters A, B, C, … , X, Y, Z.

– A={1, 1, 2, 3}

– B={1, 2, 3, 3}

– X={2, 3, 1, 3}

Since set should not contain duplicates, the sample sets stated above can be simply
written as set with three elements, {1, 2, 3}

• If the elements can be counted or enumerated, then the set is said to be finite. Otherwise, it is
infinite.

Example:

Finite set

– A={1, 1, 2, 3}

– B={1, 2, 3, 3}

Infinite Set - the symbol “…”, ellipsis, is a short for “and so forth.”

– A={1, 2, …}

– B={1, 2, 3, 3…}

DISCRETE STRUCTURES 1 23
Sets

Exercise

Determine whether each of these sets is finite or infinite.

1. Negative integers

2. Even Integers greater than 50

3. Positive integers less than 1000

4. Odd integers less than 50

5. ASCII characters

Set Representation

• Tabular Form

• Descriptive Form

• Set Builder Form

Tabular Form

• Listing all the elements of a set, separated by commas and enclosed within braces or curly
brackets { }.

Example:

A = {1, 2, 3, 4, 5} is the set of first five Natural Numbers.

B = {2, 4, 6, 8, …, 50} is the set of Even numbers up to 50.

C = {1, 3, 5, 7, 9, …} is the set of positive odd numbers.

Descriptive Form

• Stating in words the elements of a set.

Example:

A = set of first five Natural Numbers.

B = set of positive even integers less or equal to fifty.

C = set of positive odd integers.

DISCRETE STRUCTURES 1 24
Sets

Set Builder Form

• All elements in the set are characterized by stating the property or properties they must
have to be members.

Example:

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

A = { x| 1< x < 10 and x is a counting number}

Exercise

1. List the members of the set

a. {x | x is a positive integer less than 100}

b. {x | x is a square of integers and x < 50}

c. {x | x is an even integer less than 100 and x can be factored by 3}

d. {x | x is an odd integer less than 50 and x is a prime number}

e. {x | x is a composite number less than 50}

2. Represent the following Tabular Form using Set Builder Form

a. {2, 4, 6, 8, 10, …, 50}

b. {a, e, i, o, u}

c. {MSWord, MSExcel, MSPowerpoint}

d. {Phyton, Java, C++}

e. {Fred, Dan, Tim, Stefen, Paul}

DISCRETE STRUCTURES 1 25
Sets

Set Representation

• Not all sets can be represented using both methods.

• For instance, suppose you’re to represent the set of all real numbers between 0 and 1. It’s
impossible to list down all the elements of this set. Thus, you can only use the rule method to
describe this set.

These sets, each denoted using a boldface letter, play an important role in discrete mathematics:

N – Set of Natural Numbers

– N = {1, 2, 3, … }

W – Set of Whole Numbers

– W = {0, 1, 2, 3, … }

Z – Set of Integers

– Z = {…, -3, -2, -1, 0, +1, +2, +3, …}

– Z = {0, ±1, ± 2, ± 3, …}

– {“Z” stands for the first letter of the German word for integer: Zahlen.}

E – Set of Even Integers

– E = {0, ±2, ± 4, ± 6, …}

O – Set of Odd Integers

– O = {±1, ±3, ±5, …}

P – Set of Prime Numbers

– P = {2, 3, 5, 7, 11, 13, 17, 19, …}

Q – Set of Rational Numbers (or Quotient of Integers)

– Q = {x | x = p/q ; p, q  Z, q  0}

Q – Set of Irrational Numbers

– Q’ = {x | x is not rational numbers}

R – Set of Real Numbers

C – Set of Complex Numbers

Superscript symbols such as +, - ,  represent positive, negative and non-negative


(includes zero) values respectively.

DISCRETE STRUCTURES 1 26
Sets

Example:

Z denotes the set of all non-negative integers.

Z+ denotes the set of all positive integers

Subset

• If A and B are two sets, A is called a subset of B, written A  B, if, and only if, any element of A is
also an element of B.

Symbolically

A  B  x (xA  xB)

For all elements of x, if x is an element of A, then x is an element of B.

The phrase A is contained in B and B contains A are alternative ways of saying that A is a
subset of B.

When A  B, then B is called a superset of A.

When A is not subset of B, then there exists at least one x  A such that x  B.

A  B ⇔ ∃x such that x ∈ A and x ∈ B.

Every set is a subset of itself.

Example:

Let

A = {1, 3, 5}

B = {1, 2, 3, 4, 5}

C = {1, 2, 3, 4}

D = {3, 1, 5}

Then

A  B (Because every element of A is in B)

C  B (Because every element of C is also an element of B)

Example:

A  D (Because every element of A is also an element of D and also note that every element of
D is in A so D  A)

A  C (Because there is an element 5 of A which is not in C)

DISCRETE STRUCTURES 1 27
Sets

Example:

Let

A = {1}

B = {{1}}

C = { 1, {1} }

AC

Then

BC

A  B since 1  {{1}}

Exercise

Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6}, and D = {4, 6, 8}. Determine which of these sets are
subsets of other sets.

Proper Subset

• Let A and B be sets. A is a proper subset of B. If, and only if, every element of A is in B but there
is at least one element of B that is not in A, it is denoted as A  B.

Example:

Let

A = {1, 3, 5}

B = {1, 2, 3, 5}

Then

A  B (Because there is an element 2 of B which is not in A).

Set Equality

• Two sets A and B are equal if, and only if, every element of A is in B and every element of B is in
A and is denoted as A = B.

Symbolically:

A = B if A  B and B  A

DISCRETE STRUCTURES 1 28
Sets

Example:

Let

A = {1, 2, 3, 6}

B = the set of positive divisors of 6

C = {3, 1, 6, 2}

D = {1, 2, 2, 3, 6, 6, 6}

Then

A, B, C, and D are all equal sets.

Null Set

• A set which contains no element is called a null set, or an empty set or a void set. It is denoted
by the Greek letter  (phi) or { }.

Example:

B = {x | x2 = 4, x is odd number} =  (there is no existing odd number whose square is 4)

Z+ = {x | x < 0 } =  (there is no existing positive integer whose value is less than 0)

 is regarded as a subset of every set

Exercise

Determine whether each of the following statements is true or false.

1. x  {x}

2. {x}  {x}

3. {x}  {x}

4.   {x}

5.   {x}

DISCRETE STRUCTURES 1 29
Sets

Universal Set

 The set of all elements under consideration is called the Universal Set. The Universal Set is
usually denoted by U and is represented by a rectangle.

Venn Diagram

 Venn diagrams are often used to indicate the relationships between sets.
 The Universal Set is represented by the interior of a rectangle, and the other sets are
represented by circle within the rectangle.

Draw a Venn Diagram that represents V, the set of vowels in the English Alphabet.

We draw a rectangle to indicate the universal set U, which is the set of the 26 letters of the
English alphabet. Inside this rectangle, we draw a circle to represent V. Inside this circle we
indicate the elements of V with points

Example:

AB

Venn Diagram Showing that A is a Subset of B.

DISCRETE STRUCTURES 1 30
Sets

Example:

AB

Venn Diagram Showing that A is a Subset of B.

AB

Venn Diagram Showing that A is not a Subset of B.

AB

Venn Diagram Showing that A is not a Subset of B.

DISCRETE STRUCTURES 1 31
Sets

Operations on Sets

Union

Let A and B be subsets of a universal set U.

The union of A and B, denoted A U B, is the set of all elements that are in at least one of A or B.

A U B = {x  U | x  A or x  B}

For any set S, S U  = S and S U U = U

Example:

Let

U = {a, b, c, d, e, f, g}

A = {a, c, e, g}

B = {d, e, f, g}

Then

A U B = {a, c, d, e, f, g}

Intersection

Let A and B be subsets of a universal set U.

The intersection of A and B, denoted A ∩ B, is the set of all elements that are common to both A
and B.

A ∩ B = {x  U | x  A and x  B}

For any set S, S ∩  =  and S ∩ U = U

Example:

Let

U = {a, b, c, d, e, f, g}

A = {a, c, e, g}

B = {d, e, f, g}

Then

A ∩ B = {e, g}

DISCRETE STRUCTURES 1 32
Sets

Difference

Let A and B be subsets of a universal set U.

The difference of A minus B (or relative complement of A in B), denoted A − B, is the set of all
elements that are in A and not B.

A – B = {x  U | x  A and x  B}

For any set S, S –  = S and S – U = 

Example:

Let

U = {a, b, c, d, e, f, g}

A = {a, c, e, g}

B = {d, e, f, g}

Then

A – B = {a, c}

Example:

Let

U = {a, b, c, d, e, f, g}

A = {a, c, e, g}

B = {d, e, f, g}

Then

B – A = {d, f}

Take note that in set Difference, A – B is different from B – A.

DISCRETE STRUCTURES 1 33
Sets

Symmetric Difference

Let A and B be subsets of a universal set U.

The symmetric difference of A and B, denoted A  B, is the set of all elements that are in either
A or B but not both or the union of the difference of A and B and B and A.

A  B = {x  U | x  A and x  B} U {x  U | x  B and x  A}

Example:

Let

U = {a, b, c, d, e, f, g}

A = {a, c, e, g}

B = {d, e, f, g}

Then

A  B = {a, c, d, f}

Complement

Let A be a subset of a universal set U.

The complement of A, denoted Ac, is the set of all elements in U that are not in A.

Ac = {x  U | x  A}

Empty sets and universal set are related by C=U and Uc=

Example:

Let

U = {a, b, c, d, e, f, g}

A = {a, c, e, g}

Then

Ac = {b, d, f}

DISCRETE STRUCTURES 1 34
Sets

Exercise

Let A = {1, 3, 5, 7, 9}, B = {3, 6, 9}, and C = {2, 4, 6, 8}. Find each of the following and draw a Venn
Diagram representing each operation.

1. B – A 6. B  C

2. A U B 7. A  B

3. A – B 8. A U C

4. A ∩ B 9. A U C U C

5. B U C 10. A – C

Partitions of Set

 In many applications of set theory, sets are divided up into non-overlapping (or disjoint) pieces.
Such a division is called a partition.
 Two sets are called disjoint if, and only if, they have no elements in common.

A∩B=

Example:

Let

A = {1, 3, 5}

B = {2, 4, 6}

Then

A ∩ B = {1, 3, 5} ∩ {2, 4, 6}

A∩B=

A and B are disjoint since they have no elements in common.

Power Set

 There are various situations in which it is useful to consider the set of all subsets of a particular
set.
 The power set axiom guarantees that this is a set.

Given a set A, the power set of A, denoted by P(A), is the set of all subsets of A.

DISCRETE STRUCTURES 1 35
Sets

Example:

Let

A = {1, 2}

Then

P(A) = {, {1}, {2}, {1, 2}}

If A has n elements, then P(A) has 2n elements.

Exercise

Determine the power set of the following sets.

1. A={a, b, c, d}

2. B={2, 3, 5, 7, 9}

3. C={5, 10, 15}

Finite and Infinite Sets

 A set is called finite if, and only if, it is the empty set or there is one-to-one correspondence from
{1,2,3, …, n} to it, where n is a positive integer.
 A non empty set that cannot be put into one-to-one correspondence with {1, 2, 3,…, n}, for any
positive integer n, is called infinite set.

Set Cardinality

 The number of elements in a finite set A is termed as the cardinality of set A, denoted by |A|.
Thus, if A = {1, 2, 3} then |A| = 3.
 Let A and B be any sets. A has the same cardinality as B if, and only if, there is a one-to-one
correspondence from A to B (Cardinality means “the total number of elements in a set”) .
 When A and B have the same cardinality, we write |A| = |B|.

DISCRETE STRUCTURES 1 36
Sets

Exercise

Determine the cardinality of the following sets.

1. {1}

2. {1, {1}}

3. {{1}}

4. {1, {1}, {1, {1}}}

Cartesian Product

 The order of elements in a collection is often important. Because sets are unordered, a different
structure is needed to represent ordered collections. This is provided by ordered n-tuples.
 The ordered n-tuple (a1, a2, . . . , an) is the ordered collection that has a1 as its first element, a2 as
its second element, . . . , and an as its nth element.

Cartesian Product of Sets

 Given sets A1, A2, . . . , An, the Cartesian product of A1, A2, . . . , An denoted A1 × A2 × . . . × An,
is the set of all ordered n-tuples (a1, a2, . . . , an) where a1 ∈ A1, a2 ∈ A2, . . . , an ∈ An.
 A1 × A2 ×· · ·× An = {(a1, a2, . . . , an) | a1 ∈ A1, a2 ∈ A2, . . . , an ∈ An}.
 Let A and B be sets. The Cartesian product of A and B, denoted A x B (read “A cross B”), is
the set of all ordered pairs (a, b), where a is in A and b is in B.
 A x B = {(a, b)| a  A and b  B}
 If set A has m elements and set B has n elements, then A x B has m x n elements.

DISCRETE STRUCTURES 1 37
Sets

Example:

Let

A = {1, 2}

B = {a, b, c}

Then

A x B = {(1,a), (1,b), (1,c), (2,a), (2, b), (2, c)}

B x A = {(a,1), (a,2), (b, 1), (b, 2), (c, 1), (c, 2)}

A x B  B x A for non-empty and unequal sets A and B.

Ax=xA=

| A x B| = |A| x |B|

Exercise

Let

A = {x, y}

B = {1, 2, 3}

C = {a, b}

Find the Cartesian Product of the following:

1. A x B

2. A x B x C

3. A x C

4. B x A

DISCRETE STRUCTURES 1 38
Sets

Set Identities

 An identity is an equation that is universally true for all elements in some set.

Example:

The equation a + b = b + a is an identity for real numbers because it is true for all real numbers a
and b.

Example:

Prove that for all sets A, B, and C,

A − (B ∩ C) = (A − B) U (A − C)

Solution:

1. A − (B ∩ C) = A ∩ (B ∩ C)’ Set Difference

2. A ∩ (B ∩ C) = A ∩ (B’ U C’) De Morgan’s

3. A ∩ (B’ U C’) = (A ∩ B’) U (A ∩ C’) Distributive

4. (A ∩ B’) U (A ∩ C’) = (A – B) U (A – C) Set Difference

Exercise

Prove that for all sets A, B, and C,

(A − B) U C = (A U C) − (B − C)

DISCRETE STRUCTURES 1 39
Sets

References:

1. Kenneth H. Rosen. Discrete Mathematics and Its Applications, 7th Edition. McGrawHill, 2012
2. Gary Weiss Damian Lyons, et al., Fundamentals of Discrete Structures, 2nd edition, Pearson
Learning Solutions, 2012.
3. Susanna S. Epp, Discrete Mathematics with Applications, Brooks Cole; 4th edition, 2011.
4. James L. Hein, Discrete Structures, Logic, and Computability, 3rd edition, Jones & Bartlett
Publishers, 3rd edition, 2009.
5. Kolman, B., Busby, R. C., Ross, S. C. Discrete Mathematical Structures, 6th Edition. Prentice Hall,
2008.

DISCRETE STRUCTURES 1 40

You might also like