In [11]:
import sympy as sym
from sympy.polys import subresultants_qq_zz

sym.init_printing()

The Bezout matrix is a special square matrix associated with two polynomials, introduced by Sylvester (1853) and Cayley (1857) and named after Étienne Bézout. Bézoutian may also refer to the determinant of this matrix, which is equal to the resultant of the two polynomials.

The entries of Bezout matrix are bilinear functions of coefficients of the given polynomials. The Bezout formulation has gone over different generalizations. The most common one is the Cayley.. Cayley's matrix is given by,

$$ \left| \begin{array}{cc} p(x) & q(x)\\ p(a)& q(a) \end{array} \right| = \Delta(x, a)$$

where $\Delta(x, a)$ is the determinant.

We have the polynomial:

$$ \delta(x, a) = \frac{\Delta(x,a)}{x-a}$$

The matrix is then constructed from the coefficients of polynomial $\alpha$. Each coefficient is viewed as a polynomial of $x_1,..., x_n$.

The Bezout matrix is highly related to the Sylvester matrix and the greatest common divisor of polynomials. Unlike in Sylvester's formulation, where the resultant of $p$ and $q$ is the determinant of an $(m + n) \times (m + n)$ matrix, in the Cayley formulation, the resultant is obtained as the determinant of a $n \times n$ matrix.

Example: Generic example


In [2]:
b_3, b_2, b_1, b_0 = sym.symbols("b_3, b_2, b_1, b_0")
x = sym.symbols('x')

In [3]:
b = sym.IndexedBase("b")

In [4]:
p = b_2 * x ** 2 + b_1 * x + b_0
q = sym.diff(p, x)

In [5]:
subresultants_qq_zz.bezout(p, q, x)


Out[5]:
$$\left[\begin{matrix}- 2 b_{0} b_{2} + b_{1}^{2} & b_{1} b_{2}\\b_{1} b_{2} & 2 b_{2}^{2}\end{matrix}\right]$$

Example: Existence of common roots

Note that if the system has a common root we are expecting the resultant/determinant to equal to zero.

A commot root exists.


In [6]:
# example one
p = x ** 3 +1
q = x + 1

In [7]:
subresultants_qq_zz.bezout(p, q, x)


Out[7]:
$$\left[\begin{matrix}-1 & 0 & 1\\0 & 1 & 1\\1 & 1 & 0\end{matrix}\right]$$

In [8]:
subresultants_qq_zz.bezout(p, q, x).det()


Out[8]:
$$0$$

In [9]:
# example two
p = x ** 2 - 5 * x + 6
q = x ** 2 - 3 * x + 2

In [10]:
subresultants_qq_zz.bezout(p, q, x)


Out[10]:
$$\left[\begin{matrix}8 & -4\\-4 & 2\end{matrix}\right]$$

In [11]:
subresultants_qq_zz.bezout(p, q, x).det()


Out[11]:
$$0$$

A common root does not exist.


In [12]:
z = x ** 2 - 7 * x + 12
h = x ** 2 - x

In [13]:
subresultants_qq_zz.bezout(z, h, x).det()


Out[13]:
$$-72$$

Dixon's Resultant

Dixon (1908) showed how to extend this formulation to $m = 3$ polynomials in $n = 2$ variables.

In a similar manner but this time,

$$ \left| \begin{array}{cc} p(x, y) & q(x, y) & h(x, y) \cr p(a, y) & q(a, y) & h(b, y) \cr p(a, b) & q(a, b) & h(a, b) \cr \end{array} \right| = \Delta(x, y, \alpha, \beta)$$

where $\Delta(x, y, \alpha, \beta)$ is the determinant.

Thus, we have the polynomial:

$$ \delta(x,y, \alpha, \beta) = \frac{\Delta(x, y, \alpha, \beta)}{(x-\alpha)(y - \beta)}$$

In [14]:
from sympy.polys.multivariate_resultants import DixonResultant

Example: Generic example of Dixon $(n=2, m=3)$


In [15]:
a_1, a_2, b_1, b_2, u_1, u_2, u_3 = sym.symbols('a_1, a_2, b_1, b_2, u_1, u_2, u_3')

In [16]:
y = sym.symbols('y')

In [17]:
p = a_1 * x ** 2 * y ** 2 + a_2 * x ** 2
q = b_1 * x ** 2 * y ** 2 + b_2 * y ** 2
h = u_1 * x + u_2 * y + u_3

In [18]:
dixon = DixonResultant(variables=[x, y], polynomials=[p, q, h])

In [19]:
poly = dixon.get_dixon_polynomial()

