Skip to main content

Section 1 QR factorization

Suppose \(A\) is an \(m\times n\) matrix with independent columns. A \(QR\)-factorization of \(A\) is a factorization of the form \(A=QR\text{,}\) where \(Q\) is \(m\times n\text{,}\) with orthonormal columns, and \(R\) is an invertible upper-triangular (\(n\times n\)) matrix with positive diagonal entries. If \(A\) is a square matrix, \(Q\) will be orthogonal.

A lot of the methods we're looking at here involve more sophisticated numerical techniques than SymPy is designed to handle. If we wanted to spend time on these topics, we'd have to learn a bit about the NumPy package, which has built in tools for finding things like polar decomposition and singular value decomposition.

However, SymPy does know how to do \(QR\) factorization. After defining a matrix A, we can use the command

Q, R = A.QRdecomposition()

.