Method of Least Square Consider the points (x1, y1), (x2, y2), (x3, y3), ………., (xn, yn) shown on the graph. x1 x2 x3 The blue line has the equation y=mx+b We will find m and b so that the error is least. E = ( m * x1 + b - y1 ) 2 + ( m * x2 + b - y2 ) 2 + ( m * x3 + b - y3 ) 2 + ……. We must have: dE 0 dm at cons tan t b dE 0 db at cons tan t m 2(m*x1 + b -y1)*x1 + 2(m*x2 + b -y2)*x2 + 2(m*x3 + b -y3)*x3 + ….. = 0 and 2(m*x1 + b -y1) + 2(m*x2 + b -y2) + 2(m*x3 + b -y3) + ….. = 0 where we used the chain rule. The equations can be written as: m ( x1*x1 + x2*x2 + x3*x3 + ……) + b ( x1 + x2 + x3 + ….) = x1*y1 + x2*y2 + x3*y3 + ….. m ( x1 + x2 + x3 + …) + b ( 1 + 1 + 1 + …) = y1 + y2 + y3 +….. Using the summation notation we can write: m nk 1 m x xk2 b b (n x ) nk 1 xk yk y Solving for m we get: 1 n k 1 xk yk ) x y m n 1 ( nk 1 xk 2 ) x 2 n ( If you can show that this is the same equation as the one in the book you will get 10 points added to your score of 1000.