Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

BigO notation

From Wikipedia, the free encyclopedia
Describes approximate behavior of a function
Fit approximation
Concepts
Other fundamentals

BigO notation is amathematical notation that describes the approximate size of afunction on adomain. Big O is a member of afamily of notations invented by German mathematiciansPaul Bachmann[1] andEdmund Landau[2]and expanded by others, collectively calledBachmann–Landau notation. The letter O was chosen by Bachmann to stand forOrdnung, meaning theorder of approximation.

Incomputer science, big O notation is used toclassify algorithms according to how their run time or space requirements[a] grow as the input size grows.[3] Inanalytic number theory, big O notation is often used to express bounds on the growth of anarithmetical function; one well-known example is the remainder term in theprime number theorem.[4]Inmathematical analysis, includingcalculus,Big O notation is used to bound the error when truncating apower series and to express the qualityof approximation of a real or complex valued functionby a simpler function.

Often, big O notation characterizes functions according to their growth rates as the variable becomes large: different functions with the sameasymptotic growth rate may be represented using the same O notation. The letter O is used because the growth rate of a function is also referred to as theorder of the function. A description of a function in terms of big O notation only provides anupper bound on the growth rate of the function.

Associated with big O notation are several related notations, using the symbolso{\displaystyle o},{\displaystyle \sim },Ω{\displaystyle \Omega },{\displaystyle \ll },{\displaystyle \gg },{\displaystyle \asymp },ω{\displaystyle \omega }, andΘ{\displaystyle \Theta } to describe other kinds of bounds on growth rates.[5][6][7]

Formal definition

[edit]

Letf,{\textstyle f,} the function to be estimated, be either areal orcomplex valued function defined on adomainD,{\textstyle D,} and letg,{\textstyle g,} the comparison function, be a non-negative real valued function defined on the same setD.{\textstyle D.} Common choices for the domain are intervals of real numbers, bounded or unbounded, the set of positive integers, the set ofcomplex numbers and tuples of real/complex numbers. With the domain written explicitly or understood implicitly, one writes

f(x)=O(g(x)) {\displaystyle f(x)=O{\bigl (}g(x){\bigr )}\ }

which is read as "f(x){\textstyle f(x)} isbigO{\textstyle O} ofg(x){\textstyle g(x)}"  if there exists a positive real numberM{\textstyle M} such that

|f(x)|M g(x)  for all  xD.{\displaystyle \left|f(x)\right|\leq M\ g(x)\qquad ~{\mathsf {\ for\ all\ }}~\quad x\in D.}

Ifg(x)>0{\displaystyle g(x)>0} (i.e.g is also never zero) throughout the domainD,{\displaystyle D,} an equivalent definition is that the ratiof(x)g(x){\textstyle {\frac {f(x)}{g(x)}}} isbounded, i.e. there is a positive real numberM{\displaystyle M} so that|f(x)g(x)|M{\textstyle {\Big |}{\frac {f(x)}{g(x)}}{\Big |}\leq M} for allxD.{\displaystyle x\in D.} These encompass all the uses of bigO{\textstyle O} incomputer science and mathematics, including its use where the domain is finite, infinite, real, complex, single variate, or multivariate. In most applications, one chooses the functiong(x){\displaystyle g(x)} appearing within theargument ofO(){\textstyle O{\bigl (}\cdot {\bigr )}} to be as simple a form as possible, omitting constant factors and lower order terms. The numberM{\textstyle M} is called theimplied constant because it is normally not specified. When usingbigO{\textstyle O} notation, what matters is that some finiteM{\displaystyle M} exists, not its specific value. This simplifies the presentation of many analytic inequalities.

For functions defined on positive real numbers or positive integers, a more restrictive and somewhat conflicting definitionis still in common use,[3][8] especially in computer science. When restricted to functions which areeventually positive, the notation

f(x)=O(g(x)) asx{\displaystyle f(x)=O{\bigl (}g(x){\bigr )}\qquad ~{\mathsf {as}}\quad x\to \infty }

means that for some real numbera,{\textstyle a,}f(x)=O(g(x)){\textstyle f(x)=O{\bigl (}g(x){\bigr )}} in the domain[a,).{\textstyle \left[a,\infty \right).} Here, the expressionx{\textstyle x\to \infty } doesn't indicate alimit, but the notion that the inequality holds forlarge enoughx.{\textstyle x.} The expressionx{\textstyle x\to \infty } often is omitted.[3]

Similarly, for a finite real numbera,{\textstyle a,} the notation

f(x)=O(g(x))  as  xa{\displaystyle f(x)=O{\bigl (}g(x){\bigr )}\qquad ~{\text{ as }}\ x\to a}

means that for some constantc>0,{\textstyle c>0,}f(x)=O(g(x)){\textstyle f(x)=O{\bigl (}g(x){\bigr )}} on the interval[ac,a+c];{\displaystyle \left[a-c,a+c\right];} that is, in a small neighborhood ofa.{\displaystyle a.}In addition, the notation f(x)=h(x)+O(g(x)) {\displaystyle \ f(x)=h(x)+O{\bigl (}g(x){\bigr )}\ }meansf(x)h(x)=O(g(x)).{\textstyle f(x)-h(x)=O{\bigl (}g(x){\bigr )}.}More complicated expressions are also possible.

Despite the presence of the equal sign (=) as written, the expressionf(x)=O(g(x)){\textstyle f(x)=O{\bigl (}g(x){\bigr )}} does not refer to anequality, but rather to an inequality relatingf{\textstyle f} andg.{\textstyle g.}

In the 1930s,[6] the Russian number theoristI.M. Vinogradov introduced the notation,{\displaystyle \ll ,} which has been increasingly used in number theory[4][9][10] and other branches of mathematics, as an alternative to theO{\textstyle O} notation. We have

 fgf=O(g).{\displaystyle \ f\ll g\iff f=O{\bigl (}g{\bigr )}.}

Frequently both notations are used in the same work.

Set version of big O

[edit]

In computer science[3] it is common to definebigO{\textstyle O} as also defining aset of functions. With the positive (or non-negative) functiong(x){\displaystyle g(x)} specified, one interpretsO(g(x)){\textstyle O{\bigl (}g(x){\bigr )}} as representing theset of all functionsf~{\textstyle {\tilde {f}}} that satisfyf~(x)=O(g(x)).{\textstyle {\tilde {f}}(x)=O{\bigl (}g(x){\bigr )}.} One can then equivalently writef(x)O(g(x)),{\textstyle f(x)\in O{\bigl (}g(x){\bigr )},} read as "the function f(x) {\textstyle \ f(x)\ } is among the set of all functions oforder at mostg(x).{\textstyle g(x).}"

Examples with an infinite domain

[edit]

In typical usage theO{\displaystyle O} notation is applied to an infinite interval of real numbers[a,){\displaystyle [a,\infty )} and captures the behavior of the function for very largex{\displaystyle x}. 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:

  • Iff(x){\displaystyle f(x)} is a sum of several terms, if there is one with largest growth rate, it can be kept, and all others omitted.
  • Iff(x){\displaystyle f(x)} is a product of several factors, any constants (factors in the product that do not depend onx{\displaystyle x}) can be omitted.

For example, letf(x)=6x42x3+5{\displaystyle f(x)=6x^{4}-2x^{3}+5}, and suppose we wish to simplify this function, usingO{\displaystyle O} notation, to describe its growth rate for largex{\displaystyle x}. This function is the sum of three terms:6x4{\displaystyle 6x^{4}},2x3{\displaystyle -2x^{3}}, and5{\displaystyle 5}. Of these three terms, the one with the highest growth rate is the one with the largest exponent as a function ofx{\displaystyle x}, namely6x4{\displaystyle 6x^{4}}. Now one may apply the second rule:6x4{\displaystyle 6x^{4}}is a product of6{\displaystyle 6} andx4{\displaystyle x^{4}} in which the first factor does not depend onx{\displaystyle x}. Omitting this factor results in the simplified formx4{\displaystyle x^{4}}. Thus, we say thatf(x){\displaystyle f(x)} is a "big O" ofx4{\displaystyle x^{4}}. Mathematically, we can writef(x)=O(x4){\displaystyle f(x)=O(x^{4})} for allx1{\displaystyle x\geq 1}. One may confirm this calculation using the formal definition: letf(x)=6x42x3+5{\displaystyle f(x)=6x^{4}-2x^{3}+5} andg(x)=x4{\displaystyle g(x)=x^{4}}. Applying theformal definition from above, the statement thatf(x)=O(x4){\displaystyle f(x)=O(x^{4})} is equivalent to its expansion,|f(x)|Mx4{\displaystyle |f(x)|\leq Mx^{4}}for some suitable choice of a positive real numberM{\displaystyle M} and for allx1{\displaystyle x\geq 1}. To prove this, letM=13{\displaystyle M=13}. Then, for allx1{\displaystyle x\geq 1}:|6x42x3+5|6x4+|2x3|+56x4+2x4+5x4=13x4{\displaystyle {\begin{aligned}|6x^{4}-2x^{3}+5|&\leq 6x^{4}+|-2x^{3}|+5\\&\leq 6x^{4}+2x^{4}+5x^{4}\\&=13x^{4}\end{aligned}}}so|6x42x3+5|13x4.{\displaystyle |6x^{4}-2x^{3}+5|\leq 13x^{4}.}While it is also true, by the same argument, thatf(x)=O(x10){\displaystyle f(x)=O(x^{10})}, this is a less preciseapproximation of the functionf{\displaystyle f}.On the other hand, the statementf(x)=O(x3){\displaystyle f(x)=O(x^{3})} is false, because the term6x4{\displaystyle 6x^{4}} causesf(x)/x3{\displaystyle f(x)/x^{3}} to be unbounded.

