Asymptotic Notations Explained: Big O, Omega and Theta with Worked Examples
Learn what upper, lower and tight bounds mean, prove a quadratic bound with constants, and trace a dependent nested loop without settling for a loose answer.
KnowledgeGate Team
Exam prep & CS education

Learners often memorise Big O, Omega and Theta as worst, best and average case, then get stuck when asked to prove a bound or count a loop whose work changes each round. That shortcut mixes up two different ideas. Use asymptotic notation to define growth classes, prove bounds with constants and thresholds, trace exact code counts, and solve exam questions systematically.
Asymptotic analysis: what it measures and what it ignores
Let n be the input size and T(n) the number of selected operations or units of resource use. Asymptotic analysis compares the growth rate of T(n) as n becomes large. It is not a stopwatch measurement. Hardware, language, implementation and small-input effects can still change real running time.
For T(n) = 2n^2 + 7n + 4, the quadratic term eventually determines the shape of growth. The coefficient and lower-order terms still matter when an exact count is required.
A bound is also not an algorithmic case. Best, average and worst case identify which inputs are analysed. Big O, Omega and Theta describe mathematical relationships, and each notation can be applied to any of those case functions.
Use Algorithm Analysis: Asymptotic Notation, Recurrences and Worked Examples for GATE CS for recurrences and amortized analysis, Time Complexity Analysis of Algorithms for operation-count patterns and case analysis, and Time complexity and asymptotic notation for the general definitions, growth ordering and Master Theorem. An explicit two-sided proof needs constants and a threshold; a dependent nested loop needs a sum rather than mechanical multiplication.
Big O, Big Omega and Big Theta: upper, lower and tight bounds
For eventually non-negative functions:
f(n) in O(g(n))when constantsc > 0andn0exist such that0 <= f(n) <= c g(n)for everyn >= n0. Big O gives an eventual upper bound.f(n) in Omega(g(n))when constantsc > 0andn0exist such that0 <= c g(n) <= f(n)for everyn >= n0. Big Omega gives an eventual lower bound.f(n) in Theta(g(n))when positive constantsc1,c2andn0make0 <= c1 g(n) <= f(n) <= c2 g(n)for everyn >= n0. Big Theta gives both bounds, so it identifies a tight growth class.
Our function 2n^2 + 7n + 4 belongs to O(n^2) and Omega(n^2), hence Theta(n^2). It also belongs to looser sets such as O(n^3) and Omega(n). A true one-sided bound is not necessarily the most informative answer.
Little o means a strict upper growth class, while little omega means a strict lower one. For example, n^2 in o(n^3) and n^2 in omega(n log n).
Worked proof: show that 2n^2 + 7n + 4 is Theta(n^2)
Take T(n) = 2n^2 + 7n + 4 and lock the threshold to n >= 1.
For the lower bound:
T(n) = 2n^2 + 7n + 4 >= 2n^2
So choose c1 = 2.
For the upper bound, n <= n^2 and 1 <= n^2 whenever n >= 1. Therefore 7n <= 7n^2 and 4 <= 4n^2. Adding the terms gives:
T(n) <= 2n^2 + 7n^2 + 4n^2 = 13n^2
Choose c2 = 13. Thus 2n^2 <= T(n) <= 13n^2 for every n >= n0 = 1, which proves T(n) in Theta(n^2).
|
|
|
|
|---|---|---|---|
1 | 2 | 13 | 13 |
2 | 8 | 26 | 52 |
4 | 32 | 64 | 208 |
10 | 200 | 274 | 1300 |
The upper constant is loose but valid. It does not need to be the smallest possible constant.
The reusable proof recipe is: choose a candidate g(n), find positive lower and upper constants, state a threshold, verify both inequalities for every input beyond it, and only then conclude Theta(g(n)).
Comparing growth classes with actual values
Small inputs can make different growth classes look equal or close.
|
|
|
|
|---|---|---|---|
2 | 2 | 4 | 4 |
4 | 8 | 16 | 16 |
8 | 24 | 64 | 256 |
16 | 64 | 256 | 65536 |
Equality at n = 2 or n = 4 does not imply equal asymptotic growth. A useful increasing order is log n, n, n log n, n^2, n^3, 2^n. This compares growth, not every implementation. Logarithm bases differ by a constant factor, so all bases share Theta(log n) while giving different exact values.
Worked code example: a nested loop that is Theta(n), not Theta(n log n)

