0% found this document useful (0 votes)
29 views

Lecture Notes 06, Sets and Set Operations, Venn Diagrams

1) A set is an unordered collection of distinct objects. Sets can be specified using lists, ranges with ellipses, or set-builder notation. 2) The size or cardinality of a set refers to the number of elements in the set. Finite sets have a fixed number of elements, while infinite sets do not. 3) Subsets contain elements that are also elements of another set. The power set of a set contains all possible subsets.

Uploaded by

qny8n272y7
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Lecture Notes 06, Sets and Set Operations, Venn Diagrams

1) A set is an unordered collection of distinct objects. Sets can be specified using lists, ranges with ellipses, or set-builder notation. 2) The size or cardinality of a set refers to the number of elements in the set. Finite sets have a fixed number of elements, while infinite sets do not. 3) Subsets contain elements that are also elements of another set. The power set of a set contains all possible subsets.

Uploaded by

qny8n272y7
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 46

Sets

Set Operations

Imran Shafi
Email: [email protected]
Set … The Definition
A set is an unordered collection of objects
1. Students in the class: {Ahmad, Sana, Ali, Shahbaz, Farah}
2. Cities in Punjab: {Lahore, Faisalabad, Gujranwala, Jehlam}
3. Non-related items: {3, a, Apple, Sun, Trout}

Most often used sets


N = {1, 2, 3, …}
R = {0.5, 2.99, 0.000001, 6,32e10, …}
Properties
Order doesn’t matter: {1, 2, 3, 4, 5} is equivalent to {4, 1, 5, 2, 3}
No duplicate elements = Students in the class
-- makes no sense to repeat any student
Specifying a Set
Capital letters for set names: N, R, Z, Z+, …
Lower case letters for elements: a, b, x, …
Easiest way: list all elements
A = {1, 2, 3, 4, 5}, Not always feasible
May use ellipsis (…): X = {0, 2, 4, …}
C = {3, 5, 7, …}: What is next element? Very confusing
If C = Set of odd numbers greater than 1, next element is 9
If C = Set of prime numbers greater than 2, next element is 11
May use set builder notation
 P = {x | x is prime and x > 2 and x is less than 10}
 E = {x | x is positive odd number and x < 7}
Specifying a Set
A set can contain various elements that make up the set
If an element ‘a’ belongs to a set X, we use the notation
aÎX

If an element ‘b’ does not belongs to a set X, we use the notation
aÏX
Cardinality of a Set (Set Size)
The number of distinct elements in a set is known as its set size.
For a set S, set size is denoted by |S|.
The size of a set is non-negative integer value
Set size is also called the cardinality of a set
Examples:
1. Size of empty set is 0.
2. Size of “Set of letters is English Alphabet” is 26.
3. Size of “Natural numbers not greater than 10” is 10.
Often Used Sets
Set of Natural Numbers: N = {1, 2, 3, 4, …}
Set of Negative Integers: Z = {-1, -2, -3, -4, …}
Set of Real Numbers: R = {1.5, 0.232, 4.2E-10, …}
Set of Rational Numbers: Q = {1/2, 2/3, 3/7, …}
The Universal Set … U
A set containing all elements (in a specific situation) from which
other sets are formed:
Examples:
U = {a, b, c, …, z} and A = {a, e, i, o, u}
U = Set of Natural Numbers and B = {3, 6, 9, 12, 15}
U = Set of all students in the class and X = Set of A graders in the class
The Empty Set … ∅
The empty set contain no element. It is called an empty set.
It is denoted by the Greek letter ∅ (phi) or { }.
i.e., ∅ = { }

∅ Can be an element of other sets: {∅, {1}, {2}, {∅, {1}}}


