set theory(chapter1)
DESCRIPTION
Properties of the union operationA U = A Identity lawA U U = U Domination lawA U A = A Idempotent lawA U B = B U A Commutative lawA U (B U C) = (A U B) U C Associative lawProperties of the intersection operationA ∩ U = A Identity lawA ∩ = Domination lawA ∩ A = A Idempotent lawA ∩ B = B ∩ A Commutative lawA ∩ (B ∩ C) = (A ∩ B) ∩ C Associative lawTRANSCRIPT
Discrete MathematicsAM 1005
SET THEORY
Definition A set is a group of “objects”
People in a class: { Abhishek, Kunal, Chetna } Courses offered by a department: { CI 101, CI 202, … } Colors of a rainbow: {violet, indigo, red, orange, yellow, green,
blue } States of matter { solid, liquid, gas, plasma } States in the US: { Alabama, Alaska, Virginia, … } Sets can contain non-related elements: { 3, a, red, Virginia }
Although a set can contain (almost) anything, we will most often use sets of numbers All positive numbers less than or equal to 5: {1, 2, 3, 4, 5} A few selected real numbers: { 2.1, π, 0, -6.32, e }
Order does not matter {1, 2, 3, 4, 5} is equivalent to {3, 5, 2, 4, 1}
Properties
Sets do not have duplicate elements Consider the set of vowels in the alphabet.
It makes no sense to list them as {a, a, a, e, i, o, o, o, o, o, u} What we really want is just {a, e, i, o, u}
Sets can contain other sets S = { {1}, {2}, {3} } T = { {1}, {{2}}, {{{3}}} } V = { {{1}, {{2}}}, {{{3}}}, { {1}, {{2}}, {{{3}}} } }
Note that 1 ≠ {1} ≠ {{1}} ≠ {{{1}}} They are all different
Specifications Sets are usually represented by a capital letter (A, B,
S, etc.)
Elements are usually represented by an italic lower-case letter (a, x, y, etc.)
Easiest way to specify a set is to list all the elements: A = {1, 2, 3, 4, 5} Not always feasible for large or infinite sets
Can use an ellipsis (…): B = {0, 1, 2, 3, …} Consider the set C = {3, 5, 7, …}. What comes next? If the set is all odd integers greater than 2, it is 9 If the set is all prime numbers greater than 2, it is 11
Can use set-builder notation D = {x | x is prime and x > 2} E = {x | x is odd and x > 2} The vertical bar means “such that” How to read these sets ?
Specifications
A set is said to “contain” the various “members” or “elements” that make up the set If an element a is a member of (or an element of) a set S,
we use then notation a S 4 {1, 2, 3, 4}
If an element is not a member of (or an element of) a set S, we use the notation a S 7 {1, 2, 3, 4} Chandigarh {1, 2, 3, 4}
Specifications
Finite and infinite sets Finite sets
Examples: A = {1, 2, 3, 4} B = {x | x is an integer, 1 < x < 4}
Infinite sets Examples:
Z = {integers} = {…, -3, -2, -1, 0, 1, 2, 3,…} S={x| x is a real number and 1 < x < 4} = [1, 4]
Often used sets N = {1, 2, 3, …} is the set of natural numbers Z = {…, -2, -1, 0, 1, 2, …} is the set of integers Z+ = {1, 2, 3, …} is the set of positive integers (whole numbers)
Note that people disagree on the exact definitions of whole numbers and natural numbers
Q = {p/q | p Z, q Z, q ≠ 0} is the set of rational numbers Any number that can be expressed as a fraction of two integers (where
the bottom one is not zero) Q* is the set of nonzero rational numbers
R is the set of real numbers R+ is the set of positive real numbers R* is the set of nonzero real numbers C is the set of complex numbers
Some important sets
Universal set: the set of all elements about which we make assertions.
The empty set = { } has no elements.
Also called null set or void set.
U is the universal set – the set of all of elements (or the “universe”) from which given any set is drawn For the set {-2, 0.4, 2}, U would be the real numbers For the set {0, 1, 2}, U could be the natural numbers (zero
and up), the integers, the rational numbers, or the real numbers, depending on the context
More Examples For the set of the students in this class, U would be
all the students in the University (or perhaps all the people in the world)
For the set of the vowels of the alphabet, U would be all the letters of the alphabet
To differentiate U from U (which is a set operation), the universal set is written in a different font (and in bold and italics)
The empty set 1 If a set has zero elements, it is called the empty (or
null) set Written using the symbol Thus, = { } VERY IMPORTANT
If you get confused about the empty set in a problem, try replacing by { }
As the empty set is a set, it can be a element of other sets { , 1, 2, 3, x } is a valid set
The empty set 2 Note that ≠ { }
The first is a set of zero elements The second is a set of 1 element (that one element being
the empty set)
Replace by { }, and you get: { } ≠ { { } } It’s easier to see that they are not equal that way
Cardinality Cardinality of a set A (in symbols |A|) is the
number of elements in A Examples:
If A = {1, 2, 3} then |A| = 3
If B = {x | x is a natural number and 1< x< 9}
then |B| = 9
Infinite cardinality Countable (e.g., natural numbers, integers) Uncountable (e.g., real numbers)
Set equality Two sets are equal if they have the same elements
{1, 2, 3, 4, 5} = {5, 4, 3, 2, 1} Remember that order does not matter!
{1, 2, 3, 2, 4, 3, 2, 1} = {4, 3, 2, 1} Remember that duplicate elements do not matter!
Two sets are not equal if they do not have the same elements {1, 2, 3, 4, 5} ≠ {1, 2, 3, 4}
Subsets If all the elements of a set S are also elements of a set T,
then S is a subset of T For example, if S = {2, 4, 6} and T = {1, 2, 3, 4, 5, 6,
7}, then S is a subset of T This is specified by S T
Or by {2, 4, 6} {1, 2, 3, 4, 5, 6, 7} If S is not a subset of T, it is written as such:
S T For example, {1, 2, 8} {1, 2, 3, 4, 5, 6, 7}
Subsets Note that any set is a subset of itself!
Given set S = {2, 4, 6}, since all the elements of S are elements of S, S is a subset of itself
This is kind of like saying 5 is less than or equal to 5 Thus, for any set S, S S
Subsets The empty set is a subset of all sets (including itself!)
Recall that all sets are subsets of themselves All sets are subsets of the universal set The textbook has this gem to define a subset:
x ( xA xB ) English translation: for all possible elements of a set, if x is
an element of A, then x is an element of B This type of notation will be gone over later
If S is a subset of T, and S is not equal to T, then S is a proper subset of T Let T = {0, 1, 2, 3, 4, 5} If S = {1, 2, 3}, S is not equal to T, and S is a subset of T A proper subset is written as S T Let R = {0, 1, 2, 3, 4, 5}. R is equal to T, and thus is a
subset (but not a proper subset) or TCan be written as: R T and R T (or just R = T)
Let Q = {4, 5, 6}. Q is neither a subset of T nor a proper subset of T
Proper Subsets
Proper Subsets The difference between “subset” and “proper subset”
is like the difference between “less than or equal to” and “less than” for numbers
For a given set X, The empty set and the set X, itself are the only, improper subset of set X.
Venn diagrams
A Venn diagram provides a graphic view of sets
Set union, intersection, difference, symmetric difference and complements can be easily and visually identified
Venn diagrams Represents sets graphically
The box represents the universal set Circles represent the set(S)
Consider set S, which is the set of all vowels in thealphabet
The individual elements are usually not written in a Venn diagram
a e i
o u
b c d f
g h j
k l m
n p q
r s t
v w x
y z
US
Proper subsets: Venn diagram
U
S
R
S R
Subsets: review
X is a subset of Y if every element of X is also contained in Y (in symbols X Y)
Equality: X = Y if X Y and Y X, i.e., X = Y whenever x X, then x Y, and whenever x Y, then x X
X is a proper subset of Y if X Y but Y X Observation: is a subset of every set
Question What is the meaning of X Y and X≠ Y ?
Question What is the meaning of X Y and X≠ Y ?
X is a proper subset of Y
Power sets Given the set S = {0, 1}. What are all the possible
subsets of S? They are: (as it is a subset of all sets), {0}, {1}, and {0,
1} The power set of S (written as P(S)) is the set of all the
subsets of S P(S) = { , {0}, {1}, {0,1} }
Note that |S| = 2 and |P(S)| = 4
Power sets Let T = {0, 1, 2}. The P(T) = { , {0}, {1}, {2},
{0,1}, {0,2}, {1,2}, {0,1,2} } Note that |T| = 3 and |P(T)| = 8
P() = { } Note that || = 0 and |P()| = 1
If a set has n elements, then the power set will have 2n elements
If |A|=n, then |P(A)|=2n.
0for ,2210
n
n
nnnn n
Set operations:Union and Intersection
Given two sets A and B The union of A and B is defined
as the set
A U B = { x | x A or x B }
The intersection of X and Y is defined as the set
A B = { x | x A and x B}
Two sets A and B are disjoint if A B =
Set operations: Union & Intersection examples
{1, 2, 3} U {3, 4, 5} = {1, 2, 3, 4, 5} {New York, Washington} U {3, 4} = {New York,
Washington, 3, 4} {1, 2} U = {1, 2} {1, 2, 3} ∩ {3, 4, 5} = {3} {1, 2, 3} and {3, 4, 5} are not disjoint {New York, Washington} ∩ {3, 4} =
No elements in common, these sets are disjoint {1, 2} ∩ =
Any set intersection with the empty set yields the empty set
Set Operations: Relative Complement The relative complement (difference) of two
sets is the set defined as: A — B = { x | x A and x B }
Given: A = {a, b, c, d} and B = {a, c, f, g} A — B = {b, d} B — A = {f, g}
The complement of a set A contained in a Universal set U is the set A = U – A
A-B B-A U-A
_
Set Operations: Symmetric Difference
Definition: The symmetric Difference of sets A and B, denoted BA ,
consists of those elements which belong to A or B but not to both.i.e. A Δ B = { x | (x A or x B) and x A ∩ B}
Or A Δ B = (A U B) – (A ∩ B) Important!
Note:- The pink region is the required symmetric differenceIf A = {1,2,3} and B = {2,5,6,7}Then BA = { 1,3,5,6,7}
Examples {1, 2, 3} - {3, 4, 5} = {1, 2} {New York, Washington} - {3, 4} = {New York, Washington} {1, 2} - = {1, 2}
The difference of any set S with the empty set will be the set
Set operations: Complement and symmetric difference
Now, assuming U = Z Complement of {1, 2, 3} = { …, -2, -1, 0, 4, 5, 6, … } {1, 2, 3} Δ {3, 4, 5} = {1, 2, 4, 5} {New York, Washington} Δ {3, 4} = {New York,
Washington, 3, 4} {1, 2} Δ = {1, 2}
The symmetric difference of any set S with the empty set will be the set S
Example If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5}
X Y = X Y = X – Y = Y – X = X Δ Y = (how else can you write this?)
Example If X={1, 4, 7, 10}, Y={1, 2, 3, 4, 5}
X Y = {1, 2, 3, 4, 5, 7, 10} X Y = {1, 4} X – Y = {7, 10} Y – X = {2, 3, 5} X Δ Y = (X Y) – (X Y) = {2, 3, 5, 7, 10}
Properties of Set operations Properties of the union operation
A U = A Identity law A U U = U Domination law A U A = A Idempotent law A U B = B U A Commutative
law A U (B U C) = (A U B) U C Associative law Properties of the intersection operation A ∩ U = A Identity law A ∩ = Domination law A ∩ A = A Idempotent law A ∩ B = B ∩ A Commutative
law A ∩ (B ∩ C) = (A ∩ B) ∩ C Associative law
Properties of complement sets A = A Complementation law A U A = U Complement law A ∩ A = Complement law
Properties contd…
¯
¯
¯
Properties of set operations Theorem 2.1.10: Let U be a universal set, and A, B
and C subsets of U. The following properties hold:
a) Associativity: (A B) C = A (B C) (A B) C = A (B C)b) Commutativity: A B = B A A B = B Ac) Distributive laws: A(BC) = (AB)(AC) A(BC) = (AB)(AC)d) Identity laws: AU=A A = A
Properties of set operations (e) Complement laws:
AAc = U AAc =
f) Idempotent laws:
AA = A AA = A
g) Bound or Identity laws:
AU = U A = h) Absorption laws:
A(AB) = A A(AB) = A
Properties of set operationsi) Involution law: (Ac)c = A
j) Compliment laws: c = U Uc = k) De Morgan’s laws for sets:
(AB)c = AcBc
(AB)c = AcBc
Computer representation of sets Assume that U is finite (and reasonable!)
Let U be the alphabet
Each bit represents whether the element in U is in the set
The vowels in the alphabet:abcdefghijklmnopqrstuvwxyz10001000100000100000100000
The consonants in the alphabet:abcdefghijklmnopqrstuvwxyz01110111011111011111011111
Computer representation of sets Consider the union of these two sets:
10001000100000100000100000
01110111011111011111011111
11111111111111111111111111
Consider the intersection of these two sets:
10001000100000100000100000
01110111011111011111011111
00000000000000000000000000
Classic Boolean Model Illustrates the 8 possible relations
between Sets, A, B and C
Region Relationship
1 A B C
2 A B C
3 A B C
4 A B C
5 A B C
6 A B C
7 A B C
8A B C
Principle of Duality:Principle of Duality:
Suppose E is an equation of set algebra. The dual E* of E is the equation obtained by using the following replacements
E dual of E (E*)
U
U
•Theorem (The Principle of Duality) Let E denote a theoremdealing with the equality of two set expressions. Then E* is alsoa theorem.
Duality contd: For example
The dual of AABAU )()( is .)()( AABA
Thus if E is an identity, then its dual E* is also an identity.
What is the dual of A B ?
Since A B A B B A B
A B B A B B B A
.
.
The dual of is the dual of
, which is That is, .
Counting Principle:Counting Principle:
(B)n (A)n B) (A n and
finiteis BAthen sets, finite disjoint are B and A Ifb)
B)(An – (B)n (A)n B)(A n and
finite are B A and B A then finite are B andA Ifa)
).()(
)n(B-B)(An – n(C)(B)n (A)n C)B(A n and
finite is C BAthen sets finite are C B, A, If Similarly c)
CBAnCAn
C
Examlples:1. In a class of 50 college freshmen, 30 are studying JAVA, 25 studying UNIX, and 10 are studying both. How many freshmen are studying either computer language?
A B
10 1520
5| | | | | | | |A B A B A B
U
Examples:
Given 100 samplesset A: with D1
set B: with D2
set C: with D3
2. Defect types of an AND gate:D1: first input stuck at 0D2: second input stuck at 0D3: output stuck at 1
with |A|=23, |B|=26, |C|=30,| | , | | , | | ,| |A B A C B CA B C
7 8 103 , how many samples have defects?
A B
C
114
35 7
12
15
43
Ans:57
|||||||||||||||| CBACBCABACBACBA We have
Partition of a set:Let S be a nonempty set. A partition of S is a subdivision of S into non-overlapping, non-empty subsets. i.e. a partition of S is a collection }{ iA of non-empty subsets of S such that
jiAA
A
iAaSa
ji
i
i
for i.e.
disjoint mutually are}{ sets theii)(
somefor Each (i)
1A
3A
2A5A
4A
The subsets in a partition are called cells.Example: Let S = { 1,2,3,….9}
1A ={1,2}2A ={5,6,7}
3A ={8}
4A ={3,4} and 5A ={9}
Then },......,{ 5215
1 AAAA ii is a partition of S.
S
ExampleX = { 1, 2, 3, 4, 5}
S = { {1,2}, {3}, {4,5}}S is a partition of X.
Determine other possible partitions of the set X.
Partition of a set A partition divides a set into non-
overlapping subsets. A collection S of nonempty subsets of X is
said to be a partition of the set X if every element in X belongs to exactly one member of S.
If S is a partition of X, S is pairwise disjoint and S = X
Mathematical Induction Let P(n) be the predicate
This is true for particular values of n, e.g:
2
1321
nnnnP
2
)14(4104321
2
)13(36321
2
)12(2321
Want to show that P(n) is true for all integers n i.e.: n:P(n) The easiest way to prove such a statement is to
use the method of proof by induction
• The principle of mathematical induction is a useful tool for proving that a certain predicate is true for all natural numbers.
• It cannot be used to discover theorems, but only to prove them.
• If we have a propositional function P(n), and we want to prove that P(n) is true for any natural number n, we do the following:• Show that P(0) is true. (basis step) We could also start at any other integer m, in which case we prove it for all n ≥ m.
Mathematical Induction
Contd:• Show that if P(n) then P(n + 1) for any
n∈N. (inductive step)• Then P(n) must be true for any n∈N. (conclusion). Intuitively…1. Show that P(k) P(k+1) for any k2. Show that P(1) is true3. Then from 1 and 2, P(2) is true4. …and from 1 and 3, P(3) is true5. …and from 1 and 4, P(4) is true6. etc
Example 1
Case n=1: so P(1) is true Now assume P(k) is true
Need to show P(k+1) is true I.e. need to show that
1,
2
1321:
n
nnnnSnP
2
11111
S
2
211
kkkS
Example 1 (continued)
2
212
121
12
1
1
1211
kk
kkk
kkk
kkS
kkkS
Step 1: Write S(k+1) in terms of S(k)
Step 2: Use the fact that P(k) is true
Step 3: Manipulate to get the right formula
Example 1 (concluded)
So,
Therefore P(k+1) is true Therefore, by the principle of
mathematical induction, n:P(n)
2
211
kkkS
Example 2 Let P(n) be the predicate defined by:
P(n): ‘n3-n is divisible by 3’Show that n:P(n)
Case n=1: n3-n=1-1=0, which is divisible by 3. Hence P(1) is true
Now assume that P(k) holds Need to prove that P(k+1) holds
Example 2 (continued) Case n=k+1:(k+1)3 - (k+1) = (k3+3k2+3k+1) - (k+1)
= (k3-k)+(3k2+3k)= (k3-k) + 3(k2+k)
Divisible by 3 since P(k) is true
divisible by 3
Hence if k3-k is divisible by 3, then (k+1)3-(k+1) is also divisible by 3
In other words, k:(P(k) P(k+1)) Also, P(1) is true Therefore, by mathematical induction, n:P(n)
Example 3:Solution:
Notes: (Limitations of Induction) Mathematical induction can only be used to prove
arguments for which the domain of discourse is the positive, whole numbers.
For example, if P(b) is the predicate: the roots of the equation x2+bx+1 are given by
Then b:P(b) is true, but cannot be proved by induction Also We can not prove the uniqueness part of
fundamental Theorem of Arithmetic.
2
42
bbx
End of chapter 1.