Different forms for line equations $Ax + By + C = 0$

545 Views Asked by At

Let's say that we have a line $Ax + By + C_1 =0$ in a $xy$-plane.

We have some equations that can be used with this line, e.g.: $$d=\frac{\lvert C_1 - C_2 \rvert}{\sqrt{A^2+B^2}} \qquad\text{Distance between two parallel lines in the plane.}$$ $$d=\frac{\lvert Ax_1 + By_1+C_1 \rvert}{\sqrt{A^2+B^2}} \,\,\,\quad\text{Distance between line and a point $(x_1,y_1)$ in the plane.}$$

The $Ax + By + C_1$ can be represented in many ways. For instance, the following bullets represent the same one:

  • $2x - 4y + 15$
  • $4x - 8y + 30$
  • $x-2y+\frac{15}{2}$
  • $-2x + 4y - 15$
  • $-x + 2y - \frac{15}{2}$

Is there a difference in which type of expression do I use (e.g. from the list) when I use the equations I showed for $d$ or other things? I have heard that I should work with the line when $B > 0$.

4

There are 4 best solutions below

0
On

For formula 1, to get the distance between two parallel lines, you need both of the lines expressed with the same A and B (this will be possible, if they are parallel).

For the second formula, you can use any of the versions of the line. Two different equations that represent the same line must be proportional. If $Ax+By+Cz=0$ is version 1, any other version would be $\alpha Ax+\alpha By+\alpha Cz=0$. And then the distance to a point $(x_{1},y_{1})$ is:

$$d=\frac{|\alpha Ax_{1}+\alpha By_{1}+\alpha C_{1}|}{\sqrt{(\alpha A)^{2}+(\alpha B)^{2}}}=\frac{|\alpha||Ax_{1}+ By_{1}+ C_{1}|}{\sqrt{\alpha^{2}}\sqrt{A^{2}+B^{2}}}=\frac{|Ax_{1}+ By_{1}+ C_{1}|}{\sqrt{A^{2}+B^{2}}}$$

So you "recuperate" the original formula.

2
On

The form $$ Ax+By+C=0 \quad (*) $$ is a possible one for a general line in the 2D plane. I prefer transforming it into $$ (A, B)^\top (x, y) = - C $$ which if $(A,B) \ne 0$ is the equation of an affine hyperplane (here of course of dimension $2-1$, thus a line) with normal vector $$ (A,B)^\top $$ and signed distance $d = -C / \lVert (A, B)^\top \rVert$ to the origin.

What about $B$? If it is $0$, the normal vector is aligned with the $x$-axis, so the line is a vertical. You can not write it as $y = y(x)$ in this case, but rather $x = - C/A = d$.

The form $(*)$ is not unique, you can multiply it by any non-zero scalar $\alpha$ on both sides and it describes the same line.

$$ Ax+By+C=0 \iff \\ \alpha (Ax+By+C)=\alpha 0 \iff \\ (\alpha A)x + (\alpha B) y + (\alpha C)= 0 $$

The two distance formulas are invariant against such scaling too, so it will not matter what multiple you use.

$$ d =\frac{\lvert \alpha C_1 - \alpha C_2 \rvert}{\sqrt{(\alpha A)^2+(\alpha B)^2}} = \frac{\lvert \alpha \rvert}{\lvert \alpha \rvert} \frac{\lvert C_1 - C_2 \rvert}{\sqrt{A^2+B^2}} \\ d = \frac{\lvert \alpha Ax_1 + \alpha By_1+\alpha C_1 \rvert}{\sqrt{(\alpha A)^2+(\alpha B)^2}} =\frac{\lvert \alpha \rvert}{\lvert \alpha \rvert} \frac{\lvert Ax_1 + By_1+C_1 \rvert}{\sqrt{A^2+B^2}} \\ $$

5
On

No one among the 5 forms is better than others.

There are 2 forms that you haven't cited:

  • The Euler (or normal) form $x \cos(\theta) + y \sin(\theta)-p=0$ where $(p,\theta)$ are polar coordinates of the projection of the origin onto the line (connection with cartesian coordinates : $x=p \cos(\theta),y=p \sin(\theta).) \ $ Note that usually $p$ is taken as $\geq 0$. One of the big advantages of this representation is that we do not care any longer with the denominator $\sqrt{A^2+B^2}$ because it is equal to 1, plainly.

  • Another useful form is $\frac{x}{a}+\frac{y}{b}=1$ because it places into evidence the intersection points with the $x$ and $y$ axes as $(a,0)$ and $(0,b)$.

