Cramer's rule: solving with determinants
Take a system of equations and read off its coefficient matrix. Cramer's rule says each unknown is a ratio of two determinants: the denominator is the determinant D of the coefficient matrix; the numerator replaces that variable's column with the constants from the right-hand side.
System: 2x + 3y = 8
1x - 1y = -1
D = det[ 2 3 ; 1 -1 ] = 2*(-1) - 3*1 = -5
Dx = det[ 8 3 ; -1 -1 ] = 8*(-1) - 3*(-1) = -5 (x-column -> constants)
Dy = det[ 2 8 ; 1 -1 ] = 2*(-1) - 8*1 = -10 (y-column -> constants)
x = Dx / D = -5 / -5 = 1
y = Dy / D = -10 / -5 = 2
Check: 2(1)+3(2)=8 and 1-2=-1. Both hold.The augmented matrix and row operations
The second method packs the whole system into an augmented matrix: the coefficients on the left, a bar, and the constants on the right. Then we clean it up using three elementary row operations, each of which keeps the solution unchanged.
- Swap two rows (reorder the equations).
- Multiply a row by a non-zero number (scale an equation).
- Add a multiple of one row to another (combine equations to cancel a variable).
Reaching reduced row echelon form
The goal of Gaussian elimination is to massage the left block into the identity matrix — a state called reduced row echelon form. Once the left side is the identity, the right column simply reads off the answers.
Same system, as an augmented matrix: [ 2 3 | 8 ] [ 1 -1 | -1 ] R1 <-> R2 (get a leading 1 on top): [ 1 -1 | -1 ] [ 2 3 | 8 ] R2 -> R2 - 2*R1 (clear below the leading 1): [ 1 -1 | -1 ] [ 0 5 | 10 ] R2 -> R2 / 5: [ 1 -1 | -1 ] [ 0 1 | 2 ] R1 -> R1 + R2 (clear above): [ 1 0 | 1 ] [ 0 1 | 2 ] Left block is the identity -> read off: x = 1, y = 2.