MTH168 · 2080 · 5 marks
Find the equation y = a0 + a1 x of the least squares line that best fits the data points (2,1), (5,2), (7,3), (8,3).
Find the equation $y = a_0 + a_1 x$ of the least squares line that best fits the data points (2,1), (5,2), (7,3), (8,3). [5]
Least Squares Line: $y = a_0 + a_1x$
Given data
Points: $(2,1), (5,2), (7,3), (8,3)$, with $n = 4$.
Normal Equations
$$\sum y = na_0 + a_1\sum x$$ $$\sum xy = a_0\sum x + a_1\sum x^2$$
Computing Sums
| $x$ | $y$ | $x^2$ | $xy$ |
|---|---|---|---|
| 2 | 1 | 4 | 2 |
| 5 | 2 | 25 | 10 |
| 7 | 3 | 49 | 21 |
| 8 | 3 | 64 | 24 |
| $\sum x=22$ | $\sum y=9$ | $\sum x^2=142$ | $\sum xy=57$ |
Substituting
$$9 = 4a_0 + 22a_1 \quad (1)$$ $$57 = 22a_0 + 142a_1 \quad (2)$$
Solving
Multiply (1) by 22, (2) by 4:
$$198 = 88a_0 + 484a_1 \quad (3)$$ $$228 = 88a_0 + 568a_1 \quad (4)$$
Subtract (3) from (4):
$$30 = 84a_1 \implies a_1 = \frac{30}{84} = \frac{5}{14} \approx 0.357$$
Substitute into (1):
$$9 = 4a_0 + 22\cdot\frac{5}{14} = 4a_0 + \frac{55}{7}$$ $$4a_0 = 9 - \frac{55}{7} = \frac{8}{7} \implies a_0 = \frac{2}{7} \approx 0.286$$
Result
$$\boxed{y = \frac{2}{7} + \frac{5}{14}x \approx 0.286 + 0.357x}$$
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.