<s>[INST] How many roots does $(x+1)\cos x = x\sin x$ have in $(-2\pi,2\pi)$? So the nonlinear equation that I need to find the number of its roots is
$$(x+1)\cos x = x\sin x \qquad \text{with } x\in (-2\pi,2\pi)$$
Using the intermediate value theorem I know that the equation has at least one root on this interval, and if I use drawing I see that $x\sin x$ and $(x+1)\cos x$ intersect in three points, but from drawing I can't know if they might intersect again somewhere.
And the problem is that the number of zeroes is definitely not 3, the options are 4, 5, 6, 7 based on my textbook.
I tried the Fixed point method but $\{x\}$ didn't converge, either my starting point or the function I chose were inappropriate.
Can you help?
 [/INST] First we can manipulate the expression given:
$(x+1)\cos x= x\sin x$
divide both sides by $x\cos x$
Yielding: $(\frac{x+1}{x})= \tan x $
The Inverse tangent of both sides yields:
$\operatorname{arctan}(\frac{x+1}{x})=x$
We can state without requiring a proof, although can be proved, that:
$\frac{d}{dz} \operatorname{arctan}(z) = \frac{1}{1+z^2}$
In our example we could let
$z=\frac{x+1}{x}$
So:
$\frac{d}{dx}\operatorname{arctan}(z)= (\frac{d}{dz}\operatorname{arctan}(z)\cdot \frac{dz}{du})$
By the Chain Rule !
Right Hand Side (RHS) of the above expression yields
$\frac{1}{1+z^2} \cdot \frac{-1}{x^2}$
Substitute value of $z$ in terms of $x$ into the RHS to yield an overall equation:
$\frac{d}{dx}\operatorname{arctan}(z)= \frac{1}{1+(\frac{x+1}{x})^2}\cdot\frac{-1}{x^2}$
$= \frac{-1}{x^2+(x+1)^2}$
$ \therefore , \operatorname{arctan}(z)=\int \frac{-1}{x^2+(x+1)^2}$
and as: $\operatorname{arctan}(z)= x$. Then:
$x=\int \frac{-1}{x^2+(x+1)^2}$
Hopefully you can solve this integral now to find all the solutions for x
</s>