Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matrix methods for equation of a line

  1. Sep 1, 2011 #1

    zcd

    User Avatar

    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)?
     
  2. jcsd
  3. Sep 2, 2011 #2
    So you're given the points [itex]\vec{p}_1=(x_1, y_1)[/itex] and [itex]\vec{p}_2=(x_2, y_2)[/itex].

    A line is given by the equation

    [itex]
    a x + b y
    =\begin{pmatrix} a & b \end{pmatrix} \cdot \begin{pmatrix} x \\ y \end{pmatrix}
    = c
    [/itex]

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

    Note that if [itex] \det(\vec{p}_1, \vec{p}_2) = x_1 y_2 - x_2 y_1 = 0 \,, [/itex] (which happens when [itex] \vec{p}_1\propto\vec{p}_2[/itex])
    then the above does not make sense and the line must go through the origin, i.e. [itex]c=0[/itex].
    In which case,
    [itex] a x = - b y \quad \implies \quad y = -\frac{a}{b}x [/itex]
    and we can just use either point to find the single parameter determining the line
    [itex] \frac{a}{b} = -\frac{y_1}{x_1} = -\frac{y_2}{x_2} \ .[/itex]
     
    Last edited by a moderator: May 5, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matrix methods for equation of a line
  1. Matrix equation (Replies: 1)

  2. Matrix Equation (Replies: 8)

Loading...