# Splitting a polynomial into sum of factors, not necessarily linear

How can I split a given polynomial as sum of factors in Mathematica?

For example, let's say I have this polynomial: $2\cdot x^2+7\cdot x+2$.

I would like the output to be $(x+1)(x+2)+x(x+4)$. Is there a way to do that with Mathematica?

• What you want is not really factorization, because that's about multiplication of factors. There's an infinity of terms that can be added to arrive at the same result. But have a look at Factor anyway. Mar 31, 2015 at 6:15
• 'Factor' doesn't give a possible way to write factors as sum of products. Apr 7, 2015 at 6:04

expr = 2 x^2 + 7 x + 2;

expr2 = (x + a) (x + b) + x (x + c);

expr2 /. Solve[Equal @@ (CoefficientList[#, x] & /@ {expr, expr2}),
{a, b, c}, Integers][[-1]]

(1 + x) (2 + x) + x (4 + x)

• Thanks for the answer. But, is it possible to implement such a procedure symbolically and for any given polynomial not necessarily quadratic? Apr 7, 2015 at 6:05
• I believe not. The target form (expr2) would have to be specified and generally not all polynomials of a given order can be expressed in the specified form (even if just quadratic). Apr 7, 2015 at 13:44