# Factorization of a polynomial fraction to a certain combinations of other polynomial fractions

I currently am working on a project for to find some new algebra structures. But I faced with a factorization problem which I cannot come out of it! I could find the lower dimensional of it. But I need a Mathematica codding algorithm for to find the higher dimensional cases. One of my easiest factorization is as what I explain bellow (Which I know its factorization, but I want to re-find it by using Mathematica!):

I need to factorize the following polynomial fraction by using Mathematica

F6[x1, y1, x2 , y2, x3 , y3, x4, y4, x5, y5, x6] = (2 x1 x2 x5 x6 y2 (x2 y1 + x3 (y1 + y2)) y3^2 y4 (x5 y5 +  x4 (y4 + y5)))/((x2 y2 + x1 (y1 + y2)) (x3 y3+ x2 (y2 + y3))^2 (x4 y3 + x5 (y3 + y4))^2 (x5 y4 + x6 (y4 + y5)));


to the combination of the following polynomial fractions

K1[x1, y1, x2, y2, x3, y3] = ((x2 y2 + x1 (y1 + y2)) (x3 y3 + x2 (y2 + y3)))/(x2 y2 (x3 y3 + x2 (y2 + y3) + x1 (y1 + y2 + y3)));

K2[y1, x2, y2, x3, y3, x4] = ((x2 y1 + x3 (y1 + y2)) (x3 y2 + x4 (y2 + y3)))/(x3 y2 (x2 y1 + (x3 + x4) (y1 + y2) + x4 y3));

K3[x2, y2, x3, y3, x4, y4] = ((x3 y3 + x2 (y2 + y3)) (x4 y4 + x3 (y3 + y4)))/(x3 y3 (x4 y4 + x3 (y3 + y4) + x2 (y2 + y3 + y4)));

K4[ y2, x3, y3, x4, y4, x5]  = ((x3 y2 + x4 (y2 + y3)) (x4 y3 + x5 (y3 + y4)))/(x4 y3 (x3 y2 + (x4 + x5) (y2 + y3) + x5 y4));

K5[ x3, y3, x4, y4, x5, y5]  = ((x4 y4 + x3 (y3 + y4)) (x5 y5 + x4 (y4 + y5)))/(x4 y4 (x5 y5 + x4 (y4 + y5) + x3 (y3 + y4 + y5)));

K6[ y3, x4, y4, x5, y5, x6]  = ((x4 y3 + x5 (y3 + y4)) (x5 y4 + x6 (y4 + y5)))/(x5 y4 (x4 y3 + (x5 + x6) (y3 + y4) + x6 y5));


But as I know the answer, so I will write it here and need a codding which can give me this factorization or any other factorization with the above mentioned factors:

The combination is as follows:

F6[x1, y1, x2 , y2, x3 , y3, x4, y4, x5, y5, x6] = ((K1[x1, y1, x2, y2, x3, y3] - 1) (K3[x2, y2, x3, y3, x4, y4] - 1) (K4[y2, x3, y3, x4, y4, x5] - 1)(K6[y3, x4, y4, x5, y5, x6] - 1))/(K1[x1, y1, x2, y2, x3, y3] K3[x2, y2, x3, y3, x4, y4] K4[y2, x3, y3, x4, y4, x5] K6[y3, x4, y4, x5, y5, x6]) = ((K1[x1, y1, x2, y2, x3, y3] - 1)/K1[x1, y1, x2, y2, x3, y3]) ((K3[x2, y2, x3, y3, x4, y4] - 1)/K3[x2, y2, x3, y3, x4, y4]) ((K4[y2, x3, y3, x4, y4, x5] - 1)/K4[y2, x3, y3, x4, y4, x5]) ((K6[y3, x4, y4, x5, y5, x6] - 1)/K6[y3, x4, y4, x5, y5, x6]);


I will appreciate a lot if someone helps me to write down a Mathematica codding which is able to give me such combinations of $K1, K2, K3, K4, K5$ and $K6$.

Here there is another factorization problem in 9 variable (The easiest one!) which I still don't know how it should done!

The question is the same as previous one; We have the following polynomial fraction and wanna to decompose it

F9[x1, y1, z1, x2 , y2, z2, x3 , y3, z3, x4, y4, z4, x5, y5, z5, x6, y6, z6] = (2 x1 x2 x5 y2 y5 y6 z2 (x2 y1 y2 z1 + x2 y1 y3 z1 + x3 y1 y3 z1 + x2 y1 y3 z2 + x3 y1 y3 z2 + x3 y2 y3 z2) z3^2 z4 (x4 x5 y4 z4 + x4 x6 y4 z4 + x4 x6 y5 z4 + x4 x6 y4 z5 + x4 x6 y5 z5 +  x5 x6 y5 z5))/((x1 y1 z1 + x1 y1 z2 + x1 y2 z2 + x2 y2 z2) (x2 y2 z2 + x2 y2 z3 + x2 y3 z3 +  x3 y3 z3)^2 (x4 y4 z3 + x4 y5 z3 + x5 y5 z3 + x5 y5 z4)^2 (x5 y5 z4 + x5 y6 z4 + x6 y6 z4 + x6 y6 z5));


