Lec 3 - 6 (SET THEORY)

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

Fair Use Notice:

The material used in this presentation i.e., pictures/graphs/text, etc. is


solely intended for educational/teaching purpose, offered free of cost to
the students for use under special circumstances of Online Education
due to COVID-19 Lockdown situation and may include copyrighted
material - the use of which may not have been specifically authorised
by Copyright Owners. It’s application constitutes Fair Use of any such
copyrighted material as provided in globally accepted law of many
countries. The contents of presentations are intended only for the
attendees of the class being conducted by the presenter.
DISCRETE STRUCTURES
(SW325)
SET THEORY
By : HIRA NOMAN
WHAT IS SET THEORY?

 Set theory is the dominant foundation for mathematics.


The idea is that everything in mathematics—numbers,
functions, etc.—Can be written in terms of sets, so that
if you have a consistent description of how sets behave,
then you have a consistent description of how
everything built on top of them behaves. If predicate
logic is the machine code of mathematics, set theory
would be assembly language.
SETs

 A set is an unordered collection of distinct objects.


 The objects in a set are called the elements, or members, of the set. A set is
said to contain its elements.
 Sets are denoted by capital letters A,B,C….,X,Y,Z.
 The elements of a set are represented by lower case letters a, b, c, … , x, y,
z.
 If an object x is a member of a set A we write X ÎA, which reads “x
belongs to A” or “x is in A” or “x is an element of A” Otherwise we
write x ÏA, Which reads “x does not belong to A” or “x is not in A” or
“x is not an element of A”.
 A set can be defined by simply listing its members inside curly braces.
For example, the set {2, 4, 17, 23} is the same as the set {17, 4, 23, 2}.

 To denote membership we use the  symbol, as in 4  {2, 4, 17, 23}.

 On the other hand, non-membership is denoted as in 5  {2, 4, 17, 23}.


 Sets can be represented in three forms:
1. Tabular Form.
2. Descriptive Form.
3. Set Builder Form.
TABULAR FORM
 Listing all the elements of a set, separated by commas and enclosed within
braces or curly brackets{}.

EXAMPLES
In the following examples we write the sets in tabular form.

 A = {1, 2, 3, 4, 5}
 B = {2, 4, 6, 8, …, 50}
 C = {1, 3, 5, 7, 9, …}
NOTE
 The symbol “…” is called an ellipsis. It is a short for “and so forth.”
DESCRIPTIVE FORM

Stating in words the elements of a set.

EXAMPLES
Now we will write the same examples which we wrote in tabular form ,in the
descriptive form.

 A = set of FIRST FIVE NATURAL NUMBERS.


 B = set of POSITIVE EVEN INTEGERS LESS OR EQUAL TO FIFTY.
 C = set of POSITIVE ODD INTEGERS.
SET BUILDER FORM
 Writing in symbolic form the common characteristics shared by all
the elements of the set.
 The general form of this notation is {x ∣ x has property P} and is
read “the set of all x such that x has property P.”
 For instance, the set O of all odd positive integers less than 10 can
be written as
O = {x ∣ x is an odd positive integer less than 10},
or,
 Specifying the universe as the set of positive integers, as
O = {x ∈ Z+ ∣ x is odd and x < 10}.
EXAMPLES
Now we will write the same examples which we wrote in tabular as
well as descriptive form ,in set builder form .

 A = {x N ∣ x<=5} ( is the Set Builder Form)


 B = {x  E ∣ 0 < x <=50} ( is the Set Builder Form)
 C = {x O ∣ 0 < x } ( is the Set Builder Form)
 These sets, each denoted using a boldface letter below , are some of
the sets which play an important role in discrete mathematics:
 N = {0, 1, 2, 3,…}, the set of all-natural numbers
 Z = {…,−2,−1, 0, 1, 2,…}, the set of all integers
 Z+ = {1, 2, 3,…}, the set of all positive integers

REMARK:
Note that the concept of a datatype, or type, in computer science is built
upon the concept of a set. In particular, a datatype or type is the name of a
set, together with a set of operations that can be performed on objects
from that set.
For example, Boolean is the name of the set {0, 1}, together with
operators on one or more elements of this set, such as AND, OR, and
NOT.
SUBSET:
If A & 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  if x  A then x  B
REMARK:
 When A  B, then B is called a superset of A B ⊇ A.
 When A is not subset of B, then there exist at least one x  A such
