Prove the general equation of a line using linear algebra

euclidean-geometrylinear algebra

It is known that the equation $ax + by + c = 0$ can represent any line in a two dimensional Cartesian coordinate system. How to prove that using linear algebra?

Let $P = (P_x, P_y)$ and $Q = (Q_x, Q_y)$ define a straight line $r$ in such system. I can see that $k\overrightarrow{(Q – P)}$ represents a new line $s$ that has the same slope as $r$, for $k \in \mathbb{R}$. However, it's not always true that $s = r$ because $r$ seems to be translated by a factor of $c$ and I'm not sure how to deal with that.

Best Answer

As we discussed in the comments, for a point $(x,y)$ on the line we have $$\begin{bmatrix}x\\y\end{bmatrix} = \begin{bmatrix}P_x\\P_y\end{bmatrix} + k\left(\begin{bmatrix}Q_x\\Q_y\end{bmatrix} - \begin{bmatrix}P_x\\P_y\end{bmatrix}\right) = \begin{bmatrix}P_x\\P_y\end{bmatrix} + k\begin{bmatrix}Q_x - P_x\\Q_y - P_y\end{bmatrix}$$

Now, define $a = Q_y - P_y$, $b = -(Q_x - P_x)$, and $-c = aP_x + bP_y$.

Then,

$$\begin{bmatrix} x\\y\end{bmatrix} \cdot \begin{bmatrix}a\\b\end{bmatrix} = \left( \begin{bmatrix}P_x\\P_y\end{bmatrix} + k\begin{bmatrix}Q_x - P_x\\Q_y - P_y\end{bmatrix} \right) \cdot \begin{bmatrix} a\\b\end{bmatrix} = \begin{bmatrix}P_x\\P_y\end{bmatrix} \cdot \begin{bmatrix}a\\b\end{bmatrix} + k\begin{bmatrix}Q_x - P_x\\Q_y - P_y\end{bmatrix} \cdot \begin{bmatrix}a\\b\end{bmatrix}$$

Now, by working out the dot products we should get $$\begin{bmatrix}x\\y\end{bmatrix} \cdot \begin{bmatrix}a\\b\end{bmatrix} = ax + by$$ $$\begin{bmatrix}P_x\\P_y\end{bmatrix} \cdot \begin{bmatrix}a\\b\end{bmatrix} = -c$$ $$\begin{bmatrix}Q_x - P_x\\Q_y - P_y\end{bmatrix} \cdot \begin{bmatrix}a\\b\end{bmatrix} = 0$$

So we get the desired equation:

$$ax + by + c = 0$$

The chosen definitions for $a$ and $b$ should make a lot of sense when you realize that $m = -\frac{a}{b}$ is the traditionally defined slope of the line.

Related Question