Let’s decompose the next matrix A
:
A = [[1, 1, 1],
[4, 3, -1],
[3, 5, 3]]
Use row operations to transform A
into an higher triangular matrix U
. Observe the multipliers to assemble L
.
Row Operations:
- Subtract
4 * Row1
fromRow2
:
R2 → R2 - 4 * R1
- Subtract
3 * Row1
fromRow3
:
R3 → R3 - 3 * R1
- Subtract
-2 * Row2
fromRow3
:
R3 → R3 - (-2) * R2
After these steps, we get:
U = [[1, 1, 1],
[0, -1, -5],
[0, 0, -10]]L = [[1, 0, 0],
[4, 1, 0],
[3, -2, 1]]
Verify that A = L × U
:
import numpy as npL = np.array([[1, 0, 0],
[4, 1, 0],
[3, -2, 1]])
U = np.array([[1, 1, 1],
[0, -1, -5],
[0, 0, -10]])
A_reconstructed = np.dot(L, U)
print("Reconstructed A:")
print(A_reconstructed)
Output:
Reconstructed A:
[[ 1 1 1]
[ 4 3 -1]
[ 3 5 3]]
The decomposition is appropriate!