The least-squares solution can be found by a simple method that almost seems like magic before you know its derivation:
This system of equations is usually called the system of normal
equations. For short, they can be written as
x
b, which you can think of as the result of multiplying both
sides of
x
b on the left by
and putting
for
. The matrix
will always be symmetric,
i.e.,
.
Example (continued from above).
,
d
b
,
so the normal equations are
.
Thus the solution is
, as mentioned above. (As you
see, this example was specially chosen for easy arithmetic; in general
is symmetric but not diagonal.)
Notice that
needs to be nonsingular. In practice
this is very likely to be the case. The reason why, as well as the
derivation of the normal equations will be explained below.