# How can I prove an equation has a certain number of real roots?

I have this code

NSolve[1-(b/r)^2-g^-2*(2/15 * Σ^9 (1/(r-1)^9-1/(r+1)^9-9/(8r) (1/(r-1)^8-1
/(r+1)^8)) - Σ^3 (1/(r-1)^3-1/(r+1)^3-3/(2r) (1/(r-1)^2-1
/(r+1)^2))) == 0, r, Reals]


I want to prove that for any values of g, b, Σ, I will find, for r, only 4 real roots. The others will be complex.

Any ideas?

-
This seems to be a question about mathematics instead of Mathematica -- is that right? –  Michael E2 Jun 17 '13 at 22:10
@MichaelE2 , but i have to use wolfram mathematica to do that, use the commando SOLVE or FindRoot , i dont know exactly –  Lucas G Leite F Pollito Jun 17 '13 at 22:27
Try Numerator[Together @ yourfunction] /. r^n_ :> r^(n/2) and see if you can prove only two positive real roots (ruling out r == 0 because there is a factor of r in the denominator). –  Michael E2 Jun 18 '13 at 1:10
Are you sure it has only real roots? One easy thing to do would be to calculate the roots for lots of different g,b,sigma values and see if you ever get more than 4 real ones. If yes, then no need to try and prove it. If no, then you can be more confident that the result you want really exists. –  bill s Jun 18 '13 at 2:53
@bill , i cant do that, put some values ... i try to do it, i a get only four real roots, the othes is complex. i want to prove generally , for all values of sigma, g and b ... –  Lucas G Leite F Pollito Jun 18 '13 at 3:02

We needn't guess many (thousands) cases in order to verify the underlying statement if we harness some handy Mathematica functions like CountRoots, RegionPlot3D or Manipulate.

At first, we can observe that, the equation can be easily transformed to a polynomial type by an appropriate multiplication (applying Expand on the left hand side of the equation we can see an obvious choice for a multiplying factor r^2 (r + 1)^9 (r - 1)^9 g^2).

FullSimplify[ (1 - (b/r)^2 - g^-2 (2/15 Σ^9 (1/(r - 1)^9 - 1/(r + 1)^9 - 9/(8 r) (1/(r - 1)^8
- 1/(r + 1)^8)) - Σ^3 (1/(r - 1)^3 - 1/(r + 1)^3
- 3/(2 r) (1/(r - 1)^2 - 1/(r + 1)^2))) ) r^2 (r + 1)^9 (r - 1)^9 g^2 ]

g^2 (-1 + r^2)^9 (-b^2 + r^2) + 8 r^2 (-1 + r^2)^6 Σ^3
- 8/15 r^2 (5 + 45 r^2 + 63 r^4 + 15 r^6) Σ^9


So let's define:

p[r_, Σ_, b_, g_] := (   g^2 (-1 + r^2)^9 (-b^2 + r^2) + 8 r^2 (-1 + r^2)^6 Σ^3
- 8/15 r^2 (5 + 45 r^2 + 63 r^4 + 15 r^6) Σ^9 )


it is a polynomial in its all varables:

PolynomialQ[ #, Variables @ #]& @ p[r, Σ, b, g]

True


Now we can simply look for cases where CountRoots finds more real roots than 4

Manipulate[ CountRoots[p[r, Σ, b, g], r],
{ Σ, -10, 10}, {b, -2, 0}, {g, -2.5, 2.5}]


Now it is much simpler to provide an example with rational arguments e.g.

CountRoots[ p[ r, 23/10, 8323/1001, 1/20], r]

8


Therefore we conclude that there are cases with more than 4 real roots of the equation. Evaluating e.g.

NSolve[p[r, 23/10, 8323/1001, 1/20] == 0, r, Reals]


we can check that the roots are all distinct.

Moreover we can plot the region where we have more that 4 real roots (p as a 20-th order polynomial in r has 20 complex roots). For the sake of speed we can use this option PerformanceGoal -> "Speed" in RegionPlot3D (nontheless it takes > 1 minute to evaluate):

RegionPlot3D[ CountRoots[p[r, Σ, b, g], r] > 4,
{Σ, -2.5, 2.5}, {b, -10, 10}, {g, -2.5, 2.5}, PerformanceGoal -> "Speed"]


The structure of the region of interest seems to be more sophisticated but plotting it with higher fidelity needs much more time.

Edit

Working with Manipulate we can also provide examples where there are 20 real roots, e.g.:

CountRoots[ p[r, 0, 1, 1], r]

20


though in general there are multiple roots:

 r /. Solve[ p[r, 0, 1, 1] == 0, r, Reals]

{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}


i.e. 1 is a 10-fold root:

 Count[ %, 1]

10

-
"The structure of the region of interest seems to be more sophisticated" Indeed... –  Rahul Narain Jun 18 '13 at 20:25
I wish that plot would be better as well... –  Artes Jun 18 '13 at 20:42
–  Rahul Narain Jun 18 '13 at 22:58
@RahulNarain could you post the parameters you used to generate that plot. –  rcollyer Jun 19 '13 at 19:52
@rcollyer: It's just Artes's RegionPlot3D with PlotPoints -> 100 and a very long time. The other difference is that the plot in Artes's answer seems to have been rotated by 90 degrees clockwise about the $z$ axis. –  Rahul Narain Jun 19 '13 at 20:17

Applying the experimental method, we can see that the conjecture is false. Let

{\[CapitalSigma], g, b} = {-8.12029, 4.79026, 1.46801}


Then solve for the roots:

NSolve[1 - (b/r)^2 - g^-2*(2/15*\[CapitalSigma]^9
(1/(r - 1)^9 - 1/(r + 1)^9 - 9/(8 r) (1/(r - 1)^8 - 1/(r + 1)^8)) -
\[CapitalSigma]^3 (1/(r - 1)^3 - 1/(r + 1)^3 - 3/(2 r) (1/(r - 1)^2 -
1/(r + 1)^2))) == 0, r]


to which the answer is a long string of 20 complex values. On the other hand, let

{\[CapitalSigma], g, b} = {2.34665, 0.0507719, 8.31449}


Then the above has 8 real roots (and 12 complex roots). So you can have either (i) fewer than four real roots or (ii) more than 4 real roots, depending on the values.

-
+1 for tenacity or luck. I tried several values but got "only 4" (i.e. <= 4). Should have automated it, I guess. –  Michael E2 Jun 18 '13 at 3:23
@Michael E2 -- It was neither luck not tenacity, I had Mathematica guess 10000 cases and count (and print) the number of times there were not 4 real roots. This is the kind of "proof" computers are really good at. –  bill s Jun 18 '13 at 3:25
Following up, it took me more than 10000 cases, but Artes' answer shows that one will have more luck in some regions than others. –  Michael E2 Jun 18 '13 at 12:58