Practice / Linear algebra

Gaussian elimination, inverses and determinants by hand

Ten problems on solving linear systems by row reduction: a 2×2 and a 3×3 system on the augmented matrix, a zero pivot that needs a row swap, a free variable and an inconsistent row, the 2×2 inverse formula, a 3×3 inverse by Gauss–Jordan on [A | I], a determinant by row reduction, the rules for det(cA), det(AB) and det(A⁻¹), an LU factorization with forward and back substitution, and a singular matrix whose null space is a redundant feature, with worked solutions and the mistakes of updating only the left side, dropping 1/det and forgetting the sign of a swap.

Before you start

Almost every computation with matrices that is done by hand, and most of the ones a linear algebra library does for you, is Gaussian elimination underneath: solving Ax=bAx = b, inverting AA, computing det⁡A\det A, finding a rank or a null space. The method is three row operations used to clear the entries below each pivot, followed by back substitution. It goes wrong in a few predictable places: an operation applied to the coefficients but not to the right-hand side, a zero pivot divided by instead of swapped away, a row of zeros misread, the 1det⁡\tfrac{1}{\det} dropped from the 2×22\times2 inverse, and a row swap that silently flips the sign of a determinant. These ten problems cover each of them, and end with the singular matrix you meet in machine learning when one feature is the sum of two others.

  • The augmented matrix. The system Ax=bAx = b is written [A∣b][A \mid b]: the coefficients of each equation in a row, with its right-hand side after the bar. A row operation changes the whole row, right-hand side included.
  • Row operations. (1) Add a multiple of one row to another, written R2→R2−3R1R_2 \to R_2 - 3R_1. (2) Swap two rows, R1↔R2R_1 \leftrightarrow R_2. (3) Multiply a row by a nonzero number. None of them changes the solutions of the system.
  • Pivots and echelon form. Working left to right, the first nonzero entry of each row is its pivot; elimination uses each pivot to clear the entries below it. A zero where a pivot should be is fixed by swapping with a lower row. In echelon form each pivot is to the right of the one above, and any rows of zeros are at the bottom.
  • Reading the result. A pivot in every column of AA: one solution, found by back substitution from the last row up. A column without a pivot: its variable is free, and there are infinitely many solutions. A row [0  ⋯  0∣c][0 \;\cdots\; 0 \mid c] with c≠0c \ne 0 says 0=c0 = c: no solution. A row of all zeros, 0=00 = 0, says nothing.
  • Inverses. A−1A^{-1} satisfies AA−1=A−1A=IAA^{-1} = A^{-1}A = I, and exists exactly when det⁡A≠0\det A \ne 0. For 2×22\times2: [abcd]−1=1ad−bc[d−b−ca]\begin{bmatrix}a&b\\c&d\end{bmatrix}^{-1} = \dfrac{1}{ad - bc}\begin{bmatrix}d&-b\\-c&a\end{bmatrix}. In general, row reduce [A∣I][A \mid I] until the left half is II; the right half is then A−1A^{-1}.
  • Determinants. For 2×22\times2, ad−bcad - bc. Adding a multiple of one row to another leaves det⁡\det unchanged, a swap multiplies it by −1-1, and scaling a row by cc multiplies it by cc. The determinant of a triangular matrix is the product of its diagonal entries. For n×nn\times n matrices, det⁡(AB)=det⁡A det⁡B\det(AB) = \det A\,\det B, det⁡(A⊤)=det⁡A\det(A^\top) = \det A and det⁡(cA)=cndet⁡A\det(cA) = c^n\det A.
  • LU. A=LUA = LU, with UU the echelon form from elimination without swaps and LL lower triangular with 11s on its diagonal and the multipliers ℓij\ell_{ij} below it, where Ri→Ri−ℓijRjR_i \to R_i - \ell_{ij}R_j was the operation used.

