Skip to main content
1 of 4
Misha Lavrov
  • 5.3k
  • 13
  • 27

Wolfram Language (Mathematica), 53 bytes

1##&@@@(t=Tuples)@#.Signature/@t[Range@Length@#&/@#]&

Try it online!

How it works

The first part, 1##&@@@(t=Tuples)@#, computes all possible products of a term from each row of the given matrix. t[Range@Length@#&/@#] gives a list of the same length whose elements are things like {3,2,1} or {2,2,3} saying which entry of each row we picked out for the corresponding product.

We apply Signature to the second list, which maps even permutations to 1, odd permutations to -1, and non-permutations to 0. This is precisely the coefficient with which the corresponding product appears in the determinant.

Finally, we take the dot product of the two lists.

Misha Lavrov
  • 5.3k
  • 13
  • 27