Signed area and volume
In two dimensions the columns and enclose a parallelogram with signed area The magnitude gives the area. The sign records whether the linear map preserves or reverses orientation. In higher dimensions the square-matrix determinant measures the signed volume factor.
Swapping rows reverses its sign, scaling a row scales it by the same factor, and adding a multiple of another row leaves it alone. These rules also follow from the determinant being alternating and linear in each row separately. A triangular matrix has determinant equal to the product of its diagonal entries. Track the row swaps and scalings while reducing.
For subtract twice the first row from the second. The resulting triangular matrix has diagonal entries so The map doubles ordinary area and preserves orientation.
Which maps have an inverse?
For an matrix the following are equivalent: rank zero kernel, a unique solution for every right-hand side, and nonzero determinant. Elimination explains the last link: there is a zero diagonal pivot in triangular form precisely when there are fewer than pivots. The inverse reverses the map. Reducing gives when the inverse exists.
For a single numerical system, use a solver such as elimination rather than computing the inverse and multiplying by For repeated solves with the same compute a factorisation once.
Triangular solves and LU
For the example, elimination gives
The entry in records the elimination multiplier. To solve solve from the top down, then from the bottom up. With row swaps the common convention is so use on the right of the first solve.
from sympy import Matrix
A = Matrix([[2, 1], [4, 3]])
L, U, swaps = A.LUdecomposition()
print(L.tolist(), U.tolist(), swaps)
print(list(A.LUsolve(Matrix([5, 11]))))[[1, 0], [2, 1]] [[2, 1], [0, 1]] []
[2, 1]Exercises
What happens to area and orientation under
Show solution✓ Checked
The determinant is The map multiplies ordinary area by and reverses orientation.
Find the inverse of
Show solution✓ Checked
The map sends to Subtracting from the first output reverses it, so the inverse has rows and
Use the factors above for
Show solution✓ Checked
The lower triangular solve gives so The upper triangular solve gives and so