<s>[INST] Calculating a limit with series Good evening to everyone. I have a limit that gave me a lot of trouble and I couldn't find a way to solve it. I tried solving it with series but I couldn't arrive at a result.
$$
\lim _{x\to 0+}\left(\frac{\left(e^{-\frac{1}{x^2}}\cos \left(\log _e\left(x\right)\right)+\cos \left(\arctan \left(x\right)\right)-e^{-\frac{x^2}{2}}\right)}{\log _e\left(1+x^2\right)-\sin \left(x^2\right)}\right)
$$
Thank you!
 [/INST] tl;dr: This is going to be such a hoot.


*

*Let us start with the denominator:
$$\begin{align}
\ln\left(1+x^2\right)-\sin \left(x^2\right)
&= 
x^2-\frac{x^4}{2} + o(x^4) - (x^2+o(x^4)) = -\frac{x^4}{2} + o(x^4)
\end{align}
$$

*Now, the meat — the numerator, piece by piece: 


*

*No Taylor for the first, it does not apply (the arguments do not tend to $0$, for a start).
$$\begin{align}
\lvert e^{-\frac{1}{x^2}}\cos \left(\ln\left(x\right)\right)\rvert \leq 
e^{-\frac{1}{x^2}} \xrightarrow[x\to 0]{} 0
\end{align}
$$
and this term is negligible in front of any power of $x$: it decays exponentially. So in particular it is $o(x^4)$, say. (Tell me if you need a proof of that. Edit: see $(\dagger)$ at the end)

*The second, we can do a series expansion:
$$\begin{align}
\cos \left(\arctan \left(x\right)\right)
&= \cos\left( x- \frac{x^3}{3} + o(x^4)\right)= 1 - \frac{x^2}{2}+\frac{3x^4}{8} + o(x^4)
\end{align}
$$
and the last term (series can be used as well):
$$\begin{align}
-e^{-\frac{x^2}{2}} &= -(1-\frac{x^2}{2}+\frac{x^4}{8}+o(x^4)) = -1+ \frac{x^2}{2}-\frac{x^4}{8}+o(x^4)
\end{align}
$$
so overall
$$\begin{align}
e^{-\frac{1}{x^2}}\cos \left(\ln\left(x\right)\right) +\cos \left(\arctan \left(x\right)\right)-e^{-\frac{x^2}{2}} 
&= o(x^4) + 1 - \frac{x^2}{2}+\frac{3x^4}{8} + o(x^4)  + -1+ \frac{x^2}{2}-\frac{x^4}{8}+o(x^4)\\
&= \frac{x^4}{4}+o(x^4)
\end{align}
$$


*Putting it all together:
$$
\frac{e^{-\frac{1}{x^2}}\cos \left(\log _e\left(x\right)\right)+\cos \left(\arctan \left(x\right)\right)-e^{-\frac{x^2}{2}}}{\log _e\left(1+x^2\right)-\sin \left(x^2\right)}
= \frac{\frac{x^4}{4}+o(x^4)}{-\frac{x^4}{2} + o(x^4)}
\xrightarrow[x\to0^+]{} -\frac{1}{2}.
$$

Edit:
$(\dagger)$ We used the fact that, for any fixed $\alpha\geq 0$, 
$$
e^{-\frac{1}{x^2}} = o(x^\alpha)
$$
when $x\to 0$. Note that setting $u=\frac{1}{x^2}$, this is equivalent to proving that for every $\alpha \geq 0$
$
e^{-u} = o(u^{-\alpha})
$ when $u\to+\infty$, or, again, equivalently, that $$\lim_{u\to+\infty}u^\alpha e^{-u} = 0$$ for any fixed $\alpha \geq 0$. Do you see why this is true?
</s>