that 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 )
 A  D ( Because every element of A is also an element of D and that every
element of D is in A so D  A, this implies A = D ) and A is not subset of
C . ( Because there is an element 5 of A which is not in C )
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, and is
denoted as A  B.
We wish to emphasize that a set A is a subset of a set B but that A ≠ B, For
A ⊂ B to be true, it must be the case that A ⊆ B and there must exist an
element x of B that is not an element of A.
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).

EQUAL SETS:
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 A = B.
Symbolically:
A = B if A  B and B  A
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
 A = {x | x is a person taller than 10 feet} =  ( because there does
not exist any human being which is taller then 10 feet ).
 B = {x | x2 = 4, x is odd} =  (because we know that there does not
exist any odd whose square is 4).
REMARK
  is regarded as a subset of every set.
EXERCISE A
Determine whether each of the following statements is true or false.
1. x  {x}
2. {x} {x}
Note That every set has necessarily two subsets  and the set itself, these
two subset are known as improper subsets and any other subset is called
proper subset)
3. {x} {x}
4. {x} {{x}}
5.   {x}
6.   {x}
SOLUTION A
.
1. x  {x} TRUE( Because x is the member
of the singleton set { x } ).
2. {x} {x} TRUE( Because Every set is the
subset of itself).
Note That every set has necessarily two subsets  and the set itself, these
two subset are known as improper subsets and any other subset is called
proper subset)
3. {x} {x} FALSE ( Because { x} is not the
member of {x} ).
4. {x} {{x}} TRUE
5.   {x} TRUE
6.   {x} FALSE
EXERCISE B
1. List the members of these sets.
a) {x ∣ x is a real number such that x2 = 1}
b) {x ∣ x is a positive integer less than 12}
c) {x ∣ x is the square of an integer and x < 100}
d) {x ∣ x is an integer such that x2 = 2}
2. Use set builder notation to give a description of each of
these sets.
a) {0, 3, 6, 9, 12}
b) {−3,−2,−1, 0, 1, 2, 3}
c) {m, n, o, p}
3. For each of these pairs of sets, determine whether the first is a subset of the
second, the second is a subset of the first, or neither is a subset of the other.
a) the set of airline flights from New York to New Delhi, the set of nonstop airline
flights from New York to New Delhi.
b) the set of people who speak English, the set of people who speak Chinese.
c) the set of flying squirrels, the set of living creatures that can fly.
4. For each of these pairs of sets, determine whether the first is a
subset of the second, the second is a subset of the first, or
neither is a subset of the other.
a) the set of people who speak English, the set of people
who speak English with an Australian accent.
b) the set of fruits, the set of citrus fruits
c) the set of students studying discrete mathematics, the set
of students studying data structures.
SOLUTION B
1.
a) {−1,1}
b) {1,2,3,4,5,6,7,8,9,10,11}
c) {0,1,4, 9, 16,25, 36, 49, 64, 81}
d) ∅
2.
a) {x ∈ N I x is a multiple of 3 and x <= 12}
b) {x ∈ Z I -3<=x<=3 }
c) {x I x is a letter in the alphabet from m to p }

3.
a) The second is a subset of the first, but the first is not a subset of the second.
b) Neither is a subset of the other.
c) The first is a subset of the second, but the second is not a subset of the first.

4. a) The second is a subset of the first.


b) The second is a subset of the first.
c) Neither is a subset of each other
UNIVERSAL SET
The set of all elements under consideration is called the universal set. The universal set is
usually denoted by U.
U is a set containing every thing which is under consideration .
VENN DIAGRAM:
A VENN DIAGRAM is a graphical representation of sets by regions in the plane.
 The universal set is represented by the interior of a rectangle, and the other sets are
represented by disks lying within the rectangle.
 A Venn diagram uses overlapping circles or other shapes to illustrate the logical
relationships between two or more sets of items. Often, they serve to graphically
organize things, highlighting how the items are similar and different.

 Venn diagrams, also called set diagrams or logic diagrams, are widely used in
mathematics, statistics, logic, teaching, linguistics, computer science and business.

 Venn diagrams allow users to visualize data in clear, powerful ways, and therefore
are commonly used in presentations and reports. They are closely related to Euler
diagrams, which differ by omitting sets if no items exist in them. Venn diagrams
show relationships even if a set is empty.
VENN DIAGRAM