∅ ≠ {∅}
Exercise
1. x  {x} TRUE
2. {x}  {x}
TRUE
3. {x}  {x}
FALSE
4. {x} {{x}}
TRUE
5.   {x}
TRUE
6.   {x}
FALSE
Finite & Infinite Sets
A set S is said to be finite if it contains exactly m distinct elements where m
denotes some non negative integer.
In such case we write S = m or n(S) = m
A set is said to be infinite if it is not finite.
EXAMPLES
1.The set S of letters of English alphabets is finite and S = 26
2.The null set  has no elements, is finite and  = 0
3.The set of positive integers {1, 2, 3,…} is infinite.
Finite & Infinite Sets
Determine which of the following sets are finite/infinite.
A = {months in the year} FINITE
B = {even integers} INFINITE
C = {positive integers less than 1} FINITE
D = {animals living on the earth} FINITE
E = {lines parallel to x-axis} INFINITE
F = {x  R  x100 + 29x50 – 1 = 0} FINITE
G = {circles through origin} INFINITE
Subsets
If A & B are two sets, A is called a subset of B, written A  B, if, and only if, all
elements of A are also elements of B.
Symbolically:
A  B  if x ∊ A then x ∊ B
REMARK

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


2.When A is not a subset of B, then there exist at least one x ∊ A such that x B.
3.Every set is a subset of itself.
Subsets … Examples
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 also note that
every element of D is in A so D  A )
and A ⊈ C ( Because there is an element 5 of A which is not in C )
Proper Subsets
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.
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)
EXAMPLE
It is very easy to note that N  Z  Q  R  C
Number of Subsets
How many subsets of {a, b} are possible?
How many subsets of {} are possible?
How many subsets of {a, e, i, o, u} are possible?
How many subsets of {a, b, c, …, z} are possible?

Cardinality of Set Number of Subsets


0 1
1 2
2 4
3 8
N 2N
Number of Subsets
Say the set S = {a, b, c}. Draw a tree showing all the subsets of S
and how they are derived?

Number of elements: 2N
Number of Subsets … Counting with Bit Strings
Say the set S = {a, b, c}. We can encode all the subsets of S using bit
strings as follows:
If an element x is present in a subset, it is encoded with 1. Otherwise, it
is encoded with 0.
Subset c is present b is present a is present Subset Code
{} No No No 000
{a} No No Yes 001
{b} No Yes No 010
{c} Yes No No 011 Exactly the
counting of the
{a, b} No Yes Yes 100
binary system.
{a, c} Yes No Yes 101
{b, c} Yes Yes No 110
{a, b, c} Yes Yes Yes 111
Number of Subsets … Counting with Bit Strings
Say a set A = {a, b, c, d, e, f, g, h, i, j}.

1. What are the total number of subsets of A?


2. What is the 77th subset of A?
3. What is the 241st subset of A?
4. What is the 950th subset of 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. Equal sets are denoted as A = B.
Symbolically:
A = B iff A  B and B  A
EXAMPLE:
Given that 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.
Power Set
The power set of a set A is the set of all subsets of A, denoted P(A).
EXAMPLE:
Let A = {1, 2}, then
P(A) = {, {1}, {2}, {1, 2}}
Note:
If A has n elements then P(A) has 2n elements. Why?
Power Set: Exercise
1. |P()| = ?
2. |P(P())| = ?
3. |P(P(P()))|=?
4. If V = {a, e, i, o, u}, P(V)=? |P(V)|=?
5. If |X| = ∞, |P(X)|=?
Set Operations
Let A and B be subsets of a universal set U. Recall the following definitions
from your earlier classes:
Union: A  B = { x U | x A or x  B}
Intersection: A  B = { x U | x A and x  B}
Difference: A – B = { x U | x  A and x B}
Complement: Ac = { x U | x A}
Set Operations … Union Set
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}
EMAMPLE
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}
Union Set
U
A  B is shaded
B

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
Membership for Union
A B AB
1 1 1 Remember Disjunction Table
P Q
1 0 1 P ÚQ
T T T
0 1 1
T F T
0 0 0
F T T
F F F

REMARK : This membership table for Union is similar to the truth


table for logical connective, disjunction ()
Set Operations … Intersection Set
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 both A, and is denoted A  B.
Symbolically:
A  B = {x U | x A and x  B}
EMAMPLE
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 and x  B} = {e, g}
Set Operations … Intersection Set

A  B is shaded

1. A  B = B  A
2. A  B  A and A  B  B
3. If A  B = , then A & B are called disjoint sets
Set Operations … Membership Table
A B AB
1 1 1
Remember Conjunction Table
1 0 0 P Q PÙQ
0 1 0 T T T
0 0 0 T F F
F T F
F F F

REMARK : This membership table for Intersection is similar to


the truth table for logical connective, conjunction (^)
Set Operations … Difference of Sets (A-B)
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  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 = {a, c}
VENN Diagram for Difference
U