When a functionT(n){\displaystyle T(n)} describes the numberof steps required in an algorithm with inputn{\displaystyle n}, an expression such asT(n)=O(n2){\displaystyle T(n)=O(n^{2})}with the implied domain being the set of positive integers, may be interpreted as saying that the algorithm hasat most the order ofn2{\displaystyle n^{2}} time complexity.

Example with a finite domain

[edit]

Big O can also be used to describe theerror term in an approximation to a mathematical function on a finite interval. The most significant terms are written explicitly, and then the least-significant terms are summarized in a single big O term. Consider, for example, theexponential series and two expressions of it that are valid whenx{\displaystyle x} is small:ex=1+x+x2 2!+x3 3!+x4 4!+ for all finite x=1+x+x2 2+O(|x|3) for all |x|1=1+x+O(x2) for all |x|1.{\displaystyle {\begin{aligned}e^{x}&=1+x+{\frac {\;x^{2}\ }{2!}}+{\frac {\;x^{3}\ }{3!}}+{\frac {\;x^{4}\ }{4!}}+\dotsb &&{\text{ for all finite }}x\\[4pt]&=1+x+{\frac {\;x^{2}\ }{2}}+O(|x|^{3})&&{\text{ for all }}|x|\leq 1\\[4pt]&=1+x+O(x^{2})&&{\text{ for all }}|x|\leq 1.\end{aligned}}}The middle expression(the line with"O(|x3|){\displaystyle O(|x^{3}|)}") means the absolute-value of the error ex(1+x+x2 2) {\displaystyle \ e^{x}-(1+x+{\frac {\;x^{2}\ }{2}})\ } is at most some constant times |x3| {\displaystyle ~|x^{3}|\ } when x {\displaystyle \ x~} is small.This is an example of the use ofTaylor's theorem.

The behavior of a given function may be very different on finite domains than on infinite domains, for example,(x+1)8=x8+O(x7) for x1{\displaystyle (x+1)^{8}=x^{8}+O(x^{7})\quad {\text{ for }}x\geq 1}while(x+1)8=1+8x+O(x2) for |x|1.{\displaystyle (x+1)^{8}=1+8x+O(x^{2})\quad {\text{ for }}|x|\leq 1.}

Multivariate examples

[edit]

xsiny=O(x) for x1,y any real number{\displaystyle x\sin y=O(x)\quad {\text{ for }}x\geq 1,y{\text{ any real number}}}

3a2+7ab+2b2+a+3b+14a2+b2a2 for all ab1{\displaystyle 3a^{2}+7ab+2b^{2}+a+3b+14\ll a^{2}+b^{2}\ll a^{2}\quad {\text{ for all }}a\geq b\geq 1}

xyx2+y2=O(1) for all real x,y that are not both 0{\displaystyle {\frac {xy}{x^{2}+y^{2}}}=O(1)\quad {\text{ for all real }}x,y{\text{ that are not both }}0}

xit=O(1) for x0,tR.{\displaystyle x^{it}=O(1)\quad {\text{ for }}x\neq 0,t\in \mathbb {R} .}

Here we have acomplex variable function of two variables.In general, any bounded function isO(1){\displaystyle O(1)}.

(x+y)10=O(x10) for x1,2y2.{\displaystyle (x+y)^{10}=O(x^{10})\quad {\text{ for }}x\geq 1,-2\leq y\leq 2.}

The last example illustrates a mixing of finite and infinite domains on the different variables.

In all of these examples, the bound is uniformin both variables. Sometimes in a multivariate expression, one variable ismore important than others, and one may expressthat the implied constantM{\displaystyle M} depends on oneor more of the variables using subscripts to the big O symbol or the{\displaystyle \ll } symbol. For example, consider the expression

(1+x)b=1+Ob(x) for 0x1,b any real number.{\displaystyle (1+x)^{b}=1+O_{b}(x)\quad {\text{ for }}0\leq x\leq 1,b{\text{ any real number.}}}

This means that for each real numberb{\displaystyle b}, there is a constantMb{\displaystyle M_{b}},which depends onb{\displaystyle b}, so that for all0x1{\displaystyle 0\leq x\leq 1},|(1+x)b1|Mbx.{\displaystyle |(1+x)^{b}-1|\leq M_{b}\cdot x.}This particular statement follows from thegeneral binomial theorem.

Another example, common in the theory ofTaylor series, isex=1+x+Or(x2) for all |x|r,r being any real number.{\displaystyle e^{x}=1+x+O_{r}(x^{2})\quad {\text{ for all }}|x|\leq r,r{\text{ being any real number.}}}Here the implied constant depends on the size of the domain.

The subscript convention applies to all of the othernotations in this page.

Properties

[edit]

Product

[edit]
f1=O(g1) and f2=O(g2)f1f2=O(g1g2){\displaystyle f_{1}=O(g_{1}){\text{ and }}f_{2}=O(g_{2})\Rightarrow f_{1}f_{2}=O(g_{1}g_{2})}
fO(g)=O(|f|g){\displaystyle f\cdot O(g)=O(|f|g)}

Sum

[edit]

Iff1=O(g1){\displaystyle f_{1}=O(g_{1})} andf2=O(g2){\displaystyle f_{2}=O(g_{2})} thenf1+f2=O(max(g1,g2)){\displaystyle f_{1}+f_{2}=O(\max(g_{1},g_{2}))}. It follows that iff1=O(g){\displaystyle f_{1}=O(g)} andf2=O(g){\displaystyle f_{2}=O(g)} thenf1+f2=O(g){\displaystyle f_{1}+f_{2}=O(g)}.

Multiplication by a constant

[edit]

Letk be a nonzero constant. ThenO(|k|g)=O(g){\displaystyle O(|k|\cdot g)=O(g)}. In other words, iff=O(g){\displaystyle f=O(g)}, thenkf=O(g).{\displaystyle k\cdot f=O(g).}

Transitive property

[edit]

Iff=O(g){\displaystyle f=O(g)} andg=O(h){\displaystyle g=O(h)} thenf=O(h){\displaystyle f=O(h)}.

If the functionf{\displaystyle f} of a positive integern{\displaystyle n} can be written as a finite sum of other functions, then the fastest growing one determines the order off(n){\displaystyle f(n)}. For example,

f(n)=9logn+5(logn)4+3n2+2n3=O(n3)for n1.{\displaystyle f(n)=9\log n+5(\log n)^{4}+3n^{2}+2n^{3}=O(n^{3})\qquad {\text{for }}n\geq 1.}

Some general rules about growthtoward infinity; the 2nd and 3rd property belowcan be proved rigorously usingL'Hôpital's rule:

Large powers dominate small powers

[edit]

Forb>a0{\displaystyle b>a\geq 0}, thenna=O(nb).{\displaystyle n^{a}=O(n^{b}).}

Powers dominate logarithms

[edit]

For any positivea,b,{\displaystyle a,b,}(logn)a=Oa,b(nb),{\displaystyle (\log n)^{a}=O_{a,b}(n^{b}),}no matter how largea{\displaystyle a} is and how smallb{\displaystyle b} is. Here, the implied constant dependson botha{\displaystyle a} andb{\displaystyle b}.

Exponentials dominate powers

[edit]

