Notation
It is known that a matrix $$3 \times 3$$ is written as follows:
$$$\begin{pmatrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{pmatrix}$$$
where the subscripts indicate the row and the column respectively.
If we write:
$$$\left| \begin{matrix} a_{11} & a_{12} & a_{13}\\ a_{21} & a_{22} & a_{23}\\ a_{31} & a_{32} & a_{33} \end{matrix} \right|$$$
it means that the we want to calculate the determinant of this matrix.
Obviously this has been written for a $$3 \times 3$$ matrix, –because this one is the most common–, but the determinants of matrices $$2 \times 2$$, $$4 \times 4$$ or $$N \times N$$ can also be computed. It only makes sense to speak of determinants of square matrices.
Complementary minors
Let's consider the $$3 \times 3$$ matrix:
$$$ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}$$$
The complementary minor of the element $$a_{11}$$ is the determinant of order 2 that survives when row 1 and column 1 are eliminated.
In other words, the complementary minor we are looking for is:
$$$M_{11}=\left|\begin{matrix} \rlap{/}{ 1}&\rlap{/}2&\rlap{/}3\\ \rlap{/}4&5&6\\ \rlap{/}7 &8&9 \end{matrix}\right|=5 \cdot 9-8\cdot 6=-3$$$
Now let's calculate the complementary minor of the element $$a_{23}$$, in other words, the determinant of order 2 that survives when we eliminate the second row and the third column.
$$$M_{23}=\left|\begin{matrix} 1&2&\rlap{/}3\\ \rlap{/}4&\rlap{/}5&\rlap{/}6\\ 7 &8&\rlap{/}9 \end{matrix}\right|=1 \cdot 8-7\cdot 2=-6$$$
Generally, the complementary minor of an element $$a_{ij}$$ is written as $$M_{ij}$$ and it is the determinant of lower order that survives when row $$i$$ and column $$j$$ are eliminated.
Cofactors
We call the cofactor of an element of a matrix, its complementary minor but placing before it:
- The sign $$+$$ when $$i+j$$ is even
- The sign $$-$$ when $$i+j$$ is odd
Following the previous examples, the cofactor of the element $$a_{11}$$ is written as $$C_{11}$$ and must have the sign $$+$$ ($$1+1=2$$, which is even), while the cofactor of the element $$a_{23}$$ is written as $$C_{23}$$ and must have the sign $$-$$ ($$2+3=5$$, which is odd).
Using the precise notation, we conclude $$C_{11} = +M_{11} = -3$$ and $$C_{23} = -M_{23} = 6$$.
Let's see another example:
Consider the matrix:
$$$\begin{pmatrix} -1 & 0 & 2 \\ 1 & 1 & -3 \\ 0 & 2 & 4\end{pmatrix}$$$
We want to find the cofactor of the element $$a_{11}$$.
First we calculate the complementary minor:
$$$M_{11}=\left| \begin{matrix} -\rlap{/}1 & \rlap{/}0 & \rlap{/}2 \\ \rlap{/} 1 & 1 & -3 \\ \rlap{/}0 & 2 & 4\end{matrix}\right|= 1 \cdot 4 - 2 \cdot (-3)=10$$$
We check which sign corresponds: $$1+1=2$$, pair, and therefore the sign is positive. Then the cofactor of $$a_{11}$$ is $$C_{11}=10$$.
Now let's find the cofactor of the element $$a_{22}$$:
$$$M_{22}=\left|\begin{matrix} -1 & \rlap{/}0 & 2 \\ -\rlap{/}1 & \rlap{/}1 &-\rlap{/}3 \\ 0 & \rlap{/}2 & 4 \end{matrix}\right| \rightarrow \left|\begin{matrix} -1 & 2 \\ 0 & 4 \end{matrix}\right|=(-1) \cdot 4 -2 \cdot 0 = -4$$$
We verify the sign: $$2+2=4$$, pair, and therefore the sign does not change, so $$C_{22}=M_{22}$$.
And this way, we can successively find the cofactors of all the elements $$a_{ij}$$ of the matrix.
Adjoint matrix
If we replace every element of the matrix $$A$$ by its cofactor we obtain the adjoint matrix, which is written as $$Adj(A)$$.
Let's calculate it using the previous example, starting with the complementary minors:
$$$\begin{matrix} M_{11}=\left|\begin{matrix} 1 & -3 \\ 2 & 4 \end{matrix}\right|=10 & M_{12}=\left|\begin{matrix} 1 &-3 \\ 0 & 4 \end{matrix}\right|=4 & M_{13}=\left|\begin{matrix} 1 & 1 \\ 0 & 2 \end{matrix}\right|=3\\\\ M_{21}=\left|\begin{matrix} 0 & 2 \\ 2 & 4 \end{matrix}\right|=-4 & M_{22}=\left|\begin{matrix} -1 & 2 \\ 0 & 4 \end{matrix}\right|=-4 & M_{23}=\left|\begin{matrix} -1 & 0 \\ 0 & 2 \end{matrix}\right|=-2\\ \\ M_{31}=\left|\begin{matrix} 0 & 2 \\ 1 & -3 \end{matrix}\right|=-2 & M_{32}=\left|\begin{matrix} -1 & 2 \\ 0 & 4 \end{matrix}\right|=-4 & M_{33}=\left|\begin{matrix} -1 & 0 \\ 1 & 1 \end{matrix}\right|=-1 \end{matrix}$$$
Nine complementary minors have been found, but the signs of each one must be added depending on the sum $$i+j$$ being even or odd. Adding up, the signs will be as follows:
$$$\begin{pmatrix} + & - & + \\ - & + & - \\ + & - & +\end{pmatrix} $$$
and therefore the adjoint matrix will be:
$$$Adj\begin{pmatrix}-1 & 0 & 2 \\ 1 & 1 & -3 \\ 0 & 2 & 4 \end{pmatrix}= \begin{pmatrix} 10 & -4 & 3 \\ 4 & -4 & 2 \\ -2 & 4 & -1\end{pmatrix}$$$