Solve the following equations by Gaussian elimination:
x + y − z = 3 (1)
2x + y − z = 4 (2)
2x + 2y + z = 12 (3)
All three equations must be written in the same format: variables x, y, z (in the same order) on the LHS and constants on the RHS. With the equations written in order, the variables may be dropped in the calculations which follow.
\begin{matrix} \\ x + y − z =3 & (1) \\ 2x + y − z =4 & (2) \\ 2x + 2y + z = 12 & (3) \end{matrix} \longrightarrow \begin{matrix} \text {x y z RHS} \\\left(\begin{matrix} 1 & 1 & -1 & 3 \\ 2 & 1 & -1 & 4 \\ 2 & 2 & 1 & 12 \end{matrix} \right) \end{matrix} \begin{matrix} \\ (1) \\ (2) \\ (3) \end{matrix}The 3 × 4 matrix is called the augmented matrix, A. The aim of Gaussian elimination is to systematically reduce this array of numbers to upper triangular form, similar in form to the reduced set of equations (9.18). A matrix of upper triangular form has zeros beneath the main diagonal (boxed background):
x + y − z = 3
−y + z = −2 (9.18)
2z = 4
\left(\begin{array}{c c c c} {\boxed{a_{1,1}}}&{{a_{1,2}}}&{{a_{1,3}}}&{{a_{1,4}}}\\ {{0}}&{\boxed{a_{2,2}}}&{{a_{2,3}}}&{{a_{2,4}}}\\ {{0}}&{{0}}&{\boxed{a_{3,3}}}&{{a_{3,4}}}\end{array}\right)
Therefore, in column 1, we require zeros beneath the first element, and in column 2 we require zeros beneath the second element.
No further elimination is necessary, since there is a 0 beneath the second element in column 2. However, divide row 3 by 3 to simplify (optional)
\left(\begin{array}{c c c c}{{1}}&{{1}}&{{-1}}&{{3}}\\ {{0}}&{{-1}}&{{1}}&{{-2}}\\ {{0}}&{{0}}&{{1}}&{{2}}\end{array}\right) \begin{matrix} (1) \\(2)¹ \\(3)² \end{matrix}\begin{matrix}\\\\ ←\fbox {divide row 3¹ by 3}\end{matrix}
Rewrite the equations from the augmented matrix:
x + y − z =3 (1)
−y + z = −2 (2)¹ (9.19)
z =2 (3)²
Solve by back substitution
Start with equation (3)²
(3)² →z = 2
Substitute z = 2 into equation (2)¹
(2)¹ →–y + z = –2 hence –y + 2 = –2→y = 4
Substitute z = 2 and y = 4 into equation (1)
(1)² →–x + y – z = 3 hence x + 4 – 2 = 3→x = 1
Solution: x = 1, y = 4, z = 2
Action | Augmented matrix | Calculations |
\boxed{\substack{\text{To get the required 0s,}\\\text{ you must add (−2 × row 1) to row 2}\\\text{ and (−2 × row 1) to row 3}}} | \begin{matrix} \text {x y z RHS} \\ \downarrow \downarrow \downarrow \downarrow \\ \left(\begin{matrix} 1 & 1 & -1 & 3 \\ (2) & 1 & -1 & 4 \\ (2) & 2 & 1 & 12 \end{matrix} \right) \end{matrix} \begin{matrix} \\(1) \\(2) \\(3) \end{matrix} | |
\fbox {row 2+(−2 × row 1)} → | \begin{matrix} \left(\begin{matrix} 1 & 1 & -1 & 3 \\ 0 & -1 & 1 & -2 \\ 0 & 0 & 1 & 2 \end{matrix} \right) \end{matrix} \begin{matrix} (1) \\(2)¹ \\(3) \end{matrix} | \left\{\begin{array}{r r r}{{-2}}&{{-2}}&{{2}}&{{-6}}\\ {{2}}&{{1}}&{{-1}}&{{4}}\\ \hline \\ {{0}}&{{-1}}&{{1}}&{{-2}}\end{array}\right. \begin{matrix} (1)×−2 \\ (2) \\ \\ adding \end{matrix} |
\fbox {row 3+(−2 × row 1)} → | \begin{matrix} \left(\begin{matrix} 1 & 1 & -1 & 3 \\ 0 & -1 & 1 & -2 \\ 0 & 0 & 3 & 6 \end{matrix} \right) \end{matrix} \begin{matrix} (1) \\(2)¹ \\(3)¹ \end{matrix} | \left\{\begin{array}{r r r}{{-2}}&{{-2}}&{{2}}&{{-6}}\\ {{2}}&{{1}}&{{1}}&{{12}}\\ \hline \\ {{0}}&{{0}}&{{3}}&{{6}}\end{array}\right. \begin{matrix} (1)×−2 \\ (2) \\ \\ adding \end{matrix} |
¹Updated once. ²Updated twice |