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
 A: 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}$.
A: Consider $$A=\Big(1+\frac {1-\cos (x)} {x} \Big)^\frac{1}{x}$$ $$\log(A)=\frac{1}{x}\log\Big(1+\frac {1-\cos(x)} {x} \Big)$$ Now, use Taylor series $$\cos(x)=1-\frac{x^2}{2}+\frac{x^4}{24}+O\left(x^5\right)$$ $$1+\frac {1-\cos(x)} {x} =1+\frac{x}{2}-\frac{x^3}{24}+O\left(x^4\right)$$ Now, use the following series $$\log(1+y)=y-\frac{y^2}{2}+O\left(y^3\right)$$ and replace $y$ by $(\frac{x}{2}-\frac{x^3}{24})$ keeping the low order terms; this makes $$\log\Big(1+\frac {1-\cos(x)} {x} \Big)=\frac{x}{2}-\frac{x^2}{8}+O\left(x^4\right)$$ $$\log(A)=\frac{1}{2}-\frac{x}{8}+\cdots$$
This shows the limit and also how it is approached.
I am sure that you can take from here.
A: Use Asymptotic analysis: as $\cos x=1-\dfrac{x^2}2+o(x^2)$, we have:
\begin{align*}\ln\Bigl(1+\frac {1-\cos x} {x} \Bigr)^\tfrac{1}{x}&=\frac{1}{x}\ln\Bigl(1+\frac {1-\cos x} {x} \Bigr)\\
&=\frac{1}{x}\ln\Bigl(1+\frac x2 +o(x) \Bigr)=\frac{1}{x}\Bigl(\frac x2 +o(x)\Bigr)\\
&=\frac 12 +o(1),
\end{align*}
which tends to $\dfrac12$ as $x$ tends to $0$, hence the initial expression tends to $\,\mathrm e^{\tfrac12}$.
A: $$
\begin{align}
\left(1+\frac{1-\cos(x)}{x}\right)^{1/x}
&=\left(1+\frac{2\sin^2(x/2)}{x}\right)^{1/x}\\
&=\left(1+\frac12\frac{\sin^2(x/2)}{(x/2)^2}x\right)^{1/x}\\
\end{align}
$$
Since $e^x$ is continuous at $x=\frac12$,
$$
\lim_{x\to0}(1+ax)^{1/x}=e^{a/2}
$$
and
$$
\lim_{x\to0}\frac{\sin(x)}{x}=1
$$
we get
$$
\lim_{x\to0}\left(1+\frac12\frac{\sin^2(x/2)}{(x/2)^2}x\right)^{1/x}=e^{1/2}
$$
A: $(1-\cos x)/x^2 \to 1/2\implies 1-\cos x= x^2/2 +o(x^2).$ Thus the expression equals
$$(1+x/2+o(x))^{1/x} = \left [(1+x/2+o(x))^{1/(x/2+o(x))}\right ]^{(x/2+o(x))/x} $$
Using $\lim_{u\to 0}(1+u)^{1/u}=e,$ we see the limit equals $e^{1/2}.$
A: Here is a solution using L'Hôpital's rule.
$$\begin{array}{lll}
\displaystyle\lim_{x \to 0} \left(1+\frac {1-\cos x} {x} \right)^\frac{1}{x}&=&\displaystyle\lim_{x \to 0} \left(1+\frac {1-\cos x} {x} \right)^{\frac{1}{x}\cdot\frac{x}{1-\cos x}\cdot\frac{1-\cos x}{x}}\\
&=&\displaystyle\lim_{x \to 0} \bigg[\left(1+\frac {1-\cos x} {x} \right)^{\frac{x}{1-\cos x}}\bigg]^{\frac{1-\cos x}{x^2}}\\
&=& \displaystyle e^{\lim_{x \to 0}\displaystyle\frac{1-\cos x}{x^2}}\\
&=& \displaystyle e^{\lim_{x \to 0}\displaystyle\frac{\sin x}{2x}}\\
&=& \displaystyle e^{\lim_{x \to 0}\displaystyle\frac{\cos x}{2}}\\
&=& \displaystyle \sqrt{e}^{\lim_{x \to 0}\displaystyle \cos x}=\sqrt{e}^1=\sqrt{e}\\
\end{array}$$
