# Number of steps in cofactor expansion vs row reduction.

I am reading this text and I'm wondering how they got 5 and 9 for cofactor expansion for matrices of order 3:

Like, say there's a matrix like this:

$$\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}$$

Cofactor expansion in the 2nd row would be:

$$4 * C_{21} + 5 * C_{22} + 6 * C_{23}$$

$C_{21}$ means the cofactor of row 2, column 1. $So far that's 3 multiplications and 2 additions. Each cofactor (2x2 matrix) is something like this: $$A_{22} * A_{11} - A_{21} * A_{12}$$ So that's 1 more addition (really subtraction, same thing) and 2 multiplications. Since there are 3 cofactors, that means an additional 3 additions and 6 multiplications. So a total of 9 multiplications and 5 additions. Is this right? I don't get anywhere near the same numbers for row reduction. Can someone show me this? ## 1 Answer They're using the fact that you don't need to perform the operations that are known to result in$0$. There's one multiplication (really division) to get the factor$4/1$, and then two multiplications and additions (really subtractions) to subtract that multiple of the first row from the second row, since the first entry becomes zero and thus doesn't need to be computed. The same again for subtracting a multiple of the first row from the third row. Then one more multiplication to find the multiple of the second row we need to subtract from the third row, and then one more multiplication and addition to perform that subtraction (where again the second entry becomes zero and thus doesn't need to be computed). That leaves an upper triangular matrix, and we need two more multiplications to compute its determinant. That makes a total of ten multiplications and five additions. Edit in response to the comment: Your example is somewhat inconvenient, since the determinant is zero; you'll have to distinguish between numbers that are zero by construction and numbers that just happen to be zero due to your choice of example. In the first step, calculate$\lambda=\frac41$using one multiplication, and then calculate $$\pmatrix{1&2&3\\0&5-\frac41\cdot2&6-\frac41\cdot3\\7&8&9}\;,$$ using two multiplications and additions (none for the$0$). In the second step, do the same for the third row, $$\pmatrix{1&2&3\\0&5-\frac41\cdot2&6-\frac41\cdot3\\0&8-\frac71\cdot2&9-\frac71\cdot3}\;,$$ which is $$\pmatrix{1&2&3\\0&-3&-6\\0&-6&-12}\;.$$ One multiplication to find the factor$\frac{-6}{-3}=2\$, and one more multiplication and addition to subtract the corresponding multiple of the second row from the first row:

$$\pmatrix{1&2&3\\0&-3&-6\\0&0&-12-2(-6)}\;,$$

which is

$$\pmatrix{1&2&3\\0&-3&-6\\0&0&0}\;.$$

Now two more multiplications to compute the determinant:

$$1\cdot(-3)\cdot0=0\;.$$

• Can you flesh this out using the matrices? I'm having a bit of trouble visualizing and I'll give you credit! – Jwan622 Sep 4 '18 at 21:56
• @Jwan622: I did -- though your example is badly chosen, since it generates accidental zeros that you'll need to distinguish from the systematic zeros. – joriki Sep 4 '18 at 22:12