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.

The situation is this: a series of points are randomly located, a line is needed to represent the gradient of those points.

  /  .

. / ./ / .

I am a programmer but not math expert, I need the method to find such a line. Can anyone give me some direction?

Thanks in advance.

share|improve this question

1 Answer 1

There is a technique called "least squares linear fit." Those keywords should help you find a discussion in a textbook or on the web.

share|improve this answer
Cool, this looks like what I need, thanks a lot! –  Truman's world Jan 28 '13 at 13:25
You have the option of "accepting" the answer, by clicking in the check mark next to it. –  Gerry Myerson Jan 28 '13 at 22:30

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.