Linear algebra - Find a quadratic function so that it fits these data

1.7k Views Asked by At

Fit a quadratic function of the form $f(t)=c_0+c_1t+c_2t^2$ to the data points (0, 0), (1, -9), (2, -2), (3, -19), using least squares.

I'd like to know how to use least squares to do this. Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

Xβ=y
design matrix X=
1 0 0
1 1 1
1 2 4
1 3 9
observation vector y =
0
-9
-2
-19
parametric vector β =
β0
β1
β2
Using least squares: X^{T}*Xβ=X^{T}y Solve for β to find the function $f(t)=β0+β1t+β2t^2$

0
On

You want to fit the function $f(t)=c_0+c_1t+c_2t^2$ to the data points $(0,0)$, $(1,-9)$, $(2,-2)$, and $(3,19)$, where we with a data point $(x,y)$ mean a combination $(t_0,f(t_0))$ for some real number $t_0$.

Consider the first point $(0,0)$. It says that $f(0)=0$, i.e., that $c_0+0c_1+0^2c_2=0$. This can also be written as $(1,0,0^2)(c_0,c_1,c_2)'=0$ (the apostrophe denotes transpose). Similarly we get that $(1,1,1^2)(c_0,c_1,c_2)'=-9$. Now do the same exercise for the points $(2,-2)$ and $(3,19)$. Summarize the equations in $c=(c_0,c_1,c_2)'$ as $Ac=b$ with design matrix $A$ and column vector $b=(0,-9,-2,19)'$. The least squares method gives the least squares estimator $\hat{c}=(A'A)^{-1}A'b$ of $c$. This now gives you the least squares fit $f(t)=\hat{c}_0+\hat{c}_1t+\hat{c}_2t^2$.