In [20]:
poly


Out[20]:
$$\operatorname{Poly}{\left( \left(a_{2} b_{1} u_{1} x + a_{2} b_{1} u_{2} y + a_{2} b_{1} u_{3}\right) \alpha_{0}^{3}\alpha_{1} + \left(a_{2} b_{1} u_{1} x y + a_{2} b_{1} u_{2} y^{2} + a_{2} b_{1} u_{3} y\right) \alpha_{0}^{3} + \left(a_{1} b_{2} u_{1} y^{2} + a_{2} b_{1} u_{2} x y + a_{2} b_{1} u_{3} x\right) \alpha_{0}^{2}\alpha_{1} + \left(a_{1} b_{2} u_{1} y^{3} + a_{2} b_{1} u_{2} x y^{2} + a_{2} b_{1} u_{3} x y\right) \alpha_{0}^{2} + \left(a_{1} b_{2} u_{1} x y^{2} + a_{1} b_{2} u_{2} y^{3} + a_{1} b_{2} u_{3} y^{2} + a_{2} b_{2} u_{1} x + a_{2} b_{2} u_{2} y + a_{2} b_{2} u_{3}\right) \alpha_{0}\alpha_{1} + \left(a_{1} b_{2} u_{1} x y^{3} + a_{1} b_{2} u_{3} y^{3} + a_{2} b_{2} u_{1} x y + a_{2} b_{2} u_{3} y\right) \alpha_{0} + \left(a_{1} b_{2} u_{2} x y^{3} + a_{1} b_{2} u_{3} x y^{2} + a_{2} b_{2} u_{2} x y + a_{2} b_{2} u_{3} x\right) \alpha_{1} + a_{1} b_{2} u_{3} x y^{3} + a_{2} b_{2} u_{3} x y, \alpha_{0}, \alpha_{1}, domain=\mathbb{Z}\left[x, y, a_{1}, a_{2}, b_{1}, b_{2}, u_{1}, u_{2}, u_{3}\right] \right)}$$

In [21]:
matrix = dixon.get_dixon_matrix(poly)

In [22]:
matrix


Out[22]:
$$\left[\begin{matrix}0 & 0 & 0 & a_{2} b_{1} u_{1} & 0 & 0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3}\\0 & 0 & a_{2} b_{1} u_{1} & 0 & 0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3} & 0\\0 & 0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3} & 0 & a_{1} b_{2} u_{1} & 0 & 0\\0 & a_{2} b_{1} u_{2} & a_{2} b_{1} u_{3} & 0 & a_{1} b_{2} u_{1} & 0 & 0 & 0\\0 & a_{1} b_{2} u_{1} & 0 & a_{2} b_{2} u_{1} & a_{1} b_{2} u_{2} & a_{1} b_{2} u_{3} & a_{2} b_{2} u_{2} & a_{2} b_{2} u_{3}\\a_{1} b_{2} u_{1} & 0 & a_{2} b_{2} u_{1} & 0 & a_{1} b_{2} u_{3} & 0 & a_{2} b_{2} u_{3} & 0\\a_{1} b_{2} u_{2} & a_{1} b_{2} u_{3} & a_{2} b_{2} u_{2} & a_{2} b_{2} u_{3} & 0 & 0 & 0 & 0\\a_{1} b_{2} u_{3} & 0 & a_{2} b_{2} u_{3} & 0 & 0 & 0 & 0 & 0\end{matrix}\right]$$

In [23]:
matrix.det().factor()


Out[23]:
$$a_{1}^{2} a_{2}^{4} b_{1}^{2} b_{2}^{4} u_{3}^{4} \left(a_{1}^{2} b_{1}^{2} u_{3}^{4} + 2 a_{1}^{2} b_{1} b_{2} u_{1}^{2} u_{3}^{2} + a_{1}^{2} b_{2}^{2} u_{1}^{4} + 2 a_{1} a_{2} b_{1}^{2} u_{2}^{2} u_{3}^{2} - 2 a_{1} a_{2} b_{1} b_{2} u_{1}^{2} u_{2}^{2} + a_{2}^{2} b_{1}^{2} u_{2}^{4}\right)$$

Dixon's General Case

Yang et al. generalized the Dixon resultant method of three polynomials with two variables to the system of $n+1$ polynomials with $n$ variables.

Example: Numerical example


In [24]:
p = x + y
q = x ** 2 + y ** 3
h = x ** 2 + y

In [25]:
dixon = DixonResultant([p, q, h], (x, y))

In [26]:
poly = dixon.get_dixon_polynomial()
poly.simplify()


