Task 2:
Find the solution of the following system of equations using the Gaussian elimination method and show the steps.

[tex]\[
\begin{array}{l}
x - y + z = 4 \\
5x - y + z = 6 \\
3x - y + 5z = 5
\end{array}
\][/tex]



Answer :

Absolutely! We'll use Gaussian elimination to solve the given system of linear equations step-by-step.

The system is:
[tex]\[ \begin{aligned} x - y + z &= 4 \\ 5x - y + z &= 6 \\ 3x - y + 5z &= 5 \end{aligned} \][/tex]

First, we'll write this system in matrix form [tex]\(AX = B\)[/tex] where [tex]\(A\)[/tex] is the coefficient matrix, [tex]\(X\)[/tex] is the vector of variables, and [tex]\(B\)[/tex] is the right-hand side vector:
[tex]\[ A = \begin{pmatrix} 1 & -1 & 1 \\ 5 & -1 & 1 \\ 3 & -1 & 5 \end{pmatrix}, \quad X = \begin{pmatrix} x \\ y \\ z \end{pmatrix}, \quad B = \begin{pmatrix} 4 \\ 6 \\ 5 \end{pmatrix} \][/tex]

### Step 1: Convert [tex]\(A\)[/tex] to an Upper Triangular Matrix

#### First Iteration (i = 1):

Using the first row to eliminate [tex]\(x\)[/tex] from the 2nd and 3rd rows.

1. Subtract 5 times the 1st row from the 2nd row:
[tex]\[ \begin{pmatrix} 5 & -1 & 1 \end{pmatrix} - 5 \times \begin{pmatrix} 1 & -1 & 1 \end{pmatrix} = \begin{pmatrix} 5 - 5 & -1 + 5 & 1 - 5 \end{pmatrix} = \begin{pmatrix} 0 & 4 & -4 \end{pmatrix} \][/tex]

Update the 2nd row of [tex]\(B\)[/tex]:
[tex]\[ 6 - 5 \times 4 = 6 - 20 = -14 \][/tex]

2. Subtract 3 times the 1st row from the 3rd row:
[tex]\[ \begin{pmatrix} 3 & -1 & 5 \end{pmatrix} - 3 \times \begin{pmatrix} 1 & -1 & 1 \end{pmatrix} = \begin{pmatrix} 3 - 3 & -1 + 3 & 5 - 3 \end{pmatrix} = \begin{pmatrix} 0 & 2 & 2 \end{pmatrix} \][/tex]

Update the 3rd row of [tex]\(B\)[/tex]:
[tex]\[ 5 - 3 \times 4 = 5 - 12 = -7 \][/tex]

The updated system is:
[tex]\[ \begin{aligned} 1x - 1y + 1z &= 4 \\ 0x + 4y - 4z &= -14 \\ 0x + 2y + 2z &= -7 \end{aligned} \][/tex]

#### Second Iteration (i = 2):

Using the second row to eliminate [tex]\(y\)[/tex] from the 3rd row.

1. Subtract 0.5 times the 2nd row from the 3rd row:
[tex]\[ \begin{pmatrix} 0 & 2 & 2 \end{pmatrix} - 0.5 \times \begin{pmatrix} 0 & 4 & -4 \end{pmatrix} = \begin{pmatrix} 0 & 2 - 2 & 2 + 2 \end{pmatrix} = \begin{pmatrix} 0 & 0 & 4 \end{pmatrix} \][/tex]

Update the 3rd row of [tex]\(B\)[/tex]:
[tex]\[ -7 - 0.5 \times (-14) = -7 + 7 = 0 \][/tex]

The updated system is:
[tex]\[ \begin{aligned} 1x - 1y + 1z &= 4 \\ 0x + 4y - 4z &= -14 \\ 0x + 0y + 4z &= 0 \end{aligned} \][/tex]

### Step 2: Back Substitution

Starting from the last equation:
[tex]\[ 4z = 0 \implies z = 0 \][/tex]

Substituting [tex]\(z = 0\)[/tex] into the second equation:
[tex]\[ 4y - 4(0) = -14 \implies 4y = -14 \implies y = -3.5 \][/tex]

Finally, substituting [tex]\(y = -3.5\)[/tex] and [tex]\(z = 0\)[/tex] into the first equation:
[tex]\[ x - (-3.5) + 0 = 4 \implies x + 3.5 = 4 \implies x = 4 - 3.5 = 0.5 \][/tex]

Thus, the solution to the system of equations is:
[tex]\[ \begin{aligned} x &= 0.5 \\ y &= -3.5 \\ z &= 0 \end{aligned} \][/tex]

In matrix form, the solution vector [tex]\(X\)[/tex] is:
[tex]\[ X = \begin{pmatrix} 0.5 \\ -3.5 \\ 0 \end{pmatrix} \][/tex]