A) Find the best fit (in the sense of least-squares) to the data
$x_1$ $(1,-1,-1,1)$
$x_2$ $(1,1,-1,-1)$
$y$ $(5,1,1,1)$
by a linear function of the form $y$=$a$+$bx_1$+$cx_2$
B) Find the projection of vector $(5,1,1,1)$ onto the subspace of $R^4$ spanned by vectors $(1,1,1,1)$, $(1,-1,-1,1)$ and $(1,1,-1,-1)$.
You have been asked to find $a$, $b$ and $c$ such that (in a least square sense) $$\left[ {\begin{array}{*{20}{c}}5\\1\\1\\1\end{array}} \right] = a\left[ {\begin{array}{*{20}{c}}1\\1\\1\\1\end{array}} \right] + b\left[ {\begin{array}{*{20}{c}}1\\{ - 1}\\{ - 1}\\1\end{array}} \right] + c\left[ {\begin{array}{*{20}{c}}1\\1\\{ - 1}\\{ - 1}\end{array}} \right]$$By rearranging, you get the overdetermined system $$\left[ {\begin{array}{*{20}{c}}5\\1\\1\\1\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}1&1&1\\1&{ - 1}&1\\1&{ - 1}&{ - 1}\\1&1&{ - 1}\end{array}} \right]\left[ {\begin{array}{*{20}{c}}a\\b\\c\end{array}} \right]$$To solve in a least square sense, it suffices to solve the normal equation (which is obtained by multiplying the transpose of the coefficients matrix in both sides), that is$$\left[ {\begin{array}{*{20}{c}}1&1&1&1\\1&{ - 1}&{ - 1}&1\\1&1&{ - 1}&{ - 1}\end{array}} \right]\left[ {\begin{array}{*{20}{c}}1&1&1\\1&{ - 1}&1\\1&{ - 1}&{ - 1}\\1&1&{ - 1}\end{array}} \right]\left[ {\begin{array}{*{20}{c}}a\\b\\c\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}1&1&1&1\\1&{ - 1}&{ - 1}&1\\1&1&{ - 1}&{ - 1}\end{array}} \right]\left[ {\begin{array}{*{20}{c}}5\\1\\1\\1\end{array}} \right]$$upon simplification we get$$\left[ {\begin{array}{*{20}{c}}4&0&0\\0&4&0\\0&0&4\end{array}} \right]\left[ {\begin{array}{*{20}{c}}a\\b\\c\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}8\\4\\4\end{array}} \right]$$Hope it helps ;)