Problems

  1. ·

    Solve x+2y=5x + 2y = 5, 3x+4y=63x + 4y = 6 by row reducing the augmented matrix.

  2. ·

    Solve the system x+y+z=6x + y + z = 6, 2x+y−z=12x + y - z = 1, x−2y+3z=6x - 2y + 3z = 6.

  3. ··

    Solve 2y+z=12y + z = 1, x+y+z=4x + y + z = 4, 2x+3y+2z=72x + 3y + 2z = 7.

  4. ··

    Solve x+2y+z=4x + 2y + z = 4, 2x+4y+3z=112x + 4y + 3z = 11, x+2y+2z=7x + 2y + 2z = 7. Then say what happens if the last right-hand side is 88 instead of 77.

  5. ·

    Find the inverse of A=[4726]A = \begin{bmatrix}4&7\\2&6\end{bmatrix} and use it to solve Ax=(1,2)⊤Ax = (1, 2)^\top.

  6. ··

    Find the inverse of A=[123014560]A = \begin{bmatrix}1&2&3\\0&1&4\\5&6&0\end{bmatrix} by row reducing [A∣I][A \mid I].

  7. ··

    Compute det⁡A\det A for A=[0121034−38]A = \begin{bmatrix}0&1&2\\1&0&3\\4&-3&8\end{bmatrix} by row reduction, and check it by cofactor expansion.

  8. ··

    AA and BB are 3×33\times3 matrices with det⁡A=3\det A = 3 and det⁡B=−2\det B = -2. Find det⁡(2A)\det(2A), det⁡(−A)\det(-A), det⁡(A−1)\det(A^{-1}), det⁡(A⊤A)\det(A^\top A) and det⁡(A2B)\det(A^2B). Can det⁡(A+B)\det(A + B) be found from this information?

  9. ···

    Factor A=[211433879]A = \begin{bmatrix}2&1&1\\4&3&3\\8&7&9\end{bmatrix} as A=LUA = LU, use it to solve Ax=(4,10,24)⊤Ax = (4, 10, 24)^\top, and read off det⁡A\det A.

  10. ···

    A design matrix has rows (1,1,2)(1, 1, 2), (1,2,k)(1, 2, k) and (1,3,4)(1, 3, 4), one row per example and one column per feature. For which kk is it singular? For that kk, find its null space, solve Ax=(2,3,4)⊤Ax = (2, 3, 4)^\top, and show that Ax=(1,0,0)⊤Ax = (1, 0, 0)^\top has no solution.

Worked solutions

Problem 1

Solve x+2y=5x + 2y = 5, 3x+4y=63x + 4y = 6 by row reducing the augmented matrix.

  1. [125346]\left[\begin{array}{cc|c}1&2&5\\3&4&6\end{array}\right]Each equation is a row; the right-hand sides go after the bar.
  2. R2→R2−3R1R_2 \to R_2 - 3R_1: [1250−2−9]\left[\begin{array}{cc|c}1&2&5\\0&-2&-9\end{array}\right]The multiplier is 3=313 = \tfrac31, the entry to clear over the pivot. The right side changes too: 6−3⋅5=−96 - 3\cdot5 = -9.
  3. −2y=−9-2y = -9, so y=92y = \tfrac92The last row is one equation in one unknown.
  4. x+2⋅92=5x + 2\cdot\tfrac92 = 5, so x=−4x = -4Back substitution into the first row.
  5. x=−4x = -4, y=92y = \tfrac92Check in the second equation: 3(−4)+4⋅92=−12+18=63(-4) + 4\cdot\tfrac92 = -12 + 18 = 6.

Problem 2

Solve the system x+y+z=6x + y + z = 6, 2x+y−z=12x + y - z = 1, x−2y+3z=6x - 2y + 3z = 6.

  1. [111621−111−236]\left[\begin{array}{ccc|c}1&1&1&6\\2&1&-1&1\\1&-2&3&6\end{array}\right]The augmented matrix.
  2. R2→R2−2R1R_2 \to R_2 - 2R_1, R3→R3−R1R_3 \to R_3 - R_1: [11160−1−3−110−320]\left[\begin{array}{ccc|c}1&1&1&6\\0&-1&-3&-11\\0&-3&2&0\end{array}\right]Clear the first column below the pivot 11.
  3. R3→R3−3R2R_3 \to R_3 - 3R_2: [11160−1−3−11001133]\left[\begin{array}{ccc|c}1&1&1&6\\0&-1&-3&-11\\0&0&11&33\end{array}\right]The second pivot is −1-1, and the multiplier is −3−1=3\tfrac{-3}{-1} = 3. Check the new row: 2−3(−3)=112 - 3(-3) = 11 and 0−3(−11)=330 - 3(-11) = 33.
  4. 11z=3311z = 33, so z=3z = 3; −y−9=−11-y - 9 = -11, so y=2y = 2; x+2+3=6x + 2 + 3 = 6, so x=1x = 1Back substitution from the bottom row up.
  5. (x,y,z)=(1,2,3)(x, y, z) = (1, 2, 3)Check all three: 1+2+3=61 + 2 + 3 = 6, 2+2−3=12 + 2 - 3 = 1 and 1−4+9=61 - 4 + 9 = 6.

