A quick way to generate 3x3 matrices with determinant equal to 1?

11.2k Views Asked by At

Perhaps a formula involving the row number and column number of an element or just some parametric equations for each element. I know that I can just multiply two of these matrices together to get another but I'd rather not do that. Also, I wouldn't want too many zeroes in the matrix (1 or 2 at most).

3

There are 3 best solutions below

0
On BEST ANSWER

If you choose all matrix elements except one to be uniformly random (say, floating point numbers between 0 and 1, which many programming languages will do for you), then it is esssentially probability 0 that you will get a subfactor determinant that equals 0. So just expand the determinant along the first row, and choose all elements random except the last element in the first row, and then choose the last element in the first row deterministically so that when you compute the determinant expanded along the first row you get 1. This is not a very nice random distribution on matrices in a certain sense but it is definitely a particular random distribution on the set of all $3 \times 3$ matrices with determinant 1.

1
On

$$\det\left(\pmatrix{1&a&b\cr 0&1&c\cr 0&0&1\cr}\!\!\! \pmatrix{1&0&0\cr d&1&0\cr e&f&1\cr}\right) =1\times1=1\ .$$ (Does this count as multiplying two of "these" matrices together? - not sure what you meant by "these" matrices.) It is an easy way to get (for example) integer matrices with determinant $1$, and a bit of trial and error with $a,b,c,d,e,f$ will give you a small number of zeros.

1
On

A variant on user2566092's solution.

Choose the top row to be anything except $[0,0,0]$. Choose the second row to be anything that is not a scalar multiple of the top row. Since the rank of the top two rows is $2$, at least one of the three $2 \times 2$ determinants obtained by choosing two of the three columns in these two rows is nonzero. Take arbitrary values for the entries in those two columns in the third row, and adjust the remaining entry to make the determinant $1$.

Or if you prefer a formula:

$$ b_{{3,3}}={\frac {b_{{1,1}}b_{{2,3}}b_{{3,2}}-b_{{1,2}}b_{{2,3}}b_{{3, 1}}-b_{{1,3}}b_{{2,1}}b_{{3,2}}+b_{{1,3}}b_{{2,2}}b_{{3,1}}+1}{b_{{1,1 }}b_{{2,2}}-b_{{1,2}}b_{{2,1}}}} $$ as long as $b_{1,1} b_{2,2} - b_{1,2} b_{2,1} \ne 0$.