\begin{aligned}
    x_{1} + 2x_{2} + x_{3} &= -1 \\
    -3x_{1} + x_{2} + x_{3} &= 0 \\
    x_{1} + 2x_{3} &= 1 \\
\end{aligned}
\implies
\overset{A}{
    \begin{bmatrix}
    1 & 2 & 1 \\
    -3 & 1 & 1 \\
    1 & 0 & 3 \\
    \end{bmatrix}
}
\overset{x}{
    \begin{bmatrix}
    x_{1} \\
    x_{2} \\
    x_{3} \\
    \end{bmatrix}
} =
\overset{b}{
    \begin{bmatrix}
    -1 \\
    0 \\
    1 \\
    \end{bmatrix}
}

Using the formula Row_{i} := Row_{i} - (\frac{A_{ik}}{A_{kk}}) \cdot Row_{k}:


A_{ik} = A_{21} hence i = 2 and k = 1

Row_{2} := Row_{2} - (\frac{A_{21}}{A_{11}}) \cdot Row_{1}

= \begin{bmatrix}-3 & 1 & 1\end{bmatrix} - (\frac{-3}{1}) \cdot \begin{bmatrix}1 & 2 & 1\end{bmatrix}

= \begin{bmatrix}0 & 7 & 4\end{bmatrix}



\begin{bmatrix}
    1 & 2 & 1 \\
    0 & 7 & 4 \\
    1 & 0 & 3 \\
\end{bmatrix}


A_{ik} = A_{31} hence i = 3 and k = 1

Row_{3} := Row_{3} - (\frac{A_{31}}{A_{11}}) \cdot Row_{1}

= \begin{bmatrix}1 & 0 & 3\end{bmatrix} - (\frac{1}{1}) \cdot \begin{bmatrix}1 & 2 & 1\end{bmatrix}

= \begin{bmatrix}0 & -2 & 2\end{bmatrix}



\begin{bmatrix}
    1 & 2 & 1 \\
    0 & 7 & 4 \\
    0 & -2 & 2 \\
\end{bmatrix}


A_{ik} = A_{32} hence i = 3 and k = 2

Row_{3} := Row_{3} - (\frac{A_{32}}{A_{22}}) \cdot Row_{2}

= \begin{bmatrix}0 & -2 & 2\end{bmatrix} - (\frac{-2}{7}) \cdot \begin{bmatrix}0 & 7 & 4\end{bmatrix}

= \begin{bmatrix}0 & 0 & \frac{22}{7}\end{bmatrix}



\begin{bmatrix}
    1 & 2 & 1 \\
    0 & 7 & 4 \\
    0 & 0 & \frac{22}{7} \\
\end{bmatrix}




\overset{A}{
    \begin{bmatrix}
    1 & 2 & 1 \\
    -3 & 1 & 1 \\
    1 & 0 & 3 \\
    \end{bmatrix}
} =
\overset{L}{
    \begin{bmatrix}
    1 & 0 & 0 \\
    -3 & 1 & 0 \\
    1 & \frac{-2}{7} & 1 \\
    \end{bmatrix}
}
\overset{U}{
    \begin{bmatrix}
    1 & 2 & 1 \\
    0 & 7 & 4\\
    0 & 0 & \frac{22}{7} \\
    \end{bmatrix}
}



Lw = b
\implies
\overset{L}{
    \begin{bmatrix}
    1 & 0 & 0 \\
    -3 & 1 & 0 \\
    1 & \frac{-2}{7} & 1 \\
    \end{bmatrix}
}
\overset{w}{
    \begin{bmatrix}
    w_{1} \\
    w_{2} \\
    w_{3} \\
    \end{bmatrix}
} =
\overset{b}{
    \begin{bmatrix}
    -1 \\
    0 \\
    1 \\
    \end{bmatrix}
}

for j = 1 to n:
    j = 1
    w1 = b1 / L11 = -1 / 1 = -1
    for i = j + 1 to n:
        i = 2
        b2 = b2 - L21 * w1 = 0 - (-3) * (-1) = -3
        i = 3
        b3 = b3 - L31 * w1 = 1 - 1 * (-1) = 2
    j = 2
    w2 = b2 / L22 = -3 / 1 = -3
    for i = j + 1 to n:
        i = 3
        b3 = b3 - L32 * w2 = 2 - (-2 / 7) * (-3) = 8 / 7
    j = 3
    w3 = b3 / L33 = (8 / 7) / 1 = 8 / 7
    for i = j + 1 to n:
        i = 4 -> skip



Ux = w
\implies
\overset{U}{
    \begin{bmatrix}
    1 & 2 & 1 \\
    0 & 7 & 4 \\
    0 & 0 & \frac{22}{7} \\
    \end{bmatrix}
}
\overset{x}{
    \begin{bmatrix}
    x_{1} \\
    x_{2} \\
    x_{3} \\
    \end{bmatrix}
} =
\overset{w}{
    \begin{bmatrix}
    w_{1} \\
    w_{2} \\
    w_{3} \\
    \end{bmatrix}
} =
\overset{w}{
    \begin{bmatrix}
    -1 \\
    -3 \\
    \frac{8}{7} \\
    \end{bmatrix}
}

Paul Laffitte 6222808130