3.1.1 · D4Complexity Analysis

Exercises — Big-O notation — formal definition, mathematical

2,399 words11 min readBack to topic

The single rule we lean on everywhere:

The picture we return to again and again: must eventually sit under the scaled curve .

Figure — Big-O notation — formal definition, mathematical

Level 1 — Recognition

(Can you read the definition and spot true/false without heavy algebra?)

L1.1

Which of these is the correct formal statement of ?

  • (a)
  • (b)
  • (c)
Recall Solution

(b). We need one multiplier and one threshold , after which the one-sided bound holds forever. Option (a) quantifies wrongly (it demands the bound at every threshold, meaningless). Option (c) with "" is actually the definition of little-o (Little-o and little-omega), a strictly stronger statement — don't confuse them.

L1.2

True or false: .

Recall Solution

True. Take : trivially. Constant factors vanish — that is the whole point of Big-O.

L1.3

True or false: , and is the bound tight?

Recall Solution

True, but loose. For : , so . Big-O is only an upper bound, so a function may be of something that grows strictly faster. It is not tight — a tight statement would need $\Theta$, and .


Level 2 — Application

(Pick and and finish the proof.)

L2.1

Prove .

Recall Solution

Goal: find with for . Step (bound the small term by the big one): for we have , so Read off: . (Any valid pair works, e.g. since . You only need one.)

L2.2

Prove .

Recall Solution

Push every lower power up to . For : and . Hence Read off: . This is the polynomial rule: a degree- polynomial is .

L2.3

Prove . (Assume , and take as known for all .)

Recall Solution

Since for every (a log grows slower than its argument), take : Look at the s01 figure: (green) stays flat under the linear line — this is why any log is .


Level 3 — Analysis

(Now you decide whether a claim is true and justify or refute it.)

L3.1

Is ? Prove or disprove.

Recall Solution

True. For : , so giving .

L3.2

Is ? Prove or disprove.

Recall Solution

False. Suppose for all . Since for , we may divide by : But is a fixed constant while grows without bound — contradiction once . No pair exists. The breaking technique: isolate a term that grows and show it must exceed the fixed .

L3.3

Is ? Prove or disprove.

Recall Solution

True. Rewrite: . So giving . Key insight: a constant shift in the exponent is just a constant multiplier, which absorbs. (Contrast: is not — see L5.)


Level 4 — Synthesis

(Combine multiple rules or build a proof from the properties.)

L4.1

Given and , prove directly from the definition.

Recall Solution

By hypothesis there exist constants:

  • with for ;
  • with for .

Set . The reason appears in this max: the step is only true for (for it would fail, and gives equality), so we must force before using it. For all three facts hold at once — , , and — hence Read off: . This is the sum rule: , the dominant term wins.

L4.2

Prove the product rule in a special case: if and , then .

Recall Solution

There exist with () and with (). Since both , for : Read off: . This is exactly why merge sort's merges each costing levels give .

L4.3

Use transitivity to prove , then verify by unifying thresholds and multiplying constants explicitly.

Recall Solution

Step 1 — chain two known facts. From the parent note, : there are with From L1.3, : there are with Step 2 — unify the thresholds. Both bounds must hold simultaneously, so take Step 3 — multiply the constants along the chain. For every : Read off: . This is transitivity made concrete: and give with constant and threshold .


Level 5 — Mastery

(Subtle cases, degenerate inputs, and disproofs that require real care.)

L5.1

Prove or disprove: .

Recall Solution

False. Rewrite . Suppose for . Divide by : But while is fixed — contradiction once , i.e. . No pair exists. Compare with L3.3: additive shifts in the exponent are safe; multiplying the exponent (changing the base) is not.

L5.2

Consider the oscillating function , so ranges between and . Is ?

Recall Solution

True. Since for all , we have , hence So . Big-O does not require to be monotone or smooth — only that it stays under eventually. Oscillation between and is completely fine. (Note: is not , since it dips to infinitely often, so it's not .)

L5.3

Degenerate case: is the zero function in for any nonnegative ? What about ?

Recall Solution

is for every nonnegative : holds for any and . The zero function is the "smallest" thing — it's of everything. If too: then requires , forcing . So is fine, but a positive is never . This is the limiting/degenerate boundary of the definition — the bound collapses to . It is exactly the case our standing assumption ( on its tail) excludes, so we handle it by hand here.

L5.4

Use a limit to decide: is ? (Tool from Limits and infinity (Calculus).)

Recall Solution

Form the ratio with , : As , (the numerator outgrows the slow log). If then would have to hold past some — but the ratio is unbounded. So . Why the limit tool? When picking by hand is awkward, answers "does the ratio stay bounded?" directly: a finite limit (or bounded ratio) ; an infinite limit not .


Score yourself

Recall What each level tested

L1 — read the definition, spot direction (upper bound, not symmetric). L1 recall ::: L1.1 is (b); L1.2 true; L1.3 true but loose. L2 — produce ; push lower terms to the top power. L2 recall ::: : . : . : . L3 — decide + disprove via ; exponent shifts. L3 recall ::: true (); ; (). L4 — combine rules with unified thresholds. L4 recall ::: sum ; product ; transitivity with . L5 — degenerate/oscillating/limit cases. L5 recall ::: ; ; always; .


Connections

  • Parent: Big-O — formal definition, mathematical
  • Big-Omega notation — lower bound
  • Big-Theta notation — tight bound
  • Little-o and little-omega
  • Asymptotic growth rates ordering
  • Time Complexity vs Space Complexity
  • Master Theorem
  • Limits and infinity (Calculus)

Solution-strategy map

looks true

looks false

use limits

Claim f is O of g

Prove it: give one c and one n0

Disprove it: assume c then send n to infinity

Check the ratio f over g

Bounded ratio means O holds

Ratio to infinity means not O