Find the number of solutions for this trig-algebraic equation: $x^2 -x \sin x - \cos x =0$ 
The number of points in $(-\infty, \infty)$ for which $x^2 -x \sin x - \cos x =0$, are?

The first thought that came to my my mind was that the equation above is looking like a algebraic quadratic equation, and those equations have at most two different solutions. But this equation is the mixture of algebraic and trigonometric functions. Having some experience with a similar problem I proceeded like this
$$
x^2 - x \sin x = \cos x \\
x(x- \sin x ) = \cos x$$
$$
-1 \leq \cos x \leq 1 \\
-1 \leq x(x-\sin x ) \leq 1 $$
$$x(x-\sin x ) = -1 \tag{1}$$
$$x(x-\sin x ) = 1  \tag{2}
$$
$$
x-1 \leq x - \sin x  \leq x+1 \tag{i}$$
$$x-1 \leq -\frac{1}{x} \leq x+1 ~~~~~~~~~~\text{from equation (1)} \\
x-1 = \frac{-1}{x}  ~~~~~~~~~~~~; ~~~~~~~~~~~~~~ x+1 = \frac{-1}{x} \\
x^2 - x +1 =0 ~~~~~~~~~~~~; ~~~~~~~~~~~~~~ x^2 + x +1 = 0$$
Above two equations have no real solutions.
From equation (2) and inequality (i), we have
$$
x-1 = \frac{1}{x} ~~~~~~~~~~~ ; ~~~~~~~~~~~ x+1 = \frac{1}{x} \\
x^2 - x -1 = 0 ~~~~~~~~~~~ ; ~~~~~~~~~~~ x^2 + x -1 = 0$$
So, above two equations have two different solutions each, so in total we have four distinct values of $x$. But this answer of mine is not correct, drawing the graph from desmos shows there are just two intersections of $x-axis$.
I'm in need of an explanation of why my solution is giving a wrong answer, and I have two more questions:

*

*I felt suspicious when I equated $x(x-\sin x) = \{1, -1\}$, because what the inequality says is that $x(x-\sin x)$ lies between $-1$ and $1$, so I could very well equated $x(x-\sin x)$ to any number in between $[-1 , 1]$ but I did not. Could I equate it with any number in between?

*The solutions of the last two quadratic equations differ from the other's pair only in signs, so it seems to me that there is some minor issue but cannot find it. Is there a specific reason that I'm off to actual answer just due to the consideration  of signs?

 A: Hint: if $f(x) = x^2 - x \sin(x) - \cos(x)$, show that $f'(x) > 0$ for $x > 0$ and $< 0$ for $x < 0$.
A: Hint: Further hints, continuing answer above:
$$ f(0) = -1$$
$$ \lim_{x\rightarrow \infty} f(x) = \infty $$
$$ \lim_{x\rightarrow -\infty} f(x) = \infty $$
A: Another hint. Write the equation as
$$x^2=x \sin x +\cos x$$
and set $f(x)=x\sin x + \cos x$. Note that, since $f'(x)= x \cos x$, then $f(x)$ has local maxima in $x=\pi/2 +2\pi n$, where $f(x)=|x|$. So, for $|x|\geq \pi/2$, we have $f(x) \leq |x| $. This is well shown by the plot of $f(x)$:

Because for $|x|\geq \pi/2$ we clearly have $x^2>x$, you can focus on the range $-\pi/2 <x<\pi/2$.
Now simply analyze the behaviour of $y=x^2$ and $y=f(x)$ in this range to get the solution. In particular, consider that, moving rightward from $x=0$ to $x=\pi/2$, $x^2$ starts from $0$ and increases to $\pi^2/4$, whereas $f(x)$ starts from $1$ and increases to $\pi/2$. Symmetrical changes occur moving leftward from $x=0$ to $x=-\pi/2$.
Lastly, as you correctly noted, your method of equalizing $x(x-\sin x) = \{1, -1\}$ does not work. These are simply possible bounds, and the solution cannot be obtained by simply considering them.
