BigO of functions with subtractions

34 Views Asked by At

I have $f(a, b) \in O(b - a)$ and $g(a) \in O(a)$.

Can I conclude that $f(a,b) + g(a) \in O(b)$?

What if $f(a, b) \in \Theta(b - a)$ and $g(a) \in \Theta(a)$?

1

There are 1 best solutions below

0
On

Well, answering my own question:

$f(a, b) = b - 2\cdot a$ is in $O(b - a)$, and $g(a) = a$ is in $O(a)$.

$f(a, b) + g(a) = b - 2\cdot a + a = b - a$ which apparently $\notin O(b)$.

So obviously I cannot conclude as intended, but I am still curious how I can reason about $f(a, b) + g(a)$.