Lu Decomposition
1. **State the problem:** Solve the system $Ax = b$ where
$$A = \begin{bmatrix} 2 & 1 & -1 \\ 4 & 5 & 0 \\ -2 & 3 & 8 \end{bmatrix}, \quad b = \begin{bmatrix} 3 \\ 7 \\ 1 \end{bmatrix}$$
using LU decomposition.
2. **LU decomposition:** We want to find lower triangular matrix $L$ and upper triangular matrix $U$ such that $A = LU$.
Start with $A$:
$$\begin{bmatrix} 2 & 1 & -1 \\ 4 & 5 & 0 \\ -2 & 3 & 8 \end{bmatrix}$$
- Compute multipliers for elimination:
- $l_{21} = \frac{4}{2} = 2$
- $l_{31} = \frac{-2}{2} = -1$
- Update rows 2 and 3:
- Row 2: $R_2 - l_{21} R_1 = [4 - 2\cdot2, 5 - 2\cdot1, 0 - 2\cdot(-1)] = [0, 3, 2]$
- Row 3: $R_3 - l_{31} R_1 = [-2 - (-1)\cdot2, 3 - (-1)\cdot1, 8 - (-1)\cdot(-1)] = [0, 4, 7]$
- Next, compute $l_{32} = \frac{4}{3}$ to eliminate below pivot in column 2.
- Update row 3:
- $R_3 - l_{32} R_2 = [0, 4 - \frac{4}{3} \cdot 3, 7 - \frac{4}{3} \cdot 2] = [0, 0, 7 - \frac{8}{3}] = [0, 0, \frac{13}{3}]$
3. **Matrices $L$ and $U$:**
$$L = \begin{bmatrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ -1 & \frac{4}{3} & 1 \end{bmatrix}, \quad U = \begin{bmatrix} 2 & 1 & -1 \\ 0 & 3 & 2 \\ 0 & 0 & \frac{13}{3} \end{bmatrix}$$
4. **Solve $Ly = b$ for $y$:**
- $y_1 = 3$
- $2 y_1 + y_2 = 7 \implies 2 \cdot 3 + y_2 = 7 \implies y_2 = 1$
- $-1 y_1 + \frac{4}{3} y_2 + y_3 = 1 \implies -3 + \frac{4}{3} \cdot 1 + y_3 = 1 \implies y_3 = 1 + 3 - \frac{4}{3} = \frac{8}{3}$
So,
$$y = \begin{bmatrix} 3 \\ 1 \\ \frac{8}{3} \end{bmatrix}$$
5. **Solve $Ux = y$ for $x$:**
- From last row: $\frac{13}{3} x_3 = \frac{8}{3} \implies x_3 = \frac{8}{3} \cdot \frac{3}{13} = \frac{8}{13}$
- Second row: $3 x_2 + 2 x_3 = 1 \implies 3 x_2 + 2 \cdot \frac{8}{13} = 1 \implies 3 x_2 = 1 - \frac{16}{13} = \frac{-3}{13} \implies x_2 = -\frac{1}{13}$
- First row: $2 x_1 + x_2 - x_3 = 3 \implies 2 x_1 - \frac{1}{13} - \frac{8}{13} = 3 \implies 2 x_1 = 3 + \frac{9}{13} = \frac{48}{13} \implies x_1 = \frac{24}{13}$
6. **Final solution:**
$$x = \begin{bmatrix} \frac{24}{13} \\ -\frac{1}{13} \\ \frac{8}{13} \end{bmatrix}$$