Algosim documentation: CofactorMatrix

CofactorMatrix

Computes the cofactor matrix of a square matrix.

Syntax

Description

If A is a square matrix, then CofactorMatrix(A) returns the cofactor matrix of A, that is, the matrix of all cofactors of A. In other words,

CofactorMatrix(A) =

  = matrix(compute(cofactor(A, i, j), i, 1, size(A).rows, j, 1, size(A).cols))
  = matrix(compute((−1)^(i + j) ⋅ minor(A, i, j),
    i, 1, size(A).rows, j, 1, size(A).cols))
  = matrix(compute((−1)^(i + j) ⋅ det(SubmatrixByRemoval(A, i, j)),
    i, 1, size(A).rows, j, 1, size(A).cols)).

Examples

A ≔ ❨❨4, 1, 2, 3❩, ❨6, 1, 2, 3❩, ❨7, 6, 5, 0❩, ❨1, 2, 1, 6❩❩
⎛4  1  2  3⎞
⎜6  1  2  3⎟
⎜7  6  5  0⎟
⎝1  2  1  6⎠
CofactorMatrix(A)
⎛ −54  −102   198    10⎞
⎜  54    42  −126    −2⎟
⎜   0    18     0    −6⎟
⎝   0    30   −36    14⎠

See also