Gaussian Elimination — Solving Linear Syst
m equations in n unknowns \( (m \times n) \)
\[ \begin{cases} a_{11} x_1 + a_{12} x_2 + \cdots + a_{1n} x_n = b_1 & (1) \\[2mm] a_{21} x_1 + a_{22} x_2 + \cdots + a_{2n} x_n = b_2 & (2) \\[2mm] a_{32} x_1 + a_{32} x_2 + \cdots + a_{3n} x_1 = b_3 & (3) \\[4mm] a_{i1} x_1 + \cdots + a_{ij} x_j + \cdots + a_{in} x_n = b_i & (i) \\[2mm] \vdots \qquad\quad \vdots \qquad\quad \vdots & \\[2mm] a_{m1} x_1 + a_{m2} x_2 + \cdots + a_{mn} x_n = b_m & (m) \end{cases} \]Gaussian Elimination – Solving Linear Systems
m equations in n unknowns \( (m \times n) \)
\[ \begin{cases} a_{11} x_1 + a_{12} x_2 + \cdots + a_{1n} x_n = b_1 & (1) \\[2mm] a_{21} x_1 + a_{22} x_2 + \cdots + a_{2n} x_n = b_2 & (2) \\[2mm] a_{32} x_1 + a_{32} x_2 + \cdots + a_{3n} x_1 = b_3 & (3) \\[4mm] a_{i1} x_1 + \cdots + a_{ij} x_j + \cdots + a_{in} x_n = b_i & (i) \\[2mm] \vdots \qquad\quad \vdots \qquad\quad \vdots & \\[2mm] a_{m1} x_1 + a_{m2} x_2 + \cdots + a_{mn} x_n = b_m & (m) \end{cases} \]The coefficient \( a_{ij} \) is annotated to show its subscript meaning:
\[ a_{ij} \quad \underset{\text{row no.}}{\;i\;} \; \underset{\text{column number}}{\;j\;} \]Gaussian Elimination – Solving Linear Systems
m equations in n unknowns \( (m \times n) \)
\[ \left[\begin{array}{ccccc|c} a_{11} & a_{12} & a_{13} & \cdots & a_{1n} & b_1 \\ a_{21} & a_{22} & a_{23} & \cdots & a_{2n} & b_2 \\ a_{31} & a_{32} & a_{33} & \cdots & a_{3n} & b_3 \\ \vdots & \vdots & \vdots & & \vdots & \vdots \\ a_{m1} & a_{m2} & a_{m3} & \cdots & a_{mn} & b_n \end{array}\right] \] coeff. matrix vs augmented matrixElementary Row Operations
(to eliminate variables)
-
Interchange 2 rows (equations)
\[ \begin{array}{c} (\text{---} \; R_i \; \text{---}) \\ (\text{---} \; R_j \; \text{---}) \end{array} \quad\longrightarrow\quad \begin{array}{c} (\text{---} \; R_j \; \text{---}) \\ (\text{---} \; R_i \; \text{---}) \end{array} \] -
Multiply 1 row (eqn) by a non-zero no.
\[ (\text{---} \; R_i \; \text{---}) \quad \underset{(\alpha \ne 0)}{\xrightarrow{\;\times \alpha\;}} \quad (\text{---} \; \alpha R_i \; \text{---}) \] -
Add a multiple of 1 row (eqn) to another
\[ \left. \begin{array}{c} (\text{---} \; R_i \; \text{---}) \\ (\text{---} \; R_j \; \text{---}) \end{array} \right\} + \alpha R_i \;\longrightarrow\; \begin{array}{c} (\text{---} \; R_i \; \text{---}) \\ (\text{---} \; \alpha R_i + R_j \; \text{---}) \end{array} \]
Elementary Row Operations (to eliminate variables)
Note: elementary row op. can be reversed.
Hence: the new system is equivalent to the original one in the sense that they have the same set of solutions.
\( \left[\; \text{System 1} \;\right] \;\rightleftarrows\; \left[\; \text{System 2} \;\right] \)
Row Echelon Form (REF) (to facilitate backward substitution)
- make this no. to be 1
- Use it to make all the no.s below it to be zero
Figure 1
Row Echelon Form (REF)
(to facilitate backward substitution)
Figure 2
\( x_1 \) is eliminated
\( (m-1) \times (n-1) \) system. REPEAT!
Row Echelon Form (REF)
(to facilitate backward substitution)
Figure 3
upper triangular matrix
Backward Substitution: Start from the last
Columns labeled \( x_1 \), \( x_2 \), \( x_3 \), \( x_4 \).
\[ \left[\begin{array}{cccc|c} 1 & 2 & -1 & 0 & 1 \\ 0 & 1 & 7 & 5 & 0 \\ 0 & 0 & 1 & 1 & 2 \\ 0 & 0 & 0 & 1 & -3 \end{array}\right] \]Backward Substitution: Start from the last
Columns labeled \( x_1 \), \( x_2 \), \( x_3 \), \( x_4 \).
\[ \left[\begin{array}{cccc|c} 1 & 2 & -1 & 0 & 1 \\ 0 & 1 & 7 & 5 & 0 \\ 0 & 0 & 1 & 1 & 2 \\ 0 & 0 & 0 & 1 & -3 \end{array}\right] \]\( x_3 + x_4 = 2 \)
\( x_3 = 5 \)
\( x_4 = -3 \)
\( x_2 + 7x_3 + 3x_4 = 0 \)
\( x_2 = -20 \)
\( x_1 + 2x_2 - x_3 = 1 \)
\( x_1 = 46 \)
Solution:
\[ \begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \end{pmatrix} = \begin{pmatrix} 46 \\ -20 \\ 5 \\ -3 \end{pmatrix} \]Pivot vs Free Variables
It can happen that not all variables are "leading" in the row echelon form.
Figure 4
- The variables corresponding to the 1's in the REF are called pivot variables.
- The rest, non-leading, are called free variables.
Examples: Express pivot var. in terms of free var.
(a)
\( (3 \times 4) \)
\[ \begin{cases} x + y + z + w = 5 \\ x + y - z + w = 7 \\ x + y + 2z - w = 0 \end{cases} \]\[ \left[\begin{array}{cccc|c} 1 & 1 & 1 & 1 & 5 \\ 1 & 1 & -1 & 1 & 7 \\ 1 & 1 & 2 & -1 & 0 \end{array}\right] \longrightarrow \left[\begin{array}{cccc|c} 1 & 1 & 1 & 1 & 5 \\ 0 & 0 & 1 & -2 & -5 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right] \]\( x, z, w \) are pivot, \( y \) is free
Examples:
Express pivot var. in terms of free var.
(a)
\[ \left[\begin{array}{cccc|c} 1 & 1 & 1 & 1 & 5 \\ 0 & 0 & 1 & -2 & -5 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right] \]\( w = 2 \)
\( z - 2w = -5 \Rightarrow z = -1 \)
\( y = t \) (free)
\[ \begin{aligned} x &= -y - z - w + 5 \\ &= -t + 1 - 2 + 5 \\ &= 4 - t \end{aligned} \]Solution:
\[ \begin{pmatrix} x \\ y \\ z \\ w \end{pmatrix} = \begin{pmatrix} 4 - t \\ t \\ -1 \\ 2 \end{pmatrix} = \begin{pmatrix} 4 \\ 0 \\ -1 \\ 2 \end{pmatrix} + t \begin{pmatrix} -1 \\ 1 \\ 0 \\ 0 \end{pmatrix} \]Examples:
Express pivot var. in terms of free var.
(b)
\[ \begin{cases} x + 2y + 5z + 3w = 0 \\ z - w = 7 \end{cases} \qquad (2 \times 4) \] \[ \left[\begin{array}{cccc|c} 1 & 2 & 5 & 3 & 0 \\ 0 & 0 & 1 & -1 & 7 \end{array}\right] \]\( x, z \) are pivot, \( y, w \) are free
\( w = t \) (free)
\( z = w + 7 = t + 7 \)
\( y = s \) (free)
\[ \begin{aligned} x &= -2y - 5z - 3w \\ &= -2s - 5(t+7) - 3t \\ &= -35 - 2s - 8t \end{aligned} \]Solution
\[ \begin{pmatrix} x \\ y \\ z \\ w \end{pmatrix} = \begin{pmatrix} -35 - 2s - 8t \\ s \\ t + 7 \\ t \end{pmatrix} = \begin{pmatrix} -35 \\ 0 \\ 7 \\ 0 \end{pmatrix} + s \begin{pmatrix} -2 \\ 1 \\ 0 \\ 0 \end{pmatrix} + t \begin{pmatrix} -8 \\ 0 \\ 1 \\ 0 \end{pmatrix} \]Examples:
Express pivot var. in terms of free var.
(c)
\[ x - y + z = 5 \qquad (1 \times 3) \] \[ \left[\begin{array}{ccc|c} 1 & -1 & 1 & 5 \end{array}\right] \](\( x \) is pivot, \( y, z \) are free)
\( y = s \) (free)
\( z = t \) (free)
\[ \begin{aligned} x &= y - z + 5 \\ &= s - t + 5 \end{aligned} \]Solution:
\[ \begin{pmatrix} x \\ y \\ z \end{pmatrix} = \begin{pmatrix} s - t + 5 \\ s \\ t \end{pmatrix} = \begin{pmatrix} 5 \\ 0 \\ 0 \end{pmatrix} + s \begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix} + t \begin{pmatrix} -1 \\ 0 \\ 1 \end{pmatrix} \]Reduced Row Echelon Form (RREF)
(Backward substitution can also be achieved using elementary row ops.)
Figure 5
Use the pivot 1's to make all the numbers above them to be zero. (start from the last ro
Reduced Row Echelon Form (RREF)
(Backward substitution can also be achieved using elementary row ops.)
Figure 6
Use the pivot 1's to make all the numbers above them to be zero. (start from the last row)
Three Scenarios of Solving Linear Systems
-
Unique Solution (only pivot variables, i.e. no free variables, and in REF, no. of non-zero rows in the coefficient matrix is the same as the no. of non-zero rows in the augmented matrix.)
Figure 7
A large augmented matrix drawn with square brackets and a vertical bar separating the coefficient part from the augmenting column. The coefficient part shows a staircase of pivot entries equal to 1 running down the main diagonal, with asterisks marking arbitrary nonzero entries above and to the right of each pivot. The lower-left region is labeled O's indicating zero entries. To the right of the vertical bar is a single augmenting column filled with asterisks, one for each row. This depicts the row echelon form of a system with a unique solution, having only pivot variables and no free variables.
-
Infinitely many solutions ( There are free variables, and in REF, no. of non-zero rows in the coefficient matrix is the same as the no. of non-zero rows in the augmented matrix. )
Figure 8
A large augmented matrix drawn as a staircase pattern. Along the main diagonal are pivot entries equal to 1. Just above and to the right of several pivots are asterisks (highlighted), representing nonzero entries such as single asterisks and pairs of asterisks. Below the diagonal the region is labelled O's, indicating all zeros. A vertical bar separates the coefficient part from the augmenting column on the right, which is a column of asterisks representing the constant terms. This illustrates the row echelon form for a system with infinitely many solutions.
Three Scenarios of Solving Linear Systems
-
No Solution (inconsistent)
( in REF, no. of non-zero rows in the coefficient matrix is less than the no. of non-zero rows in the augmented matrix. )
Figure 9
A large augmented matrix shown in row echelon form. The left coefficient block contains pivot entries of 1 arranged along a descending staircase, with the label 0s indicating zeros below the pivots. A red brace on the left labels this coefficient portion as the number of non-zero rows in the coefficient matrix. A vertical bar separates the coefficient columns from the augmenting column on the right, which contains asterisks. The last rows of the coefficient block are shown as 1, 0, 0 while the corresponding augmenting entries are asterisks, so a row of zeros in the coefficient part corresponds to a nonzero augmenting entry. A red brace on the right labels the augmenting portion as the number of non-zero rows in the augmented matrix, illustrating that the coefficient matrix has fewer non-zero rows than the augmented matrix, giving no solution.