asymptotic-analysis
What's Vague About "Big O"
I knew the labels: is linear, is logarithmic, is exponential. I could rank them. But I couldn't explain what asymptotic analysis is actually doing, or why the formal definitions are written the way they are. Why do we throw away constants? What's the in the definition? Why is there both a "Big O" and a "little o"?
The missing piece was connecting asymptotic notation to derivatives.
The Slope Perspective
Asymptotic analysis compares how fast the slopes of two functions grow. Given and , compute their derivatives and . Whichever derivative grows faster will eventually dominate, regardless of what happens at small inputs.
Three cases:
- Constant slope (, so ): effort grows steadily. Each additional input costs the same.
- Accelerating slope (, so ): effort accelerates. Each additional input costs more than the last.
- Decelerating slope (, so ): effort flattens out. Even for a trillion inputs, .
This is the whole game. When we say "grows faster" than , we mean the slope of (which is ) eventually outpaces the slope of (which is just ). No constant multiplier can prevent this, because a growing function always beats a constant.
Why Constants Get Thrown Away
Take and .
At : and . The linear function looks way worse.
At : and . The quadratic function is 10x worse.
The crossover happens at (where ). Before that, the constant inflates above . After that, the accelerating slope of takes over permanently.
The constant 100 only delays the crossover point. It can't prevent it, because keeps growing while stays flat. Even would eventually lose to , it would just take until for the crossover to happen.
That's why we write instead of . The constant changes when the crossover occurs, not whether it occurs.
The Formal Definitions
All four notations classify the relative growth relationship between two functions. The slope perspective connects them all.
Big O (): the loose ceiling (). is if there exist constants and such that for all : .
The is the crossover point. We're saying "I don't care about the messy race at small inputs, I only care about behavior after the curves diverge." The absorbs the constant factor we're throwing away. This allows ties: is because they have the same growth shape.
Little o (): the strict gap (). is if .
Big O allows two functions with the same growth shape (like and ). Little o demands that becomes insignificant compared to . The ratio has to go to zero, not just stay bounded. So is (linear is negligible compared to quadratic), but is NOT (their ratio is 2, not 0). Little o means 's slope is in a completely higher league.
Big Omega (): the floor (). is if for all .
The mirror of Big O. Instead of "won't grow faster than this," it says "won't grow slower than this." In security, we use this to prove a lower bound on the attacker's work: their effort is at least exponential.
Theta (): the exact fit (). is if it is both and .
The growth shape is pinned down exactly. It's both the ceiling and the floor.
| Notation | Intuition | Analogy |
|---|---|---|
| Loose ceiling | (allows ties) | |
| Strict gap | (no ties) | |
| Floor | ||
| Exact fit |
Worst case vs average case. Big O usually describes worst-case complexity (Murphy's Law: assume the input is the absolute worst arrangement). Average case measures expected time over a randomly chosen input. In security, worst-case matters because we assume the attacker is brilliant and lucky.
The Caveat: Asymptotics vs Practice
An algorithm that is asymptotically better isn't always better in practice. If we're only processing 50 items, an algorithm with a constant factor of 1000 is slower than an algorithm with a constant factor of 1. The constants we threw away dominate at small inputs.
Asymptotic analysis assumes is massive. For small or moderate , you have to look at the actual constants and benchmark.
Where This Shows Up in Security
Cryptographic security is built on an asymmetric gap between two growth curves. We want the legitimate user's effort to be polynomial ( or ), while forcing the attacker into exponential effort ().
Adding 1 bit to a key doubles the attacker's work (), but barely changes the user's effort. That's the asymmetry.
In the formal notation: the user's effort is of the attacker's effort (strict gap, not just Big O). The ratio , so the user becomes negligible compared to the attacker's workload as grows.
The threat is shortcuts. If someone discovers an algorithm for factoring (replacing the current exponential methods), the gap collapses. Both user and attacker would be in polynomial time, and the "wall" disappears. This is exactly the quantum computing concern with RSA.
For how this asymptotic gap gets formalized into security definitions, see why-negligible-funcs (negligible functions are the functions that shrink faster than any inverse polynomial, making polynomial repetition unable to amplify success) and hardness-assumption (the assumption that no polynomial-time algorithm can solve the underlying problem).