<s>[INST] Find $\lim_{x\rightarrow\infty}x\left(\frac{1}{e}-\left(\frac{x}{x+1}\right)^x\right).$ This is what my prof did:
Rewrite as $$x\left(\frac{1}{e}-\left(\frac{x}{x+1}\right)^x\right)=\frac{x}{e}\left(1-e\cdot e^{-x\ln{\left(1+\frac{1}{x}\right)}}\right).$$
Here he uses that
$$\ln{(1+t)}=t-\frac{t^2}{2}+O(t^3),$$
so 
$$\frac{x}{e}\left(1-e\cdot e^{-x\left(\frac{1}{x}-\frac{1}{2x^2}+O(\frac{1}{x^3})\right)}\right)=\frac{x}{e}\left(1-e^{\frac{1}{2x}+O\left(\frac{1}{x^3}\right)}\right).$$
So far so good. Now, he uses that $e^t=1+t+O(t^2)$ so that the expression aove becomes
$$\frac{x}{e}\left(1-\left(1+\frac{1}{2x}+O\left(\frac{1}{x^2}\right)\right)\right)=-\frac{1}{2e}+O\left(\frac{1}{t}\right)$$
and now he lets $x\rightarrow\infty$ to get the answer. However, when he introduces the expansion of $e^t$, how does he get $O(1/x^2)$? 
It is my understanding that I should plug in $t=\frac{1}{2x}+O\left(\frac{1}{x^3}\right)$ everywhere in $1+t+O(t^2),$ doing that I get
$$1+\frac{1}{2x}+O\left(\frac{1}{x^3}\right)+O\left(\left(\frac{1}{2x}+O\left(\frac{1}{x^3}\right)\right)^2\right),$$
Squaring that last ordo-term, the largest power of $x$ is $1/x^2$ and the smallest is $1/x^6.$ Why choose $1/x^2$?
 [/INST] The whole argument must be understood for $t=1/x\to0$, so that the lowest exponents yield the largest terms ($t^2$ exceeds $t^4$ because $1$ exceeds $t^2$; if you prefer, $1/x^2$ exceeds $1/x^4$ because $x^4$ exceeds $x^2$).
Then
$$e^{t+O(t^3)}=1+t+O(t^3)+O\left(\left(t+O(t^3)\right)^2\right)=1+t+O(t^2)$$ by keeping the terms of lowest degree.
</s>