How to calculate $\lim_{x \to 0} \left( \cos(\sin x) + \frac{x^2}{2} \right)^{\frac{1}{(e^{x^2} -1) \left( 1 + 2x - \sqrt{1 + 4x + 2x^2}\right)}}$? I need some help with computing this limit:
$$\lim_{x \to 0} \left( \cos(\sin x) + \frac{x^2}{2} \right)^{\frac{1}{(e^{x^2} -1) \left( 1 + 2x - \sqrt{1 + 4x + 2x^2}\right)}}$$
I'm guessing that I should do a Taylor expansion of $\cos(\sin x)$ in base, but what should I do with the stuff in the exponent?

What is the problem?
From first inspection:


*

*$\cos(\sin x) + \frac{x^2}{2} \to 1^-$

*$e^{x^2}-1 \to 0^+$

*$1+2x - \sqrt{ (1+2x)^2 - 2x^2 }\to 0^+$


So we have a case of $1^\infty$, which is indeterminate, and therefore we are going to need series expansions to solve this. Let us develop the following exponent term near $0$:
$$
  \frac{ \log\left( \cos(\sin x) + \frac{x^2}{2} \right) }{ (e^{x^2}-1) (1+2x - \sqrt{1+4x+2x^2}) }
$$
Using series expansion
Choosing a precision
From rapid inspection we see that if we choose $\mathcal{O}(x^2)$, we will be left with $\cos(\sin x) + \frac{x^2}{2} \sim 1$, which will lead to $e^{\frac{\log 1}{0^+}}$ and it gets us nowhere. So we need at least $\mathcal{O}(x^3)$. Let us choose $\mathcal{O}(x^4)$ (you will see later why).
Numerator
We have:
\begin{align}
  \sin x &\sim x - \frac{x^3}{6} + \mathcal{o}(x^4) \\
  \cos(\sin x) &\sim \cos\left( x - \frac{x^3}{6} \right) 
    \sim 1 - \frac{\left( x - \frac{x^3}{6} \right)^2}{2} + \frac{\left( x - \frac{x^3}{6} \right)^4}{24} + \mathcal{o}(x^4)
\end{align}
Note that the last term is important because it contains $x^4/24$ which is within the precision that we set. Most other terms vanish and we have after simplification:
$$
  \cos(\sin x) + \frac{x^2}{2} \sim 1 + \frac{5x^4}{24} + \mathcal{o}(x^4)
$$
Now you can see why $\mathcal{O}(x^3)$ was not sufficient. Finally, we can develop the logarithm further:
$$
  \log\left(1 + \frac{5x^4}{24}\right) \sim \frac{5x^4}{24} + \mathcal{o}(x^4)
$$
Denominator
There are two factors in the denominator, one with an exponential, and one with a square-root, the relevant developments are:
\begin{align}
  e^{x^2} - 1 &\sim x^2\left(1 + \frac{x^2}{2}\right) + \mathcal{o}(x^4) \\
  [1+2x(2+x)]^{1/2} &\sim 1 + x(2+x) - \frac{x^2(2+x)^2}{2} + \mathcal{O}(x^3)\\
  &\sim 1 + 2x - x^2 + \mathcal{O}(x^3)
\end{align}
Note that we don't need to develop that last term to full precision because we only need to be able to factor $x^2$ to eliminate the factor $x^4$ in the numerator; once we do that, all other terms $\mathcal{o}(x^2)$ will vanish in the limit. (The actual development is $1+2x-x^2+2x^3-9x^4/2$).
This leads to the following denominator, after simplification:
$$
  x^4 \left( 1 + \frac{x^2}{2} \right) \left( 1 +\mathcal{O}(x) \right)
$$
Final limit
Putting all this together, we finally obtain the desired limit:
$$
  \exp\left[\frac{5}{24 \left(1+\frac{x^2}{2}\right) \left(1+\mathcal{O}(x)\right)}\right] \to e^\frac{5}{24}
$$