Problem 3

Solve 2y+z=12y + z = 1, x+y+z=4x + y + z = 4, 2x+3y+2z=72x + 3y + 2z = 7.

  1. [021111142327]\left[\begin{array}{ccc|c}0&2&1&1\\1&1&1&4\\2&3&2&7\end{array}\right]The first equation has no xx, so the top-left entry is 00 and cannot be a pivot.
  2. R1↔R2R_1 \leftrightarrow R_2: [111402112327]\left[\begin{array}{ccc|c}1&1&1&4\\0&2&1&1\\2&3&2&7\end{array}\right]Swap in a row with a nonzero first entry. Swapping equations does not change the solutions.
  3. R3→R3−2R1R_3 \to R_3 - 2R_1: [11140211010−1]\left[\begin{array}{ccc|c}1&1&1&4\\0&2&1&1\\0&1&0&-1\end{array}\right]Clear the first column.
  4. R2↔R3R_2 \leftrightarrow R_3, then R3→R3−2R2R_3 \to R_3 - 2R_2: [1114010−10013]\left[\begin{array}{ccc|c}1&1&1&4\\0&1&0&-1\\0&0&1&3\end{array}\right]The swap is optional, but it makes the pivot 11 and avoids fractions; R3→R3−12R2R_3 \to R_3 - \tfrac12R_2 without it gives the same answer.
  5. (x,y,z)=(2,−1,3)(x, y, z) = (2, -1, 3)z=3z = 3, y=−1y = -1, and x=4−(−1)−3=2x = 4 - (-1) - 3 = 2. Check: 2(−1)+3=12(-1) + 3 = 1, 2−1+3=42 - 1 + 3 = 4 and 4−3+6=74 - 3 + 6 = 7.

Problem 4

Solve x+2y+z=4x + 2y + z = 4, 2x+4y+3z=112x + 4y + 3z = 11, x+2y+2z=7x + 2y + 2z = 7. Then say what happens if the last right-hand side is 88 instead of 77.

  1. R2→R2−2R1R_2 \to R_2 - 2R_1, R3→R3−R1R_3 \to R_3 - R_1: [121400130013]\left[\begin{array}{ccc|c}1&2&1&4\\0&0&1&3\\0&0&1&3\end{array}\right]Clearing the first column also clears the second: the yy coefficients are twice the xx coefficients in every row.
  2. R3→R3−R2R_3 \to R_3 - R_2: [121400130000]\left[\begin{array}{ccc|c}1&2&1&4\\0&0&1&3\\0&0&0&0\end{array}\right]The last row says 0=00 = 0, which is always true and adds no information.
  3. The pivots are in the xx and zz columns, so yy is free: y=ty = tNo pivot in the yy column means nothing pins yy down.
  4. z=3z = 3 and x=4−2t−3=1−2tx = 4 - 2t - 3 = 1 - 2tBack substitution with y=ty = t.
  5. With 88: the same steps give the last row [0  0  0∣1][0\;0\;0 \mid 1]R3−R1R_3 - R_1 now ends in 8−4=48 - 4 = 4, and R3−R2R_3 - R_2 in 4−3=14 - 3 = 1.
  6. (x,y,z)=(1−2t, t, 3)(x, y, z) = (1 - 2t,\ t,\ 3) for every tt; with 88 the last row reads 0=10 = 1 and there is no solutionCheck t=1t = 1: (−1,1,3)(-1, 1, 3) gives −1+2+3=4-1 + 2 + 3 = 4, −2+4+9=11-2 + 4 + 9 = 11 and −1+2+6=7-1 + 2 + 6 = 7.

Problem 5