Edit: following an exchange with Widawensen, here are 2 examples showing the interest of Euler representation:

  • 1) How to express that 3 lines have a common point $(x,y)$ ? Like this:

$$\left(\begin{array}{c,c,c}\cos(\theta_1)&\sin(\theta_1)&-p_1\\ \cos(\theta_2)&\sin(\theta_2)&-p_2\\ \cos(\theta_3)&\sin(\theta_3)&-p_3 \end{array}\right)\left(\begin{array}{c}x \\y \\ 1\end{array}\right)=\left(\begin{array}{c}0\\0 \\ 0\end{array}\right).$$

In Linear algebra terms, it means that the dimension of the kernel is at least 1, or, in an equivalent way that the determinant of the matrix is $0$. Expanding this determinant with respect to the last column, we obtain the following criteria (for 3 lines to have a common point):

$$-p_1 \sin(\theta_3-\theta_2)+p_2 \sin(\theta_3-\theta_1)-p_3 \sin(\theta_2-\theta_1)=0.$$

  • 2) In the same vein, for three straight lines $L_k$ ($k=1,2,3$) in general position (not with a common point in general), if we name $V_1,V_2,V_3$ its vertices, with $V_{k}=L_{k+1} \cap L_{k+2}$ (with indices 4=1, 5=2...). Let $(x_k,y_k)$ be the coordinates of $V_k$; we have:

$$\left(\begin{array}{c,c,c}\cos(\theta_1)&\sin(\theta_1)&-p_1\\ \cos(\theta_2)&\sin(\theta_2)&-p_2\\ \cos(\theta_3)&\sin(\theta_3)&-p_3 \end{array}\right) \left(\begin{array}{c,c,c}x_1&x_2&x_3\\ y_1&y_2&y_3\\ 1&1&1\end{array}\right)= \left(\begin{array}{c,c,c}h_1&0&0\\ 0&h_2&0\\ 0&0&h_3\end{array}\right) $$

where $h_1,h_2,h_3$ are the altitudes of the triangle.

Nice, isn't it ?

0
On

The three homogeneous coordinates of a line $(A,B,C)$ are used to describe all points $(x,y,1)$ belonging to the line as

$$ P = (x,y,1) \\ L = (A,B,C) $$

then

$$ P \cdot L = 0 \\ Ax+By+C=0$$

Any scalar multiple of $P$ or $L will produce the same locus of points as long as all the coefficients are not zero.

You can define the magnitude of the line as $\| L\| = \| (A,B,C) \|= \sqrt{A^2+B^2}$ and the magnitude of a point $\| P \| = \| (x,y,w) \| = |w|$.

The distance between the line and the point is $$ d = \frac{P \cdot L}{\| P \| \|L \|}$$

The distance of the line to the origin is

$$ r = \frac{C}{\sqrt{A^2+B^2}} $$

If a line is normalized such that $\| L \|=\sqrt{A^2+B^2}=1$ then the third coordinate of $(A,B,C)$ is the distance to the origin.

The coefficients for the normalized line along the direction angle $\psi$, and distance from origin $r$ is

$$ L = (A,B,C)=(-\sin \psi, \cos \psi, r) $$

The point on the line closest to the origin in homogeneous coordinates is $$Q = (-A C, -B C, A^2+B^2) = (r \sin \psi,-r \cos\psi,1)$$

So mathematically all scalar multiples of $(A,B,C)$ work the same, you can assign geometric interpretations to the coefficients when $\sqrt{A^2+B^2}=1$. The $A$,$B$ quantities form the normal vector to the line, and the $C$ forms the distance to the origin.


PS. A line in 2D can be interpreted as a 2D projection of a 3D plane (normal vector + distance) with the normal vector being planar, just as a point in 2D is projection of a 3D point.

The same way in 3D three points define a plane, projected to 2D two points define a line (which is projection of a 3D plane). And in 3D three planes define a point, whereas in 2D two lines define a point.

So there is a correspondence in the coefficient notation in the plane to the coefficients of points and planes in 3D.