Limit of a function with exponentiation In my assignment I have to calculate the following limit:
$$\lim_{x \to 0} \left(1+\frac {1-\cos x} {x} \right)^\frac{1}{x}$$
According to wolfram alpha, the result is $\sqrt{e} $. 
However in my calculations I got a different one. Can you please let me know where did I get it wrong? 
Here's my solution:
First we represent the argument differently:
$$\lim_{x \to 0} \left(1+\frac {1-\cos x} {x} \right)^\frac{1}{x}= \lim_{x \to 0} \left(\left(1+\frac {1-\cos x} {x} \right)^x\right)^ {\frac{1}{x}\cdot {x}} $$
Now we use the heine theorem and write the following:
$$\lim_{ n \to \infty} \left(\left(1+\frac {1-\cos n} {n} \right)^n\right)^ {\frac{1}{n}\cdot {n}} = \lim_{ n \to \infty} \left(\left(1+\frac {1}{n}-\frac{\cos n}{n} \right)^n\right)^ {\frac{1}{n}\cdot {n}}, $$ where $\frac {1}{n}-\frac{\cos n}{n} \to 0$.  Therefore $\lim_{ n \to \infty}\left(1+\frac {1}{n}-\frac{\cos n}{n} \right)^n\to e. $
Since $\frac{1} {n}\cdot n \to 1$, the whole argument approaches 
$$e^1=e$$
Where am I wrong here? 
P. S. another approach to solving this is welcome. 
Thanks, 
Alan

The best approach is to take logs. If $L$ is the desired limit then we have
\begin{align}
\log L &= \log\left(\lim_{x \to 0}\left(1 + \frac{1 - \cos x}{x}\right)^{1/x}\right)\notag\\
&= \lim_{x \to 0}\log\left(1 + \frac{1 - \cos x}{x}\right)^{1/x}\text{ (by continuity of log)}\notag\\
&= \lim_{x \to 0}\frac{1}{x}\log\left(1 + \frac{1 - \cos x}{x}\right)\notag\\
&= \lim_{x \to 0}\frac{1}{x}\log\left(1 + \frac{1 - \cos^{2} x}{x(1 + \cos x)}\right)\notag\\
&= \lim_{x \to 0}\frac{1}{x}\log\left(1 + \frac{\sin^{2}x}{x^{2}}\cdot\frac{x}{(1 + \cos x)}\right)\notag\\
&= \lim_{x \to 0}\frac{1}{x}\cdot\dfrac{\log\left(1 + \dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}\right)}{\dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}}\cdot\dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}\notag\\
&= \lim_{x \to 0}\dfrac{\log\left(1 + \dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}\right)}{\dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}}\cdot1\cdot\dfrac{1}{(1 + \cos x)}\notag\\
&= \frac{1}{2}\lim_{x \to 0}\dfrac{\log\left(1 + \dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}\right)}{\dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)}}\notag\\
&= \frac{1}{2}\lim_{t \to 0}\frac{\log(1 + t)}{t}\text{ (putting }t = \dfrac{\sin^{2}x}{x^{2}}\cdot\dfrac{x}{(1 + \cos x)})\notag\\
&= \frac{1}{2}\notag
\end{align}
It is now clear that $L = e^{1/2} = \sqrt{e}$.
