An archive of Mark's Spring 2018 Numerical Analysis course.

A least squares estimate

mark

Find the first order polynomial that is the best least squares fit to the data

\{(-1,1),(0,0),(1,3)\}.
theoldernoah

We need f(x) = ax+b where a and b minimize the following function F.

F(a,b)= (a*(-1)+b-1)^2+(a*0+b-0)^2+(a*1+b-3)^2

\frac{dF}{da} = -2(-a+b-1)+2(a+b-3)= 4a-4=0

\frac{dF}{db}= 2(-a+b-1)+2b+2(a+b-3)=0a+6b-8=0

We can see from the second equation, \frac{dF}{db}, that b= \frac{4}{3} and from the first, \frac{dF}{da}, that a=1.
Thus our function is f(x)=x+\frac{4}{3}.

mark

@theoldernoah This looks mostly great - definitely the right approach! When I graph your function with the data, though, I get something that looks like so:

temp

Makes me wonder what that b^2 in your first equation is doing there. :rage:

Lorentz

I think @theoldernoah has it. :1st_place_medal:

numeric_plot