# Middle line between points

How can we calculate LINE that most fit the points T1(1,0) T2(2,0) T3(-1,1) T4(0,1)

$x= (1,2,-1,0)$

$y= (0, 0, 1, 1)$

$1= (1, 1, 1, 1)$

-
What is your definition of "best fit"? There are infinitely many answers to this question corresponding to infinitely many possible criteria for "best." – Jonathan Christensen Nov 6 '12 at 19:07

The traditional answer for the line is a linear regression which gets a nice description in chapter 15 of Numerical Recipes. Section 15.4 deals with the more general case like your parabola.

-

There are infinitely many "best" curves depending on the degree of your regression curve and on how you define your error term. One of the most commonly used regression methods is Least Squares, which minimizes the sum of the squares of the vertical errors. Using least squares, you will likely get a different "curve of best fit" for each degree polynomial you use(ie you will find a line of best fit, a quadratic curve of best fit, etc).

-

a)LINE that most fit the points $T1(1,0) \mspace{10mu} T2(2,0) \mspace{10mu} T3(-1,1) \mspace{10mu} T4(0,1)$

$x = (1 , 2 , -1 , 0)$

$y = (0 , 0 , 1 , 1)$

$1 = (1 , 1 , 1 , 1)$

Solving this: you got sistem of 2 equations:

$a < x, x> + b < 1, x> = < y, x>$
$a< x, 1> + b < 1, 1> = < y, 1>$

$< x, x>= x_1*x_1 + x_2*x_2 + x_3*x_3 + x_4*x_4 = 1*1 + 2*2 + (-1)*(-1) + 0*0 = 6$

$< 1, x> = < x, 1>= 1*x_1 + 1*x_2 + 1*x_3 + 1*x_4 = 1*1 + 1*2 + 1*(-1) + 1*0 = 2$

$< x, 1>= x_1*1 + x_2*1 + x_3*1 + x_4*1 = 1*1 + 2*1 + (-1)*1 + 0*1 = 2$

$< y, x>= x_1*y_1 + x_2*y_2 + x_3*y_3 + x_4*y_4 = 1*0 + 2*0 + (-1)*1 + 0*1= -1$

$< 1, 1> = 1 + 1 + 1 + 1 = 4$

$< y, 1> = y_1*1 + y_2*1 + y_3*1 + y_4*1 = 0*1 + 0*1 + 1*1 + 1*1 = 2$

Then you insert these results in upper equation:

$6a + 2b = -1$

$2a + 4b = 2$

$a=\frac{-2}{5} and \mspace{10mu} b=\frac{7}{10}$

Linear equation is: $\textbf{y = a x + b }$

Answer is:$\mspace{10mu} \mathbf{y = \frac{-2}{5} + \frac{7}{10} }$

-