Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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$$

share|improve this question
    
The tangent of the angle is equal to the ratio of the elements –  Elements in Space Jan 6 '13 at 9:16
    
Do you mean best fit in the least squares sense? –  mathemagician Jan 6 '13 at 9:45
    
yes, mean square sense symbalize best fit –  Iya Jan 6 '13 at 11:17
    
+1 I was coming here to ask this question because I couldn't find an answer on google boggle –  Erick Robertson Jun 6 at 11:25

2 Answers 2

$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)$.

share|improve this answer
    
This seems to be working very well. I have a sample set of points which are estimates to a linear relationship. I also know that the origin 0,0 will always be a solution. So this seems to be exactly what I needed. Thanks! +1 –  Erick Robertson Jun 6 at 11:26

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$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.