In this Chapter we will introduction two main algorithms for fitting problem, the least squares and QR decomposition.

The Fitting Problem

Like what we talk in Chapter4-Interpolation, we always want to find a proper function that go through all the given points. But it may be too costly sometimes. So does there any way to fit the given points? That’s where least squares works.

Suppose there are points

To fit with given function:

Given the weight matrix, label matrix and coefficient matrix:

Our goal is to let the loss function

To be least. Namely:

Rewrite it:

The problem turn out to be solve the equation above.

Least Squares


text title here...

example of least squares


example of least squares

QR Decomposition

If we Let

Then:

Connection Between Least Squares and QR Decomposition


Least squares and QR decompostion