# channelflow.org

### Site Tools

gibson:teaching:fall-2016:math753:qr-leastsquares

# Differences

This shows you the differences between two versions of the page.

 gibson:teaching:fall-2016:math753:qr-leastsquares [2016/10/12 09:16]gibson gibson:teaching:fall-2016:math753:qr-leastsquares [2016/10/12 09:18] (current)gibson Both sides previous revision Previous revision 2016/10/12 09:18 gibson 2016/10/12 09:16 gibson 2016/10/12 09:16 gibson 2016/10/12 09:15 gibson 2016/10/12 09:12 gibson 2016/10/12 09:02 gibson created 2016/10/12 09:18 gibson 2016/10/12 09:16 gibson 2016/10/12 09:16 gibson 2016/10/12 09:15 gibson 2016/10/12 09:12 gibson 2016/10/12 09:02 gibson created Line 9: Line 9: Let $r = Ax-b$. Thinking geometrically,​ $\|r\| = \|Ax-b\|$ will be smallest when $r$ is orthogonal to the span of the columns of $A$. Recall that for the QR factorization $A=QR$, the columns of $Q$ are an orthonormal basis for the span of the columns of $A$. So $r$ is orthogonal to the span of the columns of $A$ when Let $r = Ax-b$. Thinking geometrically,​ $\|r\| = \|Ax-b\|$ will be smallest when $r$ is orthogonal to the span of the columns of $A$. Recall that for the QR factorization $A=QR$, the columns of $Q$ are an orthonormal basis for the span of the columns of $A$. So $r$ is orthogonal to the span of the columns of $A$ when - \begin{align*} + \begin{equation*} - Q^T r = 0\\ + Q^T r = 0 - Q^T (Ax-b) = 0\\ + \end{equation*} - Q^T A x = Q^T b \\ + \begin{equation*} - Q^T Q R x = Q^T b \\ + Q^T (Ax-b) = 0 + \end{equation*} + \begin{equation*} + Q^T A x = Q^T b + \end{equation*} + \begin{equation*} + Q^T Q R x = Q^T b + \end{equation*} + \begin{equation*} R x = Q^T b R x = Q^T b - \end{align*} + \end{equation*} Since $Q$ is an $m \times n$ matrix whose columns are orthonormal,​ $Q^T Q = I$ is the $n \times n$ identity matrix. Since $R$ is $n\times n$, we now have as the same number of equations as unknowns. The last line, $Rx = Q^Tb$, is a square upper-triangular system which we can solve by backsubstitution. Since $Q$ is an $m \times n$ matrix whose columns are orthonormal,​ $Q^T Q = I$ is the $n \times n$ identity matrix. Since $R$ is $n\times n$, we now have as the same number of equations as unknowns. The last line, $Rx = Q^Tb$, is a square upper-triangular system which we can solve by backsubstitution.