# Solving a set of multivariate polynomials; four equations, four unknowns, maximum degree 2

I am currently trying to solve a set of four polynomial expressions for a geometric purpose. in short they take on this form:

$$A_0=\frac{w_0^2+w_1 w_0+w_2 w_0+w_3 w_0+27 w_0+6 w_1+6 w_2+6 w_3+117}{\left(w_0+w_1+w_2+w_3+27\right){}^2}$$

$$A_1=\frac{w_1^2+w_0 w_1+2 w_3 w_1+24 w_1+4 w_0+11 w_3+87}{\left(w_0+w_1+w_2+w_3+27\right){}^2}$$

$$A_2=\frac{w_2^2+w_0 w_2+2 w_1 w_2+24 w_2+4 w_0+11 w_1+87}{\left(w_0+w_1+w_2+w_3+27\right){}^2}$$

$$A_3=\frac{w_3^2+w_0 w_3+2 w_2 w_3+24 w_3+4 w_0+11 w_2+87}{\left(w_0+w_1+w_2+w_3+27\right){}^2}$$

The values of $$A_0,A_1,A_2,A_3$$ are assumed known, and the purpose is to invert these equations to achieve $$w_0,w_1,w_2,w_3$$.

I initially solved for $$w_0$$ in terms of all knowns, but for the remaining $$w$$ values, the formulae that result are dependent on $$w_0$$ for their result. This may lead to issues down the road especially if there are no real positive candidate roots for $$w_0$$.

The framework I laid out mostly involves solving each of the four equations for each of the four unknowns, leading to a total of 16 equations, and substituting different ones into one another until only one unknown is left. Furthermore, the current equations so far have consistently relied on the solutions of cubic and quartic equations, which can be unwieldy and could provide incorrect or spurious results.

My question is if I am taking this the wrong way and/or skipping key assumptions, and if there is a simpler approach that could be used to solve all the $$w_1,w_2,w_3$$ solely in terms of $$A_0,A_1,A_2,A_3$$. Does this set of equations remind you of any mathematical construct in particular that has had a proven solution? How would you go about to attack this problem?

• I will define $w_4 = w_1 + w_2 + w_3$ and $A_4 = A_1 + A_2 + A_3$. Both $A_0$ and $A_4$ can be expressed in terms of $w_0, w_4$. So finding $w_0, w_4$ is equivalent to finding the intersections of the two conics corresponds to $A_0$ and $A_4$. After you get $w_0$ and $w_4$, express $w_3$ in terms of $w_1, w_2, w_4$, then finding $w_1, w_2$ becomes finding intersection of the two conics corresponds to $A_1$ and $A_2$. This is messy but should be doable. – achille hui May 4 at 19:48
• Alright, I did try something similar to get $w_0$ purely in terms of the four $A$ terms at one point, only to use that as the basis for the other three. When you say express $w_3$ in terms of $w_1,w_2,w_4$, are we supposed to do this using the $A_1$ and $A_2$ equations? – Arie Tan May 4 at 20:39

No matter how you attack this, generally, you will have one variable the other three depend on, another variable that the remaining two depend on, and of these last two, one will depend on the other. (I say "generally" because very, very rarely, the variables decouple. Consider $$x^2 - x - y + 1 = 0$$. This (surprise!) factors as $$(x-1)(y-1) = 0$$, so $$x$$ and $$y$$ turn out to be independent. However, this does not happen for $$x^2 - x - y + 2 = 0$$, or for any other small perturbation of the first equation. This decoupling is a rare coincidence.)

