# Why do two roots of my equation disappear when I give numerical values to two parameters?

Consider the equation

(-Sqrt[1 + KE la + KE s + KE la s - Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2]]*
(1 - KE la + KE s - KE la s + Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2])-
(-1 + KE la - KE s + KE la s + Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2])*
Sqrt[1 + KE la + KE s + KE la s + Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2]]) == 0


KE and la are real constants. When I use Solve on the above, it gives four symbolic roots. But when I give KE and la numerical values, it only returns two numerical roots. How can this be explained?

-
Some of the branches may produce complex values for certain real inputs; these do not represent valid solutions for those inputs and therefore they are not returned. –  Mr.Wizard May 31 '14 at 10:38

Like Mr.Wizard says those four symbolic roots are not valid solutions for every input. Verify it like this:

eq = (
(-Sqrt[
1 + KE la + KE s + KE la s -
Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2]]*(1 - KE la +
KE s - KE la s +
Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2]) - (-1 + KE la -
KE s + KE la s +
Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2])*
Sqrt[1 + KE la + KE s + KE la s +
Sqrt[4 KE la + (1 + KE s - KE la (1 + s))^2]]) == 0
);
sol = Solve[eq, s];


Now sol contains the four roots. If we substitute these roots for s in the original equation then you will notice that the equation does not simplify to True for two of them:

Simplify[eq /. sol]


This shows that these roots are not always solutions. Now try this:

eq /. sol /. {KE -> 5, la -> 5}


{False, False, True, True}

With numeric input Mathematica can determine if the expression is true or not, but as it turns out only two of the roots represent valid solutions for these constants. I assumed Solve returned the two other roots because under some conditions they are valid solutions, but apparently not for all.

-
In fact, using Simplify[eq/.sol] gives the two Trues, leaving first two equations unevaluated. –  Ruslan May 31 '14 at 13:40
And, when the first two are solutions at all? They seem to be spurious solutions... –  Ruslan May 31 '14 at 13:44
@Ruslan Thank you, I have updated the answer accordingly. I'm not sure about when exactly they are solutions, but I think it's reasonable to assume that there are such circumstances since Solve returned them. Mostly I wanted to show how we could verify that the two missing roots are in fact not valid. –  Pickett May 31 '14 at 16:44