# 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:

1. 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?
2. 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?
• Were the answers adequate to explain the solution? Aug 17, 2020 at 13:54
• @Anatoly The answers didn't clarify the doubts which I asked, they gave the hints. So, I couldn't accept them. Aug 17, 2020 at 14:05

Hint: if $$f(x) = x^2 - x \sin(x) - \cos(x)$$, show that $$f'(x) > 0$$ for $$x > 0$$ and $$< 0$$ for $$x < 0$$.

• Very cool. My idea was to first prove that there is no solution outside of $[-2,2]$ and that $f$ is strictly convex on $[-2,2]$, but this is much easier. Aug 9, 2020 at 16:44
• Okay did that, $f' (x) = x (2- \cos x )$. So, evidently sign of $f'(x)$ depends upon the sign of $x$. Can you guide a little further? Aug 9, 2020 at 16:47
• @Knight, The solution isn't precalc, so you may not yet have learned that the sign of $f'$ determines whether the function is increasing ($f'>0$) or decreasing ($f'<0$). Aug 9, 2020 at 17:11
• @Macavity Yes, I followed your suggestion and removed the precalc tag. Aug 9, 2020 at 17:15
• The further hint is that $f(0) < 0$ while $f(x) > 0$ for $|x|$ sufficiently large. Aug 9, 2020 at 18:18

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 .

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.

Hint: Further hints, continuing answer above:

$$f(0) = -1$$

$$\lim_{x\rightarrow \infty} f(x) = \infty$$

$$\lim_{x\rightarrow -\infty} f(x) = \infty$$