Find the inverse of A=[4726]A = \begin{bmatrix}4&7\\2&6\end{bmatrix} and use it to solve Ax=(1,2)⊤Ax = (1, 2)^\top.

  1. det⁡A=4⋅6−7⋅2=10\det A = 4\cdot6 - 7\cdot2 = 10Not zero, so AA is invertible.
  2. A−1=110[6−7−24]A^{-1} = \dfrac{1}{10}\begin{bmatrix}6&-7\\-2&4\end{bmatrix}Swap the diagonal entries, negate the off-diagonal ones, divide by the determinant.
  3. AA−1=110[24−14−28+2812−12−14+24]=IAA^{-1} = \dfrac1{10}\begin{bmatrix}24 - 14&-28 + 28\\12 - 12&-14 + 24\end{bmatrix} = ICheck before using it.
  4. x=A−1b=110[6−14−2+8]=110[−86]x = A^{-1}b = \dfrac1{10}\begin{bmatrix}6 - 14\\-2 + 8\end{bmatrix} = \dfrac1{10}\begin{bmatrix}-8\\6\end{bmatrix}Multiply both sides of Ax=bAx = b on the left by A−1A^{-1}.
  5. A−1=110[6−7−24]A^{-1} = \dfrac{1}{10}\begin{bmatrix}6&-7\\-2&4\end{bmatrix}, x=(−0.8,0.6)⊤x = (-0.8, 0.6)^\topCheck: 4(−0.8)+7(0.6)=14(-0.8) + 7(0.6) = 1 and 2(−0.8)+6(0.6)=22(-0.8) + 6(0.6) = 2.

Problem 6

Find the inverse of A=[123014560]A = \begin{bmatrix}1&2&3\\0&1&4\\5&6&0\end{bmatrix} by row reducing [A∣I][A \mid I].

  1. R3→R3−5R1R_3 \to R_3 - 5R_1: [1231000140100−4−15−501]\left[\begin{array}{ccc|ccc}1&2&3&1&0&0\\0&1&4&0&1&0\\0&-4&-15&-5&0&1\end{array}\right]Every operation acts on all six columns.
  2. R3→R3+4R2R_3 \to R_3 + 4R_2: third row [0  0  1∣−5    4    1][0\;0\;1 \mid -5\;\;4\;\;1]−15+16=1-15 + 16 = 1, so the third pivot is already 11.
  3. R2→R2−4R3R_2 \to R_2 - 4R_3 and R1→R1−3R3R_1 \to R_1 - 3R_3: rows [0  1  0∣20    −15    −4][0\;1\;0 \mid 20\;\;{-15}\;\;{-4}] and [1  2  0∣16    −12    −3][1\;2\;0 \mid 16\;\;{-12}\;\;{-3}]Now clear above the pivots, starting from the last column: 0−4(−5)=200 - 4(-5) = 20, 1−16=−151 - 16 = -15, 1+15=161 + 15 = 16.
  4. R1→R1−2R2R_1 \to R_1 - 2R_2: first row [1  0  0∣−24    18    5][1\;0\;0 \mid -24\;\;18\;\;5]16−40=−2416 - 40 = -24, −12+30=18-12 + 30 = 18, −3+8=5-3 + 8 = 5.
  5. A−1=[−2418520−15−4−541]A^{-1} = \begin{bmatrix}-24&18&5\\20&-15&-4\\-5&4&1\end{bmatrix}Check one entry of AA−1AA^{-1} per row: (1,2,3)⋅(−24,20,−5)=−24+40−15=1(1, 2, 3)\cdot(-24, 20, -5) = -24 + 40 - 15 = 1, (0,1,4)⋅(18,−15,4)=1(0, 1, 4)\cdot(18, -15, 4) = 1, (5,6,0)⋅(5,−4,1)=1(5, 6, 0)\cdot(5, -4, 1) = 1. No row was scaled and no rows were swapped, so det⁡A\det A is the product of the pivots, 11, which is why the inverse has integer entries.

Problem 7

