Discrete Mathematics
Course Code:14B14MA211
Chapter 1
SET THEORY & MATHEMATICAL
INDUCTION
What is a set?
A set is a well defined collection 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
We often write them in order because it is easier for
humans to understand it that way
{1, 2, 3, 4, 5} is equivalent to {3, 5, 2, 4, 1}
Set 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}
Note that a list is like a set, but order does matter and
duplicate elements are allowed
We won’t be studying lists much in this class
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
Specifying a set 1
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
Specifying a set 2
Can use an ellipsis (…): B = {0, 1, 2, 3, …}
Can cause confusion. 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”
Thus, set D is read (in English) as: “all elements x such
that x is prime and x is greater than 2”
Specifying a set 3
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}
Virginia {1, 2, 3, 4}
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 = {x | x is an integer} = {…, -3, -2, -1, 0, 1, 2, 3,…}
S={x | x is a real number and 1 < x < 4} = [0, 4]
Often used sets
N = {0, 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
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 whole
numbers (zero and up), the integers, the rational
numbers, or the real numbers, depending on the
context
Other type of universal set
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
Index Set: If J = {1,2, 3,……..}, then
A= {A1, A2, A3,………….}= {A i}iєJ is called index
set and subscript i is called an index.
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 1
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:
ST
For example, {1, 2, 8} {1, 2, 3, 4, 5, 6, 7}
Subsets 2
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 3
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 values of x, (meaning
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
Proper Subsets 1
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 T
Can be written as: R T and R T (or just R = T)
Let Q = {4, 5, 6}. Q is neither a subset or T nor a proper
subset of T
Proper Subsets 2
The difference between “subset” and “proper subset”
is like the difference between “less than or equal to”
and “less than” for numbers
The empty set is a proper subset of all sets other than
the empty set (as it is equal to the empty set)
Venn diagrams 1
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 2
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 the b c d f
U
alphabet g h j
S
The individual elements k l m
are usually not written n p q e i
a
in a Venn diagram
r s t
o u
v w x
y z
Proper subsets: Venn diagram
SR
U
R
S
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 X,
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 1
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 2
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.
n n n n
2 n , for n 0
0 1 2 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
AB=
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}
A-B B-A U-A
The complement_ of a set A contained in a Universal
set U is the set A = U – A
Set Operations: Symmetric
Difference
Definition:
The symmetric Difference of sets A and B, denoted A B,
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}
A Δ B = (A U B) – (A ∩ B) Important!
Note that the pink region is the required
symmetric difference
If A = {1,2,3} and B = {2,5,6,7}
Then A B = { 1,3,5,6,7}
Set operations: Complement and
symmetric difference
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
(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}
XY=
XY=
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
AU=A Identity law
AUU=U Domination law
AUA=A Idempotent law
AUB=BUA 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
Properties contd…
Properties of complement sets
A=A Complementation law
¯
A
¯ UA=U Complement law
A∩A ¯ = Complement law
Properties of set operations (1)
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
c) Distributive laws:
AB=BA
A(BC) = (AB)(AC)
A(BC) = (AB)(AC)
d) Identity laws:
AU=A A = A
Properties of set operations (2)
(e) Complement laws:
AAc = U AAc =
f) Idempotent laws:
AA = A AA = A
g) Bound laws:
AU = U A =
h) Absorption laws:
A(AB) = A A(AB) = A
Properties of set operations (3)
i) Involution law: (Ac)c = A
j) 0/1 laws: c = U Uc =
k) De Morgan’s laws for sets:
(AB)c = AcBc
(AB)c = AcBc
Computer representation of sets 1
Assume that U is finite (and reasonable!)
Let U be the alphabet i.e. set of letters.
Each bit represents whether the element in U is in the set
The vowels in the alphabet:
abcdefghijklmnopqrstuvwxyz
10001000100000100000100000
The consonants in the alphabet:
abcdefghijklmnopqrstuvwxyz
01110111011111011111011111
Computer representation of sets 2
Consider the union of these two sets:
10001000100000100000100000
01110111011111011111011111
11111111111111111111111111
Consider the intersection of these two sets:
10001000100000100000100000
01110111011111011111011111
00000000000000000000000000
Fundamental Products:
Consider n distinct sets A1 , A2 , A3, ......... An . A fundamental product
Of the sets is a set of the form
*
* * *
A A2 A3 ......... An
1
* c
Where Ai is either Ai or Ai .
Remarks:
(i) There are 2 n Such fundamental products.
(ii) Any two such fundamental products are disjoint.
(iii) The universal set U is the disjoint union of all such fundamental
products.
Classic Boolean Model
Illustrates the 8 possible relations
between Sets, A, B and C
Region Relationship
1 ABC
2 ABC
3 ABC
4 ABC
5 ABC
6 ABC
7 ABC
8 ABC
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 theorem
dealing with the equality of two set expressions. Then E* is also
a theorem.
Duality contd:
For example
The dual of (U A) ( B A) A is ( A) ( B A) A.
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 . The dual of A B is the dual of
A B B , which is A B B . That is, B A.
Counting Principle:
• If A and B are finite then A B and A B are finite and
n (A B) n (A) n (B) – n (A B)
• If A and B are disjoint finite sets, then A B is finite and
n (A B) n (A) n (B)
• Similarly If A, B, C are finite sets then A B C is finite and
n (A B C) n (A) n (B) n(C) – n (A B) - n(B C ) n( A C ) n( A B 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
| A B | | A| | B | | A B |
20 10 15
Examples:
2.
Given 100 B
samples 12
11 4
set A: with D1 3 7
set B: with D2 5
A
set C: with D3 15 C
how many samples
| A B |7, | A C |8, | B C |10,
have defects?
with |A|=23, |B|=26, |C|
B C |3
| A=30,
| A B C || A | | B | | C | | A B | | A C | | B C | | A B C |
, Ans:57
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 { Ai } of non-empty subsets of S such that
(i) Each a S a Ai for some i
(ii) the sets { Ai } are mutually disjoint
i.e. Ai A j for i j
The subsets in a partition are
called cells. A1 A5
Example: Let S = { 1,2,3,….9} A2
A1 ={1,2} A2={5,6,7} A3 ={8}
A4 ={3,4} and A5 ={9} A3 A4 S
Then
A 5
i i 1 { A1 , A2 ,...... A5 } is a partition of S.
Example
X = { 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
nonoverlapping 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
nn 1
Pn 1 2 3 n
2
This is true for particular values of n, e.g:
2(2 1)
1 2 3
2
3(3 1)
1 2 3 6
2
4(4 1)
1 2 3 4 10
2
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(1) is true. (basis step)
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 k
2. Show that P(1) is true
3. Then from 1 and 2, P(2) is true
4. …and from 1 and 3, P(3) is true
5. …and from 1 and 4, P(4) is true
6. etc
Example 1
nn 1
Pn : S n 1 2 3 n , n 1
2
11 1
Case n=1: S 1 1 , so P(1) is true
Now assume P(k) is true2
Need to show P(k+1) is true
I.e. need to show that
S k 1
k 1k 2
2
Example 1 (concluded)
So, S k 1 k 1k 2
2
Therefore P(k+1) is true
Therefore, by the principle of
mathematical induction, n:P(n)
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
divisible by 3
P(k) is true
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:
Appendix: Well-Ordering
Property
Every nonempty set of nonnegative
integers has a least element
The well-ordering property is useful in
proving many theorems, as well as the
validity of mathematical induction
Let us see the proof by contradiction to
show the validity of mathematical
induction
End of chapter 1.