Big Theta Notation — Definition, Formula & Examples
Big Theta notation, written Θ(g(n)), means a function grows at the same rate as g(n) for large n — neither significantly faster nor significantly slower. It provides a tight bound, capturing both an upper and a lower limit on growth.
A function f(n) is in Θ(g(n)) if and only if there exist positive constants , , and such that for all , the inequality holds. Equivalently, if and only if and .
Key Formula
Where:
- = The function whose growth rate you are classifying
- = The reference function (e.g., n², n log n)
- = Positive constants that bound f(n) from below and above
- = The threshold beyond which the inequality holds
How It Works
To show that , you need to sandwich between two constant multiples of from some point onward. First, find a constant so that for large — this establishes the Big-O upper bound. Then find a constant so that for large — this establishes the Big-Omega lower bound. If both constants exist, the function is Θ(g(n)). A useful shortcut: if exists and equals a positive finite constant, then .
Worked Example
Problem: Show that f(n) = 3n² + 5n + 2 is in Θ(n²).
Upper bound: For n ≥ 1, each term is at most 3n² + 5n² + 2n² = 10n². So f(n) ≤ 10n², giving c₂ = 10.
Lower bound: Since 5n + 2 ≥ 0 for n ≥ 1, we have f(n) ≥ 3n². So c₁ = 3.
Conclusion: With c₁ = 3, c₂ = 10, and n₀ = 1, both bounds hold, so f(n) ∈ Θ(n²).
Answer: f(n) = 3n² + 5n + 2 is Θ(n²).
Why It Matters
In algorithm analysis, Big Theta gives the tightest description of running time. Saying an algorithm is Θ(n log n) — rather than merely O(n log n) — tells you that no clever input can make it run faster than n log n either, which is critical when comparing sorting algorithms or choosing data structures in computer science courses.
Common Mistakes
Mistake: Using Big-O when you mean Big-Theta. Saying "merge sort is O(n log n)" is true but imprecise — it is actually Θ(n log n).
Correction: Use Θ when you can prove both upper and lower bounds. Reserve O for when you only know (or only need) an upper bound.
