Code Katas
Focused implementation drills for computational linear algebra fluency. Use Python, NumPy, or plain arrays, but do not hide the core idea behind one library call on the first pass.
Kata 1: Gaussian Elimination with Pivot Tracking
Time limit: 20 minutes
Goal: Convert a small dense system to row-echelon form and report pivot columns, rank, and consistency.
Setup: Implement row swaps, row scaling, and row replacement for matrices up to 5 x 5.
Repeat until:
- you can produce the reduced form without losing track of pivots
- you can classify the system before full back-substitution
Kata 2: Basis Extraction from RREF
Time limit: 15 minutes
Goal: Given a matrix, return a basis for the original column space and a parametric basis for the nullspace.
Setup: Use your elimination result from Kata 1; do not call a black-box nullspace routine.
Repeat until:
- you never confuse reduced pivot columns with original pivot columns
- you can explain rank-nullity from the output
Kata 3: Gram-Schmidt and QR by Hand-Checked Code
Time limit: 20 minutes
Goal: Turn a linearly independent column set into an orthonormal basis and verify A = QR.
Setup: Start with 2 x 2 and 3 x 2 examples before trying generalization.
Repeat until:
- you can explain what each orthogonalization step removes
- your
Q^T Qcheck comes out close to identity
Kata 4: Power Iteration
Time limit: 20 minutes
Goal: Approximate the dominant eigenvector of a matrix by repeated multiplication and normalization.
Setup: Test on a symmetric matrix with a clearly dominant eigenvalue.
Repeat until:
- you can explain why the method converges in the cases where it should
- you can connect the observed behavior to spectral dominance
Kata 5: Truncated SVD Interpretation
Time limit: 20 minutes
Goal: Compute an SVD with a library routine only after first predicting what low rank should look like.
Setup: Use a small matrix with obvious redundancy, such as nearly repeated rows or columns.
Repeat until:
- you can explain what each singular value is saying
- you can justify why a rank-1 or rank-2 approximation is sensible
Completion Standard
- Can complete each kata inside the time window
- Can explain the structural reason behind each algorithm
- Can tell when a library call is hiding a conditioning or rank issue