Lecture Note-9: Theta Notation 06 Feb 2016
By Rajesh K Shukla, HOD, Department of CSE, SIRTE Bhopal
Downloaded from www.RajeshkShukla.com
The Theta (Θ) notation is a method of expressing the asymptotic tight bound on the growth rate of an
algorithm’s running time both from above and below ends i.e. upper bound and lower bound. In other words
we can say that it describes the minimum as well as maximum amount of time, an algorithm could possibly
take to finish it therefore we can say that
If f(n)= Big Oh(g(n)) and f(n) =Big Omega(g(n)) then f(n)= Theta(g(n))
i.e. f(n)= O(g(n)) and f(n) =(g(n)) then f(n)= Θ(g(n))
The “theta” or Θ -Notation is used for average-case analysis of the algorithm. Let us f (n) describes the
algorithms average case performance for some input of size n then the Theta Notation can formally be
defined as follows
“Given functions f(n) and g(n), we say that f(n) is Theta of (g(n)) if there are positive constants c1, c2 and n0
exist such that c1g(n) ≤ f(n) ≤ c2g(n) for all n, n ≥ n0 so it means that, f() lies between c1 times the function g
and c2 times the same function g, except possibly when n is smaller than n0.
00 allfor)(2)()(10and2,1constantspositiveexistthere:)({))(( nnngcnfngcsuchthatnccnfng 
Graphical representation of Theta (Θ) notation
The Theta (Θ) running time can also be proved by applying the limit formula as given below
If
)(
)(
lim ng
nf
n 
exists, then functions f(n) is Θ(g(n)) if c
ng
nf
n

 )(
)(
lim such that 0<c<∞ so it does not include
the case in which limit is ∞
Example: Prove that 8n2
+7n =Θ(n2
)
Solution
Here f(n)= 8n2
+7n and g(n)= n2
and we assume that c1 and c2 and n0 are positive constant then by the
definition of theta notation
00 allfor)(2)()(10and2,1constantspositiveexistthere:)({))(( nnngcnfngcsuchthatnccnfng 
so we have find the positive values of c1, c2 and n0 such that
)(7n+8n)(..allfor)()()( 2
2
22
1021 ncnceinnngcnfngc 
We can see that there are two inequalities
Left hand inequality
7n+8n)( 22
1 nc and right hand inequality )(7n+8n 2
2
2
nc
The left hand inequality holds for any value of n>=1 and c1= 8 i.e.
7n+8n)(8 22
n
The right hand inequality holds for any value of n>=n0>=7 and c2= 9 i.e.
)(97n+8n 22
n
So
7nand9c8,cfor)(97n+8n)(8 021
222
 nn
Therefore 8n2
+7n =Θ (n3
)

Theta notation

  • 1.
    Lecture Note-9: ThetaNotation 06 Feb 2016 By Rajesh K Shukla, HOD, Department of CSE, SIRTE Bhopal Downloaded from www.RajeshkShukla.com The Theta (Θ) notation is a method of expressing the asymptotic tight bound on the growth rate of an algorithm’s running time both from above and below ends i.e. upper bound and lower bound. In other words we can say that it describes the minimum as well as maximum amount of time, an algorithm could possibly take to finish it therefore we can say that If f(n)= Big Oh(g(n)) and f(n) =Big Omega(g(n)) then f(n)= Theta(g(n)) i.e. f(n)= O(g(n)) and f(n) =(g(n)) then f(n)= Θ(g(n)) The “theta” or Θ -Notation is used for average-case analysis of the algorithm. Let us f (n) describes the algorithms average case performance for some input of size n then the Theta Notation can formally be defined as follows “Given functions f(n) and g(n), we say that f(n) is Theta of (g(n)) if there are positive constants c1, c2 and n0 exist such that c1g(n) ≤ f(n) ≤ c2g(n) for all n, n ≥ n0 so it means that, f() lies between c1 times the function g and c2 times the same function g, except possibly when n is smaller than n0. 00 allfor)(2)()(10and2,1constantspositiveexistthere:)({))(( nnngcnfngcsuchthatnccnfng  Graphical representation of Theta (Θ) notation The Theta (Θ) running time can also be proved by applying the limit formula as given below If )( )( lim ng nf n  exists, then functions f(n) is Θ(g(n)) if c ng nf n   )( )( lim such that 0<c<∞ so it does not include the case in which limit is ∞ Example: Prove that 8n2 +7n =Θ(n2 ) Solution Here f(n)= 8n2 +7n and g(n)= n2 and we assume that c1 and c2 and n0 are positive constant then by the definition of theta notation 00 allfor)(2)()(10and2,1constantspositiveexistthere:)({))(( nnngcnfngcsuchthatnccnfng  so we have find the positive values of c1, c2 and n0 such that )(7n+8n)(..allfor)()()( 2 2 22 1021 ncnceinnngcnfngc  We can see that there are two inequalities Left hand inequality 7n+8n)( 22 1 nc and right hand inequality )(7n+8n 2 2 2 nc The left hand inequality holds for any value of n>=1 and c1= 8 i.e. 7n+8n)(8 22 n The right hand inequality holds for any value of n>=n0>=7 and c2= 9 i.e. )(97n+8n 22 n So 7nand9c8,cfor)(97n+8n)(8 021 222  nn Therefore 8n2 +7n =Θ (n3 )