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.

Please consider this as a request for some urgent help.

I have $N$ points $(x_i,y_i)$, $i = 1,2,3,...N$. I need to fit a straight line (to these points) of the form $y = mx+c$. I need a formula for calculating $m$ and $c$. I am not interested in any particular method or proof. I just need a formula. (hope fully of least squares solution).

share|improve this question
See formulae 12-15 here. –  J. M. Sep 26 '11 at 12:58
@Ross and J.M. : thank you very much for the help. –  Rajesh D Sep 26 '11 at 13:12

1 Answer 1

up vote 0 down vote accepted

The equation an derivation is given in chapter 15 of Numerical Recipes (obsolete versions are free) and probably most numerical analysis books. NR also gives routines to calculate all the parameters. The results also available in Excel. The equations are also given in Wikipedia, but you need to unpack the definitions to use them.

share|improve this answer

Your Answer


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.