# Direct formula for area of a triangle formed by three lines, given their equations in the cartesian plane.

I read this formula in some book but it didn't provide a proof so I thought someone on this website could figure it out. What it says is: If we consider 3 non-concurrent, non parallel lines represented by the equations : $$a_1x+b_1y+c_1=0$$ $$a_2x+b_2y+c_2=0$$ $$a_3x+b_3y+c_3=0$$ Then the area of the triangle that these lines will enclose is given by the magnitude of : $$\frac{det\begin{bmatrix}a_1 & b_1 & c_1\\a_2 & b_2 & c_2\\a_3 & b_3 & c_3\end{bmatrix}^2}{2C_1C_2C_3}$$ Where $C_1,C_2,C_3$ are the co-factors of $c_1,c_2,c_3$ respectively in the above matrix.

What I'm wondering is, where did this come from? And why isn't it famous? Earlier we had to calculate areas by finding the vertices and all but this does it in a minute or so and thus deserves more familiarity.

• Hint: The intersection point of two lines in homogeneous coordinates is $P=(a_1,b_1,c_1) \times (a_2,b_2,c_2)$ where $\times$ is the vector cross product. So three lines can be transformed two three vertices. – ja72 Aug 18 '14 at 13:50
• That numerator is perplexing. Is it supposed to be a 6-by-6 matrix determinant? If so, it vanishes since the first and third rows are identical. So I'd check for transcription errors. – Semiclassical Aug 20 '14 at 1:41
• No it's not a 6x6 but it's a 3x3 matrix determinant in which the elements themselves are 2x2 determinants – G-man Aug 20 '14 at 8:29

## 4 Answers

Clearly, we can scale the coefficients of a given linear equation by any (non-zero) constant and the result is unchanged. Therefore, by dividing-through by $\sqrt{a_i^2+b_i^2}$, we may assume our equations are in "normal form":

\begin{align} x \cos\theta + y \sin\theta - p &= 0 \\ x \cos\phi + y \sin\phi - q &= 0 \\ x \cos\psi + y \sin\psi - r &= 0 \end{align}

with $\theta$, $\phi$, $\psi$ and $p$, $q$, $r$ (and $A$, $B$, $C$ and $a$, $b$, $c$) as in the figure:

Then

$$C_1 = \left|\begin{array}{cc} \cos\phi & \sin\phi \\ \cos\psi & \sin\psi \end{array} \right| = \sin\psi\cos\phi - \cos\psi\sin\phi = \sin(\psi-\phi) = \sin \angle ROQ = \sin A$$ Likewise, $$C_2 = \sin B \qquad C_3 = \sin C$$

Moreover, $$D := \left|\begin{array}{ccc} \cos\theta & \sin\theta & - p \\ \cos\phi & \sin\phi & - q \\ \cos\psi & \sin\psi & - r \end{array}\right| = - \left( p C_1 + q C_2 + r C_3 \right) = - \left(\;p \sin A + q \sin B + r \sin C\;\right)$$

Writing $d$ for the circumdiameter of the triangle, the Law of Sines tells us that $$\frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} = d$$

Therefore,

\begin{align} D &= - \left( \frac{ap}{d} + \frac{bq}{d} + \frac{cr}{d} \right) \\[4pt] &= -\frac{1}{d}\left(\;ap + b q + c r\;\right) \\[4pt] &= -\frac{1}{d}\left(\;2|\triangle COB| + 2|\triangle AOC| + 2|\triangle BOA| \;\right) \\[4pt] &= -\frac{2\;|\triangle ABC|}{d} \end{align}

Also, $$C_1 C_2 C_3 = \sin A \sin B \sin C = \frac{a}{d}\frac{b}{d}\sin C= \frac{2\;|\triangle ABC|}{d^2}$$

Finally: $$\frac{D^2}{2C_1C_2C_3} = \frac{4\;|\triangle ABC|^2/d^2}{4\;|\triangle ABC|/d^2} = |\triangle ABC|$$

• Ah, good old Euclidian geometry! (+1) for an answer that leads to understanding where the formula comes from. – Han de Bruijn Aug 23 '14 at 15:33

