How do I find the angle $\theta$ of the line through the origin that matches the given points the best?

974 Views Asked by At

How to find angle $\theta$, that the line passing through the origin that is the best fit for the points given below in the mean square sense makes with the horizontal axis. $$x_1=[1\;\; 2]^T$$ $$x_2=[2\;\; 1]^T$$ $$x_3=[2\;\; 3]^T$$

2

There are 2 best solutions below

0
On

Hint: If the line passing through the points makes an angle of $\theta$ with the horizontal $x-$axis, passing through the origin, the equation of the line is $y=\tan(\theta)x$.

1
On

$Y=[2\;\; 1\;\; 3]^T$ $X=[1\;\; 2\;\; 2]^T$

You want to find a $\beta$ such that $X\beta=\hat{Y}$ minimizes the squared distance from $Y$. The scalar that you are looking for is $\beta=(X'X)^{-1}X'Y =\frac{1}{9}\cdot 10 = \frac{10}{9}$. If you are wondering about the formula, it comes from first and second order conditions that yield a minimum for the squared residuals. Then $\theta=arctan(\beta)$.