I would like to solve this equation:


But Solve in Mathematica doesn't work:

This system cannot be solved with the methods available to Solve

Being a beginner, I don't know any other ways to solve this equation. Any suggestions?


  • $\begingroup$ Have a look at NSolve, which solves an equation numerically. $\endgroup$
    – sacratus
    Sep 3, 2015 at 7:53

5 Answers 5


Restrict the domain:

Solve[-x Sin[x]==Cos[x]&&-30<=x<=30,x,Reals]//N


  • 7
    $\begingroup$ As long as you're adding the constraint -30<=x<=30, the 3rd argument Reals is superfluous. $\endgroup$
    – murray
    Sep 3, 2015 at 14:59
  • $\begingroup$ For me, restricting to the Reals is more useful than constraining the domain. $\endgroup$
    – Ron Jensen
    Jun 20, 2020 at 23:40
FindRoot[x Sin[x] == -Cos[x], {x, 2}] 


(* {x -> 2.79839}  *)

In which domain do you want to solve your problem? Make a plot and restrict your domain (example here [-2 Pi,2 Pi]).

sol = x /. NSolve[-x Sin[x] == Cos[x] && -2 \[Pi] < x < 2 \[Pi], x]
{-6.12125, -2.79839, 2.79839, 6.12125}

Plot[{-x Sin[x], Cos[x]}, {x, -2 \[Pi], 2 \[Pi]}, 
 Epilog -> {Red, PointSize -> Medium, Point[{#, Cos[#]} & /@ sol]}]

enter image description here


Another function worth trying in cases like this may be FindInstance:

FindInstance[-x Sin[x] == Cos[x], x] // N
{{x -> 2.79839}}

If you want more answers:

FindInstance[-x Sin[x] == Cos[x], x, 3] // N

The function cotSol[k, λ] for generating the $k$-th positive root of $\lambda x=\cot x$, which I wrote for this answer, can be used to directly generate the required solutions:

N[cotSol[Range[10], -1], 20]
   {2.7983860457838871367, 6.1212504668980683013, 9.3178664617910653790,
    12.486454395223781428, 15.644128370333027630, 18.796404366210157169,
    21.945612879981044573, 25.092910412112097360, 28.238936575260272929}

The negative roots are of course just the negations of the positive roots in this case.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.