Asymptotic expansion of ratio function 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?
 A: $$\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$.
A: Around $0$:
$$
f(x) = \frac{1}{x-\frac{x^2}{2}+\frac{x^3}{6}+o(x^3)}
= \frac{1}{x}\frac{1}{1-\frac{x}{2}+\frac{x^2}{6}+o(x^2)}
$$
(Advice: when doing Taylor expansions, avoid the equivalents $\sim$, which are made to capture the first term only. Confusions and mistake may arise very quickly otherwise.)
Now, use the fact that $\frac{x}{2}+\frac{x^2}{6}+o(x^2) \xrightarrow[x\to0]{}0$, and that $$\frac{1}{1+u} = 1-u+u^2 + o(u^2)$$ when $u\to 0$ (your $u$ will be $-\frac{x}{2}+\frac{x^2}{6}+o(x^2)$):
$$\begin{align}
f(x) &= \frac{1}{x}\frac{1}{1-\frac{x}{2}+\frac{x^2}{6}+o(x^2)}
= \frac{1}{x} \left(1+\frac{x}{2}-\frac{x^2}{6}+o(x^2)+\left(\frac{x}{2}+\frac{x^2}{6}+o(x^2)\right)^2\right)\\
&= \frac{1}{x} \left(1+\frac{x}{2}-\frac{x^2}{6}+o(x^2)+\left(\frac{x^2}{4}+o(x^2)\right)\right)
= \frac{1}{x} \left(1+\frac{x}{2}-\frac{x^2}{6}+o(x^2)+\frac{x^2}{4}\right)\\
&= \frac{1}{x} \left(1+\frac{x}{2}+\frac{x^2}{12}+o(x^2)\right)
= \frac{1}{x}+\frac{1}{2}+\frac{x}{12}+o(x)
\end{align}$$
A: We can consider the complex function $f(z):=\frac{1}{1-e^{-z}}$, it is easy to see that $f$ has a simple pole with residue $1$ at $z=0$, thus $\frac{1}{1-e^{-z}}  -\frac{1}{z}$ is holomorphic on a neighborhood of the origin, then we can expand it as Taylor series:
$$\frac{1}{1-e^{-z}}-\frac{1}{z}=\frac{1}{2}+\frac{1}{12}z+O(z^2).$$
It follows that 
$$\frac{1}{1-e^{-z}}=\frac{1}{z}+\frac{1}{2}+\frac{1}{12}z+O(z^2).$$
