How the equation is derived
Given two points (x1, y1) and (x2, y2), the slope m is calculated as (y2 - y1) / (x2 - x1). With the slope known and one point on the line, the equation can be written in point-slope form and then converted to slope-intercept or standard form.
If x1 equals x2 the line is vertical and has no finite slope. The equation is simply x = x1. Vertical lines cannot be expressed in slope-intercept form.
m = (y2 - y1) / (x2 - x1)
Slope from two points.
y = mx + b
Slope-intercept form, where b is the y-intercept.