Logo Data Structures and Algorithms with Object-Oriented Design Patterns in Java
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_inline58250 and tex2html_wrap_inline58252.

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

Theorem  If tex2html_wrap_inline58250 and tex2html_wrap_inline58252, then

displaymath58238

extbfProof By Definition gif, there exist two integers, tex2html_wrap_inline58272 and tex2html_wrap_inline58274 and two constants tex2html_wrap_inline58276 and tex2html_wrap_inline58278 such that tex2html_wrap_inline58280 for tex2html_wrap_inline58282 and tex2html_wrap_inline58284 for tex2html_wrap_inline58286.

Let tex2html_wrap_inline58288 and tex2html_wrap_inline58290. Consider the sum tex2html_wrap_inline58292 for tex2html_wrap_inline58098:

eqnarray1474

Thus, tex2html_wrap_inline58296.

According to Theorem gif, if we know that functions tex2html_wrap_inline58254 and tex2html_wrap_inline58256 are tex2html_wrap_inline58302 and tex2html_wrap_inline58304, respectively, the sum tex2html_wrap_inline58292 is tex2html_wrap_inline58308. The meaning of tex2html_wrap_inline58310 is this context is the function h(n) where tex2html_wrap_inline58314 for integers all tex2html_wrap_inline58076.

For example, consider the functions tex2html_wrap_inline58318 and tex2html_wrap_inline58320. Then

eqnarray1479

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

Theorem  If tex2html_wrap_inline58328 in which tex2html_wrap_inline58254 and tex2html_wrap_inline58256 are both non-negative for all integers tex2html_wrap_inline58076 such that tex2html_wrap_inline58336 for some limit tex2html_wrap_inline58338, then tex2html_wrap_inline58340.

extbfProof According to the definition of limits , the notation

displaymath58239

means that, given any arbitrary positive value tex2html_wrap_inline58342, it is possible to find a value tex2html_wrap_inline58064 such that for all tex2html_wrap_inline58098

displaymath58240

Thus, if we chose a particular value, say tex2html_wrap_inline58348, then there exists a corresponding tex2html_wrap_inline58064 such that

eqnarray1499

Consider the sum tex2html_wrap_inline58328:

eqnarray1505

where tex2html_wrap_inline58354. Thus, tex2html_wrap_inline58340.

Consider a pair of functions tex2html_wrap_inline58254 and tex2html_wrap_inline58256, which are known to be tex2html_wrap_inline58302 and tex2html_wrap_inline58304, respectively. According to Theorem gif, the sum tex2html_wrap_inline58328 is tex2html_wrap_inline58308. However, Theorem gif says that, if tex2html_wrap_inline58370 exists, then the sum f(n) is simply tex2html_wrap_inline58374 which, by the transitive property (see Theorem gif below), is tex2html_wrap_inline58302.

In other words, if the ratio tex2html_wrap_inline58378 asymptotically approaches a constant as n gets large, we can say that tex2html_wrap_inline58292 is tex2html_wrap_inline58302, which is often a lot simpler than tex2html_wrap_inline58308.

Theorem gif is particularly useful result. Consider tex2html_wrap_inline58388 and tex2html_wrap_inline58200.

eqnarray1512

From this we can conclude that tex2html_wrap_inline58392. Thus, Theorem gif suggests that the sum of a series of powers of n is tex2html_wrap_inline58396, 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_inline58250 and tex2html_wrap_inline58252, then

displaymath58241

extbfProof By Definition gif, there exist two integers, tex2html_wrap_inline58272 and tex2html_wrap_inline58274 and two constants tex2html_wrap_inline58276 and tex2html_wrap_inline58278 such that tex2html_wrap_inline58280 for tex2html_wrap_inline58282 and tex2html_wrap_inline58284 for tex2html_wrap_inline58286. Furthermore, by Definition gif, tex2html_wrap_inline58254 and tex2html_wrap_inline58256 are both non-negative for all integers tex2html_wrap_inline58076.

Let tex2html_wrap_inline58288 and tex2html_wrap_inline58430. Consider the product tex2html_wrap_inline58432 for tex2html_wrap_inline58098:

eqnarray1532

Thus, tex2html_wrap_inline58436.

Theorem gif describes a simple, but extremely useful property of big oh. Consider the functions tex2html_wrap_inline58438 and tex2html_wrap_inline58440. By Theorem gif, the asymptotic behavior of the product tex2html_wrap_inline58432 is tex2html_wrap_inline58444. 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_inline58446.

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_inline58250 and tex2html_wrap_inline58264 is a function whose value is non-negative for integers tex2html_wrap_inline58076, then

displaymath58242

extbfProof By Definition gif, there exist integers tex2html_wrap_inline58064 and constant tex2html_wrap_inline58456 such that tex2html_wrap_inline58458 for tex2html_wrap_inline58098. Since tex2html_wrap_inline58264 is never negative,

displaymath58243

Thus, tex2html_wrap_inline58464.

Theorem gif applies when we multiply a function, tex2html_wrap_inline58254, whose asymptotic behavior is known to be tex2html_wrap_inline58302, by another function tex2html_wrap_inline58264. The asymptotic behavior of the result is simply tex2html_wrap_inline58472.

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

eqnarray1544

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

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_inline58272 and tex2html_wrap_inline58274 and two constants tex2html_wrap_inline58276 and tex2html_wrap_inline58278 such that tex2html_wrap_inline58498 for tex2html_wrap_inline58282 and tex2html_wrap_inline58502 for tex2html_wrap_inline58286.

Let tex2html_wrap_inline58288 and tex2html_wrap_inline58430. Then

eqnarray1555

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

The transitive property of big oh is useful in conjunction with Theorem gif. Consider tex2html_wrap_inline58512 which is clearly tex2html_wrap_inline58514. If we add to tex2html_wrap_inline58254 the function tex2html_wrap_inline58518, then by Theorem gif, the sum tex2html_wrap_inline58292 is tex2html_wrap_inline58374 because tex2html_wrap_inline58524. That is, tex2html_wrap_inline58526. The combination of the fact that tex2html_wrap_inline58528 and the transitive property of big oh, allows us to conclude that the sum is tex2html_wrap_inline58514.


next up previous contents index

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