4
$\begingroup$

I'm trying to figure out how to find the determinant of a 5x5 matrix by co-factor expansion in the second row. I have already calculated the minors of the matrix using Minors. I'm also trying to figure out how to generate the cofactors of the minor matrices using the Table command.

A = {{1, 2, 3, 4, 4}, {2, 1, 2, 3, 4}, {3, 2, 1, 2, 3}, {4, 3, 2, 1, 2},
     {4, 4, 3, 2, 1}};

Amin = Minors[A]
(* {{-20, -22, 0, 10, 12}, {-22, -37, -16, 11, 10}, {0, -16, -32, -16, 0},
    {10, 11, -16, -37, -22}, {12, 10, 0, -22, -20}} *)

Could someone give me step-by-step instructions or concepts to solve this problem? To emphasize, please note that I am only asking for instructions.

$\endgroup$
5
  • 1
    $\begingroup$ Maybe something like Times[A, KroneckerProduct[#, #] &[(-1)^Range[Length[A]]]] would do? $\endgroup$ Mar 4 at 16:14
  • $\begingroup$ I want to understand with step by step instructions. $\endgroup$ Mar 4 at 16:30
  • $\begingroup$ (-1)^Range[Length[A]] produces the vector {-1, 1, -1, 1, -1}. Taking the KroneckerProduct turns this into a matrix of alternating sings. Times just multiplies each entry of A with the corresponding sign. $\endgroup$ Mar 4 at 16:35
  • $\begingroup$ Check Minors reference guide page, Properties & Relations section second and third examples. $\endgroup$ Mar 4 at 18:37
  • $\begingroup$ How would i create a table of cofactors first? $\endgroup$ Mar 4 at 20:31

2 Answers 2

2
$\begingroup$

Define a Cofactor and CofactorMatrix functions:

Cofactor[m_?MatrixQ, {i_Integer, j_Integer}] := (-1)^(i + j)* 
Det[Delete[Thread@Delete[m, {i}], {j}]]

CofactorMatrix[m_?MatrixQ] := 
Table[Cofactor[m, {i, j}], {i, #}, {j, #}] &@Length@m

Next, we define the DetByCofactorExpansion function:

DetByCofactorExpansion[mat_?MatrixQ, row_Integer] := 
CofactorMatrix[mat][[row]] . mat[[row]]

DetByCofactorExpansion[A, 2]

(*32*)
$\endgroup$
3
$\begingroup$

You already got the minors.

Then the determinant of a matrix can be obtained by the Laplace expansion (see e.g.: https://en.wikipedia.org/wiki/Laplace_expansion). Here is an example:

laplDet[mat_, row_] := 
  Sum[(-1)^(row + j)  Amin[[row, j]]  mat[[row, j]], {j, Length[mat]}];
laplDet[A, 2]

32
$\endgroup$
2
  • $\begingroup$ How would i create a table of cofactors first? $\endgroup$ Mar 4 at 20:19
  • $\begingroup$ The Laplace expansion is an expansion in minors with weights (cofactors) given by corresponding matrix elements of the original matrix with alternating signs. $\endgroup$ Mar 4 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.