Wolfram Research

Function Repository Resource:

CofactorMatrix (4.1.0) current version: 5.0.0 »

Source Notebook

Give the matrix of cofactors for a given input matrix

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["CofactorMatrix"][mat]

gives the cofactor matrix of the matrix mat.

Details

The (i,j) cofactor of a square matrix is, up to a change in sign, equal to the determinant of the matrix obtained by deleting the ith row and jth column.

Examples

Basic Examples (4) 

Find the matrix of cofactors of an input matrix:

In[1]:=
ResourceFunction["CofactorMatrix"][{{3, 2, 5}, {4, 3, -1}, {2, 3, 4}}]
Out[1]=

The identity matrix is equal to its own cofactor matrix:

In[2]:=
ResourceFunction["CofactorMatrix"][{{1, 0}, {0, 1}}]
Out[2]=

Find the matrix of cofactors of another matrix:

In[3]:=
ResourceFunction["CofactorMatrix"][{{3, 0, 2}, {2, 0, -2}, {0, 1, 1}}]
Out[3]=

Find the cofactor matrix of a matrix having symbolic elements:

In[4]:=
ResourceFunction[
 "CofactorMatrix"][{{1, 1, 1}, {a^2, a, 1}, {b^2, b, 1}}]
Out[4]=

Scope (1) 

CofactorMatrix returns unevaluated for non-square matrix input:

In[5]:=
ResourceFunction["CofactorMatrix"][Sin[x]]
Out[5]=
In[6]:=
ResourceFunction["CofactorMatrix"][{{3, 0}, {2, 0}, {0, 1}}]
Out[6]=

Properties and Relations (1) 

The cofactor matrix is related to the Adjugate by transposition:

In[7]:=
mat = {{3, 0, 2}, {2, 0, -2}, {0, 1, 1}};
ResourceFunction["CofactorMatrix"][mat] == Transpose[ResourceFunction[
ResourceObject[<|"Name" -> "Adjugate", "ShortName" -> "Adjugate", "UUID" -> "d389a35f-2de9-4e78-92e7-bfb79e77ddd3", "ResourceType" -> "Function", "Version" -> "1.0.0", "Description" -> "Give the adjugate matrix of a square matrix", "RepositoryLocation" -> URL[
       "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$a6f97dc9cc554e32a57bdda6d6705ffe`Adjugate", "FunctionLocation" -> CloudObject[
       "https://www.wolframcloud.com/objects/706438d5-5fe9-4d14-b38a-033f7ab6b65f"]|>, {ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"}]][mat]]
Out[8]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 5.0.0 – 23 March 2023
  • 4.1.0 – 11 May 2021
  • 4.0.0 – 24 January 2020
  • 3.0.0 – 24 January 2020
  • 2.0.0 – 06 September 2019
  • 1.0.0 – 10 July 2019

Related Resources

License Information