Let $f:\mathbb{Z} \rightarrow \mathbb{Z}$
$f(x) = 3x + 2$
How do I determine if $f$ is $O(x)$?
Let $f:\mathbb{Z} \rightarrow \mathbb{Z}$
$f(x) = 3x + 2$
How do I determine if $f$ is $O(x)$?
Suppose you are interested in the asymptotics. Then note that $f(x)/x = 3 + 2/x$ for all integers $x > 0$. So $f(x)/x < 4$ for all integers $x \geq 4$. By definition $f$ is $O(x)$ as $x \to \infty$.
You are given a polynomial function $f(x)$ (in your case it is degree 1) then $f(x) = O(x^n)$ where $n$ is the degree of $f(x)$. In a polynomial it is the highest term that dominates (relatively speaking).
A polynomial $f(x)$ is said to be $O(x^n)$ if $f(x) \leq cx^n$ for some $c > 0$ and $\forall x\geq x_0 $.
Here, $f(x) = 3x +2$, so $f(x) \leq 4x \hspace{2mm} \forall x\geq 2 $. So $f(x) = O(x)$. Here $c =4$ and $x_0 = 2$.