Solving with L'Hôpital's rule. What is wrong? L'Hôpital's rule can be used infinitely many times as the limit remains $0/0$. However, this problem does not work with L'Hôpital's rule (I may have counted wrong).
Here it is:
$$\lim _{x\to 0}\left(\frac{\left(e^x+\sin x\right)x+e^x-\cos x}{x^2}\right)$$
We use L'Hôpital's rule once:
$$\lim _{x\to 0}\left(\frac{2\sin x\left(x\right)+x\left(\cos\left(x\right)+e^x\right)+2e^x}{2x}\right)$$
One more time:
$$\left(\frac{−x\sin\left(x\right)+3\cos\left(x\right)+\left(x+3\right)e^x}{2}\right)$$
This will equal to $3$. But the real answer is $1$:
$$\lim _{x\to 0}\left(\frac{\left(e^x+\sin x\right)x+e^x-\cos x}{x^2}\right)=1$$
$3$ is not equal to $1$
Thoughts?
 A: You can't apply l'Hôpital on a non indeterminate form.
Let's see what happens with a Taylor expansion at degree $2$:
\begin{align}
(e^x+\sin x)x+e^x-\cos x
&=(1+x+x+o(x))x+1+x+\frac{x^2}{2}-1+\frac{x^2}{2}+o(x^2) \\
&=x+2x^2+x+x^2+o(x^2)\\
&=2x+3x^2+o(x^2)
\end{align}
Thus we see that the given limit cannot be finite (and indeed it is $-\infty$ from the left and $\infty$ from the right).
It's also difficult to understand how the given solution could be $1$, unless we do a sign switch:
\begin{align}
(e^x+\sin x)x-e^x+\cos x
&=(1+x+x+o(x))x-1-x-\frac{x^2}{2}+1-\frac{x^2}{2}+o(x^2) \\
&=x+2x^2-x-x^2+o(x^2)\\
&=x^2+o(x^2)
\end{align}
This proves that
$$
\lim_{x\to0}\frac{(e^x+\sin x)x-e^x+\cos x}{x^2}=1
$$
A: You can't use L^Hopital's rule since $$\lim _{x\to 0}\left({2\sin x\left(x\right)+x\left(\cos\left(x\right)+e^x\right)+2e^x}\right)=2\ne 0$$Also the limit doesn't exist since it is $\Large{2\over \pm 0}$ .
A: After applying L-Hopital once, the expression that you obtain is not of the indeterminate form ( 0/0  or infinity/infinity) , hence you cannot apply l- hopital again.
Now as after applying l hopital you do not get a finite limit, it does not imply that actual limit does not exist, its just that L-Hopital method fails here.
Important - If you use l'Hopital rule and find that the limit does not exist you cannot conclude that the initial limit does not exist. In that case you must use other methods to analyse the limit.
Note - plotting its graph suggests that its limit does not exist at 0 . It shoots towards infinity.
Also note that by using L'Hopital method you cannot conclude the existence of limit. That's why i used this graphical method of analysis.