(There was much typing, copying, pasting, and editing in the following. A typo' could easily have slipped into this answer.)

I see several repeated subexpressions that are linear in the $$w_i$$, meaning we can solve for the subexpressions, then multiply by a matrix to get the $$w_i$$. Let $$x = w_0 + w_1 + w_2 + w_3 + 27$$. Then your system is \begin{align*} A_0 x^2 &= w_0x +6 w_1 +6 w_2 +6 w_3 + 117 \\ A_1 x^2 &= (w_1+4)x - w_1 w_2 + w_1 w_3 - 7 w_1 - 4 w_2 + 7 w_3 - 21 \\ A_2 x^2 &= (w_2+4)x + w_1 w_2 - w_2 w_3 + 7 w_1 - 7 w_2 - 4 w_3 - 21 \\ A_3 x^2 &= (w_3+4)x - w_1 w_3 + w_2 w_3 - 4 w_1 + 7 w_2 - 7 w_3 - 21 \end{align*}

Adding weighted subsets of these together (which subsets and weights is evident from the left-hand sides), and setting $$y = w_1+w_2+w_3+5$$, \begin{align*} A_0 x^2 &= w_0x + 6y + 87 \\ A_1 x^2 &= (w_1+4)x +(-w_2 + w_3 - 7)y +w_2^2 - w_3^2 + 8 w_2 + 9 w_3 + 14 \\ A_2 x^2 &= (w_2+4)x + (w_1 - w_3 - 7)y -w_1^2 + w_3^2 + 9 w_1 + 8 w_3 + 14 \\ A_3 x^2 &= (w_3+4)x +(-w_1 + w_2 - 7)y + w_1^2 - w_2^2 + 8 w_1 + 9 w_2 + 14 \end{align*}\begin{align*} (A_0 + A_1 + A_2 + A_3)x^2 &= x(x-15) + 2y + 44 \tag{9} \\ (A_1 + A_2 + A_3)x^2 &= (x-4)y + 7x - 43 \\ (2A_0 + (x-4)(A_0 + A_1 + A_2 + A_3)) x^2 &= x^3 - 19x^2 + 90 x - 90 \tag{11} \end{align*} Equation $$(11)$$ is a cubic polynomial in $$x$$, constants, and the $$A_i$$s, so we can solve it for $$x$$, obtaining either one or three real roots. For each candidate $$x$$, use equation $$(9)$$ to get its corresponding $$y$$. Notice that $$x - y - 22 = w_0$$, so you can already determine whether $$w_0$$ is a positive number.

For explicitness, equation $$(11)$$ is, taking $$A = A_0+A_1+A_2+A_3$$, $$(A-1)x^3 + (-4A + 2A_0+19)x^2 - 90x + 90 = 0 \text{.}$$

• Could you elaborate on solving for subexpressions, followed by multiplying by a matrix to get the $w_i$? I'm going to recreate this in Mathematica first. – Arie Tan May 5 at 14:23
• @ArieTan : Common identified subexpressions in the above are $x = w_0 + w_1 + w_2 + w_3 + 27$ and $y = w_1 + w_2 + w_3 + 5$ which are selected because the subexpressions on the right-hand sides appear repeatedly. Then we have $$\begin{pmatrix}x \\ y \end{pmatrix} = \begin{pmatrix} 1 & 1 & 1 & 1 & 27 \\ 0 & 1 & 1 & 1 & 5 \end{pmatrix} \cdot \begin{pmatrix} w_0 \\ w_1 \\ w_2 \\ w_3 \\ 1 \end{pmatrix} \text{.}$$ We have already used row operation on the matrix to write $w_0 = x - y - 22$. – Eric Towers May 6 at 1:05
• Okay, so now that we have the values for $x$, $y$, and $w_0$, we find reduced sub-expressions like some $z = w_2 + w_3 + k$ where k is some constant and repeat this until all $w_i$ values are achieved? – Arie Tan May 6 at 14:04
• @ArieTan : That's one way to go. Although looking at the structure of the $A_i x^2$ equations, it seems more likely that $-w_1+w_2$, $-w_2+w_3$, and $-w_3+w_1$ will lead to further reductions. (Note that we do not have to restrict to just four recurring combinations.) I didn't pursue these because you already have solutions for $w_1$, $w_2$, and $w_3$ in terms of $x$ and $y$. – Eric Towers May 6 at 14:38
• wait what do you mean by solutions in terms of $x$ and $y$? $w_1$, $w_2$ and $w_3$ cannot be discerned by those two definitions alone, only their sum. I will look at these other reductions in the meantime – Arie Tan May 6 at 14:45