Data Structures and Algorithms with Object-Oriented Design Patterns in C#
next up previous contents index

Properties of Big Oh

In this section we examine some of the mathematical properties of big oh. In particular, suppose we know that tex2html_wrap_inline58451 and tex2html_wrap_inline58453.

The first theorem addresses the asymptotic behavior of the sum of two functions whose asymptotic behaviors are known:

Theorem  If tex2html_wrap_inline58451 and tex2html_wrap_inline58453, then

displaymath58439

extbfProof By Definition gif, there exist two integers, tex2html_wrap_inline58473 and tex2html_wrap_inline58475 and two constants tex2html_wrap_inline58477 and tex2html_wrap_inline58479 such that tex2html_wrap_inline58481 for tex2html_wrap_inline58483 and tex2html_wrap_inline58485 for tex2html_wrap_inline58487.

Let tex2html_wrap_inline58489 and tex2html_wrap_inline58491. Consider the sum tex2html_wrap_inline58493 for tex2html_wrap_inline58299:

eqnarray1480

Thus, tex2html_wrap_inline58497.

According to Theorem gif, if we know that functions tex2html_wrap_inline58455 and tex2html_wrap_inline58457 are tex2html_wrap_inline58503 and tex2html_wrap_inline58505, respectively, the sum tex2html_wrap_inline58493 is tex2html_wrap_inline58509. The meaning of tex2html_wrap_inline58511 is this context is the function h(n) where tex2html_wrap_inline58515 for integers all tex2html_wrap_inline58277.

For example, consider the functions tex2html_wrap_inline58519 and tex2html_wrap_inline58521. Then

eqnarray1485

Theorem gif helps us simplify the asymptotic analysis of the sum of functions by allowing us to drop the tex2html_wrap_inline58527 required by Theorem gif in certain circumstances:

Theorem  If tex2html_wrap_inline58529 in which tex2html_wrap_inline58455 and tex2html_wrap_inline58457 are both non-negative for all integers tex2html_wrap_inline58277 such that tex2html_wrap_inline58537 for some limit tex2html_wrap_inline58539, then tex2html_wrap_inline58541.

extbfProof According to the definition of limits , the notation

displaymath58440

means that, given any arbitrary positive value tex2html_wrap_inline58543, it is possible to find a value tex2html_wrap_inline58265 such that for all tex2html_wrap_inline58299

displaymath58441

Thus, if we chose a particular value, say tex2html_wrap_inline58549, then there exists a corresponding tex2html_wrap_inline58265 such that

eqnarray1505

Consider the sum tex2html_wrap_inline58529:

eqnarray1511

where tex2html_wrap_inline58555. Thus, tex2html_wrap_inline58541.

Consider a pair of functions tex2html_wrap_inline58455 and tex2html_wrap_inline58457, which are known to be tex2html_wrap_inline58503 and tex2html_wrap_inline58505, respectively. According to Theorem gif, the sum tex2html_wrap_inline58529 is tex2html_wrap_inline58509. However, Theorem gif says that, if tex2html_wrap_inline58571 exists, then the sum f(n) is simply tex2html_wrap_inline58575 which, by the transitive property (see Theorem gif below), is tex2html_wrap_inline58503.

In other words, if the ratio tex2html_wrap_inline58579 asymptotically approaches a constant as n gets large, we can say that tex2html_wrap_inline58493 is tex2html_wrap_inline58503, which is often a lot simpler than tex2html_wrap_inline58509.

Theorem gif is particularly useful result. Consider tex2html_wrap_inline58589 and tex2html_wrap_inline58401.

eqnarray1518

From this we can conclude that tex2html_wrap_inline58593. Thus, Theorem gif suggests that the sum of a series of powers of n is tex2html_wrap_inline58597, where m is the largest power of n in the summation. We will confirm this result in Section gif below.

The next theorem addresses the asymptotic behavior of the product of two functions whose asymptotic behaviors are known:

