Formal definition
Let , the function to be estimated, be a real or complex valued function and let , the comparison function, be a real valued function. Let both functions be defined on some unboundedExample
In typical usage the notation is asymptotical, that is, it refers to very large . In this setting, the contribution of the terms that grow "most quickly" will eventually make the other ones irrelevant. As a result, the following simplification rules can be applied: *If is a sum of several terms, if there is one with largest growth rate, it can be kept, and all others omitted. *If is a product of several factors, any constants (terms in the product that do not depend on ) can be omitted. For example, let , and suppose we wish to simplify this function, using notation, to describe its growth rate as approaches infinity. This function is the sum of three terms: , , and . Of these three terms, the one with the highest growth rate is the one with the largest exponent as a function of , namely . Now one may apply the second rule: is a product of and in which the first factor does not depend on . Omitting this factor results in the simplified form . Thus, we say that is a "big O" of . Mathematically, we can write . One may confirm this calculation using the formal definition: let and . Applying the formal definition from above, the statement that is equivalent to its expansion, for some suitable choice of and and for all . To prove this, let and . Then, for all : soUsage
Big O notation has two main areas of application: * InInfinite asymptotics
Big O notation is useful when analyzing algorithms for efficiency. For example, the time (or the number of steps) it takes to complete a problem of size might be found to be . As grows large, the term will come to dominate, so that all other terms can be neglected—for instance when , the term is 1000 times as large as the term. Ignoring the latter would have negligible effect on the expression's value for most purposes. Further, the coefficients become irrelevant if we compare to any otherInfinitesimal asymptotics
Big O can also be used to describe theProperties
If the function can be written as a finite sum of other functions, then the fastest growing one determines the order of . For example, : In particular, if a function may be bounded by a polynomial in , then as tends to ''infinity'', one may disregard ''lower-order'' terms of the polynomial. The sets and are very different. If is greater than one, then the latter grows much faster. A function that grows faster than for any is called ''superpolynomial''. One that grows more slowly than any exponential function of the form is called ''subexponential''. An algorithm can require time that is both superpolynomial and subexponential; examples of this include the fastest known algorithms for integer factorization and the function . We may ignore any powers of inside of the logarithms. The set is exactly the same as . The logarithms differ only by a constant factor (since ) and thus the big O notation ignores that. Similarly, logs with different constant bases are equivalent. On the other hand, exponentials with different bases are not of the same order. For example, and are not of the same order. Changing units may or may not affect the order of the resulting algorithm. Changing units is equivalent to multiplying the appropriate variable by a constant wherever it appears. For example, if an algorithm runs in the order of , replacing by means the algorithm runs in the order of , and the big O notation ignores the constant . This can be written as . If, however, an algorithm runs in the order of , replacing with gives . This is not equivalent to in general. Changing variables may also affect the order of the resulting algorithm. For example, if an algorithm's run time is when measured in terms of the number of ''digits'' of an input number , then its run time is when measured as a function of the input number itself, because .Product
: :Sum
If and then . It follows that if and then . In other words, this second statement says that is a convex cone.Multiplication by a constant
Let be a nonzero constant. Then . In other words, if , thenMultiple variables
Big ''O'' (and little o, Ω, etc.) can also be used with multiple variables. To define big ''O'' formally for multiple variables, suppose and are two functions defined on some subset of . We say : if and only if there exist constants and such that for all with for some Equivalently, the condition that for some can be written , where denotes theMatters of notation
Equals sign
The statement "''f''(''x'') is ''O''(''g''(''x''))" as defined above is usually written as . Some consider this to be an abuse of notation, since the use of the equals sign could be misleading as it suggests a symmetry that this statement does not have. As Nicolaas Govert de Bruijn">de Bruijn De Bruijn is a Dutch surname meaning "the brown". Notable people with the surname include: * (1887–1968), Dutch politician * Brian de Bruijn (b. 1954), Dutch-Canadian ice hockey player * Chantal de Bruijn (b. 1976), Dutch field hockey defender ...Other arithmetic operators
Big O notation can also be used in conjunction with other arithmetic operators in more complicated equations. For example, denotes the collection of functions having the growth of ''h''(''x'') plus a part whose growth is limited to that of ''f''(''x''). Thus, :Example
Suppose anMultiple uses
In more complicated usage, ''O''(·) can appear in different places in an equation, even several times on each side. For example, the following are true forTypesetting
Big O is typeset as an italicized uppercase "O", as in the following example:Orders of common functions
Here is a list of classes of functions that are commonly encountered when analyzing the running time of an algorithm. In each case, ''c'' is a positive constant and ''n'' increases without bound. The slower-growing functions are generally listed first. The statementRelated asymptotic notations
Big ''O'' is widely used in computer science. Together with some other related notations it forms the family of Bachmann–Landau notations.Little-o notation
Intuitively, the assertion " is " (read " is little-o of ") means that grows much faster than . As before, let ''f'' be a real or complex valued function and ''g'' a real valued function, both defined on some unbounded subset of the positiveBig Omega notation
Another asymptotic notation isThe Hardy–Littlewood definition
In 1914= Simple examples
= We have :The Knuth definition
In 1976 Donald Knuth published a paper to justify his use of theFamily of Bachmann–Landau notations
The limit definitions assumeUse in computer science
Informally, especially in computer science, the big ''O'' notation often can be used somewhat differently to describe an asymptotic tight bound where using big Theta Θ notation might be more factually appropriate in a given context. For example, when considering a function ''T''(''n'') = 73''n''3 + 22''n''2 + 58, all of the following are generally acceptable, but tighter bounds (such as numbers 2 and 3 below) are usually strongly preferred over looser bounds (such as number 1 below). # # # The equivalent English statements are respectively: #''T''(''n'') grows asymptotically no faster than ''n''100 #''T''(''n'') grows asymptotically no faster than ''n''3 #''T''(''n'') grows asymptotically as fast as ''n''3. So while all three statements are true, progressively more information is contained in each. In some fields, however, the big O notation (number 2 in the lists above) would be used more commonly than the big Theta notation (items numbered 3 in the lists above). For example, if ''T''(''n'') represents the running time of a newly developed algorithm for input size ''n'', the inventors and users of the algorithm might be more inclined to put an upper asymptotic bound on how long it will take to run without making an explicit statement about the lower asymptotic bound.Other notation
In their book '' Introduction to Algorithms'', Cormen, Leiserson,Extensions to the Bachmann–Landau notations
Another notation sometimes used in computer science is Õ (read ''soft-O''): ''f''(''n'') = ''Õ''(''g''(''n'')) is shorthand for for some ''k''. Some authors write O* for the same purpose. Essentially, it is big O notation, ignoring logarithmic factors because the growth-rate effects of some other super-logarithmic function indicate a growth-rate explosion for large-sized input parameters that is more important to predicting bad run-time performance than the finer-point effects contributed by the logarithmic-growth factor(s). This notation is often used to obviate the "nitpicking" within growth-rates that are stated as too tightly bounded for the matters at hand (since log''k'' ''n'' is always ''o''(''n''ε) for any constant ''k'' and any ). Also the L notation, defined as :Generalizations and related usages
The generalization to functions taking values in any normed vector space is straightforward (replacing absolute values by norms), where ''f'' and ''g'' need not take their values in the same space. A generalization to functions ''g'' taking values in any topological group is also possible. The "limiting process" ''x'' → ''x''o can also be generalized by introducing an arbitrary filter base, i.e. to directed nets ''f'' and ''g''. The ''o'' notation can be used to defineHistory (Bachmann–Landau, Hardy, and Vinogradov notations)
The symbol O was first introduced by number theorist Paul Bachmann in 1894, in the second volume of his book ''Analytische Zahlentheorie'' (" analytic number theory"). The number theorist Edmund Landau adopted it, and was thus inspired to introduce in 1909 the notation o; hence both are now called Landau symbols. These notations were used in applied mathematics during the 1950s for asymptotic analysis. The symbolSee also
* Asymptotic expansion: Approximation of functions generalizing Taylor's formula *References and notes
Further reading
* * * * * * * * * *External links