LOGBOOK

HELP

Quiz Entry - updated: 2026.09.18

State the formal definition of $f(n) \in O(g(n))$.

$f(n)$ is $O(g(n))$ if there are positive constants $c$ and $n_0$ such that $f(n) \le c \cdot g(n)$ for all $n \ge n_0$.

f(n) bounded above by c·g(n) from n₀ onwards

* Below n₀ nothing is promised; from n₀ on, f never rises above c·g again. *

$$f(n) \le c \cdot g(n) \quad \text{for all } n \ge n_0$$

Each piece of that sentence is doing work:

  • $c$ — "up to a constant factor". You are allowed to scale $g$ before comparing. This is the formal machinery that makes constants irrelevant.
  • $n_0$ — "eventually". The bound may fail for small $n$; it only has to hold from some point on. This is the formal machinery that makes small inputs irrelevant.
  • $\le$ — "at most". $O$ is an upper bound, a ceiling, not an exact description.

So the statement "$f$ is $O(g)$" reads: beyond some input size, $f$ grows no faster than $g$, up to a constant factor.

A consequence that catches people out: because it is only a ceiling, a linear function is also $O(n^2)$, and $O(n^{100})$ — all true, all useless. Correctness and informativeness are different things, so the convention is to name the tightest bound you can justify, and to name it in its simplest form: write $O(n)$, not $O(3n + 5)$.

Go deeper:

From Quiz: ADS / Asymptotic Analysis, O-Notation and Recursion | Updated: Sep 18, 2026