I want to expand the following function:
$$ f(x)=\frac{1}{(1-e^{-x})} $$
$f(x)$ can be rewritten as $$ f(x) \sim \frac{1}{x-x^2/2 + x^3/2/3} $$ But I want to express big-oh notation such that $$ f(x) = \frac{1}{x} + .... +O(x^2) $$ up to $x^2$ order.
How to do it?
$$\frac{1}{1-e^{-x}}=\frac{1}{x-x^2/2+x^3/6+O(x^4)} \\ =\frac{1}{x} \frac{1}{1-x/2+x^2/6+O(x^3)} \\ =\frac{1}{x} (1+x/2-x^2/6+x^2/4+O(x^3))$$
where in the last step we used the identity $\frac{1}{1-y}=\sum_{m=0}^\infty y^m$ whenever $|y|<1$. Note that in this case $y=(-x/2+x^2/6+O(x^3))$ and so the $x^2$ term has a contribution from two factors of $x/2$ as well as a contribution from one factor of $x^2/6$.