Can I factor univariate polynomials with real coefficients as a product of quadratic trinomials and binomials corresponding to the complex conjugate and real roots using Wolfram Alpha ?




If I understood you correctly, you want a factorization over the reals. One way to do this is to use decimals for your coefficients. For example, for your question you can use

Factor[x^3 - 3.0* x^2 - 2.0]

which WA will return

(1 x - 2) (1 x^2 + 1)

For the other example you tried, $x^4 - 2 x^2 + x - 2$, the command


will return

(x - 1.49257) (x + 1.78537) (x^2 - 0.292798 x + 0.750527)

This will work well if there are only rational roots, but for irrational roots you might need to do extra work to get enough precision.

  • $\begingroup$ We are getting very close. This returns numerical coefficients, but still not always works for closed-form expression coefficients. $\endgroup$ – Yves Daoust Jun 27 '18 at 13:55
  • $\begingroup$ @YvesDaoust Do you mean things like factoring $(2y^2+1)x^3 - (y-5)x + y^3$? Or the factors should closed expressions like $(x - \sqrt 5)(x + \sqrt 5)$, when applicable? $\endgroup$ – Yong Hao Ng Jun 27 '18 at 14:29
  • $\begingroup$ The second interpretation. $\endgroup$ – Yves Daoust Jun 27 '18 at 14:39
  • $\begingroup$ @YvesDaoust The problem is not all roots have closed expressions by radicals, if the polynomial is of degree $\geq 5$. For smaller degrees, one other option is to try something like >Reduce[x^3-7 == 0, Reals] which would give you the linear roots. In closed form when it can find one. So an initial factor >Factor[-7 - 14 x^2 + x^3 + 2 x^5 ] Gives you the irreducible parts over $\mathbb Q$ and you can try Reduce[] on each component. Not sure how to do everything as one command though. $\endgroup$ – Yong Hao Ng Jun 28 '18 at 8:59

Yes, you can do it, using keyword "factor".

For example, Wolfram Alpha Pro returns for $factor x^4-2x^2+x-2:$



Putting the LHS into Wolfram Alpha gets you the form you want, about half way down the page under "Alternate forms". If that isn't what you want then I don't understand the question.

  • $\begingroup$ Mh, this does not always work: wolframalpha.com/input/?i=x%5E4-2x%5E2%2Bx-2 $\endgroup$ – Yves Daoust Jun 6 '18 at 9:05
  • $\begingroup$ @YvesDaoust That one doesn't factor very nicely: factor x^4-2x^2+x-2 $\endgroup$ – Jaap Scherphuis Jun 6 '18 at 9:11
  • $\begingroup$ @JaapScherphuis: this is precisely what I don't want. $\endgroup$ – Yves Daoust Jun 6 '18 at 9:14
  • $\begingroup$ So what answer do you want for $x^4-2x^2+x-2$? $\endgroup$ – Christopher Jun 6 '18 at 9:17
  • 1
    $\begingroup$ @JaapScherphuis: WA can deliver both approximate and closed-forms of the roots, both can do. "you can then just multiply out last two factors" is precisely what I want WA to perform, without having to do it manually. $\endgroup$ – Yves Daoust Jun 6 '18 at 10:06

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.