# List of matrices where absolute value of determinant of these matrices bigger than 1

Let we have

list = {{1, 0, 2, 0, 1, 1}, {1, 1, 0, 1, 2, 1}, {1, 0, 0, 2, 1, 1},
{1, 1, 1, 2, 1, 1}, {2, 1, 1, 0, 1, 1}, {1, 2, 1, 2, 2, 1},
{2, 1, 1, 2, 1, 2}, {1, 2, 1, 1, 1, 1}, {0, 1, 1, 0, 1, 0},
{0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 1}};


I would like to obtain the list of all possible 6 x 6 matrices which are created considering every 6 tuples in the above list.

From this list, I would like to have a list of matrices where the absolute value of the determinant is bigger than 1. When we interchange two columns or rows in the matrix, we can have a minus version of the determinant, so we may have lots of repetitions. Moreover, there should not be repetition in the list.

Addition to above problem, let us consider the above algorithm for 15 x 15 matrices as follows:

list = {{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 1,
1, 0, 2, 1, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 1, 0, 1, 0, 0, 2, 0, 0,
1, 1, 0, 1}, {0, 0, 1, 0, 0, 0, 0, 2, 0, 2, 2, 1, 2, 4, 2}, {0, 1,
1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3}, {1, 1, 0, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0}, {1, 2, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1,
1}, {2, 1, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2}, {1, 2, 4, 1, 3,
4, 2, 1, 1, 2, 1, 1, 2, 2, 2}, {1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1,
1, 1, 1, 1}, {1, 1, 2, 4, 3, 1, 0, 9, 7, 6, 3, 4, 5, 6, 7}, {1, 2,
4, 5, 6, 1, 2, 1, 3, 6, 8, 6, 2, 8, 9}, {1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 0, 0}, {0, 0, 1, 2, 1, 5, 7, 8, 5, 7, 3, 2, 4, 3,
3}, {3, 5, 8, 3, 0, 5, 3, 4, 3, 3, 4, 6, 3, 3, 3}, {3, 5, 7, 8, 3,
9, 5, 3, 6, 3, 3, 9, 6, 3, 3}, {3, 5, 7, 8, 3, 0, 5, 3, 4, 6, 9,
4, 4, 6, 3}};

s = Select[Subsets[list, {Length[list[[1]]]}], Abs@Det[#] > 1 &];
Length[s]
p = Flatten[Permutations /@ s, 1];

rowID = Flatten[Position[list, #] & /@ #] &;

Dataset[{Row[{"Det", MatrixForm[#], " = ", Det[#], ",   Permutation ",
MatrixForm@rowID[#]}] & /@ s} // Transpose, MaxItems -> 1]

When I ran the above code I got  length[s] = 136  and also message that


General: The current computation was aborted because there was insufficient \ memory available to complete the computation.

Throw: Uncaught SystemException returned to top level. Can be caught with Catch[[Ellipsis], _SystemException].

SystemException["MemoryAllocationFailure"]

Even I got the above errors, I got the list of 136 matrices which satisfies the condition described in the code. The list is given 20 matrices by 20 Matrices. How can I see whole list at one time? How can we adjust Dataset for this?

Maybe this?

matrix = {{1, 0, 2, 0, 1, 1}, {1, 1, 0, 1, 2, 1}, {1, 0, 0, 2, 1,
1}, {1, 1, 1, 2, 1, 1}, {2, 1, 1, 0, 1, 1}, {1, 2, 1, 2, 2,
1}, {2, 1, 1, 2, 1, 2}, {1, 2, 1, 1, 1, 1}, {0, 1, 1, 0, 1,
0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 1}};
matrix // MatrixForm
submatrixs =
DeleteDuplicates@
Select[Table[matrix[[i]], {i, Subsets[Range[Length@matrix], {6}]}],
Det[#] > 1 &];
Det /@ submatrixs
MatrixForm /@ submatrixs

• the code should check absolute value of the determinant bigger than 1, not determinant bigger than 1. How can we revise this code in this way. thanks @cvgmt Commented Nov 21, 2020 at 19:23
• @gunes replace Det[#]>1 with Abs[Det[#]]>1
– Bill
Commented Nov 21, 2020 at 20:17
• Thanks, @Bill the code gives the list of the matrices, can ı also see what the determinant is for the corresponding matrix, when getting the list of all these matrices. Commented Nov 21, 2020 at 22:00
• @gunes Use Map[{#,Det[#]}&,submatrixs] after the code above to see a list of each matrix followed by its determinant. If that # and & stuff is beyond you then use f[m_]:={m,Det[m]};Map[f,submatrixs] instead. I suggest you look up and study deeply the Map function. It will be very useful to you in the future.
– Bill
Commented Nov 21, 2020 at 22:08
• @Bill Thank you! Commented Nov 21, 2020 at 23:30

Just fooling around, simply for the sake of speed:

matrix = DeveloperToPackedArray@{{1, 0, 2, 0, 1, 1}, {1, 1, 0, 1, 2,
1}, {1, 0, 0, 2, 1, 1}, {1, 1, 1, 2, 1, 1}, {2, 1, 1, 0, 1,
1}, {1, 2, 1, 2, 2, 1}, {2, 1, 1, 2, 1, 2}, {1, 2, 1, 1, 1,
1}, {0, 1, 1, 0, 1, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 1,
1}, {0, 0, 0, 0, 0, 1}};

submat = DeleteDuplicates@Pick[#, Positive[Abs[Det /@ N[#]] - 1.1]] &@
Partition[
matrix[[Flatten@
DeveloperToPackedArray@Subsets[Range[Length@matrix], {6}]]],
Length@First@matrix]; // RepeatedTiming

(* {0.0030, Null}  *)


Matrices + determinants:

submat = Transpose@
DeleteDuplicates@
Pick[{#, Round[#2]}, Positive[Abs[{#2, #2}] - 1.1]] &[#,
Det /@ N[#]] &@
Partition[
matrix[[Flatten@
DeveloperToPackedArray@Subsets[Range@Length@matrix, {6}]]],
Length@First@matrix]; // RepeatedTiming

(*  0.0032, Null}  *)
`