Discrete Mathematics Unit I
Discrete Mathematics Unit I
Discrete Mathematics Unit I
A set is an unordered collection of objects, which are called the ‘elements’ of the set
a ∈ A means that ‘a’ is an element of A (A is the set)
sets are equal if and only if they have the same elements
order and repetition don’t matter for sets
note that a set doesn’t equal its elements, i.e. {a} ≠ a
Cardinality
The cardinality of a set is the number of elements in the set
cardinality is denoted by |A|
For example if A={1,2,3,4,5,6} then |A|=6
Empty set
the empty set is denoted by {} or ∅
Universal set
The universal set is the set containing all elements of all sets needed to discuss a topic
denoted by U
e.g. U might be ℝ in Calculus, or ℂ in algebra
Basic notation
The following format is used to indicate a set
S={x∈A…}
Which is read as “x is an element of A (x ∈ A) such that (|) some property is true (…).
For example, S = { x ∈ ℤ | –2 < x < 5 } which is equal to { –1, 0, 1, 2, 3, 4 }.
Venn diagrams
when solving a problem using Venn diagrams, you must state what each of the
subsets means before you draw the diagram
note that often you can use inclusion-exclusion principle (covered later) rather than
Venn Diagrams
Subset
A is a subset of B if and only if every element of A is also an element of B
A ⊆ B indicates that A is a subset of the set B
A is the proper subset of B, A ⊂ B, if A ⊆ B but A ≠ B
The following properties are useful:
if A = B then A ⊆ B and B ⊆ A
if A ⊂ B then A ⊆ B
if A ⊆ B and B ⊆ A then A = B (this is used to prove that two sets are equal)
A is a proper subset of B if it is a subset of B and B has at least one element that is
not also in A
The subset relationship only exists between two sets, i.e. for A ⊆ B, A must be a set.
Proving A is a subset of B
1. Show that any element of A is also an element of B
2. “Let x ∈ LHS” and work to show that x ∈ RHS also.
3. “Thus we have shown that any element of the LHS is also an element of the RHS,
therefore LHS ⊆ RHS”
Proving A is a proper subset of B
1. Prove A ⊆ B as above
2. Then find one or more example of an element that is in B but not in A
Proving A = B
1. Show A ⊆ B and B ⊆ A, i.e. two iterations of the process above
Power set
The power set of a set is the set of all subsets of the set.
given a set A, then power set of A is the set of all of the subsets of the set S
the power set of S is denoted by P(S)
For example,
P({ 0, 1, 2 }) = {
∅,
{ 0 }, { 1 }, { 2 },
{ 0, 1 }, { 1, 2 },
{ 0, 1, 2 },
}
Note: For a set X, X ∈ P(S) and X ⊆ S mean the same thing
Cardinality of a power set
If | A | = n then | P(A) | = 2n
Or, in English, the size of the power set is equal to 2n where n is the number of elements in
the set.
Set algebra
Union
The union of the sets A and B is the set that contains the elements that are either in A or in B,
or in both.
denoted by A ∪ B
A ∪ B = { x x ∈ A or x ∈ B }
Intersection
The set containing elements that in both A and B
A∩B
Disjoint sets
Two sets are disjoint if their intersection is the empty set (i.e. they have no elements in
common)
Set difference
The difference of A and B, A – B, is the set containing elements in A but not in B.
Note that A – B ≠ B – A
Note that A ∩ B = A – B
Complement
The complement of A is A . A = U – A is the set of elements in U but not in A.
Cartesian Product
The Cartesian product of two sets, A and B, consists of all the ordered pairs that can be
constructed with the first element coming from the first set, A, and the second element
coming from the second set, B.
Example: if A={a,b,c} and B={1,2,3} Then Cartesian product of A and B denoted by AXB
will be
AXB={(a,1),(a,2),(a,3),(b,1),(b,2),(b,3),(c,1),(c,2),(c,3)}
And BXA=={(1,a),(2,a),(3,a),(1,b),(2,b),(3,b),(1,c),(2,c),(3,c)}
Note that AXB≠BXA
Relations
A relation defines the relationship between two different sets. If two sets are considered, the
relation between them will be established if there is a connection between the elements of
two or more non-empty sets.
In the morning assembly at schools, students are supposed to stand in a queue in ascending
order of the heights of all the students. This defines an ordered relation between the students
and their heights.
Therefore, we can say,
‘A set of ordered pairs is defined as a relation.’
This mapping depicts a relation from set A into set B. A relation from A to B is a subset of A
x B. The ordered pairs are (1,c),(2,n),(5,a),(7,n). For defining a relation, we use the notation
where,
set {1, 2, 5, 7} represents the domain.
set {a, c, n} represents the range.
Relations on a Set
Relations from a set A to itself are of special interest.
A relation on the set A is a relation from A to A. In other words a relation on a set A is a
subset of A x A.
Example: Let A be the set {1,2,3,4}. Which ordered pairs are in the relation R={(a,b)|a
divides b}?
Solution: Because (a,b) is in R if and only a and b are positive integer not exceeding 4 such
that a divides b, we see that
R={(1,1),(1,2),(1,3),(1,4),(2,2),(2,4),(3,3),(4,4)}
[ ]
0 0
M R= 1 0
1 1
Properties of Relations
A relation R on a set A is called reflexive if (a,a) ∊ R for every element a ∊ A
Example: The following relations on the integers are reflexive:
R1 = {(a,b) | a ≤ b},
R3 = {(a,b) | a = b or a = −b},
R4 = {(a,b) | a = b}.
The following relations are not reflexive:
R2 = {(a,b) | a > b} (note that 3 ≯ 3),
R5 = {(a,b) | a = b + 1} (note that 3 ≠3 + 1),
R6 = {(a,b) | a + b ≤ 3} (note that 4 + 4 ≰ 3)
A relation R is symmetric if and only if (b,a) ∊ R whenever (a,b) ∊ R for all a,b ∊ A.
Written symbolically, R is symmetric if and only if
∀a∀b [(a,b) ∊R ⟶ (b,a) ∊ R]
Example: The following relations on the integers are symmetric:
R3 = {(a,b) | a = b or a = −b},
R4 = {(a,b) | a = b},
R6 = {(a,b) | a + b ≤ 3}.
The following are not symmetric:
R1 = {(a,b) | a ≤ b} (note that 3 ≤ 4, but 4 ≰ 3),
R2 = {(a,b) | a > b} (note that 4 > 3, but 3 ≯ 4),
R5 = {(a,b) | a = b + 1} (note that 4 = 3 + 1, but 3 ≠4 + 1).
A relation R on a set A is called transitive if whenever (a,b) ∊ R and (b,c) ∊ R then (a,c) ∊ R,
∀ a, b, c ∊ A.
Example: The following relations on the integers are transitive:
R1 = {(a,b) | a ≤ b},
R2 = {(a,b) | a > b}
R3 = {(a,b) | a = b or a = −b},
R4 = {(a,b) | a = b}.
Example: Let R be the relation on the set of real numbers such that (a,b) ∊ R if and only if a-b
is an integer. Prove R is an equivalence relation.
Solution: As a-a=0 is an integer for all real numbers a, (a,a) ∊ R for all real numbers a. Hence,
R is reflexive. Now, suppose that (a,b) ∊ R. Then a-b is an integer, so b-a is also an integer.
Hence, (b,a) ∊ R. It follows that R is symmetric. If (a,b) ∊ R and (b,c) ∊ R then a-b and b-c are
integers. Therefore, a-c = (a-b)+(b-c) is also an integer. Hence (a,c) ∊ R. Thus, R is
transitive. Consequently R is an equivalence relation.
Problem: Suppose that R is the relation on the set of strings of English letters such that (a,b) ∊
R if and only if l(a) = l(b), where l(x) is the length of the string x. Show that R is an
equivalence relation.
Problem: Show that “divides” relation is on the set of positive integers is not an equivalence
relation.
Problem: Let R be the relation on the set of real numbers such that (a,b) ∊ R if and only if a
and b are real numbers that differ by less than 1, that is |a-b|<1. Show that R is not an
equivalence relation.
Functions:
Let A and B be two nonempty sets. A function f from A to B is an assignment of exactly one
element of B to each element of A. We write f(a) = b if b is an unique element of B assigned
by the function f to the element a of A. if f is a function from A to B, we write f: A → B.
A function f: A → B can also be defined in terms of a relation from A to B. A relation from
A to B that contains one, and only one, ordered pair (a,b) for every element a ∊ A, defines a
function f from A to B. This function is defined by the assignment f(a) = b, where (a,b) is the
unique ordered pair in the relation that has a as its first element.
If f is a function from A to B, we say that A is the domain of f and B is the codomain of f. if
f(a) = b, we say that b is the image of a and a is a preimage of b. The range of f is the set of
all images of elements of A. Also, if f is a function from A to B, we say that f maps A to B.
a 1
b 2
c 3
d 4
5
A Onto Function
a 1
b 2
c 3
d 4
A One-to-One and onto Function
Inverse Function: An inverse function or an anti function is defined as a function, which can
reverse into another function. In simple words, if any function “f” takes x to y then, the
inverse of “f” will take y to x. If the function is denoted by ‘f’ or ‘F’, then the inverse
function is denoted by f-1 or F-1.
If f and g are inverse functions, then f(x) = y if and only if g(y) = x
If you consider functions, f and g are inverse, f(g(x)) = g(f(x)) = x. A function that consists of
its inverse fetches the original value.
Example: f(x) = 2x + 5 = y
Then, g(y) = (y-5)/2 = x is the inverse of f(x).
Compositions of Functions
Consider functions, f: A → B and g: B → C. The composition of f with g is a function from
A into C defined by (gof) (x) = g [f(x)] and is defined by gof.
To find the composition of f and g, first find the image of x under f and then find the
image of f (x) under g.
Example:
Let X = {1, 2, 3}
Y = {a, b}
Z = {5, 6, 7}.
Consider the function f = {(1, a), (2, a), (3, b)} and g = {(a, 5), (b, 7)} as in figure. Find the
composition of gof.
Solution: The composition function gof is shown in fig:
How to Do It
Step 1 − Consider an initial value for which the statement is true. It is to be shown that the
statement is true for n = initial value.
Step 2 − Assume the statement is true for any value of n = k. Then prove the statement is true
for n = k+1. We actually break n = k+1 into two parts, one part is n = k (which is already
proved) and try to prove the other part.
Problem 1
3n−1 is a multiple of 2 for n = 1, 2, ...
Solution
Step 1 − For n=1,31−1=3−1=2 which is a multiple of 2
Step 2 − Let us assume 3n−1is true for n=k, Hence, 3k−1 is true (It is an assumption)
We have to prove that 3k+1−1 is also a multiple of 2
3k+1−1=3×3k−1=(2×3k)+(3k−1)
The first part (2×3k) is certain to be a multiple of 2 and the second part (3k−1) is also true as
our previous assumption.
Hence, 3k+1–1 is a multiple of 2.
So, it is proved that 3n–1 is a multiple of 2.
Problem 2
1+3+5+...+(2n−1)=n2 for n=1,2,….
Solution
Step 1 − For n=1,1=12, Hence, step 1 is satisfied.
Step 2 − Let us assume the statement is true for n=k.
Hence, 1+3+5+⋯+(2k−1)=k2 is true (It is an assumption)
We have to prove that 1+3+5+...+(2(k+1)−1)=(k+1)2 also holds
1+3+5+⋯+(2(k+1)−1)
=1+3+5+⋯+(2k+2−1)
=1+3+5+⋯+(2k+1)
=1+3+5+⋯+(2k−1)+(2k+1)
=k2+(2k+1)
=(k+1)2
So, 1+3+5+⋯+(2(k+1)−1)=(k+1)2 hold which satisfies the step 2.
Hence, 1+3+5+⋯+(2n−1)=n2 is proved.
Assignment Questions
1. What are set, cardinality, subset, and power set?
2. State and prove De Morgan’s law.
3. Let A = R – {3}, B = R – {1}. Let be defined by
Show that f is bijective.