Uploaded by num288

Week2

advertisement
UALITY 1.5 ALGEBRA OF SETS, DUALITY
Week 2
1 of 22
f union, intersection,
and complement
satisfy
variousintersection,
laws (identities)
which are satisfy var
Sets under
the operations
of union,
and complement
ormally statelisted
this as:
in Table 1-1. In fact, we formally state this as:
aws in TableTheorem
1-1.
1.5:
CISC-102
Sets satisfy
the laws 2019
in Table 1-1.
Winter
Week 2
Table 1-1 Laws of the algebra of sets Table 1-1 Laws of the algebra of sets
A ∪ A = A Idempotent laws:
(1b) A ∪
∩A = A
(1a)
(1b) A ∩ A
A ∪ B) ∪ C =
A ∪ (B ∪ C)
(2b) (A ∪
∩ B) ∪
∩C = A ∪
∩ (B ∪
∩ C)
Associative
laws:
(2a)
(2b) (A ∩ B
A∪B =B ∪A
(3b) A ∪
∩B = B ∪
∩A
Commutative laws: (3a)
(3b) A ∩ B
A ∪ (B ∩ C) =Distributive
(A ∪ B) ∩ (A
∪ C) (4a)
(4b) A ∪
∩ (B ∩
∪ C) = (A ∪
∩ B) ∩
∪ (A ∪
∩ C) (4b) A ∩ (B
laws:
A∪∅=A
(5b) A ∪
∩ ∅U =
= AA
(5a)
(5b) A ∩ U
Identity laws:
A∪U=U
(6b) A ∪
∩U
∅=
(6a)
= ∅U
(6b) A ∩ ∅
!
AC )C = A
Involution laws:
(7) (AC )C = A
A ∪ AC = UVerify these properties
(8b) A with
∩ AC =UU
∅ = {1,2,3,4,5,6,7}, (8b) A ∩ A
(8a)
∪
Complement
laws:
UC = ∅
(9b)4,
∅CC6}
=
(9a)
U
=U
∅C={4,5}.
(9b) ∅C =
A = {1,2,3}, B = {2,
C ∩ BC
(A ∪ B)C = A
DeMorgan’s
laws:
(10b) (A ∪
∩ B)C = AC ∩
∪ BC
(10a)
(10b) (A ∩
Theorem 1.5: Sets satisfy the laws in Table 1-1.
Week 2
Idempotent laws:
Associative laws:
Commutative laws:
Distributive laws:
Identity laws:
!
2 of 22
Table 1-1 Laws of the algebra of sets
(1a) A ∪ A = A
(1b) A ∩
(2a) (A ∪ B) ∪ C = A ∪ (B ∪ C)
(2b) (A ∩
(3a) A ∪ B = B ∪ A
(3b) A ∩
(4a) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) (4b) A ∩
(5a) A ∪ ∅ = A
(5b) A ∩
(6a) A ∪ U = U
(6b) A ∩
C )C = A
Involution
laws:
(7)
(A
Verify these properties with U
A ∪ AC
(8a)4, 6}.
AComplement
= {1,2,3},laws:
B = {2,
DeMorgan’s laws:
(9a) UC = ∅
= {1,2,3,4,5,6,7},
=U
(10a) (A ∪ B)C = AC ∩ B C
(8b) A ∩
(9b) ∅C =
(10b) (A ∩
Theorem 1.5: Sets satisfy the laws in Table 1-1.
Fig. 1-5
Fig. 1-5
Week 2
3 of 22
Table 1-1 Laws of the algebra of sets
UALITY 1.5 ALGEBRA OF SETS, DUALITY
Idempotent laws:
(1a) A ∪ A = A
(1b) A ∩
f union, intersection,
and complement
satisfy
various
which are satisfy
Sets under
the operations
of
and∪complement
Associative
laws:
(2a)
(Aunion,
∪ B) intersection,
∪laws
C =(identities)
A ∪ (B
C)
(2b) (Avar
∩
ormally statelisted
this
as:
in Table 1-1.
In fact,(3a)
we formally
Commutative
laws:
A ∪ B =state
B ∪this
A as:
(3b) A ∩
Distributive
∪ (B
∩ C) =
(A ∪ B) ∩ (A ∪ C) (4b) A ∩
aws in TableTheorem
1-1.
1.5: laws:
Sets satisfy(4a)
the A
laws
in Table
1-1.
(5a) A ∪ ∅ = A
(5b) A ∩
Identity laws:
(6a) A ∪ U = U
(6b) A ∩
!
laws:
(7)sets
(AC )CTable
= A 1-1 Laws of the algebra of sets
Table 1-1Involution
Laws of the
algebra of
A ∪ A = A Idempotent laws:
(1b)
∩
(1a)
AU
(1b)
(8a) A
A∪
∪A
AC==
(8b)AA∩∩A
Complement
laws:
A ∪ B) ∪ C =
A ∪ (B ∪ C)
(2b) (AC∪
∩ B) ∪
∩C = A ∪
∩ (B ∪
∩ C)
Associative
laws:
(2a)
(2b) (AC∩ B
(9a) U = ∅
(9b) ∅ =
A∪B =B ∪A
(3b) A ∪
∩B = B ∪
∩A
Commutative laws: (3a)
(3b) A ∩ B
C
C
C
DeMorgan’s
laws:
(10a)A(A
∪ B)
(10b)
(A(B
∩
A ∪ (B ∩ C) =Distributive
(A ∪ B) ∩ (A
∪ C) (4a)
(4b)
∩ (B
∪ C)==A(A∩∪
∩BB) ∩
∪ (A ∪
∩ C) (4b)
laws:
∪
∩
A∩
A∪∅=A
(5b) A ∪
∩ ∅U =
= AA
(5a)
(5b) A ∩ U
Identity laws:
A∪U=U
(6b) A ∪
∩U
∅=
(6a)
= ∅U
(6b) A ∩ ∅
!
AC )C = A
Involution laws:
(7) (AC )C = A
A ∪ AC = UDuality
(8b) A ∪
∩ AC = U
∅
(8a)
(8b) A ∩ A
Complement
laws:
Suppose E is an equation
UC = ∅
(9b) of
∅CCset
=
(9a)
U
=U
∅algebra. The dual E∗ of E (9b) ∅C =
C ∩equation
isA
the
obtained
by (A
replacing
of
(A ∪ B)C =
BC
(10b)
∩ B)C =each
∪occurrence
DeMorgan’s
laws:
(10a)
∪
AC ∩
BC
∪, ∩, U and ∅ in E by ∩, ∪, ∅, and U, respectively.
(10b) (A ∩
Commutative laws:
Distributive laws:
Week 2
Identity laws:
!
Involution laws:
(3a) A ∪ B = B ∪ A
(3b) A ∩ B
(4a) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) (4b) A ∩ (
(5a) A ∪ ∅ = A
4 of 22 (5b) A ∩ U
(6a) A ∪ U = U
(6b) A ∩ ∅
(7) (AC )C = A
Complement laws:
(8a) A ∪ AC = U
(8b) A ∩ A
DeMorgan’s laws:
(10a) (A ∪ B)C = AC ∩ B C
(10b) (A ∩
(9a) UC = ∅
Verify these properties with U = {1,2,3,4,5,6,7},
A = {1,2,3}, B = {2, 4, 6}.
(9b) ∅C =
∅=A
U=U
C
=A
AC = U
=∅
Identity laws:
Week 2
Involution laws:
Complement laws:
C ∩ BC
DeMorgan’s
laws:
∪ B)C =! A
(5b)AA∪∩∅U==AA
(5a)
(6b)AA∪∩U∅ =
=U
∅
(6a)
(7)
(AC )C
=A
5 of 22
(8a)
(8b)AA∪∩AACC==U∅
(9a)
(9b)U∅CC =
= ∅U
(10a)
(10b)(A
(A∪∩B)
B)CC==AACC∩∪BBCC
Verify these properties with U = {1,2,3,4,5,6,7},
A = {1,2,3}, B = {2, 4, 6}.
Week 2
6 of 22
Definition: A set S is said to be finite if S is
empty or if S contains exactly m elements where
m is a positive integer; otherwise S is infinite.
Some finite sets:
A = {1, 2, 3, 4},
B = {x : x ∈ ℕ, x ≥ 1, x ≤ 6}
Some infinite sets:
C = {1, 2, 3, 4, … },
D = {x : x ∈ ℝ, x ≥ 1, x ≤ 6}
Notation: We use vertical bars | | to denote the
size or cardinality of a finite set.
| A | = 4.
B = {1,2,3,4,5,6}, so | B | = 6.
Week 2
7 of 22
Definition: The set of all (different) subsets of S
is the power set of S, which we denote as P(S).
If S is a finite set we can prove that:
| P(S) | = 2 |S|.
Some examples:
∅ : the empty set has 0 elements, and 1 subset.
So | P(∅) | = 20.
{a}: has 1 element and 2 subsets.
So |P({a})| = 21.
{a,b}: has 2 elements and 4 subsets.
So |P({a,b})| = 22.
Exercise: What is the power set of the sets:
{red, blue}, {1,2,3}, {a,b,c,d}
Week 2
8 of 22
{a,b,c}: Let’s keep track of the subsets of
{a,b,c} by using a binary string counter.
Corollary: There are 2 types of people in the
world, those who can spell “those” and “don’t”
correctly and those that can’t.
Week 2
a
1
a
1
a
0
b
1
b
0
b
0
9 of 22
c
1 denotes {a,b,c}
c
1 denotes {a,c}
c
0 denotes ∅
We can keep track of the subsets of {a,b,c} by
using a 0 or 1 in a 3 bit binary string to denote
the presence or absence of the symbol in the
subset.
For elements of {a,b,c} we say that
a is element 1, b is element 2, c is element 3
We also say that the binary bits are numbered
1,2,3 from left to right.
To map a subset to a binary number
set bit i to
0 if the element i is not in the subset
1 if the element i is in the subset
Week 2
10 of 22
Claim: Every different 3 bit binary string
denotes a different subset of {a,b,c}, and every
subset of {a, b, c} is represented uniquely by a 3
bit binary string.
If we can count 3 bit binary strings then we can
also count subsets of {a,b,c}.
There are 2 choices for the left bit (bit 1).
There are 2 choices for the middle bit (bit 2).
There are 2 choices for the right bit (bit 3).
The total number of choices are:
2 × 2 × 2 = 23 = 8.
This coincides with the claim that:
|P({a,b,c})| = 23 .
Week 2
11 of 22
A standard “trick” in mathematics is to obtain a
mapping from a new problem to one where the
solution is known. When done properly (the
mapping has to be one-to-one and onto) the
known solution can be used to solve a new
problem.
Week 2
12 of 22
Humans use the decimal system or numbers
base 10, using decimal digits 0,1,2,3,4,5,6,7,8,9.
Consider the decimal number 2017.
It is equal to:
2 × 103 + 0 × 102 + 1 × 101 + 7 × 100.
2
0
1
7
2 × 1000
0 × 100
1 × 10
7×1
2 × 103
0 × 102
1 × 101
7 × 100
The maximum value that can be written using 4
decimal digits is 9999. The total number of
values from 0 … 9999 is 10000 or 104.
Week 2
13 of 22
Binary numbers are numbers base 2, using
binary bits 0,1.
Consider the binary number 1011.
It is equal to:
1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 .
1
0
1
1
1×8
0×4
1×2
1×1
1 × 23
0 × 22
1 × 21
1 × 20
The maximum value that can be written using 4
binary bits is 1111. The total number of values
from 0 … 1111(binary) is 10000 (binary) or 24.
Week 2
14 of 22
Consider the binary number
11111100011
What is the corresponding value in decimal?
1
1
1
1
1
1
0
0
0
1
1
1 × 210
1 × 29
1 × 28
1 × 27
1 × 26
1 × 25
0 × 24
0 × 23
0 × 22
1 × 21
1 × 20
1024
512
256
128
64
32
0
0
0
2
1
1024+512+256+128+64+32+2+1 = 2019
Exercise: Write 2017, 2018 in binary.
Week 2
15 of 22
Definition: Let S be a non-empty set. A
partition of S consists of pairwise disjoint nonempty subsets of S whose union is S.
For example: Let S be the set {1,2,3,4,5,6}:
E = {x ∈ S : x is even}
Ο = {x ∈ S : x is odd}
Observe that E ∩ O = ∅ and E ∪ O = S, so the
set (of sets){E,O} is a partition of S.
This {{1,2},{4,3,6},{5}} is another partition of
S.
When solving algorithmic problems it is
sometimes useful to partition the problem into
cases.
Week 2
16 of 22
A collection or a class of sets can be defined using an
index as follows:
Let Ai denote the set {x : x ∈ Z, x ≥ i}, for all i 2 N. So we
have:
A1 = { 1, 2, 3, ... }, A2 = { 2, 3, 4, ... }, A3 = { 3, 4, 5, ... }
etc.
A shorthand notation can be used to denote multiple
unions and intersection operations.
For example:
A1 ∪ A2 ∪ A3
can be written as:
[3i=1 Ai
Week 2
17 of 22
Let Ai denote the set {x : x ∈ Z, x ≥ i}, for all i 2 N. This
defines infinitely many sets. Using the generalized union
and intersection operators we can express the union or
intersection of an arbitrary finite number of sets.
So for union we have:
n
⋃
!
i=1
Ai = {x : x ∈ Ai for any i = 1,…n}
What is the value of ! ∪ni=1 Ai ?
And for intersection:
n
⋂
!
i=1
Ai = {x : x ∈ Ai for every i = 1,…n}
What is the value of ! ∩ni=1 Ai ?
Week 2
18 of 22
We can also state properties, or perform union and
intersection operations on infinitely many sets.
1. Ai ✓ Aj if i ≥ j for all i ∈ ℕ.
S
2. !
T
3. !
i2N Ai
=N
i2N Ai
=;
To justify 3. suppose that there is at least one element k in
the “intersection”. So k must be a positive integer.
However by definition there is a set A` such that ` > k and
k2
/ A`. This contradicts the assumption that there is at least
one element in the “intersection” and therefore we
conclude that the “intersection” is equal to ;.
Week 2
19 of 22
Notation
We will make extensive use of a generalized sum
notation throughout the course. It uses a large greek
letter Σ (pronounced “sigma”).
Recall that the binary number 1111 is equal to:
23 + 22 + 21 + 20
This can be written concisely using sigma notation
as:
3
∑
i=0
2i
Week 2
20 of 22
Principle of Inclusion and Exclusion
Ginger owns a peculiar music store where all of the instruments are
either red or if the instrument is not red it is a guitar.
There are 15 red instruments and 18 guitars. How many instruments are
there at Ginger’s?
Here’s a Venn diagram modelling the inventory at Ginger’s.
!
The diagram clearly shows that we also need to know how many of the
guitars at Ginger’s are red to determine the total number of instruments
in the store. So suppose there are 8 red guitars at Ginger’s.
Week 2
21 of 22
Let R denote the set of red instruments at Ginger’s and G the set of
guitars. We then have:
|R| = 15, |G| = 18, |R ∩ G| = 8.
The total number of instruments is:
|R ∪ G| = |R| + |G| - |R ∩ G| = 15 + 18 - 8 = 25.
The Principle of Inclusion and Exclusion can be stated as follows:
Theorem: Suppose A and B are finite sets. Then:
|A ∪ B| = |A| + |B| - |A ∩ B|
Week 2
22 of 22
This generalizes to a formula for determining the cardinality of the union
of three sets.
Corollary: Suppose A, B, and C are finite sets. Then:
|A ∪ B ∪ C | = |A| + |B| + |C| - |A ∩ B| - |A ∩ C| - |B ∩ C| + |A ∩ B ∩ C|
!
Consider a collection of 40 people where each of them is wearing
something that is red or blue or green such that:
20 wear something blue,
20 wear something red,
20 wear something green
10 wear red and blue, 10 wear red and green, 10 wear blue and green.
How many people in the class are wearing all 3 colours?
We will come back to the Principle of inclusion and exclusion when we
look at more counting problems.
Download