Problem: Let
be a finite set
of points in the plane. Find a formula for the linear function
which minimizes the sum of squares of errors.
If
is a sequence of numbers, then
For example, if ,
,
, the
; while
.
Sometimes, the inidices are omitted. So that we write for
.
![]() |
![]() |
![]() |
(1) |
![]() |
![]() |
![]() |
(2) |
Setting
we find
Substituting in the equation
and
clearing denominators, we find
which yields
![]() |
![]() |
![]() |
(3) |
![]() |
![]() |
![]() |
(4) |
![]() |
![]() |
![]() |
(5) |
![]() |
![]() |
![]() |
(6) |
![]() |
![]() |
![]() |
(7) |
![]() |
![]() |
![]() |
(8) |
As a general rule,
.
Thus,
(except when
!). As
,
the point we found is a minimum.
Find the line which best fits
.
![]() |
![]() |
![]() |
(9) |
![]() |
![]() |
![]() |
(10) |
![]() |
![]() |
![]() |
(11) |
![]() |
![]() |
![]() |
(12) |
![]() |
![]() |
![]() |
(13) |
So