Evaluating $\lim_{x\to 0}\frac{x\sin x-2+2\cos x}{x\ln(1+x)-x^2}$ using L'Hôpital Considering this limit, assigned to my high school students, 
$$\lim_{x\to 0}\frac{x\sin x-2+2\cos x}{x\ln \left(1+x\right)-x^2}=\left(\frac00\right)=\lim_{x\to 0}\frac{\frac{d}{dx}\left(x\sin \left(x\right)-2+2\cos \left(x\right)\right)}{\frac{d}{dx}\left(x\ln \left(1+x\right)-x^2\right)} \tag 1$$
After some steps, using L'Hôpital, I find:
$$\lim_{x\to 0}\frac{\left(x\cos \left(x\right)-\sin \left(x\right)\right)\left(1+x\right)}{-2x^2-x+x\ln \left(x+1\right)+\ln \left(x+1\right)}=\left(\frac00\right)$$
Should I continue to apply L'Hôpital? :-(
 A: In general applying L'Hospital's Rule directly is never a good idea (unless the limit problem is too simple). One must first rewrite the given expression under limit into a form which is suitable for the application of L'Hospital's Rule.
Dividing the numerator and denominator of the expression under limit by $x^3$ we get $$\dfrac{\dfrac{x\sin x - 2+2\cos x} {x^3}} {\dfrac{\log(1+x)-x}{x^2}} $$ Now we can calculate the limit of denominator above by a single application of L'Hospital's Rule and it will come out to be $-1/2$ and hence the desired limit equals $$2\lim_{x\to 0}\frac{2(1-\cos x) - x\sin x} {x^3}$$ We can now apply L'Hospital's Rule once more to get $$2\lim_{x\to 0}\frac{\sin x - x\cos x} {3x^2}$$ The above limit can be evaluated directly without any use of L'Hospital's Rule or series expansions, but it is simpler to deal with it via L'Hospital's Rule. Applying it again we get $$\frac{1}{3}\lim_{x\to 0}\frac{x\sin x} {x} =0$$ The desired limit is thus $0$.

Thumb rule to apply L'Hospital's Rule is that use it only when the necessary differentiation is damn simple.
A: A quick estimate allows you to see that Taylor would yield even degree terms at the numerator (the function is even), but the constant and quadratic ones cancel each other. At the denominator, $x^2-x^2$ and cubic terms.
Hence the limit will be zero, but you will need three successive applications of L'Hospital to establish this.
$$x\sin x-2+2\cos x\to x\cos x-\sin x\to-x\sin x\to-\sin x-x\cos x\to0$$
vs.
$$x\log(1+x)-x^2\to\log(x+1)+\frac x{x+1}-2x\to\frac1{x+1}+\frac1{(x+1)^2}-2
\\\to-\frac1{(x+1)^2}-\frac2{(x+1)^3}\not\to0.$$
A: The derivative of the denominator is
$$
\ln(1+x)+\frac{x}{1+x}-2x=\frac{(1+x)\ln(1+x)-x-2x^2}{1+x}
$$
Then after the first step you find
$$
\frac{x\cos x-\sin x}{(1+x)\ln(1+x)-x-2x^2}(x+1)
$$
The factor $x+1$ can be disregarded, because its limit is $1$.
At the next application, the numerator will become
$$
\cos x-x\sin x-\cos x=-x\sin x
$$
while the denominator will be
$$
\ln(1+x)-4x
$$
Thus the limit has become much simpler:
$$
\lim_{x\to0}\frac{x\sin x}{4x-\ln(1+x)}=
\lim_{x\to0}\frac{x^2}{4x-\ln(1+x)}\frac{\sin x}{x}
$$
and the part $(\sin x)/x$ can be disregarded. You can now apply l'Hôpital once more to get
$$
\lim_{x\to0}\frac{2x}{4-\dfrac{1}{1+x}}=0
$$
