Big Oh: Mathematical Definition
Read it as
is a member of if and only if there exist positive constants and such that for all .
Here is a pictorial illustration of the above definition:

If you want to prove that , you need to choose the constants and so that above definition holds whenever .
Exercise The running time of an algorithm is . Show that this algorithm has quadratic runtime, i.e. prove .
Solution
We can choose and for the definition of Big Oh to hold.
There is not a systematic way to find the constants. However, you can usually play with the to find one.
Resources
- Khan academy's article on Big O notation.
- Wikipedia's entry on Big O notation.
- This article is well written: Big-O Notation — A Primer.