Is it true that $O(M^3 + NM^2) \, = \, O(M^3 + N)$, where $M$ and $N$ are variables of the function?
Big-oh for function of two variables
3
$\begingroup$
computer-science
asymptotics
-
3Set $M=0$; then $M^3 + NM^2$ vanishes, but $M^3 + N$ does not. – 2010-12-16
-
1Technically, setting M=0 doesn't quite work, since the bound only has to hold for all M,N sufficiently large. – 2010-12-16
1 Answers
5
[Throughout this answer, I'm going to use set notation in order to be pedantic.]
It is true that $O(M^3+N)\subset O(M^3+NM^2)$, since for $M$ sufficiently large, $c(M^3+N)
For the reverse inclusion, consider $f(M,N)=M^3+NM^2$. Clearly $f\in O(M^3+NM^2)$. We now need to show that for all $c$ and arbitrarily large $M,N$ that $f(M,N)>c(M^3+N)$. We can do this by setting $M=\log N$. We then have $f(\log N,N)=\log^3 N + N\log^2 N$, which is clearly larger than $c(\log^3 N + N)$ for all sufficiently large $N$. So $f(M,N)\not\in O(M^3+N)$.