Asymptotic Notations
Why a formal notation?
Earlier, O(n) and O() were used informally, as labels for "roughly how T(n) scales." Asymptotic notation is what makes that informal label precise: a defined mathematical statement about how one function bounds another as n grows large, not just an intuition.
Definition
Asymptotic notation describes the growth of a function, not its exact value, by comparing it to a simpler reference function for sufficiently large n.
Three standard notations describe three different kinds of bound:
O
Ω
Θ
Big-O notation: O( )
Definition
if and only if there exist positive constants and such that for all . We then say "f(n) is big-O of g(n)".
In plain terms: from some point onward (), f(n) never exceeds a constant multiple of g(n). g(n) is an upper bound, the algorithm never does asymptotically more work than this.
Once n crosses , f(n) stays below the line for every n after that, no matter how f(n) wiggles before .
Worked derivation: f(n) = 2n + 3
To show f(n) = O(n), find constants c and that satisfy the definition:
Try c = 5:
Checking n = 1: . True. And the gap only grows in g(n)'s favor as n increases. So c = 5 and work.
Note
A function can satisfy O(...) for more than one g(n). is O(), but it is also O(), since holds too. When asked for "the" Big-O of a function, give the tightest one, the smallest g(n) that still works, unless a looser bound is explicitly asked for.
Big-Omega notation: Ω( )
Definition
if and only if there exist positive constants and such that for all . We then say "f(n) is omega of g(n)".
This is the mirror image of Big-O: g(n) is a lower bound, the algorithm never does asymptotically less work than this.
Once n crosses , f(n) stays above the line for every n after that.
Worked derivation: f(n) = 2n + 3
Try c = 1:
This holds for every , since is always at least n. So c = 1 and work.
Note
Just like with Big-O, a function can satisfy multiple Ω bounds. is technically (it never goes below some constant), but it is also , a stronger, tighter statement. When asked for the Ω of a function, give the tightest (highest) lower bound that still holds.
Big-Theta notation: Θ( )
Definition
if and only if there exist positive constants , , and such that for all . We then say "f(n) is theta of g(n)".
Θ requires both an upper and a lower bound with the same g(n), f(n) is sandwiched between and . This is a tight bound: the function grows at exactly this rate, not just no-faster or no-slower.
Once n crosses , f(n) stays trapped between the two lines and for every n after that.
Worked derivation: f(n) = 2n + 3
From the two derivations above: for all .
Because O(n) and Ω(n) both held with the same g(n) = n, Θ(n) follows directly, Θ is what you get when the tightest upper bound and the tightest lower bound agree.
Key Idea
Unlike O and Ω, a function belongs to exactly one Θ notation (based on its dominant term), because Θ demands both bounds meet at the same g(n). This is why Θ is considered the most informative and the most commonly intended meaning when someone casually says "the complexity is n", even though they might write O(n).
O vs Ω vs Θ
| Notation | Meaning | Think of it as |
|---|---|---|
| O(g(n)) | Upper bound | At most this order |
| Ω(g(n)) | Lower bound | At least this order |
| Θ(g(n)) | Tight bound | Exactly this order |
Little-o and little-omega
O and Ω both allow f(n) to equal exactly, they are not strict. Two related notations tighten this to a strict inequality.
Definition
Little-o, , means f(n) grows strictly slower than g(n): for every positive constant c, there exists such that for all .
n belongs to , because n grows strictly slower than . But n does not belong to o(n), since n is not strictly less than n, it is equal to it.
Worked derivation: is 2n = o(n²)?
To check, see whether holds for every positive c, no matter how small, once n is large enough.
For any positive c, this holds once , so pick . Since this works for every choice of c, not just one, : 2n grows strictly slower than .
Contrast this with checking 2n = o(n): that would require for every c, i.e. for every positive c, which fails the moment . So 2n is not o(n), it is only O(n) and Θ(n), same-order growth is not strictly slower growth.
Definition
Little-omega, , means f(n) grows strictly faster than g(n): for every positive constant c, there exists such that for all .
belongs to , because grows strictly faster than n. But n does not belong to , for the same reason as above, equality is not strict growth.
Worked derivation: is n² = ω(n)?
Check whether holds for every positive c, once n is large enough.
For any positive c, this holds once , so pick . This works for every c, so .
But would require for every c, i.e. for every positive c, which fails once . So is not , only , , and : a function is never strictly faster-growing than itself.
| Notation | Meaning | Strictness |
|---|---|---|
| O(g(n)) | Upper bound | Not strict (can be equal) |
| o(g(n)) | Strict upper bound | Strict (must be strictly less) |
| Ω(g(n)) | Lower bound | Not strict (can be equal) |
| ω(g(n)) | Strict lower bound | Strict (must be strictly greater) |
| Θ(g(n)) | Tight bound | Exact match |
Why is there no "little-theta"?
Θ already means f(n) and g(n) grow at exactly the same rate, sandwiched between and . o and ω exist to make O and Ω strict, ruling out the case where f(n) and g(n) happen to grow at the same rate. But Θ is built entirely around f(n) and g(n) growing at the same rate, that is the whole point of it, not a loophole to close. Making Θ "strict" in the o/ω sense would mean excluding the one case Θ exists to describe, which would leave nothing left to define. So there is nothing analogous to little-o and little-omega for Θ.
How to determine the notation for a T(n)
The dominant-term rule from "Ignore lower-order terms" (in the Time Complexity lesson) is exactly what tells you which g(n) to use here.
- Identify the dominant term. For , the dominant term is .
- Apply the rule for the notation you want. All three notations use the same dominant term as g(n) for a typical polynomial:
Note that this is only true because a single dominant polynomial term determines both the upper and lower bound at once. Not every function has this property, , for instance, is O(log n) and Ω(1) using the loosest correct bound, but its tightest correct classification is Θ(log n).
Quick recall
- Asymptotic notation makes "how T(n) scales" mathematically precise using constants c and .
- Big-O: upper bound (at most this order). Big-Omega: lower bound (at least this order). Big-Theta: tight bound (exactly this order, both bounds agree).
- A function can satisfy multiple O or Ω bounds; always give the tightest one unless told otherwise. A function belongs to exactly one Θ.
- Little-o and little-omega are the strict versions of O and Ω, they exclude the case of equal growth.
- For a T(n) with multiple terms, identify the dominant term first, that term's order is usually the O, Ω, and Θ classification all at once.