To find the gradient of a straight line we can use the change in the X and Y directions.
The gradient (Slope) of a straight line is defined as :
Grad = (Change in Y) / (Change in X)
This is the basis of a very important area of mathematics and furthur expanding this logic aids in the understanding of many real-world problems that you may have to tackle in the future.