# How to calculate the approximate gradient of a series of points?

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?