Finding number of $\pm 1$ matrices with a given determinant

combinatoricsdeterminantmatrices

I came across a problem in which we had to find the number of $3 \times 3$ matrices whose entries are $\pm 1$ and whose determinant is positive. By making a few possible matrices, I found out that the only possible values the determinant can take is are $0$ and $\pm 4$ but I have no idea how to find the number of matrices whose determinant is $4$.

Any help would be greatly appreciated! Thanks in advance!

Best Answer

Rewriting the membership constraint $x \in \{ \pm 1 \}$ as the quadratic equality constraint $x^2 = 1$, one cheeky way of finding the number of $3 \times 3$ matrices with $\pm 1$ entries and determinant equal to $4$ is to find the number of solutions of the following system of $10 = 1 + 3^2$ polynomial ($1$ cubic and $3^2$ quadratic) equations (in the $3^2$ entries) over $\Bbb R$:

$$\begin{aligned} \det({\rm X}) &= 4 \\ x_{11}^2 &= 1 \\ x_{12}^2 &= 1 \\ &\vdots \\ x_{33}^2 &= 1\end{aligned}$$

Using Macaulay2:

Macaulay2, version 1.16
with packages: ConwayPolynomials, Elimination, IntegralClosure, InverseSystems,
               LLLBases, MinimalPrimes, PrimaryDecomposition, ReesAlgebra,
               TangentCone, Truncations

i1 : R = QQ[x11, x12, x13, x21, x22, x23, x31, x32, x33]

o1 = R

o1 : PolynomialRing

i2 : I = ideal(x11 * x22 * x33 + x21 * x32 * x13 + x31 * x12 * x23 - x31 * x22 * x13 - x21 * x12 * x33 - x11 * x32 * x23 - 4, x11^2 - 1, x12^2 - 1, x13^2 - 1, x21^2 - 1, x22^2 - 1, x23^2 - 1, x31^2 - 1, x32^2 - 1, x33^2 - 1)

                                                                     
o2 = ideal (- x13*x22*x31 + x12*x23*x31 + x13*x21*x32 - x11*x23*x32 -
     ---------------------------------------------------------------------------
                                       2         2         2         2         2
     x12*x21*x33 + x11*x22*x33 - 4, x11  - 1, x12  - 1, x13  - 1, x21  - 1, x22 
     ---------------------------------------------------------------------------
             2         2         2         2
     - 1, x23  - 1, x31  - 1, x32  - 1, x33  - 1)

o2 : Ideal of R

i3 : dim I

o3 = 0

i4 : degree I

o4 = 96

Thus, there are $\color{blue}{96}$ matrices.


Bernd Sturmfels, Ideals, Varieties and Macaulay 2 [PDF]