MCFC - 02 - SPG (Part 1)

You might also like

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

Mathematics Concepts For Computing

AQ010-3-1-MCFC & Version2

Set Theory
Topic & Structure of The Lesson

• Topic Outline
➢Sets and element
➢Set operations
➢Venn Diagram
➢Cardinality of sets

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Learning Outcomes

• At the end of this topic, You should be able to

• describe the concepts of Sets.


• differentiate and write the Set Operations and its relations.
• draw the Venn diagram based on the set operation.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Key Terms You Must Be Able To
Use
• If you have mastered this topic, you should be able to use the
following terms correctly in your quiz, test and exams:
• Set
• Element
• Subset
• Proper subset
• Power set
• Cardinality
• Union
• Intersection
• complement
• Venn diagram

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Introduction
• A set is a well-defined collection of distinct objects. Often,
the objects in a set have similar properties.
• The objects that make up a set (also known as the
elements or members of a set) can be anything:

• Sets are conventionally denoted with capital letters such A,


B, C….etc.
AQ010-3-1-Mathematical Concepts for Computing Set Theory
Introduction

• For instance, all the students who are currently enrolled in


Asia Pacific University make up a set.
• Likewise, all the students currently taking a Mathematical
Concepts for Computing module make up a set.
• The language of sets is a means to study such collections
in an organized fashion.
• Set theory is a useful tool for formalising and reasoning
about computation and the objects of computation.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Applications in Computing
A computer file system which has 3 classes of users:
1. Managers,
2. Employees and
3. Customers.
The file system manages which users have access to which
files.
• The sets Rm, Re and Rc respectively contain files which the
managers, employees and customers can read.
• Similarly, Wm, We and Wc are the sets of files to which the
managers, employees and customers can write.
• All objects in these sets will be of a type FILE.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Definition

How to express a set?


The conventional way to write down a set is to
list the elements inside the curly braces.

Example 1:
A = {Orange, White, Black, Yellow} Set of colors
B= {1, 3, 5, 7, 9,………} Set of odd numbers
C= { {x,y}, {y,z}, {x,z} } Set of sets

Universal set, U contains all the objects under consideration.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Description of set
• If a set is finite and not too long →list all its elements.
Example 2: W is the set of all integers from 5 to 10
W = {5, 6, 7, 8, 9, 10}

• If a set is large finite set or infinite set → list a property


necessary for its membership.
Example 3: R is the set of all positive and even integers
R = { x | x is a positive, even integer}
R consists of the integers 2,4,6 and so on.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Element
• x  S (“x is an element of S”) is the proposition that object
x is an element or a member of the set S.
• Sets of numbers that occur frequently in mathematics.

N = {0,1, 2, 3, 4, 5, …} Set of natural numbers

Z = {…, −2, −1, 0, 1, 2, …} Set of integers

Z+ = {1, 2, 3, …} Set of positive integers


Another name
Q = {p/q | p  Z, q  Z, q ≠0} Set of rational numbers for rational
number is
fraction
R = {all real numbers} Set of real numbers

Examples of real numbers:


-12.66547, 100000000.02, 244.0,
AQ010-3-1-Mathematical Concepts for Computing Set Theory
AQ010-3-1-Mathematical Concepts for Computing Set Theory Slide ‹2› of 40
Set Equality

Two sets X and Y are equal if:


i) For every x, if x  X , then x Y
ii) For every x, if x Y, then x  X.

Example 4:
X = {1,2,3,4,5,6,7} and Y = {1,2,3,4,5,6,7}

Hence,
Two sets are equal if and only if they have the same
members.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Subset

• Let X and Y be sets. If every element of X is an


element of Y, then we say that X is a subset of Y .
X Y
Example 5:
X = {a, b, c, d, e} and Y = {a, b, c, d, e, f, g}
Example 6:
X = {1, 2, 3} and Y ={1, 2, 3, 4, 5, 6}

A subset of a set contains any or all


of the elements of the set.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Example 7- Equality

If A = {1, 2, 3, 4, 5} and
B = {x | x < 6 and x is a counting number, x N}

• A is a subset of B because every element of A is an


element of B and B is a subset of A because every
element of B is an element of A. Therefore, the two sets
are equal.

• The sets A = {2} and B = {2, 5} are not equal because B


is not a subset of A. We would write A ≠ B.
Note that A  B.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Proper Subset

• X is a proper subset of Y denoted by X  Y if and


only if every element in X is also in Y, and there exists
at least one element in Y that is not in X.

Example 8: X = {a, b, c} and Y = {a, b, c, e}

A proper subset contains any of the


elements of the set but not all of them (or except itself)

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Relationship between Subset and
Proper Subset
• {1,2,3} is a subset of {1,2,3}, but is not proper subset of
{1,2,3}.
• {1,2,3} is a proper subset of {1,2,3,4} because the
element 4 is not in the first set.
• If X is a proper subset of Y, then it is also a subset of Y.
• The empty set is a subset of every set, including the
empty set itself.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Example
(Subset & Proper Subset)

Let U = {1, 2, 3, 4, 5} with A = {1, 2, 3}, B = {3, 4} and C =


{1, 2, 3, 4}. Which of the following is true?
(a) A  C
(b) A  C
(c) B  C
(d) A  A
(e) A  A

AQ010-3-1-Mathematical Concepts for Computing Set Theory Slide ‹2› of 40


Activity 1
• Given that A = {x  N | x is a prime number and x < 13}
and 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,3,4}  {x  Z+ | x < 5}?


{1,2,3,4}  {x  Z+ | x < 5}?

