Help find the mistake in this problem of finding limit (using L'Hopital)
\begin{align}\lim_{x\to0}\frac1x+\cot x&=\lim_{x\to0}\frac{\sin x+x\cos x}{x\sin x}\\&=\lim_{x\to0}\frac{2\cos x-x\sin x}{\sin x+x\cos x}\\&=\infty.\end{align}Besides,$$\lim_{x\to0}\frac1x-\cot x=0.$$
The error you made lies in the use of the equality$$\lim_{x\to a}\bigl(f(x)g(x)\bigr)=\left(\lim_{x\to a}f(x)\right)\left(\lim_{x\to a}g(x)\right)$$in a situation where you cannot apply it (it is the second of your equalities counting from the bottom).
As @user21820 encouraged, I am going to explain the errors in this post.
The problem is the $=$ at the last 2nd line. Before this everything could be accepted, since they are the process to find the limits. But at this step you generally claim that $$ \lim f(x) \lim g(x) = \lim f(x)g(x), $$ where the limits progression are omitted for brevity. By the arithmetic operation of limits, we know that when $\lim f(x), \lim g(x)$ exists, then the equation above holds. In your case, the existence of $\lim f, \lim g$ are not examined at all. Then it is not valid to combine two limits and make it to one limit, since there is a counterexample $$ 1=\lim_{x \to 0} \frac xx , \lim _{x\to 0}x =0, \lim_{x\to 0}\frac 1x \text{ does not exist}, $$ where you obviously cannot write $1 = 0 \times \lim_{x \to 0}(1/x)$. As other answers showed, not all the two parts $$ \lim_{x\to 0} \frac {2\cos x -x \sin x}{x \cos x + \sin x}, \lim_{x\to 0} \frac {x \cos x + \sin x} {2\cos x -x \sin x} $$ exist, so the certain line makes no sense, and leads you to the wrong result.
Both the terms are in 0/0 form. So applying L'Hospital on both the limits we have,
$= \lim_{x \to 0} (\frac{2\cos{x}-x\sin{x}}{x\cos{x}+\sin{x}}) \times \lim_{x \to 0}(\frac{x\sin{x}}{x\cos{x}+\sin{x}})$
Note that the limit $\lim_{x \to 0} (\frac{2\cos{x}-x\sin{x}}{x\cos{x}+\sin{x}})$ does not exist.
In fact, even before that $\lim_{x \to 0} (\frac{\sin{x}+x\cos{x}}{x\sin{x}})$ does not exist as well.
This is the graph of $\frac{\sin{x}+x\cos{x}}{x\sin{x}}$.