General Big-O operations. Suppose $T_1(n) = O(f(n))$ and $T_2(n) = O(f(n))$.  Determine if the following is true or false.  If false, provide a $T_1,T_2$ for which it is false.
$T_1(n) - T_2(n) = O(f(n))$.
My solution:  $$T_1(n) - T_2(n) = T_1(n) + (-T_2(n)) = \big(T_1 + (-T_2)\big)(n) = O\big(\max\{|f(n)|,|-f(n)|\}\big) = O(f(n)).$$
Thus, true.
Correct?
What are the rules for these operations?
Thanks!
 A: It is true. The minus sign does not affect the big O notation, if one defines the the big O notation as wikipedia does. Thus,
$$
T_1(n)-T_2(n)=O(f(n))-O(f(n))=O(f(n))+O(f(n))=O(f(n)).
$$
A: Always go back to, and use, the definitions. If $T_1(x)=O(f(x))$ and $T_2(x)=O(f(x))$ as $x\to \infty$ then there exist positive $k_1,k_2$ such that $S_1=\{x:|T_1(x)|>|f(x)|\}$ and $S_2=\{x: |T_2(x)|>|f(x)|\}$ have finite upper bounds. So $S_1\cup S_2$ has a finite upper bound $M.$ And for $x>M$ we have $$|T_1(x)-T_2(x)|\leq |T_1(x)|+|T_2(x)|\leq k_1|f(x)|+k_2|f(x)|=(k_1+k_2)|f(x)|.$$
You can derive further rules by referring back to the def'n. E.g. for constant $k$, if $T=O(f)$ then $k T=O(f)$ and if $T_1=O(f)=T_2$ then $T_1\cdot T_2=O(f^2).$
A: We start with the definition of Big - O notation.As in the question $T_1(n)=O(f(n))$ and $T_2(n)=O(f(n))$ which is true when the following inequalities hold respectively:-
$$T_1(n)\le n_0+c_1f(n) \tag{1.}$$ where $n_0$ and $c_1$ are constants.
again:-
$$T_2(n)\le n_1+c_2f(n)\tag{2.}$$
where $n_1$ and $c_2$ are constants.Now if we do $T_1(n)-T_2(n)$ then $|T_1(n)-T_2(n)|$ may be less than,greater than or equal to $|(n_0-n1)+(c_1-c_2)f(n)|$:-
case 1:($\le$) $$|T_1(n)-T_2(n)|\le |(n_0-n1)+(c_1-c_2)f(n)|$$
Let's take an example :-$|1|<|2|$ then $1>-2$ and $1<2$ .So on multiplying r.h.s. by -1 then $$T_1(n)-T_2(n)\ge(n_1-n_0)+(c_2-c_1)f(n)=T_1(n)-T_2(n)=\Omega(f(n))$$
On the other hand:-
$$T_1(n)-T_2(n)\le (n_0-n_1)+(c_1-c_2)f(n)=T_1(n)-T_2(n)=O(f(n))$$

case 2:($\ge$)$$|T_1(n)-T_2(n)|\ge |(n_0-n_1)+(c_1-c_2)f(n)|$$Here On multiplying the r.h.s by -1 doesn't do any effect on the greater than inequality $$T_1(n)-T_2(n)\ge (n_1-n_0)+(c_2-c_1)f(n)$$ where $(n_0-n_1)$ and $(c_2-c_1)$ are constants so $$T_1(n)-T_2(n)=\Omega(f(n))$$

Example :-

$T_1(n)=\log n$ , $T_2(n)=\log n- n^2$ ,$f(n)=n$ 
$T_1(n)=O(f(n))$ and $ T_2(n)=O(f(n))$
$$T_1(n)-T_2(n)=n^2$$
so $$T1(n)-T_2(n)=\Omega(f(n))$$
