O(g(x))

BIG ‘OH’ NOTATION PRACTICE EXERCISES
Definition 1. For a positive function g, we say that f (x) = O(g(x)) as x → ∞ if
there exists an x0 and a constant C > 0, independent of x0 , such that
|f (x)| 6 Cg(x)
for all x > x0 .
So, the sign of f (x) is irrelevant as are any constants; we are just interested in the
dominant behaviour/general size. Throughout, the big ‘Oh’ terms are for x → ∞.
1. Polynomials and rational functions
Prove the following
(1)
(2)
(3)
(4)
(5)
(6)
(7)
x = O(x)
2x = O(x)
−x/5 = O(x)
2x + 5 = O(x)
−3x + 8 = O(x)
x = O(x2 )
5x + 2 = O(x2 )
(8)
(9)
(10)
(11)
(12)
(13)
x2 − 2x + 10 = O(x2 )
−x2 + 5x + 1 = O(x2 )
x3 + 3x − 1 = O(x3 )
−7x3 − x2 + x − 3 = O(x3 )
x4 + x3 + x2 + x + 1 = O(x4 )
16(x + 7)4 = O(x4 )
(14) A general polynomial of degree n is O(xn ).
1
x
(15) = O(1)
(21)
= O(1/x)
2
x
2x − 1
x
1
= O(1/x)
(22)
(16)
= O(1/x)
1 − 2x2
2x + 1
x
1
(23) 3
= O(1/x2 )
(17) 2 = O(1)
x −1
x
1
= O(1/x)
x2
1
(19)
= O(1/x2 )
2x2 + 3x + 2
x
= O(1)
(20)
x+1
(18)
(24)
x2
= O(1/x2 )
4
2x − 4x
(25)
x2
= O(x)
1−x
(26)
x4
= O(x2 )
x2 + 3x − 1
1
BIG ‘OH’ NOTATION PRACTICE EXERCISES
2
(27) Let R(x) = P (x)/Q(x) where P (x) is a polynomial of degree n and Q(x) is a
polynomial of degree m. Prove that R(x) = O(xn−m ).
(28) Let R(x) = P (x)/Q(x) where P (x) is a polynomial of degree n and Q(x) is a
polynomial of degree > n + 2. Suppose Q(x) 6= 0 for all x ∈ R. Prove that
Z ∞
R(x)dx
−∞
converges.
2. Exponentials
(29) (Fundamental) Prove that xr = O(ex ) for any r ∈ R.
Prove the following.
(30) x + ex = O(ex )
(38) ecx = O(ex
(31) ex − x2 = O(ex )
(33) x = O(e
x/2
)
(34) x2 e−x = O(e−x/2 )
(35) xr e−x = O(e−cx ) ∀r > 0, c < 1.
(36) eax = O(ebx ) ∀b > a
(37) e100x = O(ex
1.01
) ∀c, > 0
(39)
1
= O(e−x )
ex + 2
(40)
ex
= O(1)
ex + 1
(32) x3 + e−x − e2x = O(e2x )
2
1+
ex + x
= O(1)
(41) x
e + x2
(42)
ex + x2
= O(1)
ex + x
(43)
5x3 + ex
= O(e−x )
2x
e −1
)
3. Logarithms
(44) (Fundamental) Prove that log x = O(x ) for any > 0. (hint: use a result
from the previous section, or write log x as an integral and compare the integrand
with something)
Prove the following
(45) (log x)2 = O(x0.0001 )
(46) (log x)r = O(x ) ∀r, > 0
(log x)r
dx
x1+
(47)
R∞
(48)
x + log x
= O(1)
2x + (log x)2 + 1
1
converges ∀r, > 0
BIG ‘OH’ NOTATION PRACTICE EXERCISES
(49)
2x + (log x)2 + 1
= O(1)
x + log x
(52) log x = O(x1/ log log x )
(53) x1/ log log x = O(x )
(50) log log x = O((log x) )
(51) log log x =
3
(54) (log x)log log x = O(x )
O( logloglogx x )
(55)
1
x
= O(e−c
√
log x
), c > 0
Thus far, we have the following basic chain of orders of growth:
C = O(log x) = O(xr ) = O(ex ),
r>0
The chain is reversed on taking reciprocals. Also, it is easy to find intermediate
orders (as in exercises (52),(53)) by writing everything in terms of exponentials. We
now seek more accuracy in our formulas by writing them as a dominant term + O(
something smaller).
4. Asymptotics
Definition 2. We write f (x) = g(x) + O(h(x)) if f (x) − g(x) = O(h(x)) i.e. if there
exists a constant C > 0 and an x0 such that |f (x) − g(x)| 6 Ch(x) for all x > x0 .
Prove the following
(56) x2 + 3x + 1 = x2 + O(x)
(57) x2 +
1
x3/2
100
+ 3x + 1 = x2 + O(x3/2 )
(58) ex +xr +log x+C = ex +O(xr ), ∀r > 0
(64) If f (x) = O( x1 ) then ef (x) = 1 +
O(1/x)
(65) log(1 + x1 ) =
1
x
+ O(1/x2 )
(66) (1 + x1 )x = e + O(1/x)
(59) ex + x−r + log x + C = ex + O(log x),
∀r > 0
(67) If f (x) = O( x1 ) then (1 + f (x))−1 =
x
1 + O(1/x)
(60)
= 1 + O(1/x)
x+1
(68) (1 + x1 )−x = e−1 + O(1/x)
x
1
(61)
=
+ O(1/x2 )
(69) If f (x) = g(x) + O(h(x)) then
2
2x − 1
2x
f (x)ν(x) = g(x)ν(x) + O(h(x)|ν(x)|)
ex + x
−x
(62) x
= 1 + O(xe )
(70) (x + 1 + 1/x)x = exx + O(xx−1 )
e + x2
(63)
e x + x2
= 1 + O(x2 e−x )
ex + x
Now that we know big ‘Oh’ a little better, we can start abusing it. When we write
O(f (x)) we really mean a class of functions that grows no greater than Cf (x) in absolute value. For example, the expression eO(1/x) really means ef (x) where f (x) is some
BIG ‘OH’ NOTATION PRACTICE EXERCISES
4
function that grows no greater than C/x in absolute value. With this interpretation
eO(1/x) = 1 + O(1/x)
by exercise (64). As another example, we would think of x + O(1) as x + f (x) where
f (x) is some function that is bounded as x → ∞. Prove the following.
(71) x3 + O(x2 ) = O(x3 )
(76) 1 + 1/x + O(x) = O(x) (...and again)
(72) O(x2 ) + O(x) = O(x2 )
(77) O(f (x)) · O(g(x)) = O(f (x)g(x))
(73) O(1/x) + O(1/x2 ) = O(1/x)
(78) (x + O(1))2 = x2 + O(x)
(74)
(79) (1 + O(1/x))2 = 1 + O(1/x)
O(f (x))+O(g(x)) = O(max{f (x), g(x)}) (80) (1 + O(1/x))−1 = 1 + O(1/x)
(81) (x + 1 + O(1/x))x = exx + O(xx−1 )
(75) C + O(1) = O(1) (loss of info.)
and finally,
(82) Use Stirling’s formula
n! =
to show that the limit limn→∞
√
2πnn+1/2 e−n (1 + O(1/n))
n
√
n
n!
= e converges at a rate of O(log n/n).
5. Complex analysis
By virtue of the (complex) absolute value | · |, the above definitions also makes
sense for complex valued stuff. Prove the following. Throughout, z = x + iy and we
choose the branch of log z with | arg z| < π.
1
= O(1/|z|2 ), as |z| → ∞
z2 + 1
z
(84) 3
= O(1/|z|2 )
z + 100
(87) If Q(x) 6= 0, x ∈ R, then
(83)
(85)
Z
(86) R(z) =
Pn
=
j
j=0 aj z
Pn+2
j
j=0 bj z
X
R(x)dx = 2πi
−∞
z2 + 1
= O(1/|z|2 )
z 4 + 2z 2 + 2
P (z)
Q(z)
∞
zj : Q(zj )=0
=(zj )>0
(88)
1
1+iy
(89)
1
100+iy
(90)
1
= O(1/|y|2 ), x fixed, y → ±∞
z2
2
= O(1/|z| )
res(R(z), zj )
= O(1/|y|)
= O(1/|y|)
BIG ‘OH’ NOTATION PRACTICE EXERCISES
Z
c+i∞
(91) The vertical line integral
c−i∞
c > 0, is absolutely convergent.
(92)
(93)
(94)
(95)
5
(96) |z| = x(1 + O(1/x)) for fixed y, as
ez
dz,
2
x → ∞.
z
(97) log z = log x + O(1/x) for fixed y, as
x → ∞.
+ O(e ), uniformly in
| sin(z)| =
x as y → ±∞.
(98) log z = log |y| ± iπ/2 + O(1/y) for
fixed x, as y → ±∞.
tan(πn + iy) is bounded for all y ∈ R,
n ∈ Z.
(99) |z w | = |y|<(w) e∓π=(w)/2 (1 + O(1/|y|))
for fixed x, w, as y → ±∞.
tan z = i + O(e−2y ), uniformly in x as
Z c+i∞ z
y → ∞.
e
(100)
dz, c > 0, is absolutely con−2y
w
log tan z = iπ/2 + O(e ), uniformly
c−i∞ z
in x as y → ∞.
vergent for <(w) > 1.
1 y
e
2
−y