Lecture from 18.10.2024 | Video: Videos ETHZ
Calculating the Inverse
We can use Gauss-Jordan elimination to find the inverse of a matrix, if it exists. The method relies on the fact that if a matrix is invertible, then applying Gauss-Jordan elimination to the augmented matrix (where is the identity matrix) will result in .
Algorithm
- Augment the matrix: Form the augmented matrix .
- Apply Gauss-Jordan elimination: Transform the left side of the augmented matrix () into the identity matrix using elementary row operations. Apply the same row operations to the right side ().
- Extract the inverse: If the left side becomes , then the right side is the inverse . If the left side cannot be transformed into (e.g., if a row of zeros appears on the left), then is not invertible.
Example
Let’s find the inverse of the matrix:
- Augmented Matrix:
-
Gauss-Jordan Elimination:
a. Divide row 1 by 2:
b. Subtract row 1 from row 2:
c. Multiply row 2 by 2:
d. Subtract (1/2) * row 2 from row 1:
-
Extract Inverse: The left side is now the identity matrix, so the right side is the inverse:
Why this works
The elementary row operations performed on the augmented matrix can be viewed as multiplying by a sequence of elementary matrices. If is invertible, the product of these elementary matrices will be . Thus, applying these operations transforms the left side to and the right side to .
LU and LUP Decomposition
LU and LUP decomposition are valuable tools for solving linear systems for multiple right-hand sides ( vectors) efficiently. Instead of performing Gaussian elimination for each , we can decompose once and then use forward and backward substitution for each .
LU Decomposition
LU decomposition factors a matrix into a lower triangular matrix and an upper triangular matrix , such that . This decomposition is closely related to Gaussian elimination.
Connection to Gaussian Elimination
The entries of and are directly derived from the Gaussian elimination process. Specifically:
- U: is the upper triangular matrix that results after performing Gaussian elimination on .
- L: is a lower triangular matrix where:
- The diagonal entries are all 1s.
- The entries below the diagonal are the multipliers () used during elimination. represents the multiple of row that was subtracted from row to eliminate the element in the -th row and -th column.
Illustrative Example (3x3 case)
Let’s illustrate with a 3x3 matrix . Gaussian elimination involves multiplying by a series of elementary matrices (each representing a single row operation) to transform it into an upper triangular matrix . These elementary matrices, when combined, form the inverse of ().
Consider the elementary matrices corresponding to the elimination steps:
-
Eliminating the first column (below the diagonal):
-
Eliminating the second column (below the diagonal):
Multiplying these elementary matrices gives us:
Therefore, .
Taking the inverse of gives us :
Thus, we arrive at the LU decomposition: .
General Case
This pattern holds for larger matrices as well. will always be a lower triangular matrix with 1s on the diagonal and the multipliers below the diagonal. will be the upper triangular result of Gaussian elimination. Here is a proof:
Theorem 3.13: Let A be an matrix on which Gaussian elimination succeeds without row exchanges, resulting in an upper triangular matrix . Let be the multiple of row that we subtract from row when we eliminate in column . Then where:
Proof (which I think is easier)
The proof relies on representing the row operations in Gaussian elimination as multiplication by elementary matrices.
-
Elementary Matrices: Each row operation in Gaussian elimination (subtracting a multiple of one row from another) can be represented by an elementary matrix. For the operation of subtracting times row from row , the elementary matrix is the identity matrix with in the position.
-
Gaussian Elimination as Matrix Multiplication: Gaussian elimination, without row exchanges, can be expressed as a sequence of multiplications by these elementary matrices. Let be the elementary matrices representing the row operations performed to transform into . Then:
-
Inverse of Elementary Matrices: The inverse of an elementary matrix is simply the identity matrix with in the position. This represents the reverse operation (adding times row back to row ).
-
Constructing L: The key insight is that the product of the inverses of the elementary matrices, in the reverse order, forms the lower triangular matrix :
Note: The reason we switch the order when inverting multiple matrices is simple:
When we calculate this product, the multipliers “accumulate” in the appropriate positions below the diagonal of , resulting in the structure defined in Theorem 3.13. The diagonal entries remain 1s because the diagonal entries of the inverse elementary matrices are also 1s.
-
Completing the Proof: Substituting back into the equation for :
Multiplying both sides by gives us:
This proves that can be decomposed into the product of a lower triangular matrix (constructed from the Gaussian elimination multipliers) and an upper triangular matrix (the result of Gaussian elimination).
This proof demonstrates how the LU decomposition systematically captures the row operations performed during Gaussian elimination, allowing us to efficiently solve for multiple right-hand sides.
Proof (from the script)
-
Focus on a single row: Consider a fixed row of . Whenever we change row , we subtract from it, for some previous row . At this point, row is “finalized” (meaning it has been transformed into its final form in ).
-
Expressing row of : We can express row of at any point during Gaussian elimination as a linear combination of the finalized rows of (rows 1 to ) and the current state of row .
-
Step-by-step breakdown:
-
Initially: Row of is just its initial value.
-
Step 1: We subtract times the first finalized row (row 1 of ) from row of :
-
Step 2: We subtract times the second finalized row (row 2 of ) from the current row of :
-
And so on, until step .
-
After step : Row is finalized and becomes row of .
-
-
Rearranging the equation: We can rearrange the equation from step to express the original row of as:
-
Matrix Notation: This linear combination can be written compactly using matrix notation: This is a row vector multiplied by .
-
Constructing L: Stacking these row vector representations for all rows of (from to ) forms the equation . The matrix is constructed as follows:
This construction of , where the multipliers appear below the diagonal, directly reflects the row operations performed during Gaussian elimination. This completes the proof that when Gaussian elimination succeeds without row exchanges.
Solving with LU
Once we have the decomposition , solving becomes a two-step process:
- Forward Substitution: Solve for . Since is lower triangular, this is done efficiently by solving for the first element, substituting it into the next equation to solve for the second, and so on.
- Backward Substitution: Solve for . Since is upper triangular, this can similarly be solved efficiently starting with the last variable.
Why LU Decomposition Works for Solving Ax = b
The LU decomposition provides an efficient way to solve because it breaks down the problem into two simpler steps that are easier to solve than the original system. Here’s the breakdown:
-
Decomposition: We decompose the original matrix into and such that . This step is analogous to the elimination phase of Gaussian elimination, where we transform into an upper triangular matrix. The matrix essentially stores the operations performed during this elimination process.
-
Substitution: We now have the equation . We introduce an intermediate vector such that . This gives us two equations:
- : This is solved using forward substitution. Since is lower triangular, we can easily solve for from the first equation, substitute that value into the second equation to solve for , and so on.
- : Once we have , we solve for using backward substitution. Because is upper triangular, we can solve for from the last equation, substitute that value into the second-to-last equation to solve for , and so on.
In essence, the LU decomposition restructures the Gaussian elimination process:
- The LU decomposition itself () represents the elimination steps.
- The forward substitution () calculates the right-hand side of the simplified system after elimination.
- The backward substitution () performs the back-substitution phase of Gaussian elimination.
This method is more efficient when solving for multiple vectors because we only need to decompose once. For each subsequent , we simply perform the forward and backward substitutions, which are significantly faster than repeating the entire Gaussian elimination process.
LUP Decomposition
When row exchanges are required during Gaussian elimination, a permutation matrix is introduced, giving the LUP decomposition: .
Permutation Matrix Example
A permutation matrix is a square matrix used to represent row exchanges. Each row and column contains exactly one entry of and s elsewhere. For example, if we swap the first and second rows of a identity matrix , the permutation matrix would be:
Applying to a vector or matrix permutes its rows accordingly.
Solving with LUP
- Permute : Compute .
- Forward Substitution: Solve for .
- Backward Substitution: Solve for .
When LU Decomposition Fails
LU decomposition (without pivoting) fails when a zero appears on the diagonal during elimination. This prevents the calculation of multipliers needed for . LUP decomposition addresses this by incorporating row exchanges.
Efficiency
- Decomposition: Both LU and LUP decomposition require operations (or slightly faster using Strassens algorithm and similar…), similar to Gaussian elimination.
- Solving for multiple : Once , and are computed, solving for different vectors only takes time (forward and backward substitution). This makes LU/LUP decomposition much more efficient than performing Gaussian elimination for each new .
Continue here: 11 Gauss-Jordan, REF, RREF, Properties of REF