Let $(x_1,y_1),(x_2,y_2),(x_3,y_3)$ be the vertices of the triangle. Then the three non-concurrent, non parallel lines can be represented by: $$(y_2-y_1)(x-x_1)-(x_2-x_1)(y-y_1)=0$$ $$(y_3-y_2)(x-x_2)-(x_3-x_2)(y-y_2)=0$$ $$(y_1-y_3)(x-x_3)-(x_1-x_3)(y-y_3)=0$$ The coefficients in the OP's question are thus represented by: $$a_1 = (y_2-y_1) \quad ; \quad b_1 = -(x_2-x_1) \quad ; \quad c_1 = -(y_2-y_1)x_1+(x_2-x_1)y_1 \\ a_2 = (y_3-y_2) \quad ; \quad b_2 = -(x_3-x_2) \quad ; \quad c_2 = -(y_3-y_2)x_2+(x_3-x_2)y_2 \\ a_3 = (y_1-y_3) \quad ; \quad b_3 = -(x_1-x_3) \quad ; \quad c_3 = -(y_1-y_3)x_3+(x_1-x_3)y_3$$ Now straightforward calculation should reveal that: $$\frac{det\begin{bmatrix}a_1 & b_1 & c_1\\a_2 & b_2 & c_2\\a_3 & b_3 & c_3\end{bmatrix}^2}{2C_1C_2C_3} =\frac{1}{2} det\begin{bmatrix}(x_2-x_1) & (y_2-y_1)\\(x_3-x_1) & (y_3-y_1)\end{bmatrix}$$ Where the latter (half) determinant certainly represents the area of the triangle:

The algebra is somewhat tedious. Therefore I've invoked MAPLE to save time and effort:

A := array([[a1,b1,c1],[a2,b2,c2],[a3,b3,c3]]);
C1 := det(array([[a2,b2],[a3,b3]]));
C2 := -det(array([[a1,b1],[a3,b3]]));
C3 := det(array([[a1,b1],[a2,b2]]));
B := array([[x2-x1,y2-y1],[x3-x1,y3-y1]]);
verify(det(A)^2/(2*C1*C2*C3),det(B)/2,equal);
true

This completes the proof.

Here is a proof of a special case. Let the three lines be $L_1,L_2,L_3$. A special case is $L_1$ and $L_2$ as the $x$- and $y$-axes respectively, and $L_3$ of the form $\dfrac xa+\dfrac yb=1$. Then the three lines form a right triangle with area $\dfrac{1}{2} ab$. On the other hand, the formula above gives an area of $$\frac{1}{2 C_1 C_2 C_3}\left|\begin{matrix}1&0&0\\0&1&0\\a^{-1} & b^{-1} & -1\end{matrix}\right|^2=\frac{(-1)^2}{2(-a^{-1})(b^{-1})(1)}=-\frac12 ab$$ Since the triangle has a negative orientation (the order of the three lines is clockwise around the triangle) this matches the result above.

This may seem a good deal weaker than the general case. But we can map any generic set of lines to the set here by the following transformations: Translate one of the intersections to the origin, rotate the triangle into the upper half-plane such that one of its lines becomes the $x$-axis, and finally do a horizontal shear to make one of the remaining lines the $y$-axis. So all that should remain is to show that the above formula is preserved by these transformations---which, I'll confess, I don't know how to do off the top of my head. So as yet this is an incomplete proof of the general case.

Following is a derivation of the formula using homogeneous coordinates.

For any point $p = (u,v)$ on the plane, we will use $\vec{p} = (x,y,z) = (zu,zv, z)$ to denote any choice of its homogeneous coordinates. For any line $\ell = \{ (u,v) : au+bv+c = 0 \}$, we will associate it with a vector $\vec{\ell} = (a,b,c)$ as use it as a homogeneous coordinates of $\ell$.

In terms of homogeneous coordinates, the condition that point $p$ lies on line $\ell$ can be expressed as

$$au + bv + c = 0 \quad\iff\quad ax + by + cz = 0 \quad\iff\quad \vec{\ell}\cdot \vec{p} = 0$$

Let $\ell_1, \ell_2, \ell_3$ be $3$ lines on the plane forming the sides of a triangle $T$ in counterclockwise order.

