Matrix methods for equation of a line

  • Thread starter Thread starter zcd
  • Start date Start date
  • Tags Tags
    Line Matrix
zcd
Messages
197
Reaction score
0
Given two points on R2 how would one find the constants a,b,c such that
ax+by+c=0 gives the line crossing the two points (with matrix methods)?
 
Physics news on Phys.org
So you're given the points \vec{p}_1=(x_1, y_1) and \vec{p}_2=(x_2, y_2).

A line is given by the equation

<br /> a x + b y <br /> =\begin{pmatrix} a &amp; b \end{pmatrix} \cdot \begin{pmatrix} x \\ y \end{pmatrix} <br /> = c<br />

Which, assuming c \neq 0, can be rescaled to
<br /> \begin{pmatrix} a &amp; b \end{pmatrix} \cdot \begin{pmatrix} x \\ y \end{pmatrix} = 1<br />
Then the two points must satisfy
\begin{align}<br /> &amp;\begin{pmatrix} a &amp; b \end{pmatrix}\cdot\begin{pmatrix}x_1&amp;x_2 \\ y_1&amp;y_2\end{pmatrix} = \begin{pmatrix} 1 &amp; 1 \end{pmatrix} \\<br /> \implies<br /> &amp;\begin{pmatrix} a &amp; b \end{pmatrix} = \begin{pmatrix} 1 &amp; 1 \end{pmatrix}<br /> \begin{pmatrix}x_1&amp;x_2 \\ y_1&amp;y_2\end{pmatrix}^{-1}<br /> =\frac{1}{x_1 y_2 - x_2 y_1}\begin{pmatrix} y_1-y_2 &amp; x_1-x_2\end{pmatrix}<br /> \end{align}
And so we have the equation for the line. (This is just "[URL rule[/URL])

Note that if \det(\vec{p}_1, \vec{p}_2) = x_1 y_2 - x_2 y_1 = 0 \,, (which happens when \vec{p}_1\propto\vec{p}_2)
then the above does not make sense and the line must go through the origin, i.e. c=0.
In which case,
a x = - b y \quad \implies \quad y = -\frac{a}{b}x
and we can just use either point to find the single parameter determining the line
\frac{a}{b} = -\frac{y_1}{x_1} = -\frac{y_2}{x_2} \ .
 
Last edited by a moderator:
Back
Top