Out[26]:
$$\operatorname{Poly}{\left( -xy^{2}\alpha_{0} - xy^{2}\alpha_{1} - xy\alpha_{0}\alpha_{1} - xy\alpha_{1}^{2} - x\alpha_{0}\alpha_{1}^{2} + x\alpha_{0} - y^{2}\alpha_{0}\alpha_{1} + y^{2}\alpha_{1} - y\alpha_{0}\alpha_{1}^{2} + y\alpha_{1}^{2}, x, y, \alpha_{0}, \alpha_{1}, domain=\mathbb{Z} \right)}$$

In [27]:
matrix = dixon.get_dixon_matrix(polynomial=poly)
matrix


Out[27]:
$$\left[\begin{matrix}0 & 0 & -1 & 0 & -1\\0 & -1 & 0 & -1 & 0\\-1 & 0 & 1 & 0 & 0\\0 & -1 & 0 & 0 & 1\\-1 & 0 & 0 & 1 & 0\end{matrix}\right]$$

In [28]:
matrix.det()


Out[28]:
$$0$$

Example: Generic example


In [29]:
a, b, c = sym.symbols('a, b, c')

In [30]:
p_1 = a * x ** 2 + b * x * y + (b + c - a) * x + a * y + 3 * (c - 1)
p_2 = 2 * a ** 2 * x ** 2 + 2 * a * b * x * y + a * b * y + b ** 3
p_3 = 4 * (a - b) * x + c * (a + b) * y + 4 * a * b

In [31]:
polynomials = [p_1, p_2, p_3]

In [32]:
dixon = DixonResultant(polynomials, [x, y])

In [33]:
poly = dixon.get_dixon_polynomial()

In [34]:
size = len(poly.monoms())
size


Out[34]:
$$2$$

In [35]:
matrix = dixon.get_dixon_matrix(poly)
matrix


Out[35]:
$$\left[\begin{matrix}- 2 a^{4} c - 8 a^{4} + 12 a^{3} b + 2 a^{3} c^{2} + 2 a^{2} b^{2} c - 4 a^{2} b^{2} + 2 a^{2} b c^{2} & - 2 a^{3} b c - 8 a^{3} b + 12 a^{2} b^{2} + 2 a^{2} b c^{2} + 2 a b^{3} c - 4 a b^{3} + 2 a b^{2} c^{2} & - 8 a^{4} b - 4 a^{3} b^{2} + 6 a^{3} c^{2} - 6 a^{3} c - a^{2} b^{3} c + 8 a^{2} b^{3} + 8 a^{2} b^{2} c + 6 a^{2} b c^{2} - 30 a^{2} b c + 24 a^{2} b - a b^{4} c + 4 a b^{4} + 24 a b^{2} c - 24 a b^{2} - 4 b^{5}\\- 8 a^{4} b + 4 a^{3} b^{2} + 6 a^{3} c^{2} - 6 a^{3} c - a^{2} b^{3} c + 6 a^{2} b c^{2} - 6 a^{2} b c - a b^{4} c & - 8 a^{3} b^{2} + 4 a^{2} b^{3} + 6 a^{2} b c^{2} - 6 a^{2} b c - a b^{4} c + 6 a b^{2} c^{2} - 6 a b^{2} c - b^{5} c & - 4 a^{3} b^{2} + a^{2} b^{3} c + 8 a^{2} b^{3} + 4 a^{2} b^{2} c - 12 a^{2} b c + 12 a^{2} b - 4 a b^{4} - a b^{3} c^{2} + 12 a b^{2} c - 12 a b^{2} - b^{5} c - b^{4} c^{2}\end{matrix}\right]$$

In [36]:
z = sym.symbols('z')

In [37]:
f = x ** 2 + y ** 2 - 1 + z * 0
g = x ** 2 + z ** 2 - 1 + y * 0
h = y ** 2 + z ** 2 - 1

In [38]:
dixon = DixonResultant([f, g, h], [y, z])

In [39]:
poly = dixon.get_dixon_polynomial()

In [40]:
matrix = dixon.get_dixon_matrix(poly)
matrix


Out[40]:
$$\left[\begin{matrix}0 & 0 & 0 & - 2 x^{2} + 1\\0 & 0 & - 2 x^{2} + 1 & 0\\0 & - 2 x^{2} + 1 & 0 & 0\\- 2 x^{2} + 1 & 0 & 0 & 0\end{matrix}\right]$$

In [41]:
matrix.det()


Out[41]:
$$16 x^{8} - 32 x^{6} + 24 x^{4} - 8 x^{2} + 1$$