Calculating gradient & Equation of a line