### Upper-Triangular Matrix transform and solving Using Back-Substitution in c++

Definition (Upper-Triangular Matrix).

An  matrix  is called upper-triangular provided that the elements satisfy  whenever .
If A is an upper-triangular matrix, then  is said to be an upper-triangular system of linear equations.

(1)

Suppose that    is an upper-triangular system with the form given above in (1).  If   for  then there exists a unique solution.

The back substitution algorithm.

To solve the upper-triangular system  by the method of back-substitution. Proceed with the method only if all the diagonal elements are nonzero. First compute

and then use the rule

for

Or, use the "generalized rule"

for

where the "understood convention" is that  is an "empty summation" because the lower index of summation is greater than the upper index of summation.

Remark. The loop control structure will permit us to use one formula.

C++ programming Code :

Output of program :

Enter the size Of Matrix
3
Enter the matrix by rows
x[0][0]
1
x[0][1]
-2
x[0][2]
1
x[1][0]
0
x[1][1]
1
x[1][2]
6
x[2][0]
0
x[2][1]
0
x[2][2]
1
Enter the Element into b[0] =
4
Enter the Element into b[1] =
-1
Enter the Element into b[2] =
2
1       -2      1
0       1       6
0       0       1
Soluation of Ax=b is X[0] = -24
Soluation of Ax=b is X[1] = -13
Soluation of Ax=b is X[2] = 2
Press any key to continue . . .