A-B is shaded

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 for Difference
A B A-B
1 1 0
Remember Implication Table
1 0 1 P Q PQ ¬(PQ)
0 1 0 T T T F
0 0 0 T F F T
F T T F
F F T F

REMARK : This membership table for Difference is similar to


the truth table for negation of Implication
Set Operations … Symmetric Difference
Let A and B be subsets of a universal set U. The “symmetric difference
of A and B” is the set of all elements in U that belong to either A or B
but not both and is denoted A Δ B.
Symbolically:
A Δ B = {x  U | x ∊ A-B OR x ∊ B-A}
EXAMPLE
Let U = {a, b, c, d, e, f, g}
A = {a, b, c, d, e}, B = {d, e, f, g}
Then A Δ B = {a, b, c, f, g}
VENN Diagram for Symmetric Difference
U

AΔB is shaded

REMARK
1. A Δ B = (A ⊕ B)
Membership for Symmetric Difference
A B AΔB
1 1 0
Remember XOR Table
1 0 1 P Q (P⊕ Q)
0 1 1 T T F
0 0 0 T F T
F T T
F F F

REMARK : This membership table for Difference is similar to


the truth table for negation of Implication
Complement of a Set A c

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 A’ or 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}
Complement of a Set Ac … Properties
1. (Ac)c = A
2. A U (Ac) = U
3. A ∩ (Ac) = Φ
VENN Diagram for Ac
REMARKS
Ac is
1. Ac = U – A
shaded
2. A  Ac = 
3. A  Ac = U

Membership Table for Ac Membership Table for Negation


A Ac p ¬p
1 0 T F
0 1 F T
Exercise 1
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:
(i) X  Y (ii) Y  Z (iii) X – Z
(ii) Yc (v) Xc – Zc (vi) (X – Z)c
Exercise 2
Given the following universal set U and its two subsets P and Q,
where
U = {x | x  Z, 0  x  10}
P = {x  U | x is a prime number}
Q = {x  U | x2 < 70}
(i)Draw a Venn diagram for the above
(ii)List the elements in Pc  Q
Exercise 3
Let U = {1, 2, 3, 4, 5}, C = {1, 4} and A and B are non empty sets. Find A in each
of the following:
(i) A  B = U, AB= and B = {1}
(ii) A  B and A  B = {3, 5}
(iii)A  B = {4}, A  B = {2, 3, 4} and B  C = {1,2,3, 4}
(iv)A and B are disjoint, B and C are disjoint, and the union of A and B is the set
{1, 2}.
Venn Diagram
A way of graphically representing the elements of a set:
A box (rectangle) represents the universal set
A circle (disks) representing the sets

From the Venn diagram we can note:


1. Sets may intersect each other
2. A set may be the subset of other or not
3. If a set is the subset of the other then in
VENN diagram the set is totally contained
in the other set
Exercises… VENN Diagram
Problem
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:
1. Modem and printer but no scanner
2. Scanner but no printer and no modem
3. Scanner or printer but no modem
4. No modem and no printer
Exercises… VENN Diagram
Of 21 typists in an office, 5 use all types of typing accessories (M: manual
typewriters, E: electronic typewriters and W: word processors; 9 use E and
W; 7 use M and W; 6 use M and E; but no one uses M only.
a. Represent this information in a Venn Diagram
b. If the same number of typists use electronic as use word processors,
then
i. How many use word processors only?
ii. How many use electronic typewriters?
Exercises using VENN Diagram
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 and13 used both A and B:
1. 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
2. If twice as many students used package B as package A, write down a pair
of simultaneous equations in x and y
3. Solve these equations to find x and y
4. How many students used package C?
Exercise … Venn Diagram
If U = {1, 2, 3, 4, 5, 6, 7, 8}, A = {1, 2, 4, 5},
B = {2, 3, 5, 6} and C = {4, 5, 6, 7} then
Use a Venn diagram to represent the following:
i. (A  B)  Cc
ii. Ac  (B  C)
iii. (A – B)  C
iv. (A  Bc)  Cc
Proving Set Identities By Venn Diagrams
Prove the following using Venn Diagrams:
(i) A – (A – B) = A  B
(ii) (A  B)c = Ac  Bc
(iii)A – B = A  Bc

You might also like