In mathematics, a cofactor is a component of a matrix computation of the matrix determinant.
Let M be a square matrix of size n. The (i,j) minor refers to the determinant of the (n-1)×(n-1) submatrix Mi,j formed by deleting the i-th row and j-th column from M (or sometimes just to the submatrix Mi,j itself). The corresponding cofactor is the signed determinant

The adjugate matrix adj M is the square matrix whose (i,j) entry is the (j,i) cofactor. We have

which encodes the rule for expansion of the determinant of M by any the cofactors of any row or column.
This expression shows that if det M is invertible, then M is invertible and the matrix inverse is determined as

Example
Consider the following example matrix,

Its minors are the determinants (bars indicate a determinant):


The adjugate matrix of M is

and the inverse matrix is

Indeed,
![{\displaystyle {\begin{aligned}\left(M\;M^{-1}\right)_{11}&=|M|^{-1}\left(a_{1}M_{11}-a_{2}M_{12}+a_{3}M_{13}\right)={\frac {|M|}{|M|}}=1\\\left(M\;M^{-1}\right)_{21}&=|M|^{-1}\left(b_{1}M_{11}-b_{2}M_{12}+b_{3}M_{13}\right)=|M|^{-1}\left[b_{1}(b_{2}c_{3}-b_{3}c_{2})-b_{2}(b_{1}c_{3}-b_{3}c_{1})+b_{3}(b_{1}c_{2}-b_{2}c_{1})\right]=0,\\\end{aligned}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/666c962980956d9194404c9e3af6f0e44d9db2f2)
and the other matrix elements of the product follow likewise.
References