0
$\begingroup$

This simple Solve gives the roots of a quadratic:

Solve[a x^2 + b x + c == 0, x]

However, if I factor the polynomial in terms of its "unknown" roots x1 and x2, this code does not work

Solve[a x^2 + b x + c == (x - x1) (x - x2), {x1, x2}]  

to solve for x1 and x2 (which in this case, we know, they are the roots found by the first code. Why not? How can I code a solution in this spirit in mathematica?

I need to find a way to employ a solution which is in the spirit of the second code, however, for the following reason.

In my real problem, I seek the roots of a degree 5 polynomial. Indeed, this general problem cannot be solved (see: Galois). However, in my case, several of the roots are given by known functions of the other roots. I plan to insert this information into the factored form on the RHS of code in the form of my second code above.

$\endgroup$
7
  • 1
    $\begingroup$ You are solving 2 variables with 1 equation; and Mathematica did give a correct answer. What answer do you expect? $\endgroup$
    – vapor
    May 23, 2016 at 17:46
  • 1
    $\begingroup$ Consider SolveAlways[a x^2 + b x + c == (x - x1) (x - x2), x]. But you do know the Vieta formulae, no? In that case, you can then use SymmetricPolynomial[]. $\endgroup$ May 23, 2016 at 17:48
  • $\begingroup$ I understand it is fewer equations than variables, yes. But we know what the solutions x1 and x2 are, as they are given by the "quadratic formula" or the first code. How does this work? How is mma able to solve for both roots with only 1 equation in the first code but not in the second? $\endgroup$
    – Steve
    May 23, 2016 at 17:48
  • $\begingroup$ SolveAlways[a x^2 + b x + c == (x - x1) (x - x2), x] does not give the correct solutions for x1 and x2 $\endgroup$
    – Steve
    May 23, 2016 at 17:50
  • $\begingroup$ It was intended as a starting point; did you notice that you can get equations entirely in terms of b, c, x1, and x2 from it, which you can then feed to Solve[]? $\endgroup$ May 23, 2016 at 17:53

1 Answer 1

3
$\begingroup$
Reduce[ForAll[x, a x^2 + b x + c == a (x - x1) ( x - x2)], {x1, x2},Backsubstitution -> True]

gives you the solution you want.

$\endgroup$
9
  • $\begingroup$ Indeed it does, as I've posed it here. However, unfortunately this solution breaks already for degree 3, despite the Cubic Formula existing in general. Reduce[ForAll[x, x^3 + a x^2 + b x + c == (x - x1) (x - x2) (x - x3)], {x1, x2, x3}, Backsubstitution -> True] doe not work. $\endgroup$
    – Steve
    May 23, 2016 at 18:16
  • $\begingroup$ @Steve I am sleeping, can't test it now. But I remember in the reduce doc it says it does not use general formula for cubic equation by default, try adding the option Cubics->True. $\endgroup$
    – vapor
    May 23, 2016 at 18:19
  • $\begingroup$ Great work happy fish, you are right, that fixed it. Unfortunately, since no "Quintics->True" Option exists in mathematica, I still won't be able to employ this method for my problem... $\endgroup$
    – Steve
    May 23, 2016 at 18:23
  • $\begingroup$ @Steve, I don't know what you mean by "does not work"; by default, Mathematica uses Root[] to denote roots of polynomials. This is because, as you mention, not all roots admit explicit radical expressions. $\endgroup$ May 23, 2016 at 18:30
  • $\begingroup$ Well, you're right. As we've said, Galois theory proves that the general quintic polynomial cannot be solved for closed-form roots, but I am hoping to solve a particular quintic for analytic roots, for which there is a symmetry among some of them which may reduce the complexity. It stands unknown whether my problem can be solved, but I would like to know if it fails because of improper programming in mathematica or because it is genuinely impossible to write the roots of this polynomial in closed-form. $\endgroup$
    – Steve
    May 23, 2016 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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