Convert two points to line eq (Ax + By +C = 0)

$\begingroup$

Say one has two points in the x,y plane. How would one convert those two points to a line? Of course I know you could use the slope-point formula & derive the line as following: $$y - y_0 = \frac{y_1-y_0}{x_1-x_0}(x-x_0)$$ However this manner obviously doesn't hold when $x_1-x_0 = 0$ (vertical line). The more generic approach should however be capable of define every line (vertical line would simply mean B = 0); $$Ax+By +C = 0$$

But how to deduce A, B, C given two points?

$\endgroup$ 1

1 Answer

$\begingroup$

Let $P_1:(x_1,y_1)$ and $P_2:(x_2,y_2)$. Then a point $P:(x,y)$ lies on the line connecting $P_1$ and $P_2$ if and only if the area of the parallellogram with sides $P_1P_2$ and $P_1P$ is zero. This can be expressed using the determinant as$$ \begin{vmatrix} x_2-x_1 & x-x_1 \\ y_2-y_1 & y-y_1 \end{vmatrix} = 0 \Longleftrightarrow (y_1-y_2)x+(x_2-x_1)y+x_1y_2-x_2y_1=0, $$so you get (up to scale) $A=y_1-y_2$, $B=x_2-x_1$ and $C=x_1y_2-x_2y_1$.

$\endgroup$ 3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like