# On the cofactor expansion of the determinant

I'm going over the course "Calculus with Applications", and I'm struggling with one of the arguments here: The author writes

The only question left, then, is: why the sign factor?

You can interchange two rows or columns of a matrix which have the same parity (which means that both have even indices or both odd indices) with an even number of single row or column interchanges, while you need an odd number of interchanges when they have opposite parity, Each interchange requires a sign change, so there must be a sign change if the parity of the row and column indices are different, to make the computation for different indices consistent.

My understanding is that this section is supposed to justify the factors $$(-1)^{i+j}$$ in the expansion, however I can't make sense of it. As far as I know changing any two rows/columns always results in flipping the sign, regardless of the parity of them. Could anyone please help me understand this?

Thanks!

I'm not sure if the phrasing of the argument is wrong or just hard to understand, but the parity of a row index comes up not when you want to switch it with another row, but when you want to move it to the top while keeping the order of the other rows the same. To move the $i^{\text{th}}$ row to the top requires $i-1$ row swaps, and to move the $j^{\text{th}}$ column to the left requires $j-1$ column swaps.
Here is a $3 \times 3$ example of cofactor expansion. By linearity of the determinant, we have $$\begin{vmatrix}m_{11} & m_{12} & m_{13} \\ m_{21} & m_{22} & m_{23} \\ m_{31} & m_{32} & m_{33} \end{vmatrix} = m_{21} \begin{vmatrix}m_{11} & m_{12} & m_{13} \\ 1 & 0 & 0 \\ m_{31} & m_{32} & m_{33} \end{vmatrix} + m_{22} \begin{vmatrix}m_{11} & m_{12} & m_{13} \\ 0 & 1 & 0 \\ m_{31} & m_{32} & m_{33} \end{vmatrix} + m_{23} \begin{vmatrix}m_{11} & m_{12} & m_{13} \\ 0 & 0 & 1 \\ m_{31} & m_{32} & m_{33} \end{vmatrix}.$$ For the first of these simpler $3 \times 3$ determinants, we have $$\begin{vmatrix}m_{11} & m_{12} & m_{13} \\ 1 & 0 & 0 \\ m_{31} & m_{32} & m_{33} \end{vmatrix} = (-1) \begin{vmatrix}1 & 0 & 0 \\ m_{11} & m_{12} & m_{13} \\ m_{31} & m_{32} & m_{33} \end{vmatrix} = (-1) \begin{vmatrix}1 & 0 & 0 \\ 0 & m_{12} & m_{13} \\ 0 & m_{32} & m_{33} \end{vmatrix} = (-1) \begin{vmatrix}m_{12} & m_{13} \\ m_{32} & m_{33} \end{vmatrix}$$ where the last step you can justify by Gaussian elimination or by the sum-over-permutations definition of the determinant.
For the second of these $3 \times 3$ determinants, we have
$$\begin{vmatrix}m_{11} & m_{12} & m_{13} \\ 0 & 1 & 0 \\ m_{31} & m_{32} & m_{33} \end{vmatrix} = (-1) \begin{vmatrix}0 & 1 & 0 \\ m_{11} & m_{12} & m_{13} \\ m_{31} & m_{32} & m_{33} \end{vmatrix} = (-1)^2 \begin{vmatrix}1 & 0 & 0 \\ m_{12} & m_{11} & m_{13} \\ m_{32} & m_{31} & m_{33} \end{vmatrix} \\ = (-1)^2 \begin{vmatrix}1 & 0 & 0 \\ 0 & m_{11} & m_{13} \\ 0 & m_{31} & m_{33} \end{vmatrix} = (-1)^2 \begin{vmatrix} m_{11} & m_{13} \\ m_{31} & m_{33} \end{vmatrix}$$ and for the third, we have $$\begin{vmatrix}m_{11} & m_{12} & m_{13} \\ 0 & 0 & 1 \\ m_{31} & m_{32} & m_{33} \end{vmatrix} = (-1) \begin{vmatrix} 0 & 0 & 1 \\ m_{11} & m_{12} & m_{13} \\m_{31} & m_{32} & m_{33} \end{vmatrix} = (-1)^2 \begin{vmatrix} 0 & 1 & 0 \\ m_{11} & m_{13} & m_{12} \\m_{31} & m_{33} & m_{32} \end{vmatrix} \\ = (-1)^3 \begin{vmatrix} 1 & 0 & 0 \\ m_{13} & m_{11} & m_{12} \\m_{33} & m_{31} & m_{32} \end{vmatrix} = (-1)^3 \begin{vmatrix} 1 & 0 & 0 \\ 0 & m_{11} & m_{12} \\0 & m_{31} & m_{32} \end{vmatrix} = (-1)^3 \begin{vmatrix} m_{11} & m_{12} \\m_{31} & m_{32} \end{vmatrix}.$$ Altogether it takes $(i-1)+(j-1) = i+j-2$ row and column swaps to move the $1$ to the top left entry, for a sign of $(-1)^{i+j-2} = (-1)^{i+j}$.