# Solving a cubic system of equations

I have the following equation system:

$A_1 x + B_1 y + C_1 z + D_1 xy + E_1 xz + F_1 yz + G_1 xyz = M_1$ $A_2 x + B_2 y + C_2 z + D_2 xy + E_2 xz + F_2 yz + G_2 xyz = M_2$ $A_3 x + B_3 y + C_3 z + D_3 xy + E_3 xz + F_3 yz + G_3 xyz = M_3$

$A_1$, $B_1$, ..., $M_1$, $A_2$, $B_2$, ..., $M_2$, $A_3$, $B_3$, ..., $M_3$ are known.

Trying to get $x$ based on $y$ and $z$ from the first equation, then substituting it in the second equation, then getting $y$ based on $z$ and substituting it in the third equasion seems a nightmare. How to solve this equation system?

• Where did you find this question? If I may ask. Feb 16 '13 at 14:32
• I think we need to know more about the coefficients. As far as I know, there isn't a general solution to this type of equation system. Feb 16 '13 at 14:47
• It's part of another problem I'm working on. See my another question: math.stackexchange.com/questions/305395/… Feb 16 '13 at 15:02
• @Flavin: The problem is that to solve my actual problem I have to be able to solve it without knowing the coefficients. Actually this is related to another problem: math.stackexchange.com/questions/305395/… Feb 16 '13 at 15:04
• @vonbrand: Big thanks for the edit! Feb 16 '13 at 15:22

A general cubic system of three equations in three unknown has at most 27 solutions. This can be proved by reducing it to a 27 degree polynomial equation in one variable and apply Gauss theorem. Finding the polynomial give you full control of the number of solutions. However, there is a problem with this scheme since it the polynomial of such high degree might be numerically unstable. Another method is Newtons Raphsons method which will give you a numerical solution of the problem.

• For your particular equation, you will end up with a 10th degree polynomial equation in z, which you solve by a numerical method. Rewrite each of the equations as x(a_i(z)y+b_i(z))=(c_i(z)y+d_i(z)) Multiply by (a_1(z)y+b_1(z)) in equation 2 and 3 and you get (a_i(z)y+b_i(z))(c_1(z)y+c_1(z))=(c_i(z)y+d_i(z))(a_1(z)y+b_1(z)) Rewrite these equation as p_2iy^2+p_1iy+p_0i=0 Eliminate y^2 from these two equations and rewrite K(z)y=H(z) p_2iy^2+p_1iy+p_0i=0 Jun 30 '17 at 23:15
• This is a polynomial equation of 10th order. It has therefore at most 10 solutions for z. Use back substitution to first find y and then find x. I recommend you to program this method and use some numerical scheme to solve it. Jun 30 '17 at 23:23
• Forget everything after K(z)y=H(z) in my first comment. It was an error due to a not to good interface on math.stackexchange.com. Insert instead: Multiply by K(z)^2 in p_21y^2+p_11y+p_01=0 and use K(z)y=H(z) to eliminate y. You get p_21 H(z)^2+p_11H(z)K(z)+p_01 K(z)^2=0. Jun 30 '17 at 23:26

A possible workaround can be the following:

1. Let's multiply the first equation with with $-G_2$, the second equation with $G_1$, and add them.
2. Now multiply the second equation with $-G_3$, the third one with $G_2$, and add them.
3. Finally multiply the third equation with $-G_1$, and the first one with $G_3$ and add them.

Theoretically we have now tree new equations, but we escaped from the $xyz$ part.

In the same way let's escape from xy, xz, xz.

We have now a simple equation system with 3 equations and 3 unknowns:

$AA_1x + BB_1y + CC_1z = MM_1$

$AA_2x + BB_2y + CC_2z = MM_2$

$AA_3x + BB_3y + CC_3z = MM_3$

that's easy to solve.

If you think this wouldn't always work please let me know, or if you have a better solution it is welcomed!

• It will not work. Try to solve with your method the system of equations $x+y+xy=5$ and $x-y+2xy=3$. (Or even more tiny example for meditation: $x+x^{17}=4$.) Feb 16 '13 at 19:43
• You are probably right. Can you give an equation system with 3 unknowns similar to system in the question, where this will not work? Thanks! Feb 16 '13 at 20:23
• If lots of $0$-s as coefficients is okay, then $x+xyz=7$, $y+xyz=8$, $z+xyz=9$. You can't make intended transformations simultaneously, and making them one by one leaves you (before last transformation) with only one equation with $xyz$ - and you can't make $1\cdot k_1 + 0\cdot k_2$ equal to $0$ (if $k_1\neq 0$ and $k_2\neq 0$, of course). It means you can't get rid of all $xyz$-s by such method. Feb 16 '13 at 20:31
• Yeah, you are right! Any ideas? Feb 16 '13 at 20:58
• Use numerical methods to approximate solution. (And no, I can't tell more because I'm weak at them.) Feb 17 '13 at 14:30

Maybe a bit ambiguous, but you can also try to set up the equations for $M_1+M_2$, $M_1+M_3$, $M_2+M_3$ and $M_1+M_2+M_3$, which is easy, in total you then have 7 equations, with 7 unknowns ($x,y,z,xy,xz,yz,xyz$). But i dont think this is even allowed.

• It's allowed but it will help nothing. It will just make 4 more equations with no new information. Feb 17 '13 at 14:34