37.1: Least Squares Fit
- Page ID
- 70388
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
Review Chapters Chapter 13 pg 225-239 of the Boyd textbook.
In this first part of this course, we try to solve the system of linear equations \(Ax=b\) with an \(m \times n\) matrix \(A\) and a column vector \(b\).
There are three possible outcomes: an unique solution, no solution, and infinite many solutions. (Review the material on this part if you are no familiar with when the three types of outcomes happen.)
When \(m<n\), we call the matrix \(A\) underdeterminated, because we can not have an unique solution for it. When \(m>n\), we call the matrix \(A\) overdeterminated, becasue we may not have a solution with high probability.
However, if we still need to find a best \(x\), even when there is no solution or infinite many solutions we use a technique called least squares fit (LSF). Least squares fit find \(x\) such that \(\|Ax-b\|\) is the smallest (i.e. we try to minimize the estimation error).
- When there is no solution, we want to find \(x\) such that \(Ax−b\) is small (here, we want \(\|Ax-b\|\) to be small).
- If the null space of \(A\) is just \(\{0\}\), we can find an unique \(x\) to obtain the smallest \(\|Ax-b\|\).
- If there is a unique solution \(x^*\) for \(Ax=b\), then \(x^*\) is the optimal \(x\) to obtain the smallest \(\|Ax-b\|\), which is 0.
- Because the null space of \(A\) is just \(\{0\}\), you can not have infinite many solutions for \(Ax=b\).
- If the null space of \(A\) is not just \(\{0\}\), we know that we can always add a nonzero point \(x_0\) in the null space of \(A\) to a best \(x^*\), and \(\|A(x^*+x_0)-b\|=\|Ax^*-b\|\). Therefore, when we have multiple best solutions, we choose to find the \(x\) in the rowspace of \(A\), and this is unique.
Let \(A=\begin{bmatrix}1\\2\end{bmatrix},\quad b=\begin{bmatrix}1.5 \\ 2\end{bmatrix}\). Find the best \(x\) such that \(\|Ax-b\|\) has the smallest value.
Compute \((A^\top A)^{-1}A^\top b\).