Consider this exact pseudocode:
count = 0;
for (i = 1; i <= n; i *= 2) {
for (j = 1; j <= i; j++) {
count++;
}
}At n = 16, the outer values are i = 1, 2, 4, 8, 16. The inner loop runs 1, 2, 4, 8, 16 times respectively, so:
count = 1 + 2 + 4 + 8 + 16 = 31
For n = 2^k, the exact geometric sum is 1 + 2 + 4 + ... + n = 2n - 1. For arbitrary n >= 1, let p = 2^floor(log2 n), the greatest power of two not exceeding n. The count is 2p - 1. Since p <= n < 2p, integer n satisfies n <= 2p - 1 < 2n, proving the tight class Theta(n).
The trap is to multiply an outer Theta(log n) count by the largest inner bound Theta(n). That gives a valid but loose O(n log n) upper bound. Since the work changes each round, sum it instead.

Asymptotic notation traps and their repairs
Trap | What goes wrong | Repair |
|---|---|---|
Big O means worst case; Omega means best case | Confuses an input case with a bound | Choose the case, then bound its |
Stop at the first true upper bound | A loose class hides a tighter result | Seek matching bounds that give |
Drop terms before deriving the count | Makes the exact count unreliable | Count first, then simplify |
Multiply nested-loop bounds mechanically | Ignores dependent inner work | Write and evaluate the sum |
Read | Mistakes constant work for one step | Read it as bounded independently of |
Equal | Ignores constants and lower-order costs | Treat the class as growth, not stopwatch time |
Sequential costs add, then the fastest-growing term dominates: n^2 + 20n is Theta(n^2). Independent nested work multiplies: an n-round outer loop with n inner rounds is Theta(n^2). The dependent geometric loop differs because its exact sum is 2n - 1.
Set language is the precise form: T(n) in O(n^2). The familiar T(n) = O(n^2) is common shorthand, but Big O denotes a set of functions, not an ordinary numeric value.
How asymptotic notation is tested: classify, prove, trace and compare
Questions can ask for a formula's tight bound, the truth of notation statements, a loop trace and summation, or an ordering of growth functions. Do not guess from appearance.
Use this solving order:
Derive or bound the operation count.
Keep dependent work as a sum.
Simplify the expression.
Choose the tightest offered class.
For a 30-second check, substitute n = 4 or n = 16. Reject an exact formula if it fails the trace. Finite checks catch arithmetic errors but do not prove an asymptotic result.
Use GATE CS Exam Preparation Courses and Test Series to place this skill in the wider syllabus, then use the GATE Test Series for timed practice.
Asymptotic notations in the short version and the next step
Big O gives an eventual upper bound.
Big Omega gives an eventual lower bound.
Big Theta gives both bounds and is tight.
Check loop dependencies before multiplying loop levels.
The proof yields 2n^2 + 7n + 4 in Theta(n^2) with c1 = 2, c2 = 13 and n0 = 1. The dependent loop yields 31 increments at n = 16 and class Theta(n). Re-derive both without looking: write the constants and threshold, then list and sum the inner-loop counts.
Keep learning
Asymptotic Notations Interview Questions and Answers: Big-O, Omega and Theta with Worked Examples
Prepare for Big-O, Omega and Theta questions with proof-ready answers, exact loop and recurrence traces, and a method for avoiding common interview traps.
Time complexity and asymptotic notation: Big-O, Theta and Omega explained
Time complexity and asymptotic notation explained: Big-O, Theta and Omega, growth-rate ordering, analysing loops and recursion, and the Master Theorem.
Asymptotic Notations MCQs: 12 Solved Questions with Explanations
Solve 12 asymptotic notation MCQs with concise explanations of bounds, dominant terms, composition rules, strict notations, and case analysis.
Algorithm Analysis: Asymptotic Notation, Recurrences and Worked Examples for GATE CS
Build algorithm-analysis skill from first principles: count operations, compare growth rates, solve recurrences and understand amortized cost through checked examples.