For any positivea,b,{\displaystyle a,b,}na=Oa,b(ebn),{\displaystyle n^{a}=O_{a,b}(e^{bn}),}no matter how largea{\displaystyle a} is and how smallb{\displaystyle b} is.

A function that grows faster thannc{\displaystyle n^{c}} for anyc{\displaystyle c} is calledsuperpolynomial. One that grows more slowly than any exponential function of the formcn{\displaystyle c^{n}} withc>1{\displaystyle c>1} is calledsubexponential. An algorithm can require time that is both superpolynomial and subexponential; examples of this include the fastest known algorithms forinteger factorization and the functionnlogn{\displaystyle n^{\log n}}.

We may ignore any powers ofn{\displaystyle n} inside of the logarithms. For any positivec{\displaystyle c}, the notationO(logn){\displaystyle O(\log n)} means exactly the same thing asO(log(nc)){\displaystyle O(\log(n^{c}))}, sincelog(nc)=clogn{\displaystyle \log(n^{c})=c\log n}. Similarly, logs with different constant bases are equivalent with respect to Big O notation. On the other hand, exponentials with different bases are not of the same order. For example,2n{\displaystyle 2^{n}} and3n{\displaystyle 3^{n}} are not of the same order.

More complicated expressions

[edit]

In more complicated usage,O(){\displaystyle O(\cdot )} can appear in different places in an equation, even several times on each side. For example, the following are true forn{\displaystyle n} a positive integer:(n+1)2=n2+O(n),(n+O(n1/2))(n+O(logn))2=n3+O(n5/2),nO(1)=O(en).{\displaystyle {\begin{aligned}(n+1)^{2}&=n^{2}+O(n),\\(n+O(n^{1/2}))\cdot (n+O(\log n))^{2}&=n^{3}+O(n^{5/2}),\\n^{O(1)}&=O(e^{n}).\end{aligned}}}The meaning of such statements is as follows: forany functions which satisfy eachO(){\displaystyle O(\cdot )} on the left side, there aresome functions satisfying eachO(){\displaystyle O(\cdot )} on the right side, such that substituting all these functions into the equation makes the two sides equal. For example, the third equation above means: "For any function satisfyingf(n)=O(1){\displaystyle f(n)=O(1)}, there is some functiong(n)=O(en){\displaystyle g(n)=O(e^{n})} such thatnf(n)=g(n){\displaystyle n^{f(n)}=g(n)}". The implied constant in the statement "g(n)=O(en){\displaystyle g(n)=O(e^{n})}" maydepend on the implied constant in the expression"f(n)=O(1){\displaystyle f(n)=O(1)}".

Some further examples:f=O(g)abf=O(abg)f(x)=g(x)+O(1)ef(x)=O(eg(x))(1+O(1/x))O(x)=O(1) for x>0sinx=O(|x|) for all real x.{\displaystyle {\begin{aligned}f=O(g)\;&\Rightarrow \;\int _{a}^{b}f=O{\bigg (}\int _{a}^{b}g{\bigg )}\\f(x)=g(x)+O(1)\;&\Rightarrow \;e^{f(x)}=O(e^{g(x)})\\(1+O(1/x))^{O(x)}&=O(1)\quad {\text{ for }}x>0\\\sin x&=O(|x|)\quad {\text{ for all real }}x.\end{aligned}}}

Vinogradov's ≫ and Knuth's big Ω

[edit]

Whenf,g{\displaystyle f,g} are both positive functions,Vinogradov[6] introduced the notationf(x)g(x){\displaystyle f(x)\gg g(x)}, which means the same asg(x)=O(f(x)){\displaystyle g(x)=O(f(x))}. Vinogradov's two notations enjoy visual symmetry, asfor positive functionsf,g{\displaystyle f,g}, we havef(x)g(x)g(x)f(x).{\displaystyle f(x)\ll g(x)\Longleftrightarrow g(x)\gg f(x).}

In 1976,Donald Knuth[7]defined

f(x)=Ω(g(x))g(x)=O(f(x)){\displaystyle f(x)=\Omega (g(x))\Longleftrightarrow g(x)=O(f(x))}

which has the same meaning as Vinogradov'sf(x)g(x){\displaystyle f(x)\gg g(x)}.