• {6}  {3,6,9,12}

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Activity

1. Let sets A = {1, 3, 5} and B = {3, 5, 1}, is that set A


and B are equal?
2. Given that A = {x  N | x is a prime number and x <
10} and B = {2, 3, 5},
(a) Is A  B? If so, is A  B?
(b) Is B  A? If so, is B  A?
3. State true or false for each of the following.
(a) {1, 2, 3, 4, 5}  {x  Z+ | x < 6}
(b) {1, 2, 3, 4, 5}  {x  Z+ | x < 5}
(c) {6} {3,6,9,12}
AQ010-3-1-Mathematical Concepts for Computing Set Theory
Empty Set
• The empty set { } is the set that has no elements at
all. It is denoted by 
• If |T|=0 then we also write T =  (empty set)
• Thus,  = { }
• The empty set is a subset of every set, because
every element of the empty set is an element of
every other set.
Theorem 1:
For every set S,
(i)   S
(ii) S  S

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Power Set
• The set of all subsets of a set is called the power set
of, denoted by P(S).
• If a set has n elements, then its power set has 2n
subsets.

Example 9:
If X = {a, b}, then P(X) = {, {a}, {b}, {a,b}}.
Number of subsets, n[P(X)] = 22 = 4

Example 10:
If X = {a, b, c}, then
P(X) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
Number of subsets, n[P(X)] = 23 = 8

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Power Set
Example 13: Given that X= {1, 2} and Y = {5}. Find
(i) P(X)
(ii) P(P(Y))

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Cardinality of a Set

• Let S be a set. If there are exactly n distinct elements in


S where n is a nonnegative integer, we say that S is a
finite set.
• n is the cardinality of S (denoted as |S|).

Example 11: If A = {1, 2, 3, 4} then n(A) = 4

Example 12: If B = {a, b, b, c, d} then n(B) = 4

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Activity 2

Given that A = {x : x² = 1, x is integer} and


B = {3}.
Find
(i) n(P(A))
(ii) n(P(P(B)))

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Set Operations

Sets can be combined in several different ways to produce


another set

1. Union
2. Intersection
3. Disjoint
4. Difference
5. Complement

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Set Operation

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Union

The union of the sets A and B, denoted by A U B, is the set


that contains those elements that are either in A or in B, or
in both
U

A B

Venn Diagram
A U B is shaded

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Intersection

The intersection of the sets A and B, denoted by A  B,


is the set that contains those elements in both A and B.

A B

A  B is shaded

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Disjoint

2 sets are disjoint if their intersection is an empty set

A B

Two sets are "disjoint" if they have no objects in common.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Difference

• Let A and B be sets.


• The difference of A and B, denoted by A\B, is the set
containing those elements that are in A that are not in B.
• The difference of A and B is also called the relative
complement of B with respect to A.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Complement

Given a universal set U and a subset A of U,


•The set U – A is called the complement of A and written
as A

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Set Operation

Example 14:
Given that,
U = {1, 2, 3, 4, 5, 6}
A = {1, 2, 3}
B = {2, 4, 6}
C = {4, 6}
Find :
(a) A  B (b) A  B
(c) A  C (d) A'
(e) A \ B (f) B \ A

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Example 15

Find a) P  R
b) (R  P)\Q
c) P  (R \Q)
d) (P  Q)  R

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Venn Diagram
A pictorial representation of sets by sets of points in the
plane.
The universal set U is represented by the interior of a
rectangle, and other sets are represented by disks lying
within the rectangle.
For example: If A  B, then the disk representing A will be
entirely within the disk representing B as in the diagram
below:
U

B A

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Venn Diagram

If A and B are disjoint. i.e., have no elements in common


(AB = Ø), then the disk representing A will be separated
from B as in the Venn diagram below:

A B

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Cardinality

➢ If A and B are finite sets, then


n(AB) = n(A) + n(B) – n(AB)

➢ If there are 3 finite sets, A, B and C, then


n(ABC) = n(A) +n(B) +n(C) –n(AB) –
n(A C) – n(B C) +n(A B C)

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Venn Diagram

\C

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Activity 3:
In a room of 50 people, 37 have coffee and 29 people
have tea. If these are the only drinks served and all
the people have at least one drink. How many people
have both drinks?

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Example 16 :
A group of 10 students meet to plan a school
function. All are majoring in Accounting or Economics
or both. 5 of the students are Economics majors and
7 are majors in Accounting. How many major in both
subjects ?
Example 17:
In a room of 50 people, 37 have coffee and 29 people
have tea. If these are the only drinks served and all
the people have at least one drink. How many people
have both drinks?

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Example 18 :
Consider the following data for 100 mathematics
students at a college concerning the languages
French, German and Russian :
65 study French
45 study German
42 study Russian
20 study French and German
25 study French and Russian
15 study German and Russian
8 study all three languages
Draw the Venn Diagram for above data.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Example 19 :
In a survey of 60 people, it was found that 25 read
Newsweek magazine, 26 read Times, 25 read
Fortune. Also 9 read both Newsweek and Fortune, 11
read both Newsweek and Times, 8 read both Time
and Fortune, and 8 read no magazines at all.
Represent the above information in a Venn Diagram.

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Quick Review Question

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Summary of Main Teaching Points

•Sets
•Power set
•Venn Diagram
•Cardinality of sets

AQ010-3-1-Mathematical Concepts for Computing Set Theory


Question and Answer Session

Q&A

AQ010-3-1-Mathematical Concepts for Computing Set Theory


What we will cover next

Relations and Functions

AQ010-3-1-Mathematical Concepts for Computing Set Theory

You might also like