Back Substitution
In today’s lab we will write a program to solve an upper triangular matrix using back substitution. The basic algorithm is the one that you have seen in class. The pseudocode can be described as:
for j = n to 1 //loop over columns
if u_jj = 0 then stop //stop if matrix is singular
x_j = b_j/u_jj //compute component solution
for i = 1 to j-1 //
b_i = b_i-u_ij*x_j //update RHS
end
end
Try the program on the following upper triangular system
| 4 -1 2 3 || x_1 | | 20 | | 0 -2 7 -4 || x_2 | | -7 | | 0 0 6 5 || x_3 | = | 4 | | 0 0 0 3 || x_4 | | 6 |