I am trying to learn about complexity theory, which states that $f(n)$ is in $O(g)$ if, for some $C > 0$, $f(n) \leq C\cdot g(n)$ for all $n \in \mathbb{N}$. That's well and good; it makes sense to me, but when it comes to the exercises, I don't know how to actually prove that a given function is bounded by another! Here is an example:
$$f(n) = 5n^2 + 3n + 7\quad\mathrm{and}\quad g(n) = n^3$$
My intuition tells me that $f(n)$ is in $O(g)$ because the highest exponent in the function $f$ is smaller than in $g$; however, after plotting the two functions, it becomes clear that the constant added to $f$, $7$, prevents $g(n)$ from being greater for $g(n) < 1$. What is the "correct" way of approaching this problem?
Since we only care about natural numbers, try the first few:
$f(1)=15, g(1)=1$, so if this works, $C \geq 15$.
$f(2)=33, g(2)=8$. $15$, works here. Now that we have a $C$ that should work, we want to check the $Cg(n)=15n^3 \geq f(n)$ for $n=1,2,...$.
$f(n) \leq 5n^2+3n^2+7n^2=15n^2 \leq 15g(n)=15n^3$ for $n\geq 1$.