Lecture Number 2
Lecture Number 2
Mathematical Preliminaries
Topics
• Set Theory
• Combinatorics
• Mathematical Functions
• Summations
• Probability Theory
In a set all members are distinct objects , i. e, duplicate members are not allowed
A B, if x A then x B
The set A is proper subset of B, if A contains only some of the elements of B. Symbolically
the relationship is represented as:
A B
The relationship among sets is usually shown by a picture, which is called Venn diagram.
Figures (a), (b) show Venn diagrams for a subset and proper subset
B
A=B
A
A B
A B
(a) A is proper subset of B (b) A is subset of B
A B
C
A B A U B
Union set
Example (1): A={ 1, 3, 4, 5}, B={ 3, 4, 7, 8, 9}. The Union of sets A and B is the
set { 1, 3, 4, 5, 7,8, 9}.
Example(2): Union operation can be used to add elements to a set. Consider sets {a, b}, {c, d}
(i) Setting S to empty set φ
S=φ
(ii) To insert elements of first set into S, we perform union of S with {a, b}
S =S U {a, b} = {a, b}
(iii) To insert elements of second set {b, c} into S, we perform union of S with {c, d}
S = S U{c, d} = {a, b, c, d}
Mathematical Preliminaries/KICSIT 2020/Fahim Khan/7
Set Operations
Intersection
The intersection of set A and set B is set of all elements x, such that x is in A
and x is in B. Symbolically:
A I
B, if x
A and x B
The intersection operation is pictorially represented by Venn Diagram, as shown below.
A B
A I
Set intersectionB
Two sets are called disjoint, if their intersection is empty set. Thus, if A and B are disjoint,
A I B=φ
Mathematical Preliminaries/KICSIT 2020/Fahim Khan/8
Set Operations
Difference Set
The difference of set A and set B is set of all elements x, such that x is not in B if x is in A.
Symbolically:
B – A , if x
A then x B
The difference operation is illustrated by Venn Diagram, as shown below.
A B B-A
Difference set
(ii) To delete element d we perform difference operation on set S and set {d}.
S = S-{d} = { b, c, e, f }
A U B = {a, b, c, d, e, f, g, h, i, j, k}, A
It follows that | A | + | B | - | A ∩ B | = 6 + 8 – 3 = 11
∩ B = {d, e, f}, | A ∩ B | = 3
Mathematical Preliminaries/KICSIT 2020/Fahim Khan/10
Set Theory
Cartesian Product
The Cartesian product of two sets A and B, denoted by A X B, is a set of all
ordered pairs such that the first element of the pair is in set A and the second element
is in set B. It is also called cross product. Mathematically,
and bB }
A X B = { (a , b) : a A
Example: Let A = {a, b, c} and B = {g, h}, then
A X B = {(a, g), (a, h), (b, g), (b, h), (c, g), (c, h) }
| A X B | = | A | .| B |
R AXB
Since a cross product set can have one or more subsets there can be many binary relations
Their cross product is set A X B = {(a, x), (a, y), (b, x), (b, y), (c, x), (c, y) }
Example: Consider the graph G = (V, E) , and V = { a, b, c }, vertex set for the graph
A binary relation is
The set E represents edges of graph G. The graph is shown pictorially in the diagram
below.
Example: The elements of Set S={ a, b, c } can be permuted in six ways because
3! = 3.2.1 = 6
The six arrangements are: abc, acb, bac, bca, cab, cba
It is assumed that 0! = 1 (factorial of zero is one ). The factorial of a negative integer is
not defined
4 24
8 40,320
16 20,922,789,888,000
32 2.6 x 10 35
The analysis of algorithms sometimes involves large inputs. For large values of n, the
n! is approximated by the following formula,:
n! ≈ √ ( 2 π n ) ( n / e) n , where e = 2.718
v. y = x2 (Quadratic function)
y=└x ┘
where x is a real number and y is the largest integer which is smaller than or equal to
number x.
Example: └ 4.9┘= 4,
└ 4.0 ┘ = 4
The floor function is used for mapping of a real valued function into integer function
y = ┌x ┐
where x is real
number and y is the
smallest integer
larger than or equal
to x.
Example: ┌ 4.9 ┐= 5
┌ 4.0 ┐ = 4
It follows from
the definition :
x ≤ ┌x ┐<x
Mathematical Preliminaries/KICSIT 2020/Fahim Khan/21
Logarithm Function
Definition
The logarithm function y= log a x is the inverse of exponential function ay, where a is some
positive constant.
Thus, if y = log a x ,
then
x=ay
Example: Consider, y= log 5 25 . Since 25= 52, it follows y=2 .
The base 10 is normally used in computations involving decimal numbers. Here are some
examples
log 10 1 =0 because 1= 10 0 by
log 10 10 =1 definition
log 10 100 = 2 10= 10 1
log 10 1000000 = 6 100=10 2
The base 2 is often used in the analysis1000000=10
of algorithms.
6 Some examples of base 2
• x logb y = y log x
b ( Symmetry rule )
The last property is particularly useful for interchanging logarithmic exponential and
base of exponentiation. Here are some examples.
2log 2 n = n log 2 = n (Interchanging 2 and n)
2
lg x = log2 x
= log e x / loge2
= ln x / ln 2 ( ln 2 = 0.6931)
n lg n √n n lg n n2 n3 2n n! nn
2 1 1.4 2 4 8 4 2 2
4 2 2 8 16 64 16 24 256
The logarithm lg n has the lowest growth rate , and the exponential function n n
the highest
The relationship of functions in terms of their growth rates is symbolically represented
as
lg n < √n < n < n lgn < n2 < n3 < 2n < n! < n n
Mathematical Preliminaries/KICSIT 2020/Fahim Khan/26
Growth Functions
Graph
The plot of mathematical functions lg n, n, n lg n n2, n3, 2n is shown below.
f(n)
Because of extremely rapid growth of n! and nn , these functions are not shown in the
ranges shown in the graph scale
Mathematical Preliminaries/KICSIT 2020/Fahim Khan/27