I encounter this problem when I was trying to show that
$\sec x=1+\frac{1}{2}x^2+o(x^2) \: as \: x \rightarrow 0.$
We know that $\cos x=1-\frac{1}{2}x^2+o(x^3).$
So $\sec x=\frac{1}{1-\frac{1}{2}x^2+o(x^3)} = 1+\frac{1}{2}x^2-o(x^3)+o(o(x^3)-\frac{1}{2}x^2)$
In the the book Calculus Apostol, it states that the the two little o's behind is equal to $o(x^2)$ without an explanation.
I could prove that they equal to $o(x)$ since
$-o(x^3)+o(o(x^3)-\frac{1}{2}x^2)$
$= -o(x^3)+o(o(x^3)-o(x))$
$= -o(x^3)+o(o(x^3)+o(x)) = -o(x^3)+o(o(x))=o(x)+o(x^3)=o(x).$
But is this correct, if then how can it equal $o(x^2)$?
You are trying to understand in Example 1 that $$ \frac{1}{\cos x}=\frac{1}{1-\frac12x^2+o(x^3)}=1+\frac12 x^2+o(x^2) \quad\textrm{as }x\to 0. $$
Apostol says that this is "from part (e) of Theorem 7.8", i.e.,
So if you let $g(x)=-\frac12x^2+o(x^3)$, then $$ \sec x = 1-(-\frac12x^2+o(x^3))+o(-\frac12x^2+o(x^3)) =1+\frac12x^2-o(x^3)+o(-\frac12x^2+o(x^3)). $$
Note that $-o(x^3)=o(-x^3)=o(x^3)$ by Theorem 7.8 (c) and (b). Also, $$ o(-\frac12x^2+o(x^3))=o(x^2). $$
Hence, $$ \sec x = 1+\frac12 x^2+o(x^3)+o(x^2) =1+\frac12 x^2+o(x^2). $$
[Added.] To see why $o(-\frac12x^2+o(x^3))=o(x^2)$, suppose $f(x)=o(-\frac12x^2+h(x))$ for some $h$ with $\lim_{x\to 0}\frac{h(x)}{x^3}=0$. Then by definition, $$ \lim_{x\to 0}\frac{f(x)}{-\frac12x^2+h(x)}=0.\tag{1} $$
We want to show that $f(x)=o(x^2)$, i.e., $$ \lim_{x\to 0}\frac{f(x)}{x^2}=0.\tag{2} $$
But $$ \lim_{x\to 0}\frac{f(x)}{x^2} =\lim_{x\to 0}\frac{f(x)}{-\frac12x^2+h(x)}\cdot \frac{-\frac12x^2+h(x)}{x^2} =\lim_{x\to 0}\frac{f(x)}{-\frac12x^2+h(x)}\cdot \lim_{x\to 0}\frac{-\frac12x^2+h(x)}{x^2}=0. $$