0% found this document useful (0 votes)
68 views4 pages

3.2 The Growth of Functions: Big-O Notation

This document contains information about big-O, big-Ω, and big-Θ notation for analyzing the growth rates of functions. It discusses the definitions of these notations and gives examples of determining the complexity class of various functions. Important complexity classes from slowest to fastest growth are listed as 1, log n, n, n log n, n^2, 2^n, and n!. The document also contains practice problems and solutions for using the notations to classify functions.

Uploaded by

MADDY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

3.2 The Growth of Functions: Big-O Notation

This document contains information about big-O, big-Ω, and big-Θ notation for analyzing the growth rates of functions. It discusses the definitions of these notations and gives examples of determining the complexity class of various functions. Important complexity classes from slowest to fastest growth are listed as 1, log n, n, n log n, n^2, 2^n, and n!. The document also contains practice problems and solutions for using the notations to classify functions.

Uploaded by

MADDY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ICS 141: Discrete Mathematics I (Fall 2014)

3.2 The Growth of Functions


Big-O Notation

Let f and g be functions from the set of integers or the set of real numbers to the set of real
numbers. We say f (x) is O(g(x)) if there are constants C and k such that
|f (x)| C|g(x)|
whenever x > k.
In other words, Big-O is the upper bound for the growth of a function.

Important Complexity Classes

These are common functions for big-O from least to greatest:


1, log n, n, n log n, n2 , 2n , n!

The Growth of Combinations of Functions

If f1 (x) = O(g1 (x)) and f2 (x) = O(g2 (x)), then


(f1 + f2 )(x) = O(max(|g1 (x)|, |g2 (x)|))
(f1 f2 )(x) = O(g1 (x)g2 (x))

Big- Notation

Let f and g be functions from the set of integers or the set of real numbers to the set of real
numbers. We say f (x) is (g(x)) if there are positive constants C and k such that
|f (x)| C|g(x)|
whenever x > k.

1
ICS 141: Discrete Mathematics I (Fall 2014)

Big- Notation

Let f and g be functions from the set of integers or the set of real numbers to the set of real
numbers. We say that f (x) is (g(x)) if f (x) is O(g(x)) and f (x) is (g(x)). Note that f (x) is
(g(x)) if and only if there are positive constants C1 , C2 , and k such that

C1 |g(x)| f (x) C2 |g(x)|

whenever x > k.

3.2 pg 216 # 1

Determine whether each of these functions is O(x).

a) f (x) = 10
Yes. |10| |x| for all x > 10 with our witnesses C = 1 and k = 10.

b) f (x) = 3x + 7
Yes. |3x + 7| 4|x| for all x > 7 with our witnesses C = 4 and k = 7.

c) f (x) = x2 + x + 1
No. There is no value C and no value k where |x2 + x + 1| C|x| for large values of x.

d) f (x) = 5 log x
Yes. |5 log x| 5|x| for all x > 1 with our witnesses C = 5 and k = 1.

3.2 pg 216 # 5

Show that (x2 + 1)/(x + 1) is O(x)

Simplify fraction first.


x2 + 1 x2 1 + 2
=
x+1 x+1
x2 1 2
= +
x+1 x+1
(x + 1)(x 1) 2
= +
x+1 x+1
2
=x1+
x+1
Now that the fraction has been simplified, we can find the big-O.
2
x1+ x for x > 1
x+1
The function is O(x) with our witnesses C = 1 and k = 1.

2
ICS 141: Discrete Mathematics I (Fall 2014)

3.2 pg 216 # 7

Find the least integer n such that f (x) is O(xn ) for each of these functions.

a) f (x) = 2x3 + x2 log x


2x3 + x2 log x 2x3 + x3 for x > 0
2x3 + x2 log x 3x3
O(x3 ) with our witnesses C = 3 and k = 0.
Therefore, n = 3.

b) f (x) = 3x3 + (log x)4


3x3 + (log x)4 3x3 + x3 for x > 1
3x3 + (log x)4 4x3
O(x3 ) with our witnesses C = 4 and k = 1
Therefore, n = 3.

c) f (x) = (x4 + x2 + 1)/(x3 + 1)


Simplify fraction first.
x4 + x2 + 1 1
3
=x+ .
x +1 x+1
Now that the fraction has been simplified, we can find the big-O.
1
x+ x + x for x > 1
x+1
1
x+ 2x
x+1
O(x) with our witnesses C = 2 and k = 1.
Therefore, n = 1.

3.2 pg 217 # 25

Give as good a big-O estimate as possible for each of these functions

a) (n2 + 8)(n + 1)
= n3 + n2 + 8n + 8
Biggest term is n3 so the function is O(n3 ).

b) (n log n + n2 )(n3 + 2)
= n4 log n + n5 + 2n log n + 2n2
Biggest term is n5 so the function is O(n5 ).

3.2 pg 216 # 21

Arrange the functions n, 1000 log n, n log n, 2n!, 2n , 3n , and n2 /1000000 in a list so that each
function is big-O of the next function.

1000 log n, n, n log n, n2 /1000000, 2n , 3n , 2n!

3
ICS 141: Discrete Mathematics I (Fall 2014)

3.2 pg 217 # 29

Determine whether each of these functions is (x2 )

c) f (x) = x log x
No. x log x grows more slowly than x2 , since log x grows more slowly than x. Therefore
f (x) is not (x2 ).

e) f (x) = 2x
Yes. |2x | |x2 | where x > 4 with our witnesses C = 1 and k = 4.

You might also like