Compute det⁡A\det A for A=[0121034−38]A = \begin{bmatrix}0&1&2\\1&0&3\\4&-3&8\end{bmatrix} by row reduction, and check it by cofactor expansion.

  1. R1↔R2R_1 \leftrightarrow R_2: [1030124−38]\begin{bmatrix}1&0&3\\0&1&2\\4&-3&8\end{bmatrix}, and the determinant changes signThe top-left entry is 00, so swap first. Keep a running factor of −1-1.
  2. R3→R3−4R1R_3 \to R_3 - 4R_1: third row (0,−3,−4)(0, -3, -4)Adding a multiple of a row does not change the determinant.
  3. R3→R3+3R2R_3 \to R_3 + 3R_2: third row (0,0,2)(0, 0, 2)−4+6=2-4 + 6 = 2; again no change.
  4. det⁡A=−1⋅(1⋅1⋅2)=−2\det A = -1\cdot(1\cdot1\cdot2) = -2The echelon form is triangular, so its determinant is the product of its diagonal; the one swap contributes the −1-1.
  5. det⁡A=−2\det A = -2Cofactor expansion along the first row: 0−1 (1⋅8−3⋅4)+2 (1⋅(−3)−0⋅4)=4−6=−20 - 1\,(1\cdot8 - 3\cdot4) + 2\,(1\cdot(-3) - 0\cdot4) = 4 - 6 = -2.

Problem 8

AA and BB are 3×33\times3 matrices with det⁡A=3\det A = 3 and det⁡B=−2\det B = -2. Find det⁡(2A)\det(2A), det⁡(−A)\det(-A), det⁡(A−1)\det(A^{-1}), det⁡(A⊤A)\det(A^\top A) and det⁡(A2B)\det(A^2B). Can det⁡(A+B)\det(A + B) be found from this information?

  1. det⁡(2A)=23det⁡A=24\det(2A) = 2^3\det A = 242A2A doubles every one of the three rows, and each doubled row doubles the determinant.
  2. det⁡(−A)=(−1)3det⁡A=−3\det(-A) = (-1)^3\det A = -3The same rule with c=−1c = -1; for an even size the sign would not change.
  3. det⁡(A−1)=1det⁡A=13\det(A^{-1}) = \dfrac{1}{\det A} = \dfrac13det⁡A det⁡(A−1)=det⁡(AA−1)=det⁡I=1\det A\,\det(A^{-1}) = \det(AA^{-1}) = \det I = 1.
  4. det⁡(A⊤A)=det⁡A⊤det⁡A=9\det(A^\top A) = \det A^\top\det A = 9 and det⁡(A2B)=3⋅3⋅(−2)=−18\det(A^2B) = 3\cdot3\cdot(-2) = -18The product rule, with det⁡A⊤=det⁡A\det A^\top = \det A.
  5. 2424, −3-3, 13\tfrac13, 99, −18-18; det⁡(A+B)\det(A + B) cannot be foundThe determinant is not additive. With A=diag⁡(3,1,1)A = \operatorname{diag}(3, 1, 1) and B=diag⁡(−2,1,1)B = \operatorname{diag}(-2, 1, 1), det⁡(A+B)=1⋅2⋅2=4\det(A + B) = 1\cdot2\cdot2 = 4; with B=diag⁡(1,−2,1)B = \operatorname{diag}(1, -2, 1) instead, det⁡(A+B)=4⋅(−1)⋅2=−8\det(A + B) = 4\cdot(-1)\cdot2 = -8. Same determinants, different answers.

Problem 9

Factor A=[211433879]A = \begin{bmatrix}2&1&1\\4&3&3\\8&7&9\end{bmatrix} as A=LUA = LU, use it to solve Ax=(4,10,24)⊤Ax = (4, 10, 24)^\top, and read off det⁡A\det A.

  1. R2→R2−2R1R_2 \to R_2 - 2R_1, R3→R3−4R1R_3 \to R_3 - 4R_1: rows (0,1,1)(0, 1, 1) and (0,3,5)(0, 3, 5)Multipliers ℓ21=2\ell_{21} = 2 and ℓ31=4\ell_{31} = 4.
  2. R3→R3−3R2R_3 \to R_3 - 3R_2: row (0,0,2)(0, 0, 2), so U=[211011002]U = \begin{bmatrix}2&1&1\\0&1&1\\0&0&2\end{bmatrix}Multiplier ℓ32=3\ell_{32} = 3.
  3. L=[100210431]L = \begin{bmatrix}1&0&0\\2&1&0\\4&3&1\end{bmatrix}The multipliers go below the diagonal, in the positions they cleared, with their signs as used in Ri→Ri−ℓRjR_i \to R_i - \ell R_j.
  4. Lc=bLc = b: c1=4c_1 = 4, c2=10−2⋅4=2c_2 = 10 - 2\cdot4 = 2, c3=24−4⋅4−3⋅2=2c_3 = 24 - 4\cdot4 - 3\cdot2 = 2Forward substitution, top row first. This repeats on bb what elimination did to AA.
  5. Ux=cUx = c: 2x3=22x_3 = 2, x2+x3=2x_2 + x_3 = 2, 2x1+x2+x3=42x_1 + x_2 + x_3 = 4Back substitution: x3=1x_3 = 1, x2=1x_2 = 1, x1=1x_1 = 1.
  6. L=[100210431]L = \begin{bmatrix}1&0&0\\2&1&0\\4&3&1\end{bmatrix}, U=[211011002]U = \begin{bmatrix}2&1&1\\0&1&1\\0&0&2\end{bmatrix}, x=(1,1,1)⊤x = (1, 1, 1)^\top, det⁡A=2⋅1⋅2=4\det A = 2\cdot1\cdot2 = 4det⁡A=det⁡Ldet⁡U\det A = \det L\det U and det⁡L=1\det L = 1. Once LL and UU are known, each new right-hand side costs only the two triangular solves, which is why libraries factor once and reuse it.

