By using the method of least squares, find the best line through the
points:

(-1, 0) ,
(1, -2) ,
(-2, 2) .

** Step 1.** The general equation of a line is
c_0 + c_1x = y . Plugging the data points into this formula
gives a matrix equation \mathrm{A}\mathbf{c} = \mathbf{y} .
\left[\Rule{0pt}{3.6em}{0pt}\right. \left]\Rule{0pt}{3.6em}{0pt}\right. \left[\begin{matrix}c_0\\c_1\end{matrix}\right]
= \left[\Rule{0pt}{3.6em}{0pt}\right. \left]\Rule{0pt}{3.6em}{0pt}\right.

** Step 2.** The matrix equation
\mathrm{A}\mathbf{c} = \mathbf{y} has
no solution, so instead we use the **normal equation**
\mathrm{A^T} \mathrm{A}\, \hat{\mathbf{c}} = \mathrm{A^T} \mathbf{y}

\mathrm{A^T} \mathrm{A} = \left[\Rule{0pt}{2.4em}{0pt}\right. \left]\Rule{0pt}{2.4em}{0pt}\right.

\mathrm{A^T} \mathbf{y} = \left[\Rule{0pt}{2.4em}{0pt}\right. \left]\Rule{0pt}{2.4em}{0pt}\right.

** Step 3.** Solving the normal equation gives the answer

\hat{\mathbf{c}} = \left[\Rule{0pt}{2.4em}{0pt}\right. \left]\Rule{0pt}{2.4em}{0pt}\right.

** Analysis.** Compute the predicted y values:
\hat{\mathbf{y}} = \mathrm{A}\hat{\mathbf{c}} .

\hat{\mathbf{y}} =
\left[\Rule{0pt}{3.6em}{0pt}\right. \left]\Rule{0pt}{3.6em}{0pt}\right.

Compute the error vector:\mathbf{e} = \mathbf{y} - \hat{\mathbf{y}} .

\mathbf{e} = \left[\Rule{0pt}{3.6em}{0pt}\right. \left]\Rule{0pt}{3.6em}{0pt}\right.

which corresponds to the formula

Compute the error vector:

Compute the total error:

You can earn partial credit on this problem.