DAA Study Hub

6 · Asymptotic notation: O, Ω, Θ

Big-O, Omega and Theta: choosing c and n0 and writing the proof.

In one sentence

OO, Ω\Omega and Θ\Theta compare how fast functions grow for large nn, ignoring constant factors and small inputs. OO is "at most", Ω\Omega is "at least", and Θ\Theta is "exactly, up to constants".

Everyday analogy

Speed limits on a motorway. "f=O(g)f = O(g)" is like "this car never goes faster than c×c\times the speed limit gg, once it's on the motorway (after n0n_0)". "Ω\Omega" is a minimum speed. "Θ\Theta" means the car stays between a minimum and a maximum, so it is "in the same lane" as gg. What happens in the car park before the motorway (small nn) doesn't count.

Definitions

NotationMeansFormal definition: there exist positive constants…
f(n)=O(g(n))f(n) = O(g(n))ff grows no faster than ggc,n0c, n_0 with 0≤f(n)≤c g(n)0 \le f(n) \le c\,g(n) for all n≥n0n \ge n_0
f(n)=Ω(g(n))f(n) = \Omega(g(n))ff grows at least as fast as ggc,n0c, n_0 with 0≤c g(n)≤f(n)0 \le c\,g(n) \le f(n) for all n≥n0n \ge n_0
f(n)=Θ(g(n))f(n) = \Theta(g(n))same growth ratec1,c2,n0c_1, c_2, n_0 with c1g(n)≤f(n)≤c2g(n)c_1 g(n) \le f(n) \le c_2 g(n) for all n≥n0n \ge n_0
f(n)=o(g(n))f(n) = o(g(n))strictly slower (an upper bound that is not tight)for every c>0c > 0 there is an n0n_0 … f(n)<c g(n)f(n) < c\,g(n)
f(n)=ω(g(n))f(n) = \omega(g(n))strictly fasterfor every c>0c > 0 … f(n)>c g(n)f(n) > c\,g(n)
f=Θ(g)  ⟺  f=O(g) and f=Ω(g)f = \Theta(g) \iff f = O(g) \text{ and } f = \Omega(g)

Careful with little-o

The Lecture07 notation slide (Slide 6) calls oo a "tight upper bound". CLRS defines oo as an upper bound that is not tight (2n=o(n2)2n = o(n^2), but 2n2≠o(n2)2n^2 \ne o(n^2)). Use the CLRS meaning, and check with your instructor if an exam question depends on it.

Growth ladder (each grows strictly slower than the next):

1  <  log⁡n  <  n  <  n  <  nlog⁡n  <  n2  <  n3  <  2n  <  3n  <  n!  <  nn1 \;<\; \log n \;<\; \sqrt n \;<\; n \;<\; n\log n \;<\; n^2 \;<\; n^3 \;<\; 2^n \;<\; 3^n \;<\; n! \;<\; n^n

Limit shortcut (for intuition and checking, not a replacement for a c/n₀ proof when one is asked): if lim⁡n→∞f(n)/g(n)\lim_{n\to\infty} f(n)/g(n) is 00, then f=o(g)f = o(g); if it is a constant >0> 0, then f=Θ(g)f = \Theta(g); if it is ∞\infty, then f=ω(g)f = \omega(g).


Watch the ladder pull apart

nnlog⁡2n\log_2 nnnnlog⁡2nn\log_2 nn2n^22n2^n
103.310331001 024
1006.610066410 000≈1.3×1030\approx 1.3\times10^{30}
1 000101 0009 9661 000 000≈10301\approx 10^{301}

What f=O(g)f = O(g) looks like: take f(n)=3n+7f(n) = 3n + 7 and c⋅g(n)=4nc\cdot g(n) = 4n.

nn13567810100
f(n)=3n+7f(n) = 3n+710162225283137307
4n4n4122024283240400
f≤4nf \le 4n?❌❌❌❌✅✅✅✅

Before n0=7n_0 = 7, ff is bigger, and that's allowed. From n0n_0 on, ff stays under c⋅gc\cdot g forever, so 3n+7=O(n)3n + 7 = O(n).

Θ\Theta = sandwich: c1g(n)≤f(n)≤c2g(n)c_1 g(n) \le f(n) \le c_2 g(n). ff is trapped between two scaled copies of gg.


Common mistakes

  • Picking n0n_0 first, then a cc that only works for a different n0n_0. State both and check them.
  • Thinking OO means "tight". n=O(n5)n = O(n^5) is true, just not useful. Use Θ\Theta when you mean tight.
  • Dropping a negative term in a lower bound, which makes ff bigger, not smaller.
  • Writing O(2n2+3)O(2n^2 + 3). Simplify to O(n2)O(n^2).
  • The little-o slide wording (see the warning above).

Mastery check

Solve without hints, then explain

(a) Prove 4n3+10n2+5=Θ(n3)4n^3 + 10n^2 + 5 = \Theta(n^3) with explicit c1,c2,n0c_1, c_2, n_0.

(b) Prove n2≠O(5n+2)n^2 \ne O(5n + 2).

Your mastery check
Not started
Solve the problem above with no hints, close the page and explain it out loud. Tick each step honestly.
Mastery checklist

Status

Tick all six steps to unlock “Mastered”.

Which study mode worked for you?

Saved in this browser onlySee all my progress →

See it move

  • Desmos: plot 3x+73x + 7 and 4x4x and see them cross at n0=7n_0 = 7.

References

  • Lecture07 Asymptotic Analysis: Slides 2–4 (growth classes), 6 (notation overview), 7–13 (Big-O and examples), 14–18 (Ω), 19–24 (Θ), 25 (when Θ isn't possible).
  • CLRS 4e Ch 3: §3.1 (O, Ω, Θ intuition), §3.2 (formal definitions, o and ω), §3.3 (standard functions).

On this page