## Definition of $$A(i\mid j)$$

Let $$A$$ be an $$n \times n$$ matrix. Let $$i, j \in \{1,\ldots,n \}$$. We define $$A(i \mid j)$$ to be the matrix obtained from $$A$$ by removing row $$i$$ and column $$j$$ from $$A$$.

### Example

Let $$A = \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix}$$. Then $$A(1 \mid 1) = \begin{bmatrix} 5 & 6\\ 8 & 9 \end{bmatrix},$$ $$A(2 \mid 2) = \begin{bmatrix} 1 & 3\\ 7 & 9 \end{bmatrix},$$ $$A(3 \mid 1) = \begin{bmatrix} 2 & 3\\ 5 & 6 \end{bmatrix}.$$

## Cofactor expansion

One way of computing the determinant of an $$n \times n$$ matrix $$A$$ is to use the following formula called the cofactor formula.

Pick any $$i \in \{1,\ldots, n\}$$. Then $\det(A) = (-1)^{i+1}A_{i,1}\det(A(i \mid 1)) + (-1)^{i+2}A_{i,2}\det(A(i \mid 2)) + \cdots + (-1)^{i+n}A_{i,n}\det(A(i \mid n)).$

We often say the right-hand side is the cofactor expansion of the determinant along row $$i$$. (This formula can be proved directly from the definition of the determinant.)

There is also a formula for expanding along column $$j$$: $\det(A) = (-1)^{1+j}A_{1,j}\det(A(1 \mid j)) + (-1)^{2+j}A_{2,j}\det(A(2 \mid j)) + \cdots + (-1)^{n+j}A_{n,j}\det(A(n \mid j)).$

Sometimes, out of convenience, one uses $$C_{i,j}$$ to denote $$(-1)^{i+j}\det(A(i \mid j))$$. We call $$C_{i,j}$$ a cofactor of $$A$$.

Hence, the cofactor expansion along row $$i$$ could be written as $$\displaystyle\det(A) = \sum_{j = 1}^n A_{i,j}C_{i,j},$$ and the cofactor expansion along column $$j$$ could be written as $$\displaystyle\det(A) = \sum_{i = 1}^n A_{i,j}C_{i,j}.$$

### Examples

1. Let $$A = \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{bmatrix}$$. We compute $$\det(A)$$ by expanding along row $$2$$. \begin{eqnarray} \det(A) & = & (-1)^{2+1}A_{2,1}\det(A(2 \mid 1)) + (-1)^{2+2}A_{2,2}\det(A(2 \mid 2)) + (-1)^{2+3}A_{2,3}\det(A(2 \mid 3)) \\ & = & -4\left|\begin{matrix} 2 & 3 \\ 8 & 9\end{matrix}\right| + 5\left|\begin{matrix} 1 & 3 \\ 7 & 9\end{matrix}\right| - 6\left|\begin{matrix} 1 & 2 \\ 7 & 8\end{matrix}\right| \\ & = & -4(2\cdot 9 - 3\cdot 8) + 5(1 \cdot 9- 3\cdot 7) - 6(1\cdot 8 - 2 \cdot 7) \\ & = & 24 - 60 + 36 \\ & = & 0 \end{eqnarray}

2. Cofactor expansion can be very handy when the matrix has many $$0$$'s. Let $$A = \begin{bmatrix} 1 & a \\ 0_{n-1} & B \end{bmatrix}$$ where $$a$$ is $$1 \times (n-1)$$, $$B$$ is $$(n-1)\times (n-1)$$, and $$0_{n-1}$$ is an $$(n-1)$$-tuple of $$0$$'s. Using the formula for expanding along column 1, we obtain just one term since $$A_{i,1} = 0$$ for all $$i \geq 2$$. Hence, $$\det(A) = (-1)^{1+1}A_{1,1}\det(A(1 \mid 1)) = 1 \det(B) = \det(B).$$

## Exercises

1. Derive the cofactor expansion formulas for computing the determinant of a $$3 \times 3$$ matrix directly from the definition of the determinant.

2. Compute the determinant of $$\begin{bmatrix} 1 & 0 & 2\\ 3 & 4 & 5\\ 2 & -1 & -4\end{bmatrix}$$ by expanding along the second column.

3. Prove the cofactor formula for expanding along row $$i$$.