Let $p_1 = (u_1,v_1)$ be the intersection of $\ell_2$ and $\ell_3$, we have $$p_1 \in \ell_2 \cap \ell_3 \quad\implies\quad \vec{\ell}_2\cdot \vec{p}_1 = \vec{\ell}_3 \cdot \vec{p}_1 = 0 \quad\implies\quad \vec{p}_1 \propto \vec{\ell}_2 \times \vec{\ell}_3$$ Let $p_2 = (u_2,v_2)$ be the intersection of $\ell_3$ and $\ell_1$, we have $$p_2 \in \ell_3 \cap \ell_1 \quad\implies\quad \vec{\ell}_3\cdot \vec{p}_2 = \vec{\ell}_1 \cdot \vec{p}_2 = 0 \quad\implies\quad \vec{p}_2 \propto \vec{\ell}_3 \times \vec{\ell}_1$$ Let $p_3 = (u_3,v_3)$ be the intersection of $\ell_1$ and $\ell_2$. we have $$p_3 \in \ell_1 \cap \ell_2 \quad\implies\quad \vec{\ell}_1\cdot \vec{p}_3 = \vec{\ell}_2 \cdot \vec{p}_3 = 0 \quad\implies\quad \vec{p}_3 \propto \vec{\ell}_1 \times \vec{\ell}_2$$

Since $\vec{p}_1,\vec{p}_2,\vec{p}_3$ are homogeneous coordinates and rescaling them doesn't change the underlying points $p_1, p_2, p_3$, we can just pick $$\vec{p}_1 = \vec{\ell}_2 \times \vec{\ell}_3,\quad \vec{p}_2 = \vec{\ell}_3 \times \vec{\ell}_1\quad\text{ and }\quad \vec{p}_3 = \vec{\ell}_1 \times \vec{\ell}_2$$

In terms of them, the area of triangle $T$ is given by $$\verb/Area/(T) = \frac12 \left| \begin{matrix} u_1 & u_2 & u_3\\ v_1 & v_2 & v_3\\ 1 & 1 & 1\\ \end{matrix}\right| = \frac{1}{2z_1z_2z_3} \left|\begin{matrix} x_1 & x_2 & x_3\\ y_1 & y_2 & y_3\\ z_1 & z_2 & z_3\\ \end{matrix}\right| = \frac{ \vec{p}_1\cdot (\vec{p_2} \times \vec{p}_3) }{ 2 (\vec{p}_1\cdot \hat{z})(\vec{p}_2\cdot \hat{z})(\vec{p}_3\cdot \hat{z}) }$$

Notice $$\require{cancel} \vec{p}_2 \times \vec{p}_3 = (\vec{\ell}_3 \times \vec{\ell}_1) \times (\vec{\ell}_1 \times \vec{\ell}_2) = ((\vec{\ell}_3 \times \vec{\ell}_1) \cdot \vec{\ell}_2) \vec{\ell}_1 - \color{red}{\cancelto{0}{\color{gray}{((\vec{\ell}_3 \times \vec{\ell}_1) \cdot \vec{\ell}_1)}}} \vec{\ell}_2 = \Delta \vec{\ell}_1$$ where $\Delta = \vec{\ell}_1\cdot (\vec{\ell}_2 \times \vec{\ell}_3) = \left|\begin{matrix} a_1 & a_2 & a_3\\ b_1 & b_2 & b_3\\ c_1 & c_2 & c_3\\ \end{matrix}\right|$, we find $$\vec{p}_1\cdot(\vec{p}_2\times\vec{p}_3) = \Delta( \vec{\ell}_2 \times \vec{\ell}_3 ) \cdot \vec{\ell}_1 = \Delta^2$$ Together with $$\vec{p}_1 \cdot \hat{z} = (\vec{\ell}_2 \times \vec{\ell}_3 ) \cdot \hat{z} = \left|\begin{matrix} a_2 & a_3 & 0\\ b_2 & b_3 & 0\\ c_2 & c_3 & 1\\ \end{matrix}\right| = C_1 \stackrel{def}{=} \left|\begin{matrix} a_2 & a_3\\ b_2 & b_3\\ \end{matrix}\right|$$ and similar relations $$\vec{p}_2\cdot\hat{z} = C_2 \stackrel{def}{=} \left|\begin{matrix} a_3 & a_1\\ b_3 & b_1\\ \end{matrix}\right| \quad\text{ and }\quad \vec{p}_3\cdot\hat{z} = C_3 \stackrel{def}{=} \left|\begin{matrix} a_1 & a_2\\ b_1 & b_2\\ \end{matrix}\right|$$ we obtain $$\verb/Area/(T) = \frac{\Delta^2}{2C_1C_2C_3} = \frac{\left|\begin{matrix} a_1 & a_2 & a_3\\ b_1 & b_2 & b_3\\ c_1 & c_2 & c_3\\ \end{matrix}\right|^2 }{2C_1C_2C_3}$$