0
$\begingroup$

I' ve learned that the following examples can be used to decompose a factor in this way

x^5 - 5 x + 12 == (x - a) (a^4 + a^3 x + a^2 x^2 + a x^3 + x^4 - 1)
 (x - a) (a^4 - (5 a^3)/8 + (7 a^2)/8 + 1/8 (5 a^2 - 12 a) + 
   1/8 (5 a^3 - 12 a^2) + ((5 a^4)/16 - a^3/8 + (7 a^2)/16 - 
      3/16 (5 a^2 - 12 a) + 1/16 (12 a^3 - 5 a^4) + 
      1/8 (12 a^2 - 5 a^3) - (9 a)/4) x^2 + ((5 a^4)/16 + a^3/4 + (
      5 a^2)/16 + 1/16 (12 a - 5 a^2) + 1/16 (12 a^3 - 5 a^4) + a/2 + 
      1/4 (12 - 5 a) - 3) x + a x^3 + a/4 + 1/4 (5 a - 12) + x^4 - 2)

How can I get Mathematica to decompose a polynomial function f[x] into (x - a) g[x, a]?

I want to know how to write a custom function like the built-in function Factorto achieve this goal.

$\endgroup$
5
  • $\begingroup$ I'm not sure if this is what you're looking for, but try (x - a) PolynomialQuotient[poly, x - a, x] $\endgroup$
    – aooiiii
    Jan 24, 2020 at 3:27
  • $\begingroup$ But the result of this situation is not consistent with my requirements:(x - a) PolynomialQuotient[x^5 + 5 x - 12, x - a, x] // Expand $\endgroup$ Jan 24, 2020 at 3:33
  • 1
    $\begingroup$ I admit that the result doesn't look similar to your second example (I honestly don't understand its form), but it does satisfy your only explicitly stated requirement to decompose f[x] into (x - a) g[x, a]. Expand doesn't return the original polynomial, but it wouldn't return the original polynomials in any of your examples either. They're only equivalent when f[a]==0. $\endgroup$
    – aooiiii
    Jan 24, 2020 at 4:02
  • $\begingroup$ I don't understand your example; I can't see any reason why the three polynomials you show should be equal. Can can clarify your question? $\endgroup$
    – m_goldberg
    Jan 24, 2020 at 4:45
  • $\begingroup$ I agree with @m_goldberg . The LHS and RHS are not equal. Is a supposed to be any arbitrary value? $\endgroup$
    – Kendall
    Jan 24, 2020 at 22:48

2 Answers 2

3
$\begingroup$

Compute the five roots of that quintic, and set a to any one of them.

qpoly = x^5 - 5 x + 12;
rt = First[x /. Solve[qpoly == 0, x]];

Then factor using that a as the extension.

fax = Factor[qpoly, Extension -> rt] /. rt -> a

(* Out[335]= 1/16 (-a + x) (8 - 5 a - a^2 - a^3 - 
   a^4 + (4 + 3 a - a^2 - a^3 - a^4) x + 4 x^2) (-4 - 2 a - 
   2 a^3 + (-4 + a + a^2 + a^3 + a^4) x + 4 x^2) *)
$\endgroup$
1
$\begingroup$

Ok I think I know what is trying to be achieved. For illustrative purposes, I am going to use a smaller polynomial $x^2+3x+2=0$ which we know can be factored into $(x+1)(x+2)$. It is desired that we can rather factorise this polynomial into some form of $(x-a)g(x,a)$ and so we have 2 options.

Either $(x-a)(x-2a)$ or $(x-a)(x-\frac{1}{2}a)$ where $a=-1$ or $a=-2$ respectively. More simply $(x-a)(x+a+3)$. If this is the case, then

qpoly = x^5 - 3 x + 12;
roots = x /. Solve[qpoly == 0, x];
final = HoldForm[(x - a)] PolynomialQuotient[qpoly, x - a, x]

gives the output (5 + a^4 + a^3 x + a^2 x^2 + a x^3 + x^4)(x-a) note I get a 5 not a -1. I used Holdform to stop it going (-a+x) Maybe someone more skilled than me can get the other forms.

The other issue I have, is when I replace a by one of the roots the output is not the original equation. Maybe someone can figure out why.

$\endgroup$

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.