Finding the gradient (slope)