to the combination of the following polynomial fractions

K1[x1, y1, z1, x2, y2, z2, x3, y3, z3]  = ((x1 y1 z1 + x2 y2 z2 + x1 (y1 + y2) z2) (x2 y2 z2 + x3 y3 z3 + x2 (y2 + y3) z3))/(x2 y2 z2 (x2 y2 z2 + x3 y3 z3 + x2 (y2 + y3) z3 + x1 (y2 z2 + (y2 + y3) z3 + y1 (z1 + z2 + z3))));

K2[y1, z1, x2, y2, z2, x3, y3, z3, x4] = (((x2 + x3) y1 z1 + x3 (y1 + y2) z2) ((x3 + x4) y2 z2 +  x4 (y2 + y3) z3))/(x3 y2 z2 (x2 y1 z1 + (x3 + x4) (y2 z2 + y1 (z1 + z2)) + x4 (y1 + y2 + y3) z3));

K3[z1, x2, y2, z2, x3, y3, z3, x4, y4] = ((x2 (y2 + y3) z1 + x3 y3 (z1 + z2)) (x3 (y3 + y4) z2 +  x4 y4 (z2 + z3)))/(x3 y3 z2 (x2 (y2 + y3 + y4) z1 + x3 (y3 + y4) (z1 + z2) + x4 y4 (z1 + z2 + z3)));

K4[x2, y2, z2, x3, y3, z3, x4, y4, z4]  = ((x2 y2 z2 + x3 y3 z3 + x2 (y2 + y3) z3) (x3 y3 z3 + x4 y4 z4 + x3 (y3 + y4) z4))/(x3 y3 z3 (x3 y3 z3 + x4 y4 z4 + x3 (y3 + y4) z4 + x2 (y3 z3 + (y3 + y4) z4 + y2 (z2 + z3 + z4))));

K5[y2, z2, x3, y3, z3, x4, y4, z4, x5]  = (((x3 + x4) y2 z2 + x4 (y2 + y3) z3) ((x4 + x5) y3 z3 + x5 (y3 + y4) z4))/(x4 y3 z3 (x3 y2 z2 + (x4 + x5) (y3 z3 +  y2 (z2 + z3)) + x5 (y2 + y3 + y4) z4));

K6[z2, x3, y3, z3, x4, y4, z4, x5, y5]  = ((x3 (y3 + y4) z2 + x4 y4 (z2 + z3)) (x4 (y4 + y5) z3 + x5 y5 (z3 + z4)))/(x4 y4 z3 (x3 (y3 + y4 + y5) z2 +  x4 (y4 + y5) (z2 + z3) + x5 y5 (z2 + z3 + z4)));

K7[x3, y3, z3, x4, y4, z4, x5, y5, z5]  = ((x3 y3 z3 + x4 y4 z4 + x3 (y3 + y4) z4) (x4 y4 z4 + x5 y5 z5 + x4 (y4 + y5) z5))/(x4 y4 z4 (x4 y4 z4 + x5 y5 z5 + x4 (y4 + y5) z5 + x3 (y4 z4 + (y4 + y5) z5 + y3 (z3 + z4 + z5))));

K8[y3, z3, x4, y4, z4, x5, y5, z5, x6]  = (((x4 + x5) y3 z3 + x5 (y3 + y4) z4) ((x5 + x6) y4 z4 + x6 (y4 + y5) z5))/(x5 y4 z4 (x4 y3 z3 + (x5 + x6) (y4 z4 + y3 (z3 + z4)) + x6 (y3 + y4 + y5) z5));

K9[z3, x4, y4, z4, x5, y5, z5, x6, y6]  = ((x4 (y4 + y5) z3 + x5 y5 (z3 + z4)) (x5 (y5 + y6) z4 +  x6 y6 (z4 + z5)))/(x5 y5 z4 (x4 (y4 + y5 + y6) z3 + x5 (y5 + y6) (z3 + z4) + x6 y6 (z3 + z4 + z5)));


The question is the same as the previous one. We want to decompose $F9$ just in terms of $K1, K2, K3, K4, K5, K6, K7, K8, K9$, which will be our factors.

Please again let me know if the question is not clear.

Thank you very much for your help!

• Please paste the code rather than pictures of the code. – Bob Hanlon Aug 1 '16 at 15:32
• I don't know how to put in Mathematica format here! Can you please edit it? Thanks! @BobHanlon – Farrokh Aug 1 '16 at 22:12
• Convert notebook cells to InputForm then copy and paste. Indent four spaces for code block (or use {} icon). See Markdown help – Bob Hanlon Aug 1 '16 at 22:26
• Thanks! I think I did it! :) @BobHanlon – Farrokh Aug 1 '16 at 22:51
• Sorry, is it possible to have such Mathematica codding which gives me the factorization? @BobHanlon – Farrokh Aug 2 '16 at 9:42

