Processing math: 100%

Wednesday, 21 January 2015

Big O notation

I wrote Stirling's formula as
log(n!ennn+1/2)=log2π+O(1/n)
and thought later that maybe you do not know what O(1/n) means (which is read as "Big O of 1/n").

Jacqueline Kennedy Onassis was known to her friends as "the Big O". That is not what we mean here.

We say f(n)=O(g(n)) if there exists some B such that |f(n)|B|g(n)| for all n sufficiently large. We proved that A<dn<A+1/(12n), so
0<log(n!ennn+1/22π)<112n
is consistent with this, with B=1/12.

There is also a notation for lower bounds. We say f(n)=Ω(g(n)) if there exists some B such that |f(n)|B|g(n)| for all n sufficiently large. This is the same as saying g(n)=O(f(n)).

And g(n)=Θ(g(n)) if both f(n)=O(g(n)) and f(n)=Ω(g(n)) are true. Since
log(n!ennn+1/22π)>112n+1>113n
we may actually claim that
log(n!ennn+1/22π)=Θ(1/n).
Because this tells how how fast is the convergence to 0 it is stronger than just saying
limnlog(n!ennn+1/22π)=0.
Read more about "Big O", "Big omega" and "Big theta" notations. They are very commonly used in theoretical computer science.