4.2: Triangular systems
Some systems can be solved one variable at a time, with almost no rearranging. The useful feature is a pattern of zeros in their coefficient matrices.
Upper triangular systems ¶ Consider
3 x − 2 y = 8 , 2 y = 4. \begin{aligned}3x-2y&=8,\\2y&=4.\end{aligned} 3 x − 2 y 2 y = 8 , = 4. The second equation gives y = 2 y=2 y = 2 . Substitute into the first: 3 x − 4 = 8 3x-4=8 3 x − 4 = 8 , so x = 4 x=4 x = 4 . In matrix form,
[ 3 − 2 0 2 ] [ x y ] = [ 8 4 ] . \begin{bmatrix}3&-2\\0&2\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}
=\begin{bmatrix}8\\4\end{bmatrix}. [ 3 0 − 2 2 ] [ x y ] = [ 8 4 ] . The zero in the bottom-left position is doing useful work: the last equation contains only the last variable.
A square matrix is upper triangular if every entry below its main diagonal is zero. It is lower triangular if every entry above its main diagonal is zero.
The main diagonal runs from the top-left entry to the bottom-right entry.
For example,
U = [ 2 − 1 4 0 3 5 0 0 − 2 ] , L = [ 2 0 0 − 1 3 0 3 1 − 2 ] U=\begin{bmatrix}2&-1&4\\0&3&5\\0&0&-2\end{bmatrix},\qquad
L=\begin{bmatrix}2&0&0\\-1&3&0\\3&1&-2\end{bmatrix} U = ⎣ ⎡ 2 0 0 − 1 3 0 4 5 − 2 ⎦ ⎤ , L = ⎣ ⎡ 2 − 1 3 0 3 1 0 0 − 2 ⎦ ⎤ are upper and lower triangular, respectively. Entries on the other side of the diagonal are allowed to be zero too. A diagonal matrix is both upper and lower triangular.
Back substitution ¶ For an upper triangular system with nonzero diagonal entries, we start at the bottom and work upward. This is called back substitution .
Let’s solve
[ 4 − 2 2 0 3 − 1 0 0 5 ] [ x 1 x 2 x 3 ] = [ 6 3 15 ] . \begin{bmatrix}4&-2&2\\0&3&-1\\0&0&5\end{bmatrix}\begin{bmatrix}x_1\\x_2\\x_3\end{bmatrix}
=\begin{bmatrix}6\\3\\15\end{bmatrix}. ⎣ ⎡ 4 0 0 − 2 3 0 2 − 1 5 ⎦ ⎤ ⎣ ⎡ x 1 x 2 x 3 ⎦ ⎤ = ⎣ ⎡ 6 3 15 ⎦ ⎤ . Writing out the equations makes the order clear:
4 x 1 − 2 x 2 + 2 x 3 = 6 , 3 x 2 − x 3 = 3 , 5 x 3 = 15. \begin{aligned}4x_1-2x_2+2x_3&=6,\\3x_2-x_3&=3,\\5x_3&=15.\end{aligned} 4 x 1 − 2 x 2 + 2 x 3 3 x 2 − x 3 5 x 3 = 6 , = 3 , = 15. The last equation gives x 3 = 3 x_3=3 x 3 = 3 . The second then gives 3 x 2 − 3 = 3 3x_2-3=3 3 x 2 − 3 = 3 , so x 2 = 2 x_2=2 x 2 = 2 . Finally,
4 x 1 − 2 ( 2 ) + 2 ( 3 ) = 6 ⟹ x 1 = 1. 4x_1-2(2)+2(3)=6\quad\Longrightarrow\quad x_1=1. 4 x 1 − 2 ( 2 ) + 2 ( 3 ) = 6 ⟹ x 1 = 1. Thus x ⃗ = [ 1 2 3 ] \vec x=\begin{bmatrix}1\\2\\3\end{bmatrix} x = ⎣ ⎡ 1 2 3 ⎦ ⎤ . Check it by multiplying the original matrix by this vector.
Forward substitution ¶ For a lower triangular system, the direction reverses. Consider
[ 2 0 0 − 1 3 0 3 1 − 2 ] [ x y z ] = [ 4 7 1 ] . \begin{bmatrix}2&0&0\\-1&3&0\\3&1&-2\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}
=\begin{bmatrix}4\\7\\1\end{bmatrix}. ⎣ ⎡ 2 − 1 3 0 3 1 0 0 − 2 ⎦ ⎤ ⎣ ⎡ x y z ⎦ ⎤ = ⎣ ⎡ 4 7 1 ⎦ ⎤ . This time the first equation contains only one variable:
2 x = 4 ⟹ x = 2 , − x + 3 y = 7 ⟹ − 2 + 3 y = 7 ⟹ y = 3 , 3 x + y − 2 z = 1 ⟹ 6 + 3 − 2 z = 1 ⟹ z = 4. \begin{aligned}2x=4&\quad\Longrightarrow\quad x=2,\\
-x+3y=7&\quad\Longrightarrow\quad -2+3y=7\quad\Longrightarrow\quad y=3,\\
3x+y-2z=1&\quad\Longrightarrow\quad6+3-2z=1\quad\Longrightarrow\quad z=4.
\end{aligned} 2 x = 4 − x + 3 y = 7 3 x + y − 2 z = 1 ⟹ x = 2 , ⟹ − 2 + 3 y = 7 ⟹ y = 3 , ⟹ 6 + 3 − 2 z = 1 ⟹ z = 4. The solution is [ x y z ] = [ 2 3 4 ] \begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}2\\3\\4\end{bmatrix} ⎣ ⎡ x y z ⎦ ⎤ = ⎣ ⎡ 2 3 4 ⎦ ⎤ .
Rewrite each system as a matrix equation, then solve it. Identify whether you use forward or back substitution.
2 x + y = 7 2x+y=7 2 x + y = 7 , y = 3 y=3 y = 3 .
2 x = 2 2x=2 2 x = 2 , 2 x + 3 y = 8 2x+3y=8 2 x + 3 y = 8 , x − y + 2 z = 5 x-y+2z=5 x − y + 2 z = 5 .
2 x − y + z = 4 2x-y+z=4 2 x − y + z = 4 , 3 y + 2 z = 7 3y+2z=7 3 y + 2 z = 7 , z = 2 z=2 z = 2 .
Check each solution in all of its original equations.
1. The matrix equation is
[ 2 1 0 1 ] [ x y ] = [ 7 3 ] . \begin{bmatrix}2&1\\0&1\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}=\begin{bmatrix}7\\3\end{bmatrix}. [ 2 0 1 1 ] [ x y ] = [ 7 3 ] . Use back substitution: y = 3 y=3 y = 3 , then 2 x + 3 = 7 2x+3=7 2 x + 3 = 7 , so x = 2 x=2 x = 2 . The solution is [ 2 3 ] \begin{bmatrix}2\\3\end{bmatrix} [ 2 3 ] . Checking gives 2 ( 2 ) + 3 = 7 2(2)+3=7 2 ( 2 ) + 3 = 7 and 3 = 3 3=3 3 = 3 .
2. The matrix equation is
[ 2 0 0 2 3 0 1 − 1 2 ] [ x y z ] = [ 2 8 5 ] . \begin{bmatrix}2&0&0\\2&3&0\\1&-1&2\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}2\\8\\5\end{bmatrix}. ⎣ ⎡ 2 2 1 0 3 − 1 0 0 2 ⎦ ⎤ ⎣ ⎡ x y z ⎦ ⎤ = ⎣ ⎡ 2 8 5 ⎦ ⎤ . Use forward substitution: 2 x = 2 2x=2 2 x = 2 gives x = 1 x=1 x = 1 ; 2 + 3 y = 8 2+3y=8 2 + 3 y = 8 gives y = 2 y=2 y = 2 ; and 1 − 2 + 2 z = 5 1-2+2z=5 1 − 2 + 2 z = 5 gives z = 3 z=3 z = 3 . The solution is [ 1 2 3 ] \begin{bmatrix}1\\2\\3\end{bmatrix} ⎣ ⎡ 1 2 3 ⎦ ⎤ . Checking gives 2 ( 1 ) = 2 2(1)=2 2 ( 1 ) = 2 , 2 ( 1 ) + 3 ( 2 ) = 8 2(1)+3(2)=8 2 ( 1 ) + 3 ( 2 ) = 8 , and 1 − 2 + 2 ( 3 ) = 5 1-2+2(3)=5 1 − 2 + 2 ( 3 ) = 5 .
3. The matrix equation is
[ 2 − 1 1 0 3 2 0 0 1 ] [ x y z ] = [ 4 7 2 ] . \begin{bmatrix}2&-1&1\\0&3&2\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}4\\7\\2\end{bmatrix}. ⎣ ⎡ 2 0 0 − 1 3 0 1 2 1 ⎦ ⎤ ⎣ ⎡ x y z ⎦ ⎤ = ⎣ ⎡ 4 7 2 ⎦ ⎤ . Use back substitution: z = 2 z=2 z = 2 , then 3 y + 4 = 7 3y+4=7 3 y + 4 = 7 gives y = 1 y=1 y = 1 , and 2 x − 1 + 2 = 4 2x-1+2=4 2 x − 1 + 2 = 4 gives x = 3 2 x=\frac32 x = 2 3 . The solution is [ 3 / 2 1 2 ] \begin{bmatrix}3/2\\1\\2\end{bmatrix} ⎣ ⎡ 3/2 1 2 ⎦ ⎤ . Checking gives 2 ( 3 / 2 ) − 1 + 2 = 4 2(3/2)-1+2=4 2 ( 3/2 ) − 1 + 2 = 4 , 3 ( 1 ) + 2 ( 2 ) = 7 3(1)+2(2)=7 3 ( 1 ) + 2 ( 2 ) = 7 , and 2 = 2 2=2 2 = 2 .
Why the diagonal matters ¶ At each step, we divide by a diagonal entry. The diagonal entries don’t need to be 1 , but they do need to be nonzero for this procedure to determine one new variable at every step.
For instance,
[ 2 1 0 0 ] [ x y ] = [ 7 3 ] \begin{bmatrix}2&1\\0&0\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}
=\begin{bmatrix}7\\3\end{bmatrix} [ 2 0 1 0 ] [ x y ] = [ 7 3 ] has a last equation 0 = 3 0=3 0 = 3 , so it has no solution. Replacing the right-hand side by [ 7 0 ] \begin{bmatrix}7\\0\end{bmatrix} [ 7 0 ] gives 0 = 0 0=0 0 = 0 instead. Then y y y is unrestricted, and x = ( 7 − y ) / 2 x=(7-y)/2 x = ( 7 − y ) /2 gives infinitely many solutions.
We’ll study these possibilities in Chapter 4.5. For now, our triangular solves will have nonzero diagonal entries.
Give a 3 × 3 3\times3 3 × 3 matrix that is upper triangular but not lower triangular.
What must a matrix look like if it is both upper and lower triangular?
Explain why a triangular system with all diagonal entries nonzero has exactly one solution for every right-hand side.
1. One example is
[ 1 2 0 0 3 4 0 0 5 ] . \begin{bmatrix}1&2&0\\0&3&4\\0&0&5\end{bmatrix}. ⎣ ⎡ 1 0 0 2 3 0 0 4 5 ⎦ ⎤ . Every entry below the diagonal is zero, so it is upper triangular. The nonzero entries above the diagonal mean it is not lower triangular.
2. It must be diagonal: being upper triangular forces all entries below the diagonal to be zero, and being lower triangular forces all entries above it to be zero. Diagonal entries may be zero or nonzero.
3. For an upper triangular system, the last equation determines the last variable uniquely because its coefficient is nonzero. After substituting that value into the preceding equation, the next variable is uniquely determined for the same reason. Continuing upward determines all variables, with no choices or contradictions. A lower triangular system works the same way from top to bottom. Thus every right-hand side gives exactly one solution.