U
U = Set of all positive Integers less than or equal to 10.
A = Set of even numbers.
B = Set of prime numbers
U = {0,1,2,3,4,5,6,7,8,9,10}.
A = {0,2,4,6,8,10}
B = {2,3,5,7}
SET OPERATIONS
1. UNION:
Let A and B be subsets of a universal set U. The union of sets A and B is
the set of all elements in U that belong to A or to B or to both, and is
denoted A  B.
Symbolically:
A  B = {x U | x A or x  B}
EXAMPLE
Let U = {a, b, c, d, e, f, g} A = {a, c, e, g}, B = {d, e, f, g}
Then
A  B = {x U | x A or x  B} = {a, c, d, e, f, g}
VENN DIAGRAM FOR UNION

All items in the sets.


REMARK:
1. A  B = B  A that is union is commutative you can
prove this very easily only by using definition.
2. A  A  B and B  A  B
The above remark of subset is easily seen by the definition of union.
MEMBERSHIP TABLE FOR UNION:

A B AB
1 1 1
1 0 1
0 1 1
0 0 0

REMARK:
This membership table is similar to the truth table for logical
connective, disjunction ().
2. INTERSECTION:
Let A and B subsets of a universal set U. The intersection of sets A and B
is the set of all elements in U that belong to both A and B and is denoted
as:
A  B.

Symbolically:
A  B = {x U | x  A and x B}
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}
VENN DIAGRAM FOR
INTERSECTION

The items that overlap in the sets. Sometimes called a subset.


REMARK:
1. A  B = B  A
2. A  B  A and A  B  B
3. If A  B = , then A & B are called disjoint sets.
MEMBERSHIP TABLE FOR INTERSECTION:

A B AB
1 1 1
1 0 0
0 1 0
0 0 0
REMARK:
This membership table is similar to the truth table for logical
connective, conjunction ().
3. DIFFERENCE:

Let A and B be subsets of a universal set U. The difference of “A and B”


(or relative complement of B in A) is the set of all elements in U that
belong to A but not to B, and is denoted A – B or A \ B.

Symbolically:
A − B = {x ∣ x ∈ A and x ∉ B}.
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}
VENN DIAGRAM FOR
DIFFERENCE

Everything in A except the intersection.


REMARK:
1. A – B  B – A that is set difference is not commutative.
2. A – B  A
3. A – B, A  B and B – A are mutually disjoint sets.
MEMBERSHIP TABLE FOR SET DIFFERENCE:

A B A–B
1 1 0
1 0 1
0 1 0
0 0 0
COMPLEMENT:
Let A be a subset of universal set U. The complement of A is the set of
all element in U that do not belong to A, and is denoted Ac

Symbolically:
Ac = {x U | x A}
EXAMPLE
Let U = {a, b, c, d, e, f, g], A = {a, c, e, g}
Then Ac = {b, d, f} , this is equivalent to U- A
Therefore, we can say that Ac = U - A
VENN DIAGRAM FOR
COMPLEMENT

Everything not in the set


REMARK :

1. Ac = U – A
2. A  Ac = 
3. A  Ac = U
MEMBERSHIP TABLE FOR COMPLEMENT:

A Ac
1 0
0 1

REMARK
This membership table is similar to the truth table for logical connective
negation (~)
SET IDENTITIES
EXAMPLE A
A.
Let U = {1, 2, 3, …, 10}, X = {1, 2, 3, 4, 5}
Y = {y | y = 2 x, x X}, Z = {z | z2 – 9 z + 14 = 0}

Enumerate:

(1)X  Y (2) Y  Z (3) X – Z


