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?
 A: This answer is a codicil to that of Paramanand Singh. I give here a different calculation of $$\lim\limits_{x\to 0} \frac{\cos(\sin x)-1+\frac{x^2}{2}}{x^4}$$ 
Frequent use of the replacement of $\sin y$ by $\frac{\sin y}{y}y$ is made.
We have 
$$ \frac{\cos(\sin x)-1+\frac{x^2}{2}}{x^4}= \frac{\cos(\sin x)-\cos x}{x^4}
+ \frac{\cos(x)-1+\frac{x^2}{2}}{x^4}.$$ And we calculate each separately.
For the first we use the difference of cosines formula $\cos a-\cos b=2\sin \frac{a+b}{2}\sin \frac{b-a}{2}$
So we have $$\frac{\cos(\sin x)-\cos x}{x^4}=2\frac{\sin \frac{\sin x+x}{2}}{x}\frac{\sin \frac{x-\sin x}{2}}{x^3}$$
the standard replacement above reduces to the limit of 
$$\frac{1}{2}\frac{\sin x+x}{x}\frac{x-\sin x}{x^3}\rightarrow \frac{1}{6}.$$
As for the limit $\frac{\cos(x)-1+\frac{x^2}{2}}{x^4}$, many people would be willing to take this as granted but I give here a nice elementary derivation.
First $$\left(\frac{1-\cos x}{x^2}\right)^2=\frac{2-2\cos x-\sin^2 x}{x^4}\rightarrow \frac{1}{4}$$
Second $$\frac{x-\sin x}{x^3}\frac{\sin x}{x}=\frac{x\sin x-\sin^2 x}{x^4}\rightarrow \frac{1}{6}$$
Subtracting the first from the second gives
$$\frac{2\cos x-2 +x\sin x }{x^4}\rightarrow -\frac{1}{12} $$
we can rewrite this as
$$2\frac{\cos x-1 +\frac{x^2}{2} }{x^4}+\frac{\sin x -x}{x^3}\rightarrow -\frac{1}{12} $$ and this gives 
$$\frac{\cos x-1 +\frac{x^2}{2} }{x^4}\rightarrow \frac{1}{24} $$
Finally adding them together we get 
$$\frac{1}{6}+\frac{1}{24}=\frac{5}{24}.$$
A: 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}
$$
