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!
 A: 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?
A: If you want to do this without relying on Taylor series, note that
$$\lim_{x\to0^+}\left({e^{-{1\over x^2}}\cos(\ln x)+\cos(\arctan x)-e^{-{x^2\over2}}\over\ln(1+x^2)-\sin(x^2)}\right)
={\displaystyle\lim_{x\to0^+}\left({e^{-{1\over x^2}}\cos(\ln x)\over x^4}\right)+\lim_{x\to0^+}\left(\cos(\arctan x)-e^{-{x^2\over2}}\over x^4\right)\over\displaystyle\lim_{x\to0^+}\left(\ln(1+x^2)-\sin(x^2)\over x^4 \right)}$$
provided all three limits on the right exist and the one in the denominator is nonzero. (The "cleverness" here, if any, is knowing to use an $x^4$.  But that really just comes from anticipating what's going to happen in the denominator.)
Let's take them one at a time, starting with the denominator. A change of variable and two L'Hopitals lead to
$$\lim_{x\to0^+}\left(\ln(1+x^2)-\sin(x^2)\over x^4 \right)=\lim_{u\to0^+}\left(\ln(1+u)-\sin(u)\over u^2 \right)=\lim_{u\to0^+}\left({1\over1+u}-\cos u\over2u \right)=\lim_{u\to0^+}\left({-1\over(1+u)^2}+\sin u\over2 \right)=-{1\over2}$$
As for the first limit in the numerator,
$$\left|\lim_{x\to0^+}\left({e^{-{1\over x^2}}\cos(\ln x)\over x^4}\right)\right|\le\lim_{x\to0^+}\left({e^{-{1\over x^2}}\over x^4}\right)=\lim_{u\to\infty}{u^2\over e^u}=\lim_{u\to\infty}{2u\over e^u}=\lim_{u\to\infty}{2\over e^u}=0$$
Finally, it's convenient to convert 
$$\cos(\arctan x)={1\over\sec(\arctan x)}={1\over\sqrt{1+\tan^2(\arctan x)}}={1\over\sqrt{1+x^2}}$$
so that, as with the limit in the denominator, we get
$$\lim_{x\to0^+}\left(\cos(\arctan x)-e^{-{x^2\over2}}\over x^4\right)=\lim_{u\to0^+}\left((1+u)^{-1/2}-e^{-u/2}\over u^2 \right)=\lim_{u\to0^+}\left(-{1\over2}(1+u)^{-3/2}+{1\over2}e^{-u/2}\over 2u \right)=\lim_{u\to0^+}\left({3\over4}(1+u)^{-5/2}-{1\over4}e^{-u/2}\over 2 \right)={1\over4}$$
Putting it all together, we get
$$\lim_{x\to0^+}\left({e^{-{1\over x^2}}\cos(\ln x)+\cos(\arctan x)-e^{-{x^2\over2}}\over\ln(1+x^2)-\sin(x^2)}\right)={0+{1\over4}\over-{1\over2}}=-{1\over2}$$
