Evaluate $$\displaystyle\lim_{x\to 0} \frac{x\cos x - \ln (1+x)}{x^2}$$
Here's my method but that results into an error.
\begin{align} \lim_{x\to 0} \frac{x\cos x - \ln (1+x)}{x^2} &=\lim_{x\to 0}\frac{\cos x}{x} - \lim_{x\to 0}\left(\frac{1}{x}\right)\lim_{x\to 0}\left(\frac{\ln(1+x)}{x}\right)\\ &= \frac{\cos x}{x} - \frac{1}{x} \\ &= \frac{\cos x -1}{x}\\ &= 0 \quad \text{(either by L'hôpital or some manipulations)} \end{align}
I have used the fact that
$$\lim_{x\to 0} \frac{\ln(1+x)}{x}=1$$
And the answer seems to be $\frac{1}{2}$. I can do it in different ways (L'hôpital precisely) but please point out my error.
The error lies in these steps:
$$\lim_{x\to 0}\frac{\cos x}{x} - \lim_{x\to 0}\left(\frac{1}{x}\right)\lim_{x\to 0}\left(\frac{\ln(1+x)}{x}\right)\color{red}{=}\frac{\cos x}{x} - \frac{1}{x} \\$$ This is not correct because once you split the limit, you need to put the values. Evidently it fails here because you get $\infty - \infty$ as the answer which is not well defined.
Here after applying your limits after splitting, we cannot manipulate further, because we give the expression a value.
To solve the limit, consider using L'hopital or taylor expansions to get limit as $\tfrac{1}{2}$.