limit without L'Hôpitale rule or infinity series 
I was solving this limit 
$$
\lim_{x\to0} \frac{\ln(x+1)-x}{1-\cos(x)}=L
$$
I tried to rewrite the function $f(x)=\dfrac{\ln(xe^{-x}+e^{-x})}{2\sin^2(\frac{x}{2})}$
and we have $$\lim_{x\to0} f(-x)=L$$
$$
4L=\lim_{x\to0} \frac{(e^x-1)^2}{\sin^2(\frac{x}{2})}=4
$$
and that give us $L=1$ But when I calculate it by Wolfarm the result was $-1$

Can any one tell me where's my fault ?
 A: As you have done : 
$$\lim_{x \rightarrow 0}\Bigg(\frac {\ln(x.e^{-x}+e^{-x})}{\sin^2(\frac{x}{2})}\Bigg)=2L$$
$$\implies\lim_{x \rightarrow 0}\Bigg(\frac{\ln(x.e^{-x}+e^{-x})}{x.e^{-x}+e^{-x}-1}.\frac{x.e^{-x}+e^{-x}-1}{\sin^2(\frac{x}{2})}\Bigg)$$
$$\implies \lim_{x \rightarrow 0}\Bigg(\frac{x.e^{-x}+e^{-x}-1}{\sin^2(\frac{x}{2})}\Bigg)=2L \dots (\star_1)$$
On replacing $x \rightarrow {-x}$
$$\implies\lim_{x \rightarrow 0}\Bigg( \frac{-x.e^{x}+e^{x}-1}{\sin^2(\frac{x}{2})}\Bigg)=2L \dots (\star_2)$$
On adding $\dots (\star_1)$ and $\dots (\star_2)$
$$\implies \lim_{x \rightarrow 0}\Bigg(\frac{-x.e^{x}+e^{x}-1}{\sin^2(\frac{x}{2})}+\frac{x.e^{-x}+e^{-x}-1}{\sin^2(\frac{x}{2})}\Bigg)=4L$$
$$\implies  \lim_{x \rightarrow 0}\frac{\Big(x.e^{-x}+e^{-x}-1\Big)+\Big (-x.e^{x}+e^{x}-1\Big)}{\sin^2(\frac{x}{2})}=4L $$
Here what you did, You cancelled $x.e^{-x}$ and ($-x.e^{x}$).But how?
This is the faulty point.The sum will be :
$$\implies \lim_{x \rightarrow 0}\frac{e^x+e^{-x}-2+x(e^{-x}-e^x)}{\sin^2(\frac{x}{2})}=4L $$
$$\implies \lim_{x \rightarrow 0}\frac{e^{2x}+1-2e^x+x(1-e^{2x})}{\sin^2(\frac{x}{2})}=4L $$
$$\implies \lim_{x \rightarrow 0}\frac{e^{2x}+1-2e^x+x(1-e^{2x})}{\frac{x^2}{4}}=4L $$
(Partial limit of $\sin x$)
$$\implies \lim_{x \rightarrow 0}\frac{e^{2x}+1-2e^x+x(1-e^2x)}{x^2}=L $$
$$\implies \lim_{x \rightarrow 0}\frac{(e^x-1)^2}{x^2}+ \lim_{x \rightarrow 0}\frac{x(1-e^{2x})}{x^2}=L$$
$$1-2=-1=L$$
$$L=-1$$
Hope it helps!
