What is the slope of the line through the points (X1, Y1)
and (X2, Y2)
?
The equation for the slope is m = \dfrac{\color{BLUE}{y_2} - \color{ORANGE}{y_1}}{\color{BLUE}{x_2} - \color{ORANGE}{x_1}}
for points (\color{ORANGE}{X1}, \color{ORANGE}{Y1})
and (\color{BLUE}{X2}, \color{BLUE}{Y2})
.
Substituting in, we get m = \dfrac{\color{BLUE}{Y2} - \color{ORANGE}{negParens(Y1)}}{\color{BLUE}{X2} - \color{ORANGE}{negParens(X1)}} =
\dfrac{\color{GREEN}{Y2 - Y1}}{\color{PINK}{X2 - X1}}
So, the slope m
is fractionReduce( Y2 - Y1, X2 - X1 )
.