I'm asked to show there is exactly two values for which $x^2=x\sin x+\cos x$
I have no idea where to start but I was thinking about taking the difference $h(x)=x^2-x\sin x-\cos x$ to show that $h'(x) > 0$ if $x>0$ and $h'(x)<0$ if $x<0$ then since $h(0)<0$ there exists exactly two sets of numbers $[a_1,b_1]$ and $[a_2,b_2]$ such that $h(a_1)>0>h(b_1)$ and $h(a_2)<0<h(b_2)$. Therefore by the intermediate value theorem and since $h$ is continuous there exists exactly two numbers $c_1,c_2$ such that $h(c_1)=h(c_2)=0$ implying these numbers hold true in the proposed statement.
Does this hold as a working proof if I refine it a little more? If there is a more proper way I should be doing this please share your thoughts, thank you.
Yes, consider $$ f(x)=x^2-x\sin x-\cos x $$ so $$ f'(x)=2x-\sin x-x\cos x+\sin x=x(2-\cos x) $$ which is positive for $x>0$ and negative for $x<0$.
Note that the function is even, so studying it for $x\ge0$ is enough. In this interval $f$ is increasing and $f(0)=-1$. On the other hand, $$ f\left(\frac{\pi}{2}\right)= \frac{\pi^2}{4}-\frac{\pi}{2}= \frac{\pi}{2}\left(\frac{\pi}{2}-1\right)>0 $$ Thus $f$ has a single root in $(0,\infty)$ and another one in $(-\infty,0)$.