Lab 2.3
Testing LU Decomposition
Lab goal
See what SciPy returns, why Q = P.T gives Q @ A = L @ U, and where rank deficiency appears.
- Rank of a product
- Rectangular LU
- Permutation matrix
- Residual
Code extensionThe full notebook generates random 10×11 matrices, repeats the test ten times, and plots the collected results.
Key ideas
Terms you will use
- Rank bound
A = X Y ⇒ rank(A) ≤ 2 A product with a two-dimensional middle space cannot have rank larger than two.
- Pivoted LU
A = P L U ⇔ Q A = L U SciPy returns A = P L U. Setting Q = P.T gives the course form Q A = L U.
- Residual
‖Q A − L U‖ The residual compresses the reconstruction difference into one nonnegative number.
Lab 2.3 · Guided example
Test LU once, with reproducible numbers
The notebook’s repeated random experiment is reduced to one deterministic 3×4 matrix so the rank and reconstruction are visible without a histogram.
Select a line to see its action, array shape, and concrete operation.
X has two columns and Y has two rows.
Build rank into the example
We will multiply a 3×2 matrix by a 2×4 matrix, forcing the result through a two-dimensional middle space.
Reveal to compare.