QR Factorization
QR factorization is one of the most efficient and widely used methods for diagonalizing general matrices, including symmetric and non-symmetric matrices. The QR algorithm works by iteratively decomposing a matrix into the product of an orthogonal matrix and an upper triangular matrix . By repeatedly applying this decomposition and reconstructing the matrix as , the matrix converges to a diagonal or triangular form, from which the eigenvalues can be extracted. The eigenvectors are obtained from the accumulated product of the matrices.
Mathematical Foundation
For a matrix , the QR factorization is given by:
where:
- is an orthogonal matrix (),
- is an upper triangular matrix.
The QR algorithm iteratively applies this factorization to converge to a diagonal or triangular form:
- Start with .
- For each iteration :
- Compute the QR factorization: .
- Reconstruct the matrix: .
- Repeat until converges to a diagonal or triangular matrix.
The eigenvalues of are found on the diagonal of the final matrix , and the eigenvectors are obtained from the product of all matrices.
Algorithm
Initialization:
- Start with the matrix .
QR Factorization:
- Decompose into and :
Reconstruction:
- Reconstruct the matrix as:
Accumulate Transformations:
- Update the eigenvector matrix as:
- Initialize (identity matrix).
Check for Convergence:
- Repeat the process until is sufficiently diagonal or triangular (i.e., the off-diagonal elements are below a specified tolerance).
Extract Eigenvalues and Eigenvectors:
- The eigenvalues are the diagonal elements of the final .
- The eigenvectors are the columns of the final .
An Example
As an example we perform QR factorization of a real symmetrix matrix using single-precision arithmetic.
Step 1: Initialize
Start with the matrix :
Step 2: First QR Iteration
Step 2.1: Compute and
Perform QR factorization on using the Gram-Schmidt process.
First column of : Normalize the first column of :
Thus:
Second column of : Orthogonalize the second column of with respect to :
Compute :
Normalize :
Thus:
Third column of : Orthogonalize the third column of with respect to and :
Compute :
Normalize :
Thus:
Construct and :
Step 2.2: Update
Compute :
Step 3: Second QR Iteration
Step 3.1: Compute and
Perform QR factorization on the updated .
First column of : Normalize the first column of :
Thus:
Second column of : Orthogonalize the second column of with respect to :
Compute :
Normalize :
Thus:
Third column of : Orthogonalize the third column of with respect to and :
Compute :
Normalize :
Thus:
Construct and :
Step 3.2: Update
Compute :
Step 4: Check Convergence
Check if all off-diagonal elements are below the tolerance . In this case, the off-diagonal elements are already zero, so the matrix is diagonalized.
After convergence, the diagonalized matrix will be:
Final Result
The eigenvalues of computed using QR factorization with single precision are:
Key Takeaway
The QR factorization method with single precision produces eigenvalues that are close to the true values but may differ slightly due to rounding errors. For higher accuracy, double-precision arithmetic or more iterations with stricter convergence criteria are recommended.
Advantages
- Efficiency: The QR algorithm is highly efficient for large matrices.
- Versatility: It works for both symmetric and non-symmetric matrices.
- Stability: The algorithm is numerically stable and robust.
Limitations
- Computational Cost: The QR factorization step can be computationally expensive for very large matrices.
- Slow Convergence for Non-Symmetric Matrices: The algorithm may require many iterations for non-symmetric matrices.