A generalization of the answer to 129970 solves the first half of this question in about 70 seconds.

tp = Tuples[Range[-1, 1], 6]; tp // Length
(* 729 *)
gp = Map[t1^#[[1]] t2^#[[2]] t3^#[[3]] t4^#[[4]] t5^#[[5]] t6^#[[6]] &, tp].
Table[Unique["c"], tp // Length];
sol = Flatten@Solve[Table[(f6 == (gp /. {t1 -> k1, t2 -> k2, t3 -> k3, t4 -> k4,
t5 -> k5, t6 -> k6})) /. Thread[{x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5} ->
RandomInteger[{1, 11}, 11]], {n, tp // Length}],
List @@ (First@# & /@ (gp /. gp[[1]] -> gp[[1]] z))]);
sol /. Rule[_, 0] -> Nothing
(* {c114 -> -2, c115 -> 2, c123 -> 2, c124 -> -2, c330 -> -2, c331 -> 2,
c339 -> 2, c340 -> -2, c357 -> 2, c358 -> -2, c366 -> -2, c367 -> 2,
c87 -> 2, c88 -> -2, c96 -> -2, c97 -> 2} *)
Factor[gp /. sol]
(* (2 (-1 + t1) (-1 + t3) (-1 + t4) (-1 + t6))/(t1 t3 t4 t6) *)


poly = (2 x1 x2 x5 x6 y2 (x2 y1 + x3 (y1 + y2)) y3^2 y4 (x5 y5 +
x4 (y4 + y5)))/((x2 y2 + x1 (y1 + y2)) (x3 y3 + x2 (y2 + y3))^2 (x4 y3 +
x5 (y3 + y4))^2 (x5 y4 + x6 (y4 + y5)));

eqns = {
K1 == ((x2 y2 + x1 (y1 + y2)) (x3 y3 + x2 (y2 + y3)))/(x2 y2 (x3 y3 +
x2 (y2 + y3) + x1 (y1 + y2 + y3))),
K2 == ((x2 y1 + x3 (y1 + y2)) (x3 y2 +
x4 (y2 + y3)))/(x3 y2 (x2 y1 + (x3 + x4) (y1 + y2) + x4 y3)),
K3 == ((x3 y3 + x2 (y2 + y3)) (x4 y4 + x3 (y3 + y4)))/(x3 y3 (x4 y4 +
x3 (y3 + y4) + x2 (y2 + y3 + y4))),
K4 == ((x3 y2 + x4 (y2 + y3)) (x4 y3 +
x5 (y3 + y4)))/(x4 y3 (x3 y2 + (x4 + x5) (y2 + y3) + x5 y4)),
K5 == ((x4 y4 + x3 (y3 + y4)) (x5 y5 + x4 (y4 + y5)))/(x4 y4 (x5 y5 +
x4 (y4 + y5) + x3 (y3 + y4 + y5))),
K6 == ((x4 y3 + x5 (y3 + y4)) (x5 y4 +
x6 (y4 + y5)))/(x5 y4 (x4 y3 + (x5 + x6) (y3 + y4) + x6 y5))
};


Compute GroebnerBasis

gb = GroebnerBasis[eqns, {x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6}];


The remainder gives a representation of poly in terms of K1 .. K6

{qs, r} = PolynomialReduce[poly, gb, {x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, x6}];


Where r is your solution in K1 ... K6. This validates correctness:

poly == r /. ToRules[And @@ eqns] // Expand


Please note, this may take a while, but simplification seems part of your research objective (and you are only asking for ways to code this).

• Thank you very much for your answer! I even didn't expect that there can be a relation between this question and Groebner Basis! I think it will work. But since morning I am trying to load it! But it seems it needs too much memory! I also bought a student account in Mathematica online, but it also says "This computation has exceeded the memory limit for your plan"! Can I ask that how much memory is enough for to run this program, please? I want to buy another plan from Mathematica online! Thanks! – Farrokh Aug 4 '16 at 12:27
• It does exceed 16 GB few times, so I guess 32 GB is what you need. Not sure if my config is representative. Also, calculation seems to explode exponentially so before you start spending ... I'm not sure if you can address much larger problems. – Sander Aug 4 '16 at 12:45
• Definitely a very sound approach (I upvoted), and (unfortunately) also one that can chew up a lot of RAM. – Daniel Lichtblau Aug 4 '16 at 15:50
• I had not considered ExperimentalOptimizeExpression but my feeling is that it is no stronger for this example than rule replacement or use of PolynomialReduce` without first computing GB. – Daniel Lichtblau Aug 5 '16 at 13:51
• Try to get your hands on 32GB, I said it EXCEEDS 16 GB, meaning that it probably will slow down substantially due to memory swaps (I did not time my solution but had it run overnight, swapping could - I don't know the data intensity of the algorithm behind it but it definitely was not CPU constraint - get it to run for days!! Good luck with you project anyway! – Sander Aug 6 '16 at 8:54