gradient is change in y over change in x.
if (x1,y1) and (x2,x1) are lines on a graph then the change in y is y2-y1 and change in x is x2-x1, and since they are both on the line y1=mx1+c and y2=mx2+c, so
y2-y1=(mx2+c)-(mx1+c)=mx2-mx1=m(x2-x1), so m=(y2-y1)/(x2-x1) which is the gradient