Computing $\lim_{x \to 0} \frac{\cos x - \sqrt{2 - e^{x^2}}}{\ln{(\cos x) + \frac{1}{2} x \sin x}} \cdot \frac{(x+2)^{2017}}{(x-2)^{2015}}$ I'm studying for an exam, but I have trouble with computing the following limit:
$$\lim_{x \to 0}  \frac{\cos x - \sqrt{2 - e^{x^2}}}{\ln{(\cos x) + \frac{1}{2} x \sin x}} \cdot \frac{(x+2)^{2017}}{(x-2)^{2015}}$$
I tried directly plugging in a $0$, but that just results in $\frac{0}{0}$. Using L'Hospital's rule doesn't seem like it would help simplify this. Any help would be appreciated.

This is another case of intimidation via use of large numbers. The part $(x + 2)^{2017}/(x - 2)^{2015}$ is a rational function which is defined for $x = 0$ and hence its limit as $x \to 0$ is same as its value at $x = 0$ and thus the limit of this part is $-4$. We can thus proceed as follows
\begin{align}
L &= \lim_{x \to 0}\dfrac{\cos x - \sqrt{2 - e^{x^{2}}}}{\log\cos x + \dfrac{1}{2}x \sin x}\cdot\frac{(x + 2)^{2017}}{(x - 2)^{2015}}\notag\\
&= -4\lim_{x \to 0}\dfrac{2\cos x - 2\sqrt{2 - e^{x^{2}}}}{2\log\cos x + x \sin x}\notag\\
&= -8\lim_{x \to 0}\dfrac{\cos x - \sqrt{2 - e^{x^{2}}}}{2\log\cos x + x \sin x}\notag\\
&= -8\lim_{x \to 0}\dfrac{\cos^{2} x - (2 - e^{x^{2}})}{\{2\log\cos x + x \sin x\}\{\cos x + \sqrt{2 - e^{x^{2}}}\}}\notag\\
&= -4\lim_{x \to 0}\dfrac{\cos^{2} x - (2 - e^{x^{2}})}{2\log\cos x + x \sin x}\tag{1}
\end{align}
Now we can see that $$\frac{d}{dx}\log\cos x = -\tan x = -x - \frac{x^{3}}{3} + o(x^{3})$$ and hence via integration it follows that $$\log\cos x = - \frac{x^{2}}{2} - \frac{x^{4}}{12} - o(x^{4})$$ so that $$2\log\cos x + x\sin x = - \frac{x^{4}}{3} + o(x^{4})\tag{2}$$ and clearly $$\cos^{2}x - 2 + e^{x^{2}} = \frac{\cos 2x + 2e^{x^{2}} - 3}{2} = \frac{5x^{4}}{6} + o(x^{4})\tag{3}$$ It should now be obvious from equations $(1), (2)$ and $(3)$ that the desired limit is $$-4\cdot\frac{5/6}{-1/3} = 10$$ I have tried to get the required Taylor series expansion for $\log\cos x$ without using any tedious calculation.
