Chapter 3 - Asymptotic Notations |
Document last modified: |
Definition
Asymptotic a line that continually approaches a given curve but does not meet it at any finite distance.
Example
x is asymptotic with x + 1
limit -
f(x) = k
Roughly translated might read as:
x approaches ∞, f(x) approaches k
for x close to ∞, f(x) is close to k
Two limits we'll often use are:
f(x) =
1/x = 0
f(x) =
cx = ∞ for c>0
asymptotic - A way to describe the behavior of functions in the limit or without bounds.
Let f(x) and g(x) be functions from the set of real numbers to the set of real numbers.
We say that f and g are asymptotic and write f(x) ≈ g(x) if
f(x) / g(x) = c (constant)
Examples
x/ 2x = ½
½x / 2x = 1/4
x2/2x2 = ½
½x2 / 2x2 = 1/4
x3/2x3 = ½
½x3 / 2x3 = 1/4
Question 3.1 - What is:
(1/x + 3)
2x/10x
2x/10x2
lg x/x
lg 4294967296 = lg 232 = 32
|
O Big-O Notation
|
![]()
1000n2 + 50n = O(n2) with c=1050 and n0=1
Graph illustrates that: 0 ≤ 1000n2 + 50n ≤ 1050n2 Note that the y-scale is much greater than the x-scale.
n2 + 50n = O(n2) with c=2 and n0=50
n = O(n lg n) with c=1 and n0=2
3n2 = O(n3) with c=1 and n0=2 3n2 = O(n3) with c=1 and n0=3
|
Ω Omega Notation
|
![]()
n3 = Ω(n2) with c=1 and n0=1
3n2 + n = Ω(n2) with c=1 and n0=1
3n2 + n = Ω(n2) with c=3 and n0=1
v n = Ω(lg n) with c=1 and n0=16 |
Θ Theta Notation
|
![]()
n2/2-2n = Θ(n2)
½n2-3n = Θ(n2)
|
Theorem 3.1 page 46
For any two functions, f(n) and g(n):
f(n) = Θ(g(n)) ↔ f(n) = O(g(n)) and f(n) = Ω(g(n))
You might recall that p ↔ q is read as "p if and only if q" and called an equivalence that is true when p=q.
p q p ↔ q T T T T F F F T F F F T
Qualified Notation
Ω Omega Notation
|
v n
= Ω(lg n) with c=1 and n0=16
|
O Big-O Notation
|
n = O(n lg n)
with c=1 and n0=2
|
Θ Theta Notation
|
n2/2-3n = Θ(n2)
c1=1/14, c2=1/2 and n0=7
|
Asymptotic - a line that continually approaches a given curve but does not meet it at any finite distance.
Little-o Notation
non-asymptotically tight upper bound for f(n)
f(n) ∈ o(g(n)) where
o(g(n)) = {h(n): for any constant c > 0, ∃ a constant n0 > 0, such that: 0 ≤ h(n) < cg(n), ∀ n ≥ n0}
f(n) / g(n) = 0 for any 0 < c < ∞
O(g(n)) = {h(n): for some constant c > 0, ∃ a constant n0 > 0, such that: 0 ≤ h(n) ≤ cg(n), ∀ n ≥ n0}
f(n) / g(n) = c for some 0 ≤ c < ∞
O is a possibly asymptotically tight upper bound for f(n)
2n2 = O(n2) is asymptotically tight
2n = o(n2) is non-asymptotically tight
Question 3.14 - What is implied by f(n) / g(n) = 0?
Examples o(n2)
n1.999
n2/lg n
n2/lg n/n2 =
1/lg n = 0
2n
2n / n2 = 0
Examples not o(n2)
2n2 ≠ o(n2)
2n2 / n2 = 2
n2 ≠ o(n2) (just as 2 is not < 2)
n2/1000 ≠ o(n2)
Since in 0 ≤ f(n) < cg(n), c is any constant > 0
0 ≤ n2/1000< cn2
0 ≤ 1/1000 < c contradicted by picking any c < 1/1000
Can also show by:
n2/1000 / n2 =
1/1000 = 1/1000 not 0
o(g(n)) = {h(n): for any constant c > 0, ∃ a constant n0 > 0, such that:
0 ≤ h(n) < cg(n), ∀ n ≥ n0}
n = o(n2)
c = 1/10 and c = 1/20
Question 3.15 - Using limits show:
n2/lg n = o(n2)
f(n) / g(n) = 0
n2 ≠ o(n2)
Question 3.16 - Classify n2.001 and n1.999 as o(n2) or not, from the graph at right.
Little-ω Notation
non-asymptotically tight lower bound for f(n)
f(n) ∈ ω(g(n)) where
ω(g(n)) = {h(n): for any constant c > 0, ∃ a constant n0 > 0, such that 0 ≤ cg(n) < h(n), ∀ n ≥ n0} Ω possibly asymptotically tight lower bound
f(n) / g(n) = ∞
Ω(g(n)) = {h(n): for some constant c > 0, ∃ a constant n0 > 0, such that 0 ≤ cg(n) ≤ h(n), ∀ n ≥ n0}
f(n) / g(n) = c for some 0 < c ≤ ∞
ω non-asymptotically tight lower bound
Examples n2 = ω(n)
n2/n = ∞
n2.001 = ω(n2)
n2.001/n2 = ∞
n2 lg n = ω(n2)
n2 lg n/n2 =
lg n = ∞
n2 ≠ ω(n2) (just as 2 is not > 2)
n2/n2 = 1
n2/1000 ≠ ω(n2)
Since in 0 ≤ cg(n) < f(n) , c is any constant > 0
0 ≤ cn2 < n2/1000
0 ≤ c < 1/1000 contradicted by picking any c ≥ 1/1000
Can also show by:
n2/1000 / n2 =
1/1000 = 1/1000 not ∞
n2 = ω(n)
c = 20 and c = 30
Question 3.17
- What is implied by
f(n) / g(n) = ∞?
- Show n2/lg n ≠ ω(n2)
- What is the
n1.9999/n2?
- Is n1.999 = ω(n2)?
Asymptotic notation in equations and inequalities
Have been using notation:
n = O(n2) → n ∈ O(n2)
3n + 1 = Θ(n) → 3n + 1 ∈ Θ(n)
where
2n2 + 3n + 1 = 2n2+ Θ(n) means 2n2 + f(n)
for f(n) ∈ Θ(n)
in this case: f(n) = 3n + 1 ∈ Θ(n)
In equations
2n2 + 3n + 1 = 2n2+ Θ(n) = Θ(n2)
2n2 + Θ(n) = Θ(n2) finer detail coarser detail
Comparison of Functions
An imprecise analogy between the asymptotic comparison of two function f and g and the relation between their values:
f(n) = O(g(n)) ≈ f(n) ≤ g(n)
f(n) = Ω(g(n)) ≈ f(n) ≥ g(n)
f(n) = Θ(g(n)) ≈ f(n) = g(n)
f(n) = o(g(n)) ≈ f(n) < g(n)
f(n) = ω(g(n)) ≈ f(n) > g(n)