Problem 10

A design matrix has rows (1,1,2)(1, 1, 2), (1,2,k)(1, 2, k) and (1,3,4)(1, 3, 4), one row per example and one column per feature. For which kk is it singular? For that kk, find its null space, solve Ax=(2,3,4)⊤Ax = (2, 3, 4)^\top, and show that Ax=(1,0,0)⊤Ax = (1, 0, 0)^\top has no solution.

  1. det⁡A=1 (8−3k)−1 (4−k)+2 (3−2)=6−2k\det A = 1\,(8 - 3k) - 1\,(4 - k) + 2\,(3 - 2) = 6 - 2kCofactor expansion along the first row of A=[11212k134]A = \begin{bmatrix}1&1&2\\1&2&k\\1&3&4\end{bmatrix}.
  2. det⁡A=0\det A = 0 exactly when k=3k = 3Then the third column is (2,3,4)⊤=(1,1,1)⊤+(1,2,3)⊤(2, 3, 4)^\top = (1, 1, 1)^\top + (1, 2, 3)^\top: the third feature is the sum of the first two.
  3. Row reduce with k=3k = 3: [112011000]\begin{bmatrix}1&1&2\\0&1&1\\0&0&0\end{bmatrix}, so x3=tx_3 = t, x2=−tx_2 = -t, x1=−tx_1 = -t; null space spanned by (1,1,−1)⊤(1, 1, -1)^\topR2−R1R_2 - R_1 and R3−R1R_3 - R_1 give (0,1,1)(0, 1, 1) and (0,2,2)(0, 2, 2), and R3−2R2R_3 - 2R_2 gives zeros. Check: A(1,1,−1)⊤=(0,0,0)⊤A(1, 1, -1)^\top = (0, 0, 0)^\top.
  4. (2,3,4)⊤(2, 3, 4)^\top is the third column, so x=(0,0,1)⊤x = (0, 0, 1)^\top works, and every solution is (0,0,1)⊤+t(1,1,−1)⊤(0, 0, 1)^\top + t(1, 1, -1)^\topOne solution plus anything in the null space.
  5. For (1,0,0)⊤(1, 0, 0)^\top the same operations end in the row [0  0  0∣1][0\;0\;0 \mid 1]The right side becomes (1,−1,−1)(1, -1, -1) after R2−R1R_2 - R_1 and R3−R1R_3 - R_1, and R3−2R2R_3 - 2R_2 turns its last entry into −1−2(−1)=1-1 - 2(-1) = 1. That row says 0=10 = 1.
  6. Singular for k=3k = 3; null space t(1,1,−1)⊤t(1, 1, -1)^\top; x=(t,t,1−t)⊤x = (t, t, 1 - t)^\top for (2,3,4)⊤(2, 3, 4)^\top; no solution for (1,0,0)⊤(1, 0, 0)^\topIn regression terms: weights ww and w+t(1,1,−1)⊤w + t(1, 1, -1)^\top give identical predictions, so X⊤XX^\top X is singular and the least-squares weights are not unique until a feature is dropped or a penalty such as ridge is added.

Where this goes wrong

1. Row operation applied to the coefficients only

