input: find the equation of a line
given two points P = (2,4) and
Q = (9, -1).
The slope of a line passing through the two
points P = (x1, yi) and Q = (x2, y2)
У2 - У
is given by m =
X2 ー X1
We have that x1 = 2, y, = 4, x2 = 9,
У2 = -1.
Plug the given values into the formula for Slope:
m =
(-1) - (4
(9) - (2)
=
-5
7
5
=-+
Now, the y-intercept is b = y, - m • xj (or b = y2 - m • x2, the result is the same).
6=4-(-)・0=
38
7
Finally, the equation of the line can be written
in the form y = mx + b.
y=
5
38