(4)Yc (5) Xc – Zc (6) (X – Z) c
SOLUTION A
U = {1, 2, 3, …, 10},
X = {1, 2, 3, 4, 5}
Y = {y | y = 2 x, x X} = {2, 4, 6, 8, 10}
Z = {z | z2 – 9 z + 14 = 0} = {2, 7}
(1) X  Y = {1, 2, 3, 4, 5}  {2, 4, 6, 8, 10}
= {2, 4}
(2) Y  Z = {2, 4, 6, 8, 10}  {2, 7}
= {2, 4, 6, 7, 8, 10}
(3) X – Z = {1, 2, 3, 4, 5} – {2, 7}
= {1, 3, 4, 5}
c
(4) Y = U – Y = {1, 2, 3, …, 10} – {2, 4, 6, 8, 10}
= {1, 3, 5, 7, 9
c c
(5) X – Z = {6, 7, 8, 9, 10} – {1, 3, 4, 5, 6, 8, 9, 10}
= {7}
(6) (X – Z)c = U – (X – Z)
= {1, 2, 3, …, 10} – {1, 3, 4, 5}
= {2, 6, 7, 8, 9, 10}

NOTE (X – Z)c  Xc – Zc
EXAMPLE B
2. Given the following universal set U and its two subsets P and Q,
where
U = {x | x  Z, 0  x  10}
P = {x | x is a prime number}
Q = {x | x2 < 70}
Draw a Venn diagram for the above and List the elements in Pc  Q.
SOLUTION B
First we write the sets in Tabular form.
U = {x | x Z, 0  x  10}
Since it is the set of integers that are greater then or equal 0 and less or equal to
10. So we have
U= {0, 1, 2, 3, …, 10}
P = {x | x is a prime number}
It is the set of prime numbers between 0 and 10. Remember Prime numbers are
those numbers which have only two distinct divisors.
P = {2, 3, 5, 7}
Q = {x | x2 < 70}
The set Q contains the elements between 0 and 10 which has their square less or
equal to 70.
Q= {0, 1, 2, 3, 4, 5, 6, 7, 8}
Thus we write the sets in Tabular form.
VENN DIAGRAM:

U
Q
2,3,5,7P

0,1,4,6,8
9,10
 Pc  Q = ?

Pc = U – P = {0, 1, 2, 3, …, 10}- {2, 3, 5, 7}


= {0, 1, 4, 6, 8, 9, 10}
and
Pc  Q = {0, 1, 4, 6, 8, 9, 10}  {0, 1, 2, 3, 4, 5, 6, 7, 8}
= {0, 1, 4, 6, 8}
EXERCISE C

Let
U = {1, 2, 3, 4, 5}, C = {1, 3}
and A and B are non empty sets. Find A in each of the following:
1. A  B = U, A  B =  and B = {1}.
2. AB and A  B = {4, 5}.
3. A  B = {3}, A  B = {2, 3, 4} and B  C = {1,2,3}.
4. A and B are disjoint, B and C are disjoint, and the union of A and B is the
set {1, 2}.
SOLUTION C

1. A  B = U, A  B =  and B = {1}

Since A  B = U = {1, 2, 3, 4, 5}
and A  B = ,
Therefore A = Bc = {1}c = {2, 3, 4, 5}

2. A  B and A  B = {4, 5} also C = {1, 3}

When A  B, then A  B = B = {4, 5}


Also A being a proper subset of B implies
A = {4} or A = {5}
3. A  B = {3}, A  B = {2, 3, 4}and B  C = {1,2,3} Also C = {1, 3}
4. A and B are disjoint, B and C are disjoint, and the
union of A and B is the set {1, 2}.

Given: A  B = , B  C = , A  B = {1, 2}. Also C = {1, 3}

U
A B
1 2
C
3 4, 5
A = {1}
EXEXCISE D
 Use a Venn diagram to represent the following:
i. (A  B)  Cc
ii. Ac  (B  C)
iii. (A – B)  C
iv. (A  Bc)  Cc

U
9 3 B
A 2
6
5
1 1
4 C
7 8
SOLUTION D
i. (A  B)  Cc
Let us first construct the sets from the given venn diagram.
A = { 1,2,4,5} B = {2,3,5,6} C = {4,5,6,7} U = {1,2,3,4,5,6,7,8,9}

NOW,

A  B = {2,5} and Cc = U- C = {1,2,8,9}


9
SO,
(A  B)  Cc = {2,5}  {1,2,8,9} = {2}
2. Ac  (B  C)

B U
9 A 3
2
5 6
1
4
7 C
8

3. (A – B)  C
3 B U
9
A 2
5 6
1
4 7
C
8

(A – B)  C is shaded
3. (A  Bc)  Cc

B
9 3
U

2
A 5 6
C
1 4
7
8
SET IDENTITIES
PROVING SET IDENTITIES
 Prove the following using Venn Diagrams and membership
tables:
1. (A  B)c = A c  B c
2. A– B =A Bc
SOLUTION(Proof using Venn Diagram): 1. (A  B)c = A c  B c

Let A = {1,2} , B = {2,3} and U = {1,2,3,4} , taking the L.H.S


U
(a) U (b)
A B
A B
2 1 2 3
3
1 4
4

AB (A  B)c
Now taking the R.H.S

L.H.S = R.H.S , Hence Proved


SOLUTION (Proof using Membership Table):

A B AB (AB)c Ac Bc Ac  Bc

1 1 1 0 0 0 0

1 0 0 1 0 1 1

0 1 0 1 1 0 1

0 0 0 1 1 1 1

(A  B)c = A c  B c

Since the fourth and last columns of the above table are same hence
the corresponding set expressions are same.
That is (A  B)c = A c  B c
SOLUTION (Proof using Venn Diagram): 2. A – B = A  Bc
Let A = {1,2} , B = {2,3} and U = {1,2,3,4} , taking the L.H.S

Now taking the R.H.S

L.H.S = R.H.S , Hence Proved


SOLUTION (Proof using Membership Table):

A B A–B Bc A  Bc

1 1 0 0 0

1 0 1 1 1

0 1 0 0 0

0 0 0 1 0

A – B = A  Bc

Since the third and last columns of the above table are same hence
the corresponding set expressions are same.
That is A – B = A  Bc
USING SET IDENTITIES (EXAMPLE A)
For all subsets A and B of a universal set U, prove that
(A – B)  (A  B) = A

PROOF:
LHS = (A – B)  (A  B)
= (A  Bc)  (A  B) (Alternative representation for set difference)
= A  (Bc  B) Distributive Law
=A  U Complement Law
=A Identity Law
= RHS PROVED
The result can also be seen by Venn diagram.

U
A B

A-B AB
USING SET IDENTITIES (EXAMPLE B)
For any two sets A and B prove that A – (A – B) = A  B
PROOF:
LHS = A – (A – B)
= A – (A  Bc) Alternative representation for set difference

= A  (A  Bc) c Alternative representation for set difference

= A  (Ac  (Bc) c) De-Morgan’s Law


= A  (Ac  B) Double Complement Law
= (A  Ac)  (A  B) Distributive Law
=   (A  B) Complement Law
=AB Identity Law
= RHS PROVED
APPLICATIONS OF VENN DIAGRAM
(EXAMPLE A)
Out of 21 typists in an office,
 5 use all ( manual typewriters (M), electronic typewriters
(E) and word processors (W))
 Only 9 use E and W;
 Only 7 use M and W;
 Only 6 use M and E;
 but no one uses M only.
(i) Represent this information in a Venn Diagram.
(ii) If the same number of typists use electronic as well as word
processors, then
(a) How many use word processors only ?
(b) How many use electronic typewriters ?
 SOLUTION (i):

M E
1
0
5
2 4

GIVEN:
M&W=7
M&E=6
ONLY M = 0
E&W=9
M&E&W=5
SOLUTION (ii-a)
Let the number of typists using electronic typewriters (E) only be x, and the
number of typists using word processors (W) only be y.

Given: Total number of typists using E = Total Number of typists using W


1+5 +4+x=2+5+4+y
or, x–y=1 ………….(1)
Also, total number of typists = 21 (Given)
0 + x + y + 1 + 2 + 4 + 5 = 21
or, x+y=9 …………. (2)
Solving (1) & (2), we get
x = 5, y=4
Therefore, number of typists using word processor only is y = 4
SOLUTION (ii-b):

Typists using electronic typewriters = No. of


elements in E
=1+5 +4+x
=1+5+4+5
= 15
EXERCISE E
1. For all set A, B, and C prove that :
(A – B) – C = (A – C) – B.
2. Simplify (Bc  (Bc – A)) c
3. A number of computer users are surveyed to find out if they have a printer, modem or
scanner. Draw separate Venn diagrams and shade the areas, which represent the
following configurations.
I. modem and printer but no scanner
II. scanner but no printer and no modem
III. scanner or printer but no modem.
IV. no modem and no printer.
4. In a school, 100 students have access to three software packages,
➢ A, B and C
➢ 28 did not use any software
➢ 8 used only packages A
➢ 26 used only packages B
➢ 7 used only packages C
➢ 10 used all three packages
➢ 13 used both A and B
I. Draw a Venn diagram with all sets enumerated as for as possible. Label the two subsets
which cannot be enumerated as x and y, in any order.
II. If twice as many students used package B as package A, write down a pair of simultaneous
equations in x and y.
III. Solve these equations to find x and y.
IV. How many students used package C?

You might also like