Equation of line from two points (general solution)

69 Views Asked by At

I'm looking for the equation of the line that goes through points $A(x_1, y_1)$ and $B(x_2, y_2)$, expressed in the format $a + bx = y$ where $b$ is the slope of the line. The solutions that I've found start by calculating the slope with $b = \frac{y_1-y_2}{x_1-x_2}$, but this equation has no solution for when $x_1=x_2$. Is there a general solution that includes vertical and horizontal lines?

2

There are 2 best solutions below

4
On

Firstly you need at least two unique points to find the equation of a line.
We know that equation of line given two points $\displaystyle ( x_{1} ,y_{1})$ and $\displaystyle ( x_{2} ,y_{2})$ is given by
$\displaystyle y-y_{1} =\frac{y_{2} -y_{1}}{x_{2} -x_{1}}( x-x_{1})$
However when $\displaystyle x_{2} =x_{1}$ you may say that the slope is undefined, but when we rearrange this equation we get $\displaystyle ( y-y_{1})( x_{2} -x_{1}) =( y_{2} -y_{1})( x-x_{1})$ and now pluggin $\displaystyle x_{2} =x_{1}$ we get that $\displaystyle x-x_{1} =0$ or the equation of line is $\displaystyle x=x_{1}$

0
On

Horizontal lines are included in the usual form, with the slope being zero since $y_1 = y_2$ for every $y$ on the horizontal case, so $b=0$ and $y=a$. Now you cannot include vertical lines for a lot of reasons. First and foremost, vertical lines are not functions i.e. there is no dependent variable $y=y(x)$.