The coefficients sit in a neat block, and the column after the bar is easy to leave behind.

  1. [125346]\left[\begin{array}{cc|c}1&2&5\\3&4&6\end{array}\right]Right so far: Problem 1.
  2. “R2→R2−3R1R_2 \to R_2 - 3R_1 turns (3,4)(3, 4) into (0,−2)(0, -2).”The habit that causes the mistake: the operation is done on the coefficients and stops at the bar.
  3. [1250−26]\left[\begin{array}{cc|c}1&2&5\\0&-2&6\end{array}\right], so y=−3y = -3 and x=11x = 11The right side must become 6−3⋅5=−96 - 3\cdot5 = -9. The check exposes it: 3⋅11+4(−3)=213\cdot11 + 4(-3) = 21, not 66. The solution is x=−4x = -4, y=92y = \tfrac92.

2. Dropping the 1/det from the 2×2 inverse

The swap-and-negate pattern is the memorable part of the formula, and the scalar in front is not.

  1. A=[4726]A = \begin{bmatrix}4&7\\2&6\end{bmatrix}, with [6−7−24]\begin{bmatrix}6&-7\\-2&4\end{bmatrix} from swapping and negatingRight so far: Problem 5.
  2. “So A−1=[6−7−24]A^{-1} = \begin{bmatrix}6&-7\\-2&4\end{bmatrix}.”The step that causes the mistake: the division by det⁡A=10\det A = 10 is skipped.
  3. x=[6−7−24](1,2)⊤=(−8,6)⊤x = \begin{bmatrix}6&-7\\-2&4\end{bmatrix}(1, 2)^\top = (-8, 6)^\topThen Ax=(−32+42, −16+36)⊤=(10,20)⊤Ax = (-32 + 42,\ -16 + 36)^\top = (10, 20)^\top, ten times bb: the matrix used is 10A−110A^{-1}, and AA times it is 10I10I, not II. Divide by det⁡A\det A: x=(−0.8,0.6)⊤x = (-0.8, 0.6)^\top.

3. A row of zeros read as no solution

A row with nothing left in it looks like a system that has broken down.

  1. [121400130000]\left[\begin{array}{ccc|c}1&2&1&4\\0&0&1&3\\0&0&0&0\end{array}\right]Right so far: Problem 4.
  2. “The last row has no variables left.”True, and harmless: it says 0=00 = 0.
  3. “So the system has no solution.”No solution needs a row [0  0  0∣c][0\;0\;0 \mid c] with c≠0c \ne 0. A row of zeros on both sides of the bar only says one equation was a combination of the others: here the third equation is the second minus the first. The yy column has no pivot, so there are infinitely many solutions, (1−2t,t,3)(1 - 2t, t, 3), such as (1,0,3)(1, 0, 3) and (−1,1,3)(-1, 1, 3).

4. A row swap that keeps the determinant's sign

Row operations are thought of as harmless to the determinant, and for the most common one they are.

  1. A=[0121034−38]A = \begin{bmatrix}0&1&2\\1&0&3\\4&-3&8\end{bmatrix}, swap R1↔R2R_1 \leftrightarrow R_2 to get a nonzero pivotRight so far: Problem 7.
  2. Eliminate to [103012002]\begin{bmatrix}1&0&3\\0&1&2\\0&0&2\end{bmatrix}Also right: the two row additions do not change the determinant.
  3. det⁡A=1⋅1⋅2=2\det A = 1\cdot1\cdot2 = 2A swap multiplies the determinant by −1-1, so det⁡A=−2\det A = -2, as cofactor expansion confirms. Two swaps would cancel; an odd number leaves a minus sign.

5. det(2A) taken as 2 det A

Scalars come out of most things linearly, so the 22 is pulled out once.

  1. det⁡A=3\det A = 3 for a 3×33\times3 matrix AARight so far: Problem 8.
  2. “2A2A is AA times 22.”True; the question is what that does to the determinant.
  3. det⁡(2A)=2⋅3=6\det(2A) = 2\cdot3 = 62A2A multiplies each of the three rows by 22, and the determinant is linear in each row separately, so the factor comes out three times: det⁡(2A)=23⋅3=24\det(2A) = 2^3\cdot3 = 24. A quick test: det⁡(2I)=8\det(2I) = 8 for the 3×33\times3 identity, not 22.

Print this set: gaussian-elimination-inverses-and-determinants.pdf (problems, answers, and worked solutions on separate pages).

Read the guide: Gaussian elimination and matrix inverses: whole-row operations, and [A | I] to [I | A⁻¹]