**for**

**Background**

The formulas for linear least squares fitting
were independently derived by German mathematician Johann
Carl Friedrich Gauss (1777-1855) and the French
mathematician Adrien-Marie
Legendre (1752-1833).

**Theorem (****Least
Squares Line****
****Fitting****).****
** Given the data
points , the
least squares line that
fits the points has coefficients a and b given by:

and

.

**Proof ****Least
Squares Lines** **Least
Squares Lines**

**Remark.** The least
squares line is often times called the line of regression.

**Computer
Programs ****Least
Squares Lines** **Least
Squares Lines**

**Mathematica Subroutine (Least Squares
Line).**

**Example 1.** Find the
standard "least squares line" for
the data points

.

Use the subroutine **Regression** to find the
line. Compare with the line obtained with
*Mathematica*'s **Fit** procedure.

**Solution
1.**

**Example 2.** Find the
other "Least Squares Lines" for
the data points

.

Use the subroutine **Regression** to find the line.

**2 (a).** Use the
computer to find the least squares lines .

**2 (b).** Is it the same
as the line we found in Example 1 ? Why?

**Solution
2.**

**Example 3.** Find the
point of intersection of the two lines.

**Solution
3.**

**Philosophy.** What
comes first the chicken or the egg ? Which coordinate is
more sacred, the abscissas or the ordinates. We are always
free to choose which variable is independent when we graph a
line; or . When
you realize that two different "least squares lines" can be produced
we are amazed. What should we do ? Which line
should we use ? You must decide a priori which variable is
independent and which is dependent and then proceed. Exercise 3 asked
you to think about the mathematics that is involved with this
"paradox."

**Another "Fit"
Theorem (Power Fit).**

.

**Remark.** The case m
= 1 is a line that passes through the origin.

**Proof ****Least
Squares Lines** **Least
Squares Lines**

**Mathematica Subroutine (Power
Curve).**

**Example 4.** Find
"modified least squares line" of the form for
the data points .

**Solution
4.**

**Application to Astronomy**

In 1601 the German astronomer Johannes Kepler (1571-1630) formulated the third law of planetary motion , where is the distance to the sun measured in millions of kilometers, is the orbital period measured in days, and is a constant. The observed data pairs for the first four planets: Mercury, Venus, Earth, and Mars are .

**Example 5.** Find the
power curve for
the data points .

**Solution
5.**

**Old Lab Project (****Least
Squares Lines** **Least
Squares
Lines****).** Internet
hyperlinks to an old lab project.

**Research Experience for
Undergraduates**

**Least
Squares Lines** **Least
Squares Lines** Internet hyperlinks to web
sites and a bibliography of articles.

**Download this
Mathematica Notebook****
****Least
Squares Lines**

**Return
to Numerical Methods - Numerical Analysis**

(c) John H. Mathews 2004