Consider a set of equations in a matrix form

Solved using the following algorithm

Example: Consider a system with the given row-echelon form for its augmented matrix.

The equations for this system are

x − 2y + z = 4

y + 6z = −1

z = 2

The last equation says z = 2. Substitute this into the second equation to get

y + 6(2) = −1

y = −13

Now substitute z = 2 and y = –13 into the first equation to get

x−2(−13)+(2)=4

x=−24

Thus the solution is x = –24, y = –13, and z = 2.

**Ax=b**, where A is a upper triangular matrix with non-zero diagonal elements. The equation is re-written in full matrix form asSolved using the following algorithm

Example: Consider a system with the given row-echelon form for its augmented matrix.

The equations for this system are

x − 2y + z = 4

y + 6z = −1

z = 2

The last equation says z = 2. Substitute this into the second equation to get

y + 6(2) = −1

y = −13

Now substitute z = 2 and y = –13 into the first equation to get

x−2(−13)+(2)=4

x=−24

Thus the solution is x = –24, y = –13, and z = 2.

### Example: C++ program to solve Upper-Triangular Matrix transform and solving Using Back-Substitution

#### Output

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

Solution of Ax=b is X[0] = -24

Solution of Ax=b is X[1] = -13

Solution of Ax=b is X[2] = 2

## Post a Comment