Theorem  If tex2html_wrap_inline58451 and tex2html_wrap_inline58453, then

displaymath58442

extbfProof By Definition gif, there exist two integers, tex2html_wrap_inline58473 and tex2html_wrap_inline58475 and two constants tex2html_wrap_inline58477 and tex2html_wrap_inline58479 such that tex2html_wrap_inline58481 for tex2html_wrap_inline58483 and tex2html_wrap_inline58485 for tex2html_wrap_inline58487. Furthermore, by Definition gif, tex2html_wrap_inline58455 and tex2html_wrap_inline58457 are both non-negative for all integers tex2html_wrap_inline58277.

Let tex2html_wrap_inline58489 and tex2html_wrap_inline58631. Consider the product tex2html_wrap_inline58633 for tex2html_wrap_inline58299:

eqnarray1538

Thus, tex2html_wrap_inline58637.

Theorem gif describes a simple, but extremely useful property of big oh. Consider the functions tex2html_wrap_inline58639 and tex2html_wrap_inline58641. By Theorem gif, the asymptotic behavior of the product tex2html_wrap_inline58633 is tex2html_wrap_inline58645. That is, we are able to determine the asymptotic behavior of the product without having to go through the gory details of calculating that tex2html_wrap_inline58647.

The next theorem is closely related to the preceding one in that it also shows how big oh behaves with respect to multiplication.

Theorem  If tex2html_wrap_inline58451 and tex2html_wrap_inline58465 is a function whose value is non-negative for integers tex2html_wrap_inline58277, then

displaymath58443

extbfProof By Definition gif, there exist integers tex2html_wrap_inline58265 and constant tex2html_wrap_inline58657 such that tex2html_wrap_inline58659 for tex2html_wrap_inline58299. Since tex2html_wrap_inline58465 is never negative,

displaymath58444

Thus, tex2html_wrap_inline58665.

Theorem gif applies when we multiply a function, tex2html_wrap_inline58455, whose asymptotic behavior is known to be tex2html_wrap_inline58503, by another function tex2html_wrap_inline58465. The asymptotic behavior of the result is simply tex2html_wrap_inline58673.

One way to interpret Theorem gif is that it allows us to do the following mathematical manipulation:

eqnarray1550

That is, Fallacy gif notwithstanding, we can multiply both sides of the ``equation'' by tex2html_wrap_inline58465 and the ``equality'' still holds. Furthermore, when we multiply tex2html_wrap_inline58503 by tex2html_wrap_inline58465, we simply bring the tex2html_wrap_inline58465 inside the tex2html_wrap_inline57397.

The last theorem in this section introduces the transitive property of big oh:

Theorem (Transitive Property)    If f(n)=O(g(n)) and g(n)=O(h(n)) then f(n)=O(h(n)).

extbfProof By Definition gif, there exist two integers, tex2html_wrap_inline58473 and tex2html_wrap_inline58475 and two constants tex2html_wrap_inline58477 and tex2html_wrap_inline58479 such that tex2html_wrap_inline58699 for tex2html_wrap_inline58483 and tex2html_wrap_inline58703 for tex2html_wrap_inline58487.

Let tex2html_wrap_inline58489 and tex2html_wrap_inline58631. Then

eqnarray1561

Thus, f(n)=O(h(n)).

The transitive property of big oh is useful in conjunction with Theorem gif. Consider tex2html_wrap_inline58713 which is clearly tex2html_wrap_inline58715. If we add to tex2html_wrap_inline58455 the function tex2html_wrap_inline58719, then by Theorem gif, the sum tex2html_wrap_inline58493 is tex2html_wrap_inline58575 because tex2html_wrap_inline58725. That is, tex2html_wrap_inline58727. The combination of the fact that tex2html_wrap_inline58729 and the transitive property of big oh, allows us to conclude that the sum is tex2html_wrap_inline58715.


next up previous contents index

Bruno Copyright © 2001 by Bruno R. Preiss, P.Eng. All rights reserved.