Much earlier, Hardy and Littlewood definedΩ{\displaystyle \Omega }differently, but this it seldom used anymore (Ivič's book[9] being one exception).Justifying his use of theΩ{\displaystyle \Omega }-symbol to describe a stronger property,[7] Knuth wrote: "For all the applications I have seen so far in computer science, a stronger requirement ... is much more appropriate". Knuth further wrote, "Although I have changed Hardy and Littlewood's definition ofΩ{\displaystyle \Omega }, I feel justified in doing so because their definition is by no means in wide use, and because there are other ways to say what they want to say in the comparatively rare cases when their definition applies."[7]

Indeed, Knuth's bigΩ{\displaystyle \Omega } enjoys much more widespread use today than the Hardy–Littlewood bigΩ{\displaystyle \Omega }, being a common featurein computer science and combinatorics.

Hardy's ≍ and Knuth's big Θ

[edit]

In analytic number theory,[10] thenotationf(x)g(x){\displaystyle f(x)\asymp g(x)} means bothf(x)=O(g(x)){\displaystyle f(x)=O(g(x))} andg(x)=O(f(x)){\displaystyle g(x)=O(f(x))}. This notation is originally due to Hardy.[5] Knuth's notation for the same notion isf(x)=Θ(g(x)){\displaystyle f(x)=\Theta (g(x))}.[7] Roughly speaking, these statements assert thatf(x){\displaystyle f(x)} andg(x){\displaystyle g(x)} have thesame order. These notations mean that there are positive constantsM,N{\displaystyle M,N}so thatNg(x)f(x)Mg(x){\displaystyle Ng(x)\leq f(x)\leq Mg(x)}for allx{\displaystyle x} in the common domain off,g{\displaystyle f,g}. When the functions are defined on the positive integers or positive real numbers, as with big O, writers oftentimes interpret statementsf(x)=Ω(g(x)){\displaystyle f(x)=\Omega (g(x))} andf(x)=Θ(g(x)){\displaystyle f(x)=\Theta (g(x))} as holding for all sufficiently largex{\displaystyle x}, that is, for allx{\displaystyle x} beyond some pointx0{\displaystyle x_{0}}. Sometimes thisis indicated by appendingx{\displaystyle x\to \infty } to the statement. For example,2n210n=Θ(n2){\displaystyle 2n^{2}-10n=\Theta (n^{2})}is true for the domainn6{\displaystyle n\geq 6} but false if thedomain is all positive integers, since the function is zero atn=5{\displaystyle n=5}.

Further examples

[edit]

n3+20n2+n+12n3 for all n1.{\displaystyle n^{3}+20n^{2}+n+12\asymp n^{3}\quad {\text{ for all }}n\geq 1.}

(1+x)8=x8+Θ(x7) for all x1.{\displaystyle (1+x)^{8}=x^{8}+\Theta (x^{7})\quad {\text{ for all }}x\geq 1.}

The notation

f(n)=eΩ(n) for all n1,{\displaystyle f(n)=e^{\Omega (n)}\quad {\text{ for all }}n\geq 1,}means that there is a positive constantM{\displaystyle M}so thatf(n)eMn{\displaystyle f(n)\geq e^{Mn}} for alln1{\displaystyle n\geq 1}. By contrast,f(n)=eO(n) for all n1,{\displaystyle f(n)=e^{-O(n)}\quad {\text{ for all }}n\geq 1,}means that there is a positive constantM{\displaystyle M}so thatf(n)eMn{\displaystyle f(n)\geq e^{-Mn}} for alln1{\displaystyle n\geq 1} andf(n)=eΘ(n) for all n1,{\displaystyle f(n)=e^{\Theta (n)}\quad {\text{ for all }}n\geq 1,}means that there are positive constantsM,N{\displaystyle M,N}so thateMnf(n)eNn{\displaystyle e^{Mn}\leq f(n)\leq e^{Nn}} for alln1{\displaystyle n\geq 1}.

For any domainD{\displaystyle D},f(x)=g(x)+O(1)ef(x)eg(x),{\displaystyle f(x)=g(x)+O(1)\Longleftrightarrow e^{f(x)}\asymp e^{g(x)},}each statement being for allx{\displaystyle x} inD{\displaystyle D}.

Orders of common functions

[edit]
Further information:Time complexity § Table of common time complexities
"O(1)" redirects here. For the quasicoherent sheaf, seeProj construction § The twisting sheaf of Serre.

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 andn increases without bound. The slower-growing functions are generally listed first.

NotationNameExample
O(1){\displaystyle O(1)}constantFinding the median value for a sorted array of numbers; Calculating(1)n{\displaystyle (-1)^{n}}; Using a constant-sizelookup table
O(α(n)){\displaystyle O(\alpha (n))}inverse Ackermann functionAmortized complexity per operation for theDisjoint-set data structure
O(loglogn){\displaystyle O(\log \log n)}double logarithmicAverage number of comparisons spent finding an item usinginterpolation search in a sorted array of uniformly distributed values
O(logn){\displaystyle O(\log n)}logarithmicFinding an item in a sorted array with abinary search or a balanced searchtree as well as all operations in abinomial heap
O((logn)c){\displaystyle O((\log n)^{c})}
c>1{\textstyle c>1}
polylogarithmicMatrix chain ordering can be solved in polylogarithmic time on aparallel random-access machine.
O(nc){\displaystyle O(n^{c})}
0<c<1{\textstyle 0<c<1}
fractional powerSearching in ak-d tree
O(n){\displaystyle O(n)}linearFinding an item in an unsorted list or in an unsorted array; adding twon-bit integers byripple carry
O(nlogn){\displaystyle O(n\log ^{*}n)}nlog-starnPerformingtriangulation of a simple polygon using Seidel's algorithm,[11] wherelog(n)={0,if n11+log(logn),if n>1{\displaystyle \log ^{*}(n)={\begin{cases}0,&{\text{if }}n\leq 1\\1+\log ^{*}(\log n),&{\text{if }}n>1\end{cases}}}
O(nlogn)=O(logn!){\displaystyle O(n\log n)=O(\log n!)}linearithmic, loglinear, quasilinear, or "nlogn{\displaystyle n\log n}"Performing afast Fourier transform; fastest possiblecomparison sort;heapsort andmerge sort
O(n2){\displaystyle O(n^{2})}quadraticMultiplying twon{\displaystyle n}-digit numbers byschoolbook multiplication; simple sorting algorithms, such asbubble sort,selection sort andinsertion sort; (worst-case) bound on some usually faster sorting algorithms such asquicksort,Shellsort, andtree sort
O(nc){\displaystyle O(n^{c})}polynomial or algebraicTree-adjoining grammar parsing; maximummatching forbipartite graphs; finding thedeterminant withLU decomposition
Ln[α,c]=e(c+o(1))(lnn)α(lnlnn)1α{\displaystyle L_{n}[\alpha ,c]=e^{(c+o(1))(\ln n)^{\alpha }(\ln \ln n)^{1-\alpha }}}
0<α<1{\textstyle 0<\alpha <1}
L-notation orsub-exponentialFactoring a number using thequadratic sieve ornumber field sieve
O(cn){\displaystyle O(c^{n})}
c>1{\textstyle c>1}
exponentialFinding the (exact) solution to thetravelling salesman problem usingdynamic programming; determining if two logical statements are equivalent usingbrute-force search
O(n!){\displaystyle O(n!)}factorialSolving thetravelling salesman problem via brute-force search; generating all unrestricted permutations of aposet; finding thedeterminant withLaplace expansion; enumeratingall partitions of a set

The statementf(n)=O(n!){\displaystyle f(n)=O(n!)} is sometimes weakened tof(n)=O(nn){\displaystyle f(n)=O\left(n^{n}\right)} to derive simpler formulas for asymptotic complexity.In many of these examples, the running time isactuallyΘ(g(n)){\displaystyle \Theta (g(n))}, which conveys moreprecision.

Little-o notation

[edit]
"Little o" redirects here. For the baseball player, seeOmar Vizquel. For the Greek letter, seeOmicron.

For real or complex-valued functions of a real variablex{\displaystyle x} withg(x)>0{\displaystyle g(x)>0} forsufficiently largex{\displaystyle x}, one writes[2]

f(x)=o(g(x)) as x{\displaystyle f(x)=o(g(x))\quad {\text{ as }}x\to \infty }

iflimxf(x)g(x)=0.{\displaystyle \lim _{x\to \infty }{\frac {f(x)}{g(x)}}=0.}That is, for every positive constantε there exists a constantx0{\displaystyle x_{0}} such that

|f(x)|εg(x) for all xx0.{\displaystyle |f(x)|\leq \varepsilon g(x)\quad {\text{ for all }}x\geq x_{0}.}

Intuitively, this means thatg(x){\displaystyle g(x)} grows much faster thanf(x){\displaystyle f(x)}, or equivalentlyf(x){\displaystyle f(x)} grows much slower thang(x){\displaystyle g(x)}.For example, one has

200x=o(x2){\displaystyle 200x=o(x^{2})} and1/x=o(1),{\displaystyle 1/x=o(1),}     both asx.{\displaystyle x\to \infty .}

When one is interested in the behavior of a function for large values ofx{\displaystyle x}, little-o notation makes astronger statement than the corresponding big-O notation: every function that is little-o ofg{\displaystyle g} is also big-O ofg{\displaystyle g} on some interval[a,){\displaystyle [a,\infty )}, but not every function that is big-O ofg{\displaystyle g} is little-o ofg{\displaystyle g}. For example,2x2=O(x2){\displaystyle 2x^{2}=O(x^{2})} but2x2o(x2){\displaystyle 2x^{2}\neq o(x^{2})} forx1{\displaystyle x\geq 1}.

Little-o respects a number of arithmetic operations. For example,

ifc{\displaystyle c} is a nonzero constant andf=o(g){\displaystyle f=o(g)} thencf=o(g){\displaystyle c\cdot f=o(g)}, and
iff=o(F){\displaystyle f=o(F)} andg=o(G){\displaystyle g=o(G)} thenfg=o(FG).{\displaystyle f\cdot g=o(F\cdot G).}
iff=o(F){\displaystyle f=o(F)} andg=o(G){\displaystyle g=o(G)} thenf+g=o(F+G){\displaystyle f+g=o(F+G)}

It also satisfies atransitivity relation:

iff=o(g){\displaystyle f=o(g)} andg=o(h){\displaystyle g=o(h)} thenf=o(h).{\displaystyle f=o(h).}

Little-o can also be generalized to the finite case:[2]f(x)=o(g(x)) as xx0{\displaystyle f(x)=o(g(x))\quad {\text{ as }}x\to x_{0}} iflimxx0f(x)g(x)=0.{\displaystyle \lim _{x\to x_{0}}{\frac {f(x)}{g(x)}}=0.}In other words,f(x)=α(x)g(x){\displaystyle f(x)=\alpha (x)g(x)} for someα(x){\displaystyle \alpha (x)} withlimxx0α(x)=0{\displaystyle \lim _{x\to x_{0}}\alpha (x)=0}.

This definition is especially useful in the computation oflimits usingTaylor series. For example:

sinx=xx33!+=x+o(x2) as x0{\displaystyle \sin x=x-{\frac {x^{3}}{3!}}+\ldots =x+o(x^{2}){\text{ as }}x\to 0}, solimx0sinxx=limx0x+o(x2)x=limx01+o(x)=1{\displaystyle \lim _{x\to 0}{\frac {\sin x}{x}}=\lim _{x\to 0}{\frac {x+o(x^{2})}{x}}=\lim _{x\to 0}1+o(x)=1}

Asymptotic notation

[edit]

A relation related to little-o is theasymptotic notation{\displaystyle \sim }. For real valued functionsf,g{\displaystyle f,g}, the expressionf(x)g(x) as x{\displaystyle f(x)\sim g(x)\quad {\text{ as }}x\to \infty }meanslimxf(x)g(x)=1.{\displaystyle \lim _{x\to \infty }{\frac {f(x)}{g(x)}}=1.}One can connect this to little-o by observing thatf(x)g(x){\displaystyle f(x)\sim g(x)} is also equivalent tof(x)=(1+o(1))g(x){\displaystyle f(x)=(1+o(1))g(x)}. Hereo(1){\displaystyle o(1)} refers to a function tending to zero asx{\displaystyle x\to \infty }. One reads this as"f(x){\displaystyle f(x)} isasymptotic tog(x){\displaystyle g(x)}". For nonzero functions on the same (finite or infinite) domain,{\displaystyle \sim } forms anequivalence relation.

One of the most famous theorems using the notation{\displaystyle \sim } isStirling's formulan!(ne)n2πn as n.{\displaystyle n!\sim {\bigg (}{\frac {n}{e}}{\bigg )}^{n}{\sqrt {2\pi n}}\quad {\text{ as }}n\to \infty .}In number theory, the famousprime number theorem states thatπ(x)xlogx as x,{\displaystyle \pi (x)\sim {\frac {x}{\log x}}\quad {\text{ as }}x\to \infty ,}whereπ(x){\displaystyle \pi (x)} is the number of primes whichare at mostx{\displaystyle x} andlog{\displaystyle \log } is thenatural logarithm ofx{\displaystyle x}.

As with little-o, there is a version with finite limits (two-sided orone-sided) as well, for examplesinxx as x0.{\displaystyle \sin x\sim x\quad {\text{ as }}x\to 0.}

Further examples:xa=oa,b(ebx) as x, for any positive constants a,b,{\displaystyle x^{a}=o_{a,b}(e^{bx})\quad {\text{ as }}x\to \infty ,{\text{ for any positive constants }}a,b,}f(x)=g(x)+o(1)ef(x)eg(x)(x).{\displaystyle f(x)=g(x)+o(1)\quad \Longleftrightarrow \quad e^{f(x)}\sim e^{g(x)}\quad (x\to \infty ).}n=11ns1s1(x).{\displaystyle \sum _{n=1}^{\infty }{\frac {1}{n^{s}}}\sim {\frac {1}{s-1}}\quad (x\to \infty ).}The last asymptotic is a basic property of theRiemann zeta function.

Knuth's little 𝜔

[edit]

For eventually positive, real valued functionsf,g,{\displaystyle f,g,} the notationf(x)=ω(g(x)) as x{\displaystyle f(x)=\omega (g(x))\quad {\text{ as }}x\to \infty }meanslimxf(x)g(x)=.{\displaystyle \lim _{x\to \infty }{\frac {f(x)}{g(x)}}=\infty .}In other words,g(x)=o(f(x)){\displaystyle g(x)=o(f(x))}.Roughly speaking, this means thatf(x){\displaystyle f(x)}grows much faster than doesg(x){\displaystyle g(x)}.

The Hardy–Littlewood Ω notation

[edit]

In 1914G.H. Hardy andJ.E. Littlewood introduced the new symbol Ω,{\displaystyle \ \Omega ,}[12] which is defined as follows:

f(x)=Ω( g(x) ){\displaystyle f(x)=\Omega {\bigl (}\ g(x)\ {\bigr )}\quad } asx{\displaystyle \quad x\to \infty \quad } iflim supx | f(x) g(x)|>0 .{\displaystyle \quad \limsup _{x\to \infty }\ \left|{\frac {\ f(x)\ }{g(x)}}\right|>0~.}

Thus f(x)=Ω( g(x) ) {\displaystyle ~f(x)=\Omega {\bigl (}\ g(x)\ {\bigr )}~} is the negation of f(x)=o( g(x) ) .{\displaystyle ~f(x)=o{\bigl (}\ g(x)\ {\bigr )}~.}

In 1916 the same authors introduced the two new symbols ΩR {\displaystyle \ \Omega _{R}\ } and ΩL ,{\displaystyle \ \Omega _{L}\ ,} defined as:[13]

f(x)=ΩR( g(x) ){\displaystyle f(x)=\Omega _{R}{\bigl (}\ g(x)\ {\bigr )}\quad } asx{\displaystyle \quad x\to \infty \quad } iflim supx  f(x) g(x)>0 ;{\displaystyle \quad \limsup _{x\to \infty }\ {\frac {\ f(x)\ }{g(x)}}>0\ ;}
f(x)=ΩL( g(x) ){\displaystyle f(x)=\Omega _{L}{\bigl (}\ g(x)\ {\bigr )}\quad } asx{\displaystyle \quad x\to \infty \quad } if lim infx  f(x) g(x)<0 .{\displaystyle \quad ~\liminf _{x\to \infty }\ {\frac {\ f(x)\ }{g(x)}}<0~.}

These symbols were used byE. Landau, with the same meanings, in 1924.[14] Authors that followed Landau, however, use a different notation for the same definitions:[9] The symbol ΩR {\displaystyle \ \Omega _{R}\ } has been replaced by the current notation Ω+ {\displaystyle \ \Omega _{+}\ } with the same definition, and ΩL {\displaystyle \ \Omega _{L}\ } became Ω .{\displaystyle \ \Omega _{-}~.}

These three symbols Ω ,Ω+ ,Ω ,{\displaystyle \ \Omega \ ,\Omega _{+}\ ,\Omega _{-}\ ,} as well as f(x)=Ω±( g(x) ) {\displaystyle \ f(x)=\Omega _{\pm }{\bigl (}\ g(x)\ {\bigr )}\ } (meaning that f(x)=Ω+( g(x) ) {\displaystyle \ f(x)=\Omega _{+}{\bigl (}\ g(x)\ {\bigr )}\ } and f(x)=Ω( g(x) ) {\displaystyle \ f(x)=\Omega _{-}{\bigl (}\ g(x)\ {\bigr )}\ } are both satisfied), are now currently used inanalytic number theory.[9][10]

Simple examples

[edit]

We have

sinx=Ω(1){\displaystyle \sin x=\Omega (1)\quad } asx ,{\displaystyle \quad x\to \infty \ ,}

and more precisely

sinx=Ω±(1){\displaystyle \sin x=\Omega _{\pm }(1)\quad } asx, {\displaystyle \quad x\to \infty ,~}

whereΩ±{\displaystyle \Omega _{\pm }} means that the left side is bothΩ+(1){\displaystyle \Omega _{+}(1)} andΩ(1){\displaystyle \Omega _{-}(1)},

We have

1+sinx=Ω(1){\displaystyle 1+\sin x=\Omega (1)\quad } asx ,{\displaystyle \quad x\to \infty \ ,}

and more precisely

1+sinx=Ω+(1){\displaystyle 1+\sin x=\Omega _{+}(1)\quad } asx ;{\displaystyle \quad x\to \infty \ ;}

however

1+sinxΩ(1){\displaystyle 1+\sin x\neq \Omega _{-}(1)\quad } asx .{\displaystyle \quad x\to \infty ~.}

Family of Bachmann–Landau notations

[edit]

For understanding the formal definitions, consult thelist of logic symbols used in mathematics.

NotationName[7]DescriptionFormal definitionCompact definition

[4][5][7][12][15][16]

f(n)=o(g(n)){\displaystyle f(n)=o(g(n))}Small O; Small Oh; Little O; Little Ohf is dominated byg asymptotically (for any constant factork{\displaystyle k})k>0n0n>n0:|f(n)|kg(n){\displaystyle \forall k>0\,\exists n_{0}\,\forall n>n_{0}\colon |f(n)|\leq k\,g(n)}limnf(n)g(n)=0{\displaystyle \lim _{n\to \infty }{\frac {f(n)}{g(n)}}=0}
f(n)=O(g(n)){\displaystyle f(n)=O(g(n))} or

f(n)g(n){\displaystyle f(n)\ll g(n)} (Vinogradov's notation)

Big O; Big Oh; Big Omicron|f|{\displaystyle |f|} is bounded above byg (up to constant factork{\displaystyle k})k>0nD:|f(n)|kg(n){\displaystyle \exists k>0\,\forall n\in D\colon |f(n)|\leq k\,g(n)}supnD|f(n)|g(n)<{\displaystyle \sup _{n\in D}{\frac {\left|f(n)\right|}{g(n)}}<\infty }
f(n)g(n){\displaystyle f(n)\asymp g(n)} (Hardy's notation) orf(n)=Θ(g(n)){\displaystyle f(n)=\Theta (g(n))} (Knuth notation)Of the same order as (Hardy); Big Theta (Knuth)f is bounded byg both above (with constant factork2{\displaystyle k_{2}}) and below (with constant factork1{\displaystyle k_{1}})k1>0k2>0nD:{\displaystyle \exists k_{1}>0\,\exists k_{2}>0\,\forall n\in D\colon }k1g(n)f(n)k2g(n){\displaystyle k_{1}\,g(n)\leq f(n)\leq k_{2}\,g(n)}f(n)=O(g(n)){\displaystyle f(n)=O(g(n))} andg(n)=O(f(n)){\displaystyle g(n)=O(f(n))}
f(n)g(n){\displaystyle f(n)\sim g(n)} asna{\displaystyle n\to a}, wherea{\displaystyle a} is finite,{\displaystyle \infty }

or{\displaystyle -\infty }

Asymptotic equivalencef is equal togasymptoticallyε>0n0n>n0:|f(n)g(n)1|<ε{\displaystyle \forall \varepsilon >0\,\exists n_{0}\,\forall n>n_{0}\colon \left|{\frac {f(n)}{g(n)}}-1\right|<\varepsilon } (in the casea={\displaystyle a=\infty })limnaf(n)g(n)=1{\displaystyle \lim _{n\to a}{\frac {f(n)}{g(n)}}=1}
f(n)=Ω(g(n)){\displaystyle f(n)=\Omega (g(n))} (Knuth's notation), or

f(n)g(n){\displaystyle f(n)\gg g(n)} (Vinogradov's notation)

Big Omega in complexity theory (Knuth)f is bounded below byg, up to a constant factork>0nD:f(n)kg(n){\displaystyle \exists k>0\,\forall n\in D\colon f(n)\geq k\,g(n)}infnDf(n)g(n)>0{\displaystyle \inf _{n\in D}{\frac {f(n)}{g(n)}}>0}
f(n)=ω(g(n)){\displaystyle f(n)=\omega (g(n))} asna{\displaystyle n\to a},

wherea{\displaystyle a} can be finite,{\displaystyle \infty } or{\displaystyle -\infty }

Small Omega; Little Omegaf dominatesg asymptoticallyk>0n0n>n0:f(n)>kg(n){\displaystyle \forall k>0\,\exists n_{0}\,\forall n>n_{0}\colon f(n)>k\,g(n)} (fora={\displaystyle a=\infty })limnaf(n)g(n)={\displaystyle \lim _{n\to a}{\frac {f(n)}{g(n)}}=\infty }
f(n)=Ω(g(n)){\displaystyle f(n)=\Omega (g(n))}Big Omega in number theory (Hardy–Littlewood)|f|{\displaystyle |f|} is not dominated byg asymptoticallyk>0n0n>n0:|f(n)|kg(n){\displaystyle \exists k>0\,\forall n_{0}\,\exists n>n_{0}\colon |f(n)|\geq k\,g(n)}lim supn|f(n)|g(n)>0{\displaystyle \limsup _{n\to \infty }{\frac {\left|f(n)\right|}{g(n)}}>0}

The limit definitions assumeg(n)>0{\displaystyle g(n)>0} forn{\displaystyle n} in a neighborhood of the limit; when thelimit is{\displaystyle \infty }, this means thatg(n)>0{\displaystyle g(n)>0} for sufficiently largen{\displaystyle n}.

Computer science and combinatorics use the bigO{\displaystyle O}, big ThetaΘ{\displaystyle \Theta }, littleo{\displaystyle o}, little omegaω{\displaystyle \omega } and Knuth's big OmegaΩ{\displaystyle \Omega } notations.[3] Analytic number theory often uses the bigO{\displaystyle O}, smallo{\displaystyle o}, Hardy's{\displaystyle \asymp },Hardy–Littlewood's big OmegaΩ{\displaystyle \Omega } (with or without the +, − or ± subscripts), Vinogradov's{\displaystyle \ll } and{\displaystyle \gg } notations and{\displaystyle \sim } notations.[9][4][10] The small omegaω{\displaystyle \omega } notation is not used as often in analysis or in number theory.[17]

Quality of approximations using different notation

[edit]
Further information:Analysis of algorithms

Informally, especially in computer science, the bigO{\displaystyle O} notation often can be used somewhat differently to describe an asymptotictight bound where using big ThetaΘ{\displaystyle \Theta } notation might be more factually appropriate in a given context.[18]For example, when considering a functionT(n)=73n3+22n2+58{\displaystyle T(n)=73n^{3}+22n^{2}+58}, all of the following are generally acceptable, but tighter bounds (such as numbers 2,3 and 4 below) are usually strongly preferred over looser bounds (such as number 1 below).

  1. T(n)=O(n100){\displaystyle T(n)=O(n^{100})}
  2. T(n)=O(n3){\displaystyle T(n)=O(n^{3})}
  3. T(n)=Θ(n3){\displaystyle T(n)=\Theta (n^{3})}
  4. T(n)73n3{\displaystyle T(n)\sim 73n^{3}} asn{\displaystyle n\to \infty }.

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, ifT(n){\displaystyle T(n)} represents the running time of a newly developed algorithm for input sizen{\displaystyle n}, the inventors and users of the algorithm might be more inclined to put an upper bound on how long it will take to run without making an explicit statement about the lower bound or asymptotic behavior.

Extensions to the Bachmann–Landau notations

[edit]

Another notation sometimes used in computer science isO~{\displaystyle {\tilde {O}}} (readsoft-O), which hides polylogarithmic factors. There are two definitions in use: some authors usef(n)=O~(g(n)){\displaystyle f(n)={\tilde {O}}(g(n))} as shorthand forf(n)=O(g(n)logkn){\displaystyle f(n)=O(g(n)\log ^{k}n)} for somek{\displaystyle k}[citation needed], while others use it as shorthand forf(n)=O(g(n)logkg(n)){\displaystyle f(n)=O(g(n)\log ^{k}g(n))}.[19]Wheng(n){\displaystyle g(n)} is polynomial inn{\displaystyle n}, there is no difference; however, the latter definition allows one to say, e.g. thatn2n=O~(2n){\displaystyle n2^{n}={\tilde {O}}(2^{n})} while the former definition allows forlogkn=O~(1){\displaystyle \log ^{k}n={\tilde {O}}(1)} for any constantk{\displaystyle k}. Some authors writeO* for the same purpose as the latter definition.[20] Essentially, it is bigO notation, ignoringlogarithmic factors because thegrowth-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 (sincelogkn=o(nε){\displaystyle \log ^{k}n=o(n^{\varepsilon })}for any constantk{\displaystyle k} and anyε>0.{\displaystyle \varepsilon >0.}

Also, theL notation, defined as

Ln[α,c]=e(c+o(1))(lnn)α(lnlnn)1α,{\displaystyle L_{n}[\alpha ,c]=e^{(c+o(1))(\ln n)^{\alpha }(\ln \ln n)^{1-\alpha }},}

is convenient for functions that are betweenpolynomial andexponential in terms oflogn{\displaystyle \log n}.

Generalizations and related usages

[edit]

The generalization to functions taking values in anynormed vector space is straightforward (replacing absolute values by norms), wheref{\displaystyle f} andg{\displaystyle g} need not take their values in the same space. A generalization to functionsg{\displaystyle g} taking values in anytopological group is also possible[citation needed].The "limiting process"xx0{\displaystyle x\to x_{0}} can also be generalized by introducing an arbitraryfilter base, i.e. to directednetsf{\displaystyle f} andg{\displaystyle g}. Theo{\displaystyle o} notation can be used to definederivatives anddifferentiability in quite general spaces, and also (asymptotical) equivalence of functions,

fg(fg)o(g){\displaystyle f\sim g\iff (f-g)\in o(g)}

which is anequivalence relation and a more restrictive notion than the relationship "f{\displaystyle f} isΘ(g){\displaystyle \Theta (g)}" from above. (It reduces tolimf/g=1{\displaystyle \lim f/g=1} iff{\displaystyle f} andg{\displaystyle g} are positive real valued functions.) For example,2x=Θ(x){\displaystyle 2x=\Theta (x)} is, but2xxo(x){\displaystyle 2x-x\neq o(x)}.

History

[edit]

We sketch the history of the Bois-Reymond, Bachmann–Landau, Hardy, Vinogradov and Knuth notations.

In 1870, Paul du Bois-Reymond[21]definedf(x)ϕ(x){\displaystyle f(x)\succ \phi (x)},f(x)ϕ(x){\displaystyle f(x)\sim \phi (x)} andf(x)ϕ(x){\displaystyle f(x)\prec \phi (x)}to mean, respectively,limxf(x)ϕ(x)=,limxf(x)ϕ(x)>0,limxf(x)ϕ(x)=0.{\displaystyle \lim _{x\to \infty }{\frac {f(x)}{\phi (x)}}=\infty ,\quad \lim _{x\to \infty }{\frac {f(x)}{\phi (x)}}>0,\quad \lim _{x\to \infty }{\frac {f(x)}{\phi (x)}}=0.}These were not widely adopted and are not used today.The first and third enjoy a symmetry:f(x)ϕ(x){\displaystyle f(x)\prec \phi (x)} means the same asϕ(x)f(x){\displaystyle \phi (x)\succ f(x)}. Later, Landau adopted{\displaystyle \sim } in the narrowersense that the limit off(x)/ϕ(x){\displaystyle f(x)/\phi (x)} equals 1. None of these notations is in use today.

The symbol O was first introduced by number theoristPaul Bachmann in 1894, in the second volume of his bookAnalytische Zahlentheorie ("analytic number theory").[1] The number theoristEdmund Landau adopted it, and was thus inspired to introduce in 1909 the notation o;[2] hence both are now called Landau symbols. These notations were used in applied mathematics during the 1950s for asymptotic analysis.[22]The symbolΩ{\displaystyle \Omega } (in the sense "is not ano of") was introduced in 1914 by Hardy and Littlewood.[12] Hardy and Littlewood also introduced in 1916 the symbolsΩR{\displaystyle \Omega _{R}} ("right") andΩL{\displaystyle \Omega _{L}} ("left"),.[13] This notationΩ{\displaystyle \Omega } became somewhat commonly used in number theory at least since the 1950s.[23]

The symbol{\displaystyle \sim }, although it had been used before with different meanings,[21] was given its modern definition by Landau in 1909[2] and by Hardy in 1910.[5] Just above on the same page of his tract Hardy defined the symbol{\displaystyle \asymp }, wheref(x)g(x){\displaystyle f(x)\asymp g(x)} means that bothf(x)=O(g(x)){\displaystyle f(x)=O(g(x))} andg(x)=O(f(x)){\displaystyle g(x)=O(f(x))} are satisfied. The notation is still currently used in analytic number theory.[24][10] In his tract Hardy also proposed the symbol{\displaystyle \mathbin {\,\asymp \;\;\;\;\!\!\!\!\!\!\!\!\!\!\!\!\!-} }, wherefg{\displaystyle f\mathbin {\,\asymp \;\;\;\;\!\!\!\!\!\!\!\!\!\!\!\!\!-} g} means thatfKg{\displaystyle f\sim Kg} for some constantK0{\displaystyle K\not =0} (this corresponds to Bois-Reymond's notationfg{\displaystyle f\sim g}).

In the 1930s, Vinogradov[6] popularized the notationf(x)g(x){\displaystyle f(x)\ll g(x)}andg(x)f(x){\displaystyle g(x)\gg f(x)}, both of which meanf(x)=O(g(x)){\displaystyle f(x)=O(g(x))}. This notation became standard in analytic number theory.[4]

In the 1970s the big O was popularized in computer science byDonald Knuth, who proposed the different notationf(x)=Θ(g(x)){\displaystyle f(x)=\Theta (g(x))} for Hardy'sf(x)g(x){\displaystyle f(x)\asymp g(x)}, and proposed a different definition for the Hardy and Littlewood Omega notation.[7]

Hardy introduced the symbols{\displaystyle \preccurlyeq } and advocated for Boid-Reymond's{\displaystyle \prec } (as well as the already mentioned other symbols) in his 1910 tract "Orders of Infinity",[5] but made use of them only in three papers (1910–1913). In his nearly 400 remaining papers and books he consistently used the Landau symbols O and o.[25]Hardy's symbols{\displaystyle \preccurlyeq } and{\displaystyle \mathbin {\,\asymp \;\;\;\;\!\!\!\!\!\!\!\!\!\!\!\!\!-} } are not used anymore.

Matters of notation

[edit]

Arrows

[edit]

In mathematics, an expression such asx{\displaystyle x\to \infty } indicates the presence of alimit. In big-O notation and related notationsΩ,Θ,,,{\displaystyle \Omega ,\Theta ,\gg ,\ll ,\asymp }, there is no implied limit, in contrast withlittle-o,{\displaystyle \sim } andω{\displaystyle \omega } notations.Notation such asf(x)=O(g(x))(x){\displaystyle f(x)=O(g(x))\;\;(x\to \infty )} can be considered anabuse of notation.

Equals sign

[edit]

Some considerf(x)=O(g(x)){\displaystyle f(x)=O(g(x))} to also be anabuse of notation, since the use of the equals sign could be misleading as it suggests a symmetry that this statement does not have. Asde Bruijn says,O(x)=O(x2){\displaystyle O(x)=O(x^{2})} is true butO(x2)=O(x){\displaystyle O(x^{2})=O(x)} is not.[26]Knuth describes such statements as "one-way equalities", since if the sides could be reversed, "we could deduce ridiculous things liken=n2{\displaystyle n=n^{2}} from the identitiesn=O(n2){\displaystyle n=O(n^{2})} andn2=O(n2){\displaystyle n^{2}=O(n^{2})}.[27] In another letter, Knuth also pointed out that[28]

the equality sign is not symmetric with respect to such notations [as, in this notation,] mathematicians customarily use the '=' sign as they use the word 'is' in English: Aristotle is a man, but a man isn't necessarily Aristotle.

For these reasons, some advocate for usingset notation and writef(x)O(g(x)){\displaystyle f(x)\in O(g(x))},read as "f(x){\displaystyle f(x)}is an element ofO(g(x)){\displaystyle O(g(x))}", or "f(x){\displaystyle f(x)} is in the setO(g(x)){\displaystyle O(g(x))}" – thinking ofO(g(x)){\displaystyle O(g(x))} as the class of all functionsh(x){\displaystyle h(x)} such thath(x)=O(g(x)){\displaystyle h(x)=O(g(x))}.[27] However, the use of the equals sign is customary.[26][27]and is more convenient in more complex expressions of the formf(x)=g(x)+O(h(x))=O(k(x)).{\displaystyle f(x)=g(x)+O(h(x))=O(k(x)).}

The Vinogradov notations{\displaystyle \ll } and{\displaystyle \gg }, which are widely used in number theory[9][4][10]do not suffer from this defect, as they more clearly indicate that big-O indicates aninequality rather than anequality. They also enjoy a symmetry that big-O notation lacks:f(x)g(x){\displaystyle f(x)\ll g(x)} means the same asg(x)f(x){\displaystyle g(x)\gg f(x)}. In combinatorics and computer science, these notationsare rarely seen.[3]

Typesetting

[edit]

Big O is typeset as an italicized uppercase "O", as in the following example:O(n2){\displaystyle O(n^{2})}.[29][30] InTeX, it is produced by simply typing 'O' inside math mode. Unlike Greek-named Bachmann–Landau notations, it needs no special symbol. However, some authors use the calligraphic variantO{\displaystyle {\mathcal {O}}} instead.[31][32]

The big-O originally stands for "order of" ("Ordnung", Bachmann 1894), and is thus a Latin letter. Neither Bachmann nor Landau ever call it "Omicron". The symbol was much later on (1976) viewed by Knuth as a capitalomicron,[7] probably in reference to his definition of the symbolOmega. The digitzero should not be used.

See also

[edit]

References and notes

[edit]
  1. ^abBachmann, Paul (1894).Analytische Zahlentheorie [Analytic Number Theory] (in German). Vol. 2. Leipzig: Teubner.
  2. ^abcdeLandau, Edmund (1909).Handbuch der Lehre von der Verteilung der Primzahlen [Handbook on the theory of the distribution of the primes] (in German). Leipzig: B.G. Teubner; reprinted as two volumes in one by Chelsea, 1974, with an appendix by Dr. Paul T. Bateman. pp. 59–63.
  3. ^abcdefCormen, Thomas H.;Leiserson, Charles E.;Rivest, Ronald L.;Stein, Clifford (2022). "Characterizing running times".Introduction to Algorithms (4th ed.). MIT Press and McGraw-Hill.ISBN 978-0-262-53091-0.
  4. ^abcdefIwaniec, Henryk; Kowalski, Emmanuel (2004).Analytic Number Theory. American Mathematical Society.
  5. ^abcdeHardy, G. H. (1910).Orders of Infinity: The 'Infinitärcalcül' of Paul du Bois-Reymond.Cambridge University Press. p. 2.
  6. ^abcdVinogradov, Matveevič (1934). "A new estimate forG(n) in Waring's problem".Doklady Akademii Nauk SSSR (in Russian).5 (5–6):249–253.
    Translated in English in:
    Vinogradov, Matveevič (1985).Selected works / Ivan Matveevič Vinogradov; prepared by the Steklov Mathematical Institute of the Academy of Sciences of the USSR on the occasion of his 90th birthday. Springer-Verlag.
  7. ^abcdefghiKnuth, Donald (April–June 1976)."Big Omicron and big Omega and big Theta".SIGACT News.8 (2):18–24.doi:10.1145/1008328.1008329.S2CID 5230246.
  8. ^Sipser, Michael (2012).Introduction to the Theory of Computation (3 ed.). Boston, MA: PWS Publishin.
  9. ^abcdefIvić, A. (1985).The Riemann Zeta-Function. John Wiley & Sons. chapter 9.
  10. ^abcdefGérald Tenenbaum, Introduction to analytic and probabilistic number theory, « Notation », page xxiii. American Mathematical Society, Providence RI, 2015.
  11. ^Seidel, Raimund (1991), "A Simple and Fast Incremental Randomized Algorithm for Computing Trapezoidal Decompositions and for Triangulating Polygons",Computational Geometry,1:51–64,CiteSeerX 10.1.1.55.5877,doi:10.1016/0925-7721(91)90012-4
  12. ^abcHardy, G.H.;Littlewood, J.E. (1914)."Some problems of diophantine approximation:Part II. The trigonometrical series associated with the ellipticθ functions".Acta Mathematica.37: 225.doi:10.1007/BF02401834.Archived from the original on 2018-12-12. Retrieved2017-03-14.
  13. ^abHardy, G.H.;Littlewood, J.E. (1916). "Contribution to the theory of the Riemann zeta-function and the theory of the distribution of primes".Acta Mathematica.41:119–196.doi:10.1007/BF02422942.
  14. ^Landau, E. (1924). "Über die Anzahl der Gitterpunkte in gewissen Bereichen. IV" [On the number of grid points in known regions].Nachr. Gesell. Wiss. Gött. Math-phys. (in German):137–150.
  15. ^Balcázar, José L.; Gabarró, Joaquim."Nonuniform complexity classes specified by lower and upper bounds"(PDF).RAIRO – Theoretical Informatics and Applications – Informatique Théorique et Applications.23 (2): 180.ISSN 0988-3754.Archived(PDF) from the original on 14 March 2017. Retrieved14 March 2017 – via Numdam.
  16. ^Cucker, Felipe; Bürgisser, Peter (2013)."A.1 Big Oh, Little Oh, and Other Comparisons".Condition: The Geometry of Numerical Algorithms. Berlin, Heidelberg: Springer. pp. 467–468.doi:10.1007/978-3-642-38896-5.ISBN 978-3-642-38896-5.
  17. ^for example it is omitted in:Hildebrand, A.J."Asymptotic Notations"(PDF). Department of Mathematics.Asymptotic Methods in Analysis. Math 595, Fall 2009. Urbana, IL: University of Illinois.Archived(PDF) from the original on 14 March 2017. Retrieved14 March 2017.
  18. ^Cormen et al. 2022, p. 57.
  19. ^Cormen et al. 2022, p. 74–75.
  20. ^Andreas Björklund and Thore Husfeldt and Mikko Koivisto (2009)."Set partitioning via inclusion-exclusion"(PDF).SIAM Journal on Computing.39 (2):546–563.doi:10.1137/070683933.Archived(PDF) from the original on 2022-02-03. Retrieved2022-02-03. See sect.2.3, p.551.
  21. ^abBois-Reymond, Paul du (1870)."Sur la grandeur relative des infinis des fonctions".Annali di Matematica. Series 2.4:338–353.doi:10.1007/BF02420041.
  22. ^Erdelyi, A. (1956).Asymptotic Expansions. Courier Corporation.ISBN 978-0-486-60318-6.{{cite book}}:ISBN / Date incompatibility (help).
  23. ^E. C. Titchmarsh, The Theory of the Riemann Zeta-Function (Oxford; Clarendon Press, 1951)
  24. ^Hardy, G. H.;Wright, E. M. (2008) [1st ed. 1938]. "1.6. Some notations".An Introduction to the Theory of Numbers. Revised byD. R. Heath-Brown andJ. H. Silverman, with a foreword byAndrew Wiles (6th ed.). Oxford: Oxford University Press.ISBN 978-0-19-921985-8.
  25. ^Hardy, G. H. (1966–1979).Collected papers of G. H. Hardy (Including Joint papers with J. E. Littlewood and others), 7 vols. Clarendon Press, Oxford.
  26. ^abde Bruijn, N.G. (1958).Asymptotic Methods in Analysis. Amsterdam: North-Holland. pp. 5–7.ISBN 978-0-486-64221-5.Archived from the original on 2023-01-17. Retrieved2021-09-15.{{cite book}}:ISBN / Date incompatibility (help)
  27. ^abcGraham, Ronald;Knuth, Donald;Patashnik, Oren (1994).Concrete Mathematics (2 ed.). Reading, Massachusetts: Addison–Wesley. p. 446.ISBN 978-0-201-55802-9.Archived from the original on 2023-01-17. Retrieved2016-09-23.
  28. ^Donald Knuth (June–July 1998)."Teach Calculus with Big O"(PDF).Notices of the American Mathematical Society.45 (6): 687.Archived(PDF) from the original on 2021-10-14. Retrieved2021-09-05. (Unabridged versionArchived 2008-05-13 at theWayback Machine)
  29. ^Donald E. Knuth, The art of computer programming. Vol. 1. Fundamental algorithms, third edition, Addison Wesley Longman, 1997. Section 1.2.11.1.
  30. ^Ronald L. Graham, Donald E. Knuth, and Oren Patashnik,Concrete Mathematics: A Foundation for Computer Science (2nd ed.), Addison-Wesley, 1994. Section 9.2, p. 443.
  31. ^Sivaram Ambikasaran and Eric Darve, AnO(NlogN){\displaystyle {\mathcal {O}}(N\log N)} Fast Direct Solver for Partial Hierarchically Semi-Separable Matrices,J. Scientific Computing57 (2013), no. 3, 477–501.
  32. ^Saket Saurabh and Meirav Zehavi,(k,nk){\displaystyle (k,n-k)}-Max-Cut: AnO(2p){\displaystyle {\mathcal {O}}^{*}(2^{p})}-Time Algorithm and a Polynomial Kernel,Algorithmica80 (2018), no. 12, 3844–3860.

Notes

[edit]
  1. ^Note that the "size" of the input is typically used as an indication of how challenging a giveninstance is, of the problem to be solved. The amount of [execution] time, and the amount of [memory] space required to compute the answer, (or to "solve' the problem), are seen as indicating the difficulty of thatinstance of the problem. For purposes ofComputational complexity theory, BigO{\displaystyle O} notation is used for an upper bound on [the "order of magnitude" of] all 3 of those: the size of the input [data stream], the amount of [execution] time required, and the amount of [memory] space required.

Further reading

[edit]
  • Knuth, Donald (1997). "1.2.11: Asymptotic Representations".Fundamental Algorithms. The Art of Computer Programming. Vol. 1 (3rd ed.). Addison-Wesley.ISBN 978-0-201-89683-1.
  • Sipser, Michael (1997).Introduction to the Theory of Computation. PWS Publishing. pp. 226–228.ISBN 978-0-534-94728-6.
  • Avigad, Jeremy; Donnelly, Kevin (2004).Formalizing O notation in Isabelle/HOL(PDF). International Joint Conference on Automated Reasoning.doi:10.1007/978-3-540-25984-8_27.
  • Black, Paul E. (11 March 2005). Black, Paul E. (ed.)."big-O notation".Dictionary of Algorithms and Data Structures. U.S. National Institute of Standards and Technology. RetrievedDecember 16, 2006.
  • Black, Paul E. (17 December 2004). Black, Paul E. (ed.)."little-o notation".Dictionary of Algorithms and Data Structures. U.S. National Institute of Standards and Technology. RetrievedDecember 16, 2006.
  • Black, Paul E. (17 December 2004). Black, Paul E. (ed.)."Ω".Dictionary of Algorithms and Data Structures. U.S. National Institute of Standards and Technology. RetrievedDecember 16, 2006.
  • Black, Paul E. (17 December 2004). Black, Paul E. (ed.)."ω".Dictionary of Algorithms and Data Structures. U.S. National Institute of Standards and Technology. RetrievedDecember 16, 2006.
  • Black, Paul E. (17 December 2004). Black, Paul E. (ed.)."Θ".Dictionary of Algorithms and Data Structures. U.S. National Institute of Standards and Technology. RetrievedDecember 16, 2006.

External links

[edit]
The WikibookData Structures has a page on the topic of:Big-O Notation
Wikiversity solved aMyOpenMath problem usingBig-O Notation
Retrieved from "https://en.wikipedia.org/w/index.php?title=Big_O_notation&oldid=1339201558"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp