Discrete Mathematics - Quick Guide
Discrete Mathematics - Quick Guide
Discrete Mathematics − It involves distinct values; i.e. between any two points,
there are a countable number of points. For example, if we have a finite set of
objects, the function can be defined as a list of ordered pairs having these objects,
and can be presented as a complete list of those pairs.
Mathematical Logic
Group theory
Counting Theory
Probability
Graph Theory
Trees
Boolean Algebra
We will discuss each of these concepts in the subsequent chapters of this tutorial.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 1/52
Page 2 of 52
Set theory forms the basis of several other fields of study like counting theory, relations,
graph theory and finite state machines. In this chapter, we will cover the different aspects
of Set Theory.
Set - Definition
A set is an unordered collection of different elements. A set can be written explicitly by
listing its elements using set bracket. If the order of the elements is changed or any
element of a set is repeated, it does not make any changes in the set.
Explore our latest online courses and learn new skills at your own pace. Enroll and
become a certified expert to boost your career.
Representation of a Set
Sets can be represented in two ways −
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 2/52
Page 3 of 52
Cardinality of a Set
Cardinality of a set S, denoted by |S |, is the number of elements of the set. The number is
also referred as the cardinal number. If a set has an infinite number of elements, its
cardinality is ∞.
|X| = |Y | denotes two sets X and Y having same cardinality. It occurs when the
number of elements in X is exactly equal to the number of elements in Y. In this
case, there exists a bijective function ‘f’ from X to Y.
|X| ≤ |Y | denotes that set X’s cardinality is less than or equal to set Y’s cardinality.
It occurs when number of elements in X is less than or equal to that of Y. Here,
there exists an injective function ‘f’ from X to Y.
|X| < |Y | denotes that set X’s cardinality is less than set Y’s cardinality. It occurs
when number of elements in X is less than that of Y. Here, the function ‘f’ from X to
Y is injective function but not bijective.
I f |X| ≤ |Y | and |X| ≥ |Y | then |X| = |Y | . The sets X and Y are commonly
referred as equivalent sets.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 3/52
Page 4 of 52
Types of Sets
Sets can be classified into many types. Some of which are finite, infinite, subset, universal,
proper, singleton set, etc.
Finite Set
A set which contains a definite number of elements is called a finite set.
Infinite Set
A set which contains infinite number of elements is called an infinite set.
Subset
A set X is a subset of set Y (Written as X ⊆ Y ) if every element of X is an element of set
Y.
Example 1 − Let, X = {1, 2, 3, 4, 5, 6} and Y = {1, 2}. Here set Y is a subset of set
X as all the elements of set Y is in set X. Hence, we can write Y ⊆ X.
Proper Subset
The term “proper subset” can be defined as “subset of but not equal to”. A Set X is a
proper subset of set Y (Written as X ⊂ Y ) if every element of X is an element of set Y and
|X| < |Y | .
Example − Let, X = {1, 2, 3, 4, 5, 6} and Y = {1, 2}. Here set Y ⊂ X since all
elements in Y are contained in X too and X has at least one element is more than
set Y .
Universal Set
It is a collection of all elements in a particular context or application. All the sets in that
context or application are essentially subsets of this universal set. Universal sets are
represented as U .
Example − We may define U as the set of all animals on earth. In this case, set of all
mammals is a subset of U , set of all fishes is a subset of U , set of all insects is a
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 4/52
Page 5 of 52
Equal Set
If two sets contain the same elements they are said to be equal.
Example − If A = {1, 2, 6} and B = {6, 1, 2}, they are equal as every element of
set A is an element of set B and every element of set B is an element of set A.
Equivalent Set
If the cardinalities of two sets are same, they are called equivalent sets.
Example − If A = {1, 2, 6} and B = {16, 17, 22}, they are equivalent as cardinality
of A is equal to the cardinality of B. i.e. |A| = |B| = 3
Overlapping Set
Two sets that have at least one common element are called overlapping sets.
Example − Let, A = {1, 2, 6} and B = {6, 12, 42} . There is a common element ‘6’,
hence these sets are overlapping sets.
Disjoint Set
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 5/52
Page 6 of 52
Two sets A and B are called disjoint sets if they do not have even one element in common.
Therefore, disjoint sets have the following properties −
n(A ∩ B) = ∅
Example − Let, A = {1, 2, 6} and B = {7, 9, 14}, there is not a single common element,
hence these sets are overlapping sets.
Venn Diagrams
Venn diagram, invented in 1880 by John Venn, is a schematic diagram that shows all
possible logical relations between different mathematical sets.
Examples
Set Operations
Set Operations include Set Union, Set Intersection, Set Difference, Complement of Set,
and Cartesian Product.
Set Union
The union of sets A and B (denoted by A ∪ B) is the set of elements which are in A, in B,
or in both A and B. Hence, A ∪ B = {x | x ∈ A OR x ∈ B} .
Example − If A = {10, 11, 12, 13} and B = {13, 14, 15}, then
A ∪ B = {10, 11, 12, 13, 14, 15} . (The common element occurs only once)
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 6/52
Page 7 of 52
Set Intersection
The intersection of sets A and B (denoted by A ∩ B) is the set of elements which are in
both A and B. Hence, A ∩ B = {x | x ∈ A AN D x ∈ B}.
Example − If A = {11, 12, 13} and B = {13, 14, 15}, then A ∩ B = {13}.
Example − If A = {10, 11, 12, 13} and B = {13, 14, 15}, then (A − B) = {10, 11, 12}
Complement of a Set
The complement of a set A (denoted by A
′
) is the set of elements which are not in set A.
Hence, A′ = {x|x ∉ A}.
More specifically, A
′
= (U − A) where U is a universal set which contains all objects.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 7/52
Page 8 of 52
The Cartesian product of A and B is written as − A × B = {(a, 1), (a, 2), (b, 1), (b, 2)}
The Cartesian product of B and A is written as − B × A = {(1, a), (1, b), (2, a), (2, b)}
Power Set
Power set of a set S is the set of all subsets of S including the empty set. The cardinality of
a power set of a set S of cardinality n is 2n . Power set is denoted as P (S ) .
Example −
Subsets with 2 elements − {a, b}, {a, c}, {a, d}, {b, c}, {b, d}, {c, d}
Subsets with 3 elements − {a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}
Hence, P (S ) =
{ {∅}, {a}, {b}, {c}, {d}, {a, b}, {a, c}, {a, d}, {b, c}, {b, d}, {c, d}, {a, b, c},
4
|P (S )| = 2 = 16
0
|P ({∅})| = 2 = 1
Partitioning of a Set
Partition of a set, say S, is a collection of n disjoint subsets, say P1 , P2 , … Pn that
satisfies the following three conditions −
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 8/52
Page 9 of 52
The union of the subsets must equal the entire original set.
[P1 ∪ P2 ∪ ⋯ ∪ Pn = S ]
Example
Let S = {a, b, c, d, e, f , g, h}
Bell Numbers
Bell numbers give the count of the number of ways to partition a set. They are denoted by
Bn where n is the cardinality of the set.
Example −
Let S = {1, 2, 3} , n = |S | = 3
1. ∅, {1, 2, 3}
2. {1}, {2, 3}
Hence B3 = 5
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 9/52
Page 10 of 52
For two distinct sets, A and B, having cardinalities m and n respectively, the maximum
cardinality of a relation R from A to B is mn.
Examples
Let, A = {1, 2, 9} and B = {1, 3, 7}
Case 2 − If relation R is 'less than' then R = {(1, 3), (1, 7), (2, 3), (2, 7)}
Case 3 − If relation R is 'greater than' then R = {(2, 1), (9, 1), (9, 3), (9, 7)}
The number of vertices in the graph is equal to the number of elements in the set from
which the relation has been defined. For each ordered pair (x, y) in the relation R, there
will be a directed edge from the vertex ‘x’ to vertex ‘y’. If there is an ordered pair (x, x),
there will be self- loop on vertex ‘x’.
Suppose, there is a relation R = {(1, 1), (1, 2), (3, 2)} on set S = {1, 2, 3} , it can be
represented by the following graph −
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 10/52
Page 11 of 52
Types of Relations
Example − The relation R = {(1, 2), (2, 1), (3, 2), (2, 3)} on set A = {1, 2, 3} is
symmetric.
and y ≤ x implies x = y.
Example − The relation R = {(1, 2), (2, 3), (1, 3)} on set A = {1, 2, 3} is
transitive.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 11/52
Page 12 of 52
Function - Definition
A function or mapping (Defined as f : X → Y ) is a relationship from elements of one set
X to elements of another set Y (X and Y are non-empty sets). X is called Domain and Y is
called Codomain of function ‘f’.
Function ‘f’ is a relation on X and Y such that for each x ∈ X, there exists a unique y ∈ Y
such that (x, y) ∈ R. ‘x’ is called pre-image and ‘y’ is called image of function f.
A function can be one to one or many to one but not one to many.
Example
f : N → N , f (x) = 5x is injective.
f : N → N , f (x) = x
2
is injective.
f : R → R, f (x) = x
2
is not injective as (−x)
2
= x
2
Example
f : N → N , f (x) = x + 2 is surjective.
f : R → R, f (x) = x
2
is not surjective since we cannot find a real number whose
square is negative.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 12/52
Page 13 of 52
Problem
Prove that a function f : R → R defined by f (x) = 2x– 3 is a bijective function.
Hence, f is injective.
Here, 2x– 3 = y
Hence, f is surjective.
Inverse of a Function
The inverse of a one-to-one corresponding function f : A → B, is the function
g : B → A, holding the following property −
f (x) = y ⇔ g(y) = x
Example
A Function f : Z → Z , f (x) = x
2
is not invertiable since this is not one-to-one as
(−x)
2
= x
2
.
Composition of Functions
Two functions f : A → B and g : B → C can be composed to give a composition gof .
Example
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 13/52
Page 14 of 52
Solution
(f og)(x) = f (g(x)) = f (2x + 1) = 2x + 1 + 2 = 2x + 3
Composition always holds associative property but does not hold commutative
property.
Propositional Logic is concerned with statements to which the truth values, “true” and
“false”, can be assigned. The purpose is to analyze these statements either individually or
in a composite manner.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 14/52
Page 15 of 52
"A is less than 2". It is because unless we give a specific value of A, we cannot say
whether the statement is true or false.
Connectives
In propositional logic generally we use five connectives which are −
OR (∨ )
AND (∧ )
Negation/ NOT (¬ )
A B A∨ B
A B A∧ B
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 15/52
Page 16 of 52
A ¬A
True False
False True
A B A→B
If and only if (⇔) − A ⇔ B is bi-conditional logical connective which is true when p and
q are same, i.e. both are false or both are true.
A B A⇔ B
Tautologies
A Tautology is a formula which is always true for every value of its propositional variables.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 16/52
Page 17 of 52
A B A→B (A → B) ∧ A [( A → B ) ∧ A] → B
Contradictions
A Contradiction is a formula which is always false for every value of its propositional
variables.
A B A∨ B ¬A ¬B (¬ A) ∧ ( ¬ B) (A ∨ B) ∧ [( ¬ A) ∧ (¬ B)]
Contingency
A Contingency is a formula which has both some true and some false values for every
value of its propositional variables.
A B A∨ B ¬A (A ∨ B) ∧ (¬ A)
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 17/52
Page 18 of 52
As we can see every value of (A ∨ B) ∧ (¬A) has both “True” and “False”, it is a
contingency.
Propositional Equivalences
Two statements X and Y are logically equivalent if any of the following two conditions hold
−
The truth tables of each statement have the same truth values.
A B A∨ B ¬ (A ∨ B) ¬A ¬B [(¬ A) ∧ (¬ B)]
Here, we can see the truth values of ¬(A ∨ B)and[(¬A) ∧ (¬B)] are same, hence the
statements are equivalent.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 18/52
Page 19 of 52
Hypothesis, p
Conclusion, q
Example of Conditional Statement − “If you do your homework, you will not be
punished.” Here, "you do your homework" is the hypothesis, p, and "you will not be
punished" is the conclusion, q.
Inverse − An inverse of the conditional statement is the negation of both the hypothesis
and the conclusion. If the statement is “If p, then q”, the inverse will be “If not p, then not
q”. Thus the inverse of p → q is ¬p → ¬q.
Example − The inverse of “If you do your homework, you will not be punished” is “If you
do not do your homework, you will be punished.”
Example − The converse of "If you do your homework, you will not be punished" is "If
you will not be punished, you do your homework”.
Example − The Contra-positive of " If you do your homework, you will not be punished” is
"If you are punished, you did not do your homework”.
Duality Principle
Duality principle states that for any true statement, the dual statement obtained by
interchanging unions into intersections (and vice versa) and interchanging Universal set
into Null set (and vice versa) is also true. If dual of any statement is the statement itself,
it is said self-dual statement.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 19/52
Page 20 of 52
Normal Forms
We can convert any proposition in two normal forms −
Examples
(A ∨ B) ∧ (A ∨ C ) ∧ (B ∨ C ∨ D)
(P ∪ Q) ∩ (Q ∪ R)
Examples
(A ∧ B) ∨ (A ∧ C ) ∨ (B ∧ C ∧ D)
(P ∩ Q) ∪ (Q ∩ R)
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 20/52
Page 21 of 52
Quantifiers
The variable of predicates is quantified by quantifiers. There are two types of quantifier in
predicate logic − Universal Quantifier and Existential Quantifier.
Universal Quantifier
Universal quantifier states that the statements within its scope are true for every value of
the specific variable. It is denoted by the symbol ∀.
Example − "Man is mortal" can be transformed into the propositional form ∀xP (x) where
P(x) is the predicate which denotes x is mortal and the universe of discourse is all men.
Existential Quantifier
Existential quantifier states that the statements within its scope are true for some values
of the specific variable. It is denoted by the symbol ∃.
Example − "Some people are dishonest" can be transformed into the propositional form
∃xP (x) where P(x) is the predicate which denotes x is dishonest and the universe of
discourse is some people.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 21/52
Page 22 of 52
Nested Quantifiers
If we use a quantifier that appears within the scope of another quantifier, it is called
nested quantifier.
Example
An argument is a sequence of statements. The last statement is the conclusion and all its
preceding statements are called premises (or hypothesis). The symbol “∴ ”, (read
therefore) is placed before the conclusion. A valid argument is one where the conclusion
follows from the truth values of the premises.
Rules of Inference provide the templates or guidelines for constructing valid arguments
from the statements that we already have.
P ∨ Q
P
Addition ¬P Disjunctive Syllogism
∴ P ∨ Q
∴ Q
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 22/52
Page 23 of 52
P P → Q
(P → Q) ∧ (R → S )
P ∧ Q
Simplification P ∨ R Constructive Dilemma
∴ P
∴ Q ∨ S
P → Q (P → Q) ∧ (R → S )
P → Q
¬Q Modus Tollens
∴ ¬P
Addition
If P is a premise, we can use Addition rule to derive P ∨ Q.
∴ P ∨ Q
Example
Let P be the proposition, “He studies very hard” is true
Therefore − "Either he studies very hard Or he is a very bad student." Here Q is the
proposition “he is a very bad student”.
Conjunction
If P and Q are two premises, we can use Conjunction rule to derive P ∧ Q.
∴ P ∧ Q
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 23/52
Page 24 of 52
Example
Let P − “He studies very hard”
Therefore − "He studies very hard and he is the best boy in the class"
Simplification
If P ∧ Q is a premise, we can use Simplification rule to derive P.
P ∧ Q
∴ P
Example
"He studies very hard and he is the best boy in the class", P ∧ Q
Modus Ponens
If P and P → Q are two premises, we can use Modus Ponens to derive Q.
P → Q
∴ Q
Example
"If you have a password, then you can log on to facebook", P → Q
Modus Tollens
If P → Q and ¬Q are two premises, we can use Modus Tollens to derive ¬P .
P → Q
¬Q
∴ ¬P
Example
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 24/52
Page 25 of 52
Disjunctive Syllogism
If ¬P and P ∨ Q are two premises, we can use Disjunctive Syllogism to derive Q.
¬P
P ∨ Q
∴ Q
Example
"The ice cream is not vanilla flavored", ¬P
Hypothetical Syllogism
If P → Q and Q → R are two premises, we can use Hypothetical Syllogism to derive
P → R
P → Q
Q → R
∴ P → R
Example
"If it rains, I shall not go to school”, P → Q
Constructive Dilemma
If (P → Q) ∧ (R → S ) and P ∨ R are two premises, we can use constructive dilemma to
derive Q ∨ S.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 25/52
Page 26 of 52
(P → Q) ∧ (R → S )
P ∨ R
∴ Q ∨ S
Example
“If it rains, I will take a leave”, (P → Q)
Destructive Dilemma
If (P → Q) ∧ (R → S ) and ¬Q ∨ ¬S are two premises, we can use destructive dilemma
to derive ¬P ∨ ¬R.
(P → Q) ∧ (R → S )
¬Q ∨ ¬S
∴ ¬P ∨ ¬R
Example
“If it rains, I will take a leave”, (P → Q)
In 1854, Arthur Cayley, the British Mathematician, gave the modern definition of group for
the first time −
“A set of symbols all of them different, and such that the product of any two of
them (no matter in what order), or the product of any one of them into itself,
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 26/52
Page 27 of 52
belongs to the set, is said to be a group. These symbols are not in general
convertible [commutative], but are associative.”
In this chapter, we will know about operators and postulates that form the basics of set
theory, group theory and Boolean algebra.
Any set of elements in a mathematical system may be defined with a set of operators and
a number of postulates.
A binary operator defined on a set of elements is a rule that assigns to each pair of
elements a unique element from that set. For example, given the set A = {1, 2, 3, 4, 5},
we can say ⊗ is a binary operator for the operation c = a ⊗ b, if it specifies a rule for
finding c for the pair of (a, b), such that a, b, c ∈ A .
The postulates of a mathematical system form the basic assumptions from which rules
can be deduced. The postulates are −
Closure
A set is closed with respect to a binary operator if for every pair of elements in the set, the
operator finds a unique element from that set.
Example
Let A = {0, 1, 2, 3, 4, 5, …}
This set is closed under binary operator into (∗) , because for the operation c = a ∗ b, for
any a, b ∈ A, the product c ∈ A.
The set is not closed under binary operator divide (÷), because, for the operation
c = a ÷ b , for any a, b ∈ A, the product c may not be in the set A. If a = 7, b = 2 , then
Associative Laws
A binary operator ⊗ on a set A is associative when it holds the following property −
(x ⊗ y) ⊗ z = x ⊗ (y ⊗ z), where x, y, z ∈ A
Example
Let A = {1, 2, 3, 4}
The operator plus (+) is associative because for any three elements, x, y, z ∈ A, the
property (x + y) + z = x + (y + z) holds.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 27/52
Page 28 of 52
(x − y) − z ≠ x − (y − z)
Commutative Laws
A binary operator ⊗ on a set A is commutative when it holds the following property −
x ⊗ y = y ⊗ x, where x, y ∈ A
Example
Let A = {1, 2, 3, 4}
The operator plus (+) is commutative because for any two elements, x, y ∈ A, the
property x + y = y + x holds.
x − y ≠ y − x
Distributive Laws
Two binary operators ⊗ and ⊛ on a set A, are distributive over operator ⊛ when the
following property holds −
x ⊗ (y ⊛ z) = (x ⊗ y) ⊛ (x ⊗ z) , where x, y, z ∈ A
Example
Let A = {1, 2, 3, 4}
The operators into (∗) and plus (+) are distributive over operator + because for any three
elements, x, y, z ∈ A, the property x ∗ (y + z) = (x ∗ y) + (x ∗ z) holds.
x + (y ∗ z) ≠ (x + y) ∗ (x + z)
Identity Element
A set A has an identity element with respect to a binary operation ⊗ on A, if there exists
an element e ∈ A, such that the following property holds −
e ⊗ x = x ⊗ e, where x ∈ A
Example
Let Z = {0, 1, 2, 3, 4, 5, …}
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 28/52
Page 29 of 52
The element 1 is an identity element with respect to operation ∗ since for any element
x ∈ Z,
1 ∗ x = x ∗ 1
On the other hand, there is no identity element for the operation minus (−)
Inverse
If a set A has an identity element e with respect to a binary operator ⊗, it is said to have
an inverse whenever for every element x ∈ A, there exists another element y ∈ A, such
that the following property holds −
x ⊗ y = e
Example
Let A = {⋯ − 4, −3, −2, −1, 0, 1, 2, 3, 4, 5, …}
Given the operation plus (+) and e = 0, the inverse of any element x is (−x) since
x + (x) = 0
De Morgan's Law
De Morgan’s Laws gives a pair of transformations between union and intersection of two
(or more) sets in terms of their complements. The laws are −
′ ′ ′
(A ∪ B) = A ∩ B
′ ′ ′
(A ∩ B) = A ∪ B
Example
Let A = {1, 2, 3, 4}, B = {1, 3, 5, 7} , and
′
A = {5, 6, 7, 8, 9, 10}
′
B = {2, 4, 6, 8, 9, 10}
A ∪ B = {1, 2, 3, 4, 5, 7}
A ∩ B = {1, 3}
′
(A ∪ B) = {6, 8, 9, 10}
′ ′
A ∩ B = {6, 8, 9, 10}
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 29/52
Page 30 of 52
′
(A ∩ B) = {2, 4, 5, 6, 7, 8, 9, 10}
′ ′
A ∪ B = {2, 4, 5, 6, 7, 8, 9, 10}
Closure − For every pair (a, b) ∈ S , (aοb) has to be present in the set S.
Example
The set of positive integers (excluding zero) with addition operation is a semigroup. For
example, S = {1, 2, 3, …}
Here closure property holds as for every pair (a, b) ∈ S , (a + b) is present in the set S.
For example, 1 + 2 = 3 ∈ S]
For example, (1 + 2) + 3 = 1 + (2 + 3) = 5
Monoid
A monoid is a semigroup with an identity element. The identity element (denoted by e or
E) of a set S is an element such that (aοe) = a, for every element a ∈ S . An identity
element is also called a unit element. So, a monoid holds three properties simultaneously
− Closure, Associative, Identity element.
Example
The set of positive integers (excluding zero) with multiplication operation is a monoid.
S = {1, 2, 3, …}
Here closure property holds as for every pair (a, b) ∈ S , (a × b) is present in the set S.
[For example, 1 × 2 = 2 ∈ S and so on]
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 30/52
Page 31 of 52
Group
A group is a monoid with an inverse element. The inverse element (denoted by I) of a set
S is an element such that (aοI ) = (I οa) = a, for each element a ∈ S . So, a group holds
four properties simultaneously - i) Closure, ii) Associative, iii) Identity element, iv) Inverse
element. The order of a group G is the number of elements in G and the order of an
element in a group is the least positive integer n such that an is the identity element of
that group G.
Examples
The set of N × N non-singular matrices form a group under matrix multiplication
operation.
The set of N × N non-singular matrices contains the identity matrix holding the identity
element property.
As all the matrices are non-singular they all have inverse elements which are also
nonsingular matrices. Hence, inverse property also holds.
Abelian Group
An abelian group G is a group for which the element pair (a, b) ∈ G always holds
commutative law. So, a group holds five properties simultaneously - i) Closure, ii)
Associative, iii) Identity element, iv) Inverse element, v) Commutative.
Example
The set of positive integers (including zero) with addition operation is an abelian group.
G = {0, 1, 2, 3, …}
Here closure property holds as for every pair (a, b) ∈ S , (a + b) is present in the set S.
[For example, 1 + 2 = 2 ∈ S and so on]
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 31/52
Page 32 of 52
Example
The set of complex numbers {1, −1, i, −i} under multiplication operation is a cyclic group.
(– i)
1
= −i, (– i)
2
= −1, (– i)
3
= i, (– i)
4
= 1 which covers all the elements of the group.
Hence, it is a cyclic group.
Note − A cyclic group is always an abelian group but not every abelian group is a cyclic
group. The rational numbers under addition is not cyclic but is abelian.
A subgroup H of a group G that does not include the whole group G is called a proper
subgroup (Denoted by H < G). A subgroup of a cyclic group is cyclic and a abelian
subgroup is also abelian.
Example
Let a group G = {1, i, −1, −i}
Examples
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 32/52
Page 33 of 52
The set of real numbers under binary operation less than or equal to (≤) is a
poset.
Let the set S = {1, 2, 3} and the operation is ≤
The relations will be {(1, 1), (2, 2), (3, 3), (1, 2), (1, 3), (2, 3)}
This relation R is also transitive as {(1, 2), (2, 3), (1, 3)} ∈ R.
Hence, it is a poset.
The vertex set of a directed acyclic graph under the operation ‘reachability’ is a
poset.
Hasse Diagram
The Hasse diagram of a poset is the directed graph whose vertices are the element of that
poset and the arcs covers the pairs (x, y) in the poset. If in the poset x < y, then the
point x appears lower than the point y in the Hasse diagram. If x < y < z in the poset,
then the arrow is not shown between x and z as it is implicit.
Example
The poset of subsets of {1, 2, 3} = {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}} is
shown by the following Hasse diagram −
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 33/52
Page 34 of 52
defined as a distributive lattice having the property {a ∨ b, a ∧ b} = {a, b} for all values of
a and b in set S.
Example
The powerset of {a, b} ordered by \subseteq is a totally ordered set as all the elements of
the power set P = {∅, {a}, {b}, {a, b}} are comparable.
Here, for all (x, y) ∈ S , x|y have to hold but it is not true that 2 | 3, as 2 does not divide 3
or 3 does not divide 2. Hence, it is not a total ordered set.
Lattice
A lattice is a poset (L, ≤) for which every pair {a, b} ∈ L has a least upper bound
(denoted by a ∨ b) and a greatest lower bound (denoted by a ∧ b). LUB ({a, b}) is called
the join of a and b. GLB ({a, b}) is called the meet of a and b.
Example
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 34/52
Page 35 of 52
This above figure is a lattice because for every pair {a, b} ∈ L, a GLB and a LUB exists.
This above figure is a not a lattice because GLB(a, b) and LU B(e, f ) does not exist.
Bounded Lattice
A lattice L becomes a bounded lattice if it has a greatest element 1 and a least element 0.
Complemented Lattice
A lattice L becomes a complemented lattice if it is a bounded lattice and if every element
in the lattice has a complement. An element x has a complement x’ if
′ ′
∃x(x ∧ x = 0andx ∨ x = 1)
Distributive Lattice
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 35/52
Page 36 of 52
If a lattice satisfies the following two distribute properties, it is called a distributive lattice.
a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)
a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)
Modular Lattice
If a lattice satisfies the following property, it is called modular lattice.
a ∧ (b ∨ (a ∧ d)) = (a ∧ b) ∨ (a ∧ d)
Properties of Lattices
Idempotent Properties
a ∨ a = a
a ∧ a = a
Absorption Properties
a ∨ (a ∧ b) = a
a ∧ (a ∨ b) = a
Commutative Properties
a ∨ b = b ∨ a
a ∧ b = b ∧ a
Associative Properties
a ∨ (b ∨ c) = (a ∨ b) ∨ c
a ∧ (b ∧ c) = (a ∧ b) ∧ c
Dual of a Lattice
The dual of a lattice is obtained by interchanging the '∨ ' and '∧ ' operations.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 36/52
Page 37 of 52
Example
The dual of [a ∨ (b ∧ c)] is [a ∧ (b ∨ c)]
Example
Question − A boy lives at X and wants to go to School at Z. From his home X he has to
first reach Y and then Y to Z. He may go X to Y by either 3 bus routes or 2 train routes.
From there, he can either choose 4 bus routes or 5 train routes to reach Z. How many
ways are there to go from X to Z?
Permutations
A permutation is an arrangement of some elements in which order matters. In other
words a Permutation is an ordered Combination of elements.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 37/52
Page 38 of 52
Examples
Number of Permutations
The number of permutations of ‘n’ different things taken ‘r’ at a time is denoted by nP
r
n!
nP =
r
(n − r)!
There are n number of ways to fill up the first place. After filling the first place (n-1)
number of elements is left. Hence, there are (n-1) ways to fill up the second place. After
filling the first and second place, (n-2) number of elements is left. Hence, there are (n-2)
ways to fill up the third place. We can now generalize the number of ways to fill up r-th
place as [n – (r–1)] = n–r+1
So, the total no. of ways to fill up from first place up to r-th-place −
Hence,
nP = n!/(n − r)!
r
If there are n elements of which a1 are alike of some kind, a2 are alike of another
kind; a3 are alike of third kind and so on and ar are of r th kind, where
(a1 + a2 +. . . ar ) = n.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 38/52
Page 39 of 52
Some Problems
Problem 1 − From a bunch of 6 different cards, how many ways we can permute it?
Solution − As we are taking 6 cards at a time from a deck of 6 cards, the permutation
will be 6
P6 = 6! = 720
Problem 2 − In how many ways can the letters of the word 'READER' be arranged?
Solution − There are 6 letters word (2 E, 1 A, 1D and 2R.) in the word 'READER'.
Problem 3 − In how ways can the letters of the word 'ORANGE' be arranged so that the
consonants occupy only the even positions?
Solution − There are 3 vowels and 3 consonants in the word 'ORANGE'. Number of ways
of arranging the consonants among themselves =3 P3 = 3! = 6. The remaining 3 vacant
places will be filled up by 3 vowels in 3 P3 = 3! = 6 ways. Hence, the total number of
permutation is 6 × 6 = 36
Combinations
A combination is selection of some given elements in which order does not matter.
n!
n
Cr =
r!(n − r)!
Problem 1
Solution
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 39/52
Page 40 of 52
The cardinality of the set is 6 and we have to choose 3 elements from the set. Here, the
ordering does not matter. Hence, the number of subsets will be 6
C 3 = 20 .
Problem 2
There are 6 men and 5 women in a room. In how many ways we can choose 3 men and 2
women from the room?
Solution
Problem 3
How many ways can you choose 3 distinct groups of 3 students from total 9 students?
Solution
The number of ways for choosing 3 students for 2nd group after choosing 1st group − 6
C3
The number of ways for choosing 3 students for 3rd group after choosing 1st and 2nd
group − 3 C 3
Pascal's Identity
Pascal's identity, first derived by Blaise Pascal in 17th century, states that the number of
ways to choose k elements from n elements is equal to the summation of number of ways
to choose (k-1) elements from (n-1) elements and the number of ways to choose
elements from n-1 elements.
n −1 n −1
Mathematically, for any positive integers k and n: n
Ck = C k−1 + Ck
Proof −
n− 1 n −1
C k−1 + Ck
(n−1)! (n−1)!
= +
(k−1)!(n−k)! k!(n−k−1)!
k n−k
= (n − 1)!( + )
k!(n−k)! k!(n−k)!
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 40/52
Page 41 of 52
n
= (n − 1)!
k!(n−k)!
n!
=
k!(n−k)!
= nC
k
Pigeonhole Principle
In 1834, German mathematician, Peter Gustav Lejeune Dirichlet, stated a principle which
he called the drawer principle. Now, it is known as the pigeonhole principle.
Pigeonhole Principle states that if there are fewer pigeon holes than total number of
pigeons and each pigeon is put in a pigeon hole, then there must be at least one pigeon
hole with more than one pigeon. If n pigeons are put into m pigeonholes where n > m,
there's a hole with more than one pigeon.
Examples
Ten men are in a room and they are taking part in handshakes. If each person
shakes hands at least once and no man shakes the same man’s hand more than
once then two men took part in the same number of handshakes.
There must be at least two people in a class of 30 whose names start with the
same alphabet.
|A ∪ B| = |A| + |B| − |A ∩ B|
|A ∪ B ∪ C | = |A| + |B| + |C | − |A ∩ B| − |A ∩ C | − |B ∩ C | + |A ∩ B ∩ C |
n \n−1
|⋃ Ai | = ∑ |Ai ∩ Aj | + ∑ |Ai ∩ Aj ∩ Ak | − ⋯ + (−1) |A1 ∩
i=1
1≤i<j<k≤n 1≤i<j<k≤n
⋯ ∩ A2 |
Problem 1
Solution
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 41/52
Page 42 of 52
|A ∪ B| = |A| + |B| − |A ∩ B| = 25 + 16 − 8 = 33
Problem 2
In a group of 50 students 24 like cold drinks and 36 like hot drinks and each student likes
at least one of the two drinks. How many like both coffee and tea?
Solution
Let X be the set of students who like cold drinks and Y be the set of people who like hot
drinks.
So, |X ∪ Y | = 50 , |X| = 24 , |Y | = 36
|X ∩ Y | = |X| + |Y | − |X ∪ Y | = 24 + 36 − 50 = 60 − 50 = 10
Hence, there are 10 students who like both tea and coffee.
Basic Concepts
Probability theory was invented in the 17th century by two French mathematicians, Blaise
Pascal and Pierre de Fermat, who were dealing with mathematical problems regarding of
chance.
Before proceeding to details of probability, let us get the concept of some definitions.
Random Experiment − An experiment in which all possible outcomes are known and the
exact output cannot be predicted in advance is called a random experiment. Tossing a fair
coin is an example of random experiment.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 42/52
Page 43 of 52
Sample Space − When we perform an experiment, then the set S of all possible
outcomes is called the sample space. If we toss a coin, the sample space S = {H , T }
Event − Any subset of a sample space is called an event. After tossing a coin, getting
Head on the top is an event.
The word "probability" means the chance of occurrence of a particular event. The best we
can say is how likely they are to happen, using the idea of probability.
As the occurrence of any event varies between 0% and 100%, the probability varies
between 0 and 1.
Tossing a Coin
If a coin is tossed, there are two possible outcomes − Heads (H ) or Tails (T )
Hence, the probability of getting a Head (H ) on top is 1/2 and the probability of getting a
Tails (T ) on top is 1/2
Throwing a Dice
When a dice is thrown, six possible outcomes can be on the top − 1, 2, 3, 4, 5, 6.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 43/52
Page 44 of 52
Probability Axioms
For an impossible event the probability is 0 and for a certain event the probability
is 1.
If the occurrence of one event is not influenced by another event, they are called
mutually exclusive or disjoint.
If A1 , A2 . . . . An are mutually exclusive/disjoint events, then P (Ai ∩ Aj ) = ∅ for
i ≠ j and P (A1 ∪ A2 ∪. . . . An ) = P (A1 ) + P (A2 )+. . . . . P (An )
Properties of Probability
¯¯
¯
p(x) = 1 − p(x)
For two non-disjoint events A and B, the probability of the union of two events −
P (A ∪ B) = P (A) + P (B)
Conditional Probability
The conditional probability of an event B is the probability that the event will occur given
an event A has already occurred. This is written as P (B|A) .
If event A and B are mutually exclusive, then the conditional probability of event B after
the event A will be the probability of event B that is P (B).
Problem 1
In a country 50% of all teenagers own a cycle and 30% of all teenagers own a bike and
cycle. What is the probability that a teenager owns bike given that the teenager owns a
cycle?
Solution
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 44/52
Page 45 of 52
Let us assume A is the event of teenagers owning only a cycle and B is the event of
teenagers owning only a bike.
So, P (A) = 50/100 = 0.5 and P (A ∩ B) = 30/100 = 0.3 from the given problem.
Hence, the probability that a teenager owns bike given that the teenager owns a cycle is
60%.
Problem 2
In a class, 50% of all students play cricket and 25% of all students play cricket and
volleyball. What is the probability that a student plays volleyball given that the student
plays cricket?
Solution
Let us assume A is the event of students playing only cricket and B is the event of
students playing only volleyball.
So, P (A) = 50/100 = 0.5 and P (A ∩ B) = 25/100 = 0.25 from the given problem.
Hence, the probability that a student plays volleyball given that the student plays cricket is
50%.
Problem 3
Six good laptops and three defective laptops are mixed up. To find the defective laptops all
of them are tested one-by-one at random. What is the probability to find both of the
defective laptops in the first two pick?
Solution
Let A be the event that we find a defective laptop in the first test and B be the event that
we find a defective laptop in the second test.
Bayes' Theorem
Theorem − If A and B are two mutually exclusive events, where P (A) is the probability
of A and P (B) is the probability of B, P (A|B) is the probability of A given that B is true.
P (B|A) is the probability of B given that A is true, then Bayes’ Theorem states −
P (B|A)P (A)
P (A|B) =
n
∑ P (B|Ai)P (Ai)
i=1
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 45/52
Page 46 of 52
In situations where all the events of sample space are mutually exclusive events.
In situations where either P (Ai ∩ B) for each Ai or P (Ai ) and P (B|Ai ) for each
Ai is known.
Problem
Consider three pen-stands. The first pen-stand contains 2 red pens and 3 blue pens; the
second one has 3 red pens and 2 blue pens; and the third one has 4 red pens and 1 blue
pen. There is equal probability of each pen-stand to be selected. If one pen is drawn at
random, what is the probability that it is a red pen?
Solution
Here, i = 1,2,3.
The probability that a red pen is chosen among the five pens of the first pen-stand,
P (B|A1 ) = 2/5
The probability that a red pen is chosen among the five pens of the second pen-stand,
P (B|A2 ) = 3/5
The probability that a red pen is chosen among the five pens of the third pen-stand,
P (B|A3 ) = 4/5
= 3/5
Mathematical Induction
Mathematical induction, is a technique for proving results or establishing statements for
natural numbers. This part illustrates the method through a variety of examples.
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 46/52
Page 47 of 52
Definition
Mathematical Induction is a mathematical technique which is used to prove a
statement, a formula or a theorem is true for every natural number.
Step 1(Base step) − It proves that a statement is true for the initial value.
Step 2(Inductive step) − It proves that if the statement is true for the nth iteration (or
number n), then it is also true for (n+1)th iteration ( or number n+1).
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
3
n
− 1 is a multiple of 2 for n = 1, 2, ...
Solution
Step 1 − For n = 1, 3
1
− 1 = 3 − 1 = 2 which is a multiple of 2
k+1 k k k
3 − 1 = 3 × 3 − 1 = (2 × 3 ) + (3 − 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, 3
k+1
–1 is a multiple of 2.
Problem 2
1 + 3 + 5+. . . +(2n − 1) = n
2
for n = 1, 2, …
Solution
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 47/52
Page 48 of 52
Step 1 − For n = 1, 1 = 1
2
, Hence, step 1 is satisfied.
Hence, 1 + 3 + 5 + ⋯ + (2k − 1) = k
2
is true (It is an assumption)
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)
2
= k + (2k + 1)
2
= (k + 1)
So, 1 + 3 + 5 + ⋯ + (2(k + 1) − 1) = (k + 1)
2
hold which satisfies the step 2.
Hence, 1 + 3 + 5 + ⋯ + (2n − 1) = n
2
is proved.
Problem 3
Prove that (ab)
n
= a b
n n
is true for every natural number n
Solution
Given, (ab)
k
= a b
k k
Or, k
(ab) (ab) = (a b )(ab)
k k
[Multiplying both side by 'ab']
Or, (ab)
k+1
= (aa )(bb )
k k
Or, (ab)
k+1
= (a
k+1
b
k+1
)
So, (ab)
n
= a b
n n
is true for every natural number n.
Strong Induction
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 48/52
Page 49 of 52
Step 1(Base step) − It proves that the initial proposition P (1) true.
Definition
A recurrence relation is an equation that recursively defines a sequence where the next
term is a function of the previous terms (Expressing Fn as some combination of Fi with
i < n).
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 49/52
Page 50 of 52
2
x − Ax − B = 0
then Fn = ax
n
1
+ bnx
n
1
is the solution.
Case 3 − If the equation produces two distinct complex roots, x1 and x2 in polar form
x1 = r∠θ and x2 = r∠(−θ), then Fn = r
n
(acos(nθ) + bsin(nθ)) is the solution.
Problem 1
Solution
2
x − 5x + 6 = 0,
So, (x − 3)(x − 2) = 0
x1 = 3 and x2 = 2
The roots are real and distinct. So, this is in the form of case 1
n n
Fn = ax + bx
1 2
Here, Fn = a3
n
+ b2
n
(As x1 = 3 and x2 = 2)
Therefore,
0 0
1 = F0 = a3 + b2 = a + b
1 1
4 = F1 = a3 + b2 = 3a + 2b
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 50/52
Page 51 of 52
n n n n
Fn = 2.3 + (−1). 2 = 2.3 − 2
Problem 2
Solution
2
x − 10x − 25 = 0
So (x − 5)
2
= 0
n n
Fn = ax + bnx
1 1
0 0
3 = F0 = a.5 + (b)(0.5) = a
1 1
17 = F1 = a.5 + b.1.5 = 5a + 5b
Problem 3
Solution
2
x − 2x − 2 = 0
x1 = 1 + i and x2 = 1 − i
In polar form,
–
and where and
π
x1 = r∠θ x2 = r∠(−θ), r = √2 θ =
4
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 51/52
Page 52 of 52
– n
Fn = (√ 2) (acos(n. ⊓/4) + bsin(n. ⊓/4))
– 0
1 = F0 = (√ 2) (acos(0. ⊓/4) + bsin(0. ⊓/4)) = a
– 1 – – –
3 = F1 = (√ 2) (acos(1. ⊓/4) + bsin(1. ⊓/4)) = √ 2(a/√ 2 + b/√ 2)
First part is the solution (a h ) of the associated homogeneous recurrence relation and the
second part is the particular solution (a t ) .
an = ah + at
Solution to the first part is done using the procedures discussed in the previous section.
If x ≠ x1 and x ≠ x2 , then a t = Ax
n
If x = x1 , x ≠ x2 , then at = Anx
n
If x = x1 = x2 , then a t = An x
2 n
Example
Let a non-homogeneous recurrence relation be Fn = AFn–1 + BFn−2 + f (n) with
characteristic roots x1 = 2 and x2 = 5. Trial solutions for different possible values of f (n)
are as follows −
https://www.tutorialspoint.com/discrete_mathematics/discrete_mathematics_quick_guide.htm 52/52