Quadratic Fit 4D2Fb1
1. **State the problem:** We want to find the best values of $a$, $b$, and $c$ such that the quadratic function $$y = a + bx + cx^2$$ fits the given data points:
$$\begin{array}{c|ccccc} x & 0 & 1 & 2 & 3 & 4 \\ y & 4 & -4 & -1 & 4 & 11 \\ \end{array}$$
2. **Method:** We use the least squares method to find $a$, $b$, and $c$ that minimize the sum of squared errors between the observed $y$ values and the predicted values from the quadratic model.
3. **Set up the system:** For each data point $(x_i, y_i)$, the model predicts $$y_i = a + b x_i + c x_i^2.$$ We write this as a system of linear equations:
$$\begin{cases}
4 = a + b \cdot 0 + c \cdot 0^2 \\
-4 = a + b \cdot 1 + c \cdot 1^2 \\
-1 = a + b \cdot 2 + c \cdot 2^2 \\
4 = a + b \cdot 3 + c \cdot 3^2 \\
11 = a + b \cdot 4 + c \cdot 4^2
\end{cases}$$
4. **Matrix form:** Let
$$X = \begin{bmatrix} 1 & 0 & 0 \\ 1 & 1 & 1 \\ 1 & 2 & 4 \\ 1 & 3 & 9 \\ 1 & 4 & 16 \end{bmatrix}, \quad Y = \begin{bmatrix} 4 \\ -4 \\ -1 \\ 4 \\ 11 \end{bmatrix}, \quad \beta = \begin{bmatrix} a \\ b \\ c \end{bmatrix}.$$
The least squares solution is given by:
$$\beta = (X^T X)^{-1} X^T Y.$$
5. **Calculate $X^T X$ and $X^T Y$:**
$$X^T X = \begin{bmatrix} 5 & 10 & 30 \\ 10 & 30 & 100 \\ 30 & 100 & 354 \end{bmatrix}, \quad X^T Y = \begin{bmatrix} 14 \\ 39 \\ 121 \end{bmatrix}.$$
6. **Compute $(X^T X)^{-1}$:**
The inverse matrix is
$$ (X^T X)^{-1} = \begin{bmatrix} 2.7 & -1.8 & 0.3 \\ -1.8 & 1.4 & -0.2 \\ 0.3 & -0.2 & 0.04 \end{bmatrix}$$
7. **Find $eta$:**
$$\beta = (X^T X)^{-1} X^T Y = \begin{bmatrix} 2.7 & -1.8 & 0.3 \\ -1.8 & 1.4 & -0.2 \\ 0.3 & -0.2 & 0.04 \end{bmatrix} \begin{bmatrix} 14 \\ 39 \\ 121 \end{bmatrix} = \begin{bmatrix} 3 \\ -6 \\ 2 \end{bmatrix}.$$
8. **Interpretation:** The best fit quadratic function is:
$$y = 3 - 6x + 2x^2.$$