Area of a triangle
A triangle in the coordinate plane with vertices ( x 1 , y 1 ) , ( x 2 , y 2 ) , ( x 3 , y 3 ) (x_1, y_1), (x_2, y_2), (x_3, y_3) ( x 1 , y 1 ) , ( x 2 , y 2 ) , ( x 3 , y 3 ) has area given by an explicit determinant. The formula is widely used in geometry, in surveying, and in computer graphics. As a corollary, three points are collinear iff this determinant is zero , a simple algebraic test that avoids slope comparisons.
Given three points A 1 = ( x 1 , y 1 ) , A 2 = ( x 2 , y 2 ) , A 3 = ( x 3 , y 3 ) A_1 = (x_1, y_1), A_2 = (x_2, y_2), A_3 = (x_3, y_3) A 1 = ( x 1 , y 1 ) , A 2 = ( x 2 , y 2 ) , A 3 = ( x 3 , y 3 ) in the plane, the area of triangle A 1 A 2 A 3 A_1 A_2 A_3 A 1 A 2 A 3 is
Area = 1 2 ∣ det ( x 1 y 1 1 x 2 y 2 1 x 3 y 3 1 ) ∣ . \text{Area} = \frac{1}{2} \left| \det \begin{pmatrix} x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\ x_3 & y_3 & 1 \end{pmatrix} \right|. Area = 2 1 det x 1 x 2 x 3 y 1 y 2 y 3 1 1 1 .
The absolute value is necessary: a positive determinant means the vertices are listed counterclockwise; a negative determinant means clockwise. Either way, area is positive.
Derivation
Expand the determinant along the third column:
det = x 1 ( y 2 − y 3 ) − y 1 ( x 2 − x 3 ) + ( x 2 y 3 − x 3 y 2 ) \det = x_1(y_2 - y_3) - y_1(x_2 - x_3) + (x_2 y_3 - x_3 y_2) det = x 1 ( y 2 − y 3 ) − y 1 ( x 2 − x 3 ) + ( x 2 y 3 − x 3 y 2 )
= x 1 ( y 2 − y 3 ) + x 2 ( y 3 − y 1 ) + x 3 ( y 1 − y 2 ) = x_1(y_2 - y_3) + x_2(y_3 - y_1) + x_3(y_1 - y_2) = x 1 ( y 2 − y 3 ) + x 2 ( y 3 − y 1 ) + x 3 ( y 1 − y 2 ) .
Geometrically this is twice the signed area of the triangle, obtained by computing the cross product of two edge vectors A 1 A 2 ⃗ \vec{A_1 A_2} A 1 A 2 and A 1 A 3 ⃗ \vec{A_1 A_3} A 1 A 3 . The factor 1 / 2 1/2 1/2 in the formula corrects for this doubling.
Collinearity test
Three points are collinear iff they form a degenerate triangle, i.e., the area is zero. By the formula, this happens iff
det ( x 1 y 1 1 x 2 y 2 1 x 3 y 3 1 ) = 0. \det\begin{pmatrix} x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \\ x_3 & y_3 & 1 \end{pmatrix} = 0. det x 1 x 2 x 3 y 1 y 2 y 3 1 1 1 = 0.
This is often the most efficient way to check collinearity.
Equation of a line through two points
The line through ( x 1 , y 1 ) (x_1, y_1) ( x 1 , y 1 ) and ( x 2 , y 2 ) (x_2, y_2) ( x 2 , y 2 ) consists of all points ( x , y ) (x, y) ( x , y ) collinear with these two. Set up the collinearity determinant:
det ( x y 1 x 1 y 1 1 x 2 y 2 1 ) = 0. \det\begin{pmatrix} x & y & 1 \\ x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \end{pmatrix} = 0. det x x 1 x 2 y y 1 y 2 1 1 1 = 0.
Expanding gives the line equation in two-point form.
Worked examples
Example 1. Find the area of triangle with vertices ( 2 , 3 ) , ( 4 , 7 ) , ( 8 , 5 ) (2, 3), (4, 7), (8, 5) ( 2 , 3 ) , ( 4 , 7 ) , ( 8 , 5 ) .
det ( 2 3 1 4 7 1 8 5 1 ) = 2 ( 7 − 5 ) − 3 ( 4 − 8 ) + ( 20 − 56 ) = 4 + 12 − 36 = − 20 \det\begin{pmatrix} 2 & 3 & 1 \\ 4 & 7 & 1 \\ 8 & 5 & 1 \end{pmatrix} = 2(7 - 5) - 3(4 - 8) + (20 - 56) = 4 + 12 - 36 = -20 det 2 4 8 3 7 5 1 1 1 = 2 ( 7 − 5 ) − 3 ( 4 − 8 ) + ( 20 − 56 ) = 4 + 12 − 36 = − 20 .
Area = ∣ − 20 ∣ / 2 = 10 = |-20|/2 = 10 = ∣ − 20∣/2 = 10 .
Example 2. Are ( 1 , 2 ) , ( 3 , 4 ) , ( 5 , 6 ) (1, 2), (3, 4), (5, 6) ( 1 , 2 ) , ( 3 , 4 ) , ( 5 , 6 ) collinear?
det ( 1 2 1 3 4 1 5 6 1 ) = 1 ( 4 − 6 ) − 2 ( 3 − 5 ) + 1 ( 18 − 20 ) = − 2 + 4 − 2 = 0 \det\begin{pmatrix} 1 & 2 & 1 \\ 3 & 4 & 1 \\ 5 & 6 & 1 \end{pmatrix} = 1(4 - 6) - 2(3 - 5) + 1(18 - 20) = -2 + 4 - 2 = 0 det 1 3 5 2 4 6 1 1 1 = 1 ( 4 − 6 ) − 2 ( 3 − 5 ) + 1 ( 18 − 20 ) = − 2 + 4 − 2 = 0 . Yes, collinear.
Example 3. Find the equation of the line through ( 1 , 2 ) (1, 2) ( 1 , 2 ) and ( 3 , 4 ) (3, 4) ( 3 , 4 ) .
det ( x y 1 1 2 1 3 4 1 ) = 0 \det\begin{pmatrix} x & y & 1 \\ 1 & 2 & 1 \\ 3 & 4 & 1 \end{pmatrix} = 0 det x 1 3 y 2 4 1 1 1 = 0 .
Expand: x ( 2 − 4 ) − y ( 1 − 3 ) + ( 4 − 6 ) = − 2 x + 2 y − 2 = 0 x(2 - 4) - y(1 - 3) + (4 - 6) = -2x + 2y - 2 = 0 x ( 2 − 4 ) − y ( 1 − 3 ) + ( 4 − 6 ) = − 2 x + 2 y − 2 = 0 , so y = x + 1 y = x + 1 y = x + 1 .
Example 4. Find the value of k k k so that the area of the triangle with vertices ( 1 , 4 ) , ( k , 0 ) , ( 0 , k ) (1, 4), (k, 0), (0, k) ( 1 , 4 ) , ( k , 0 ) , ( 0 , k ) is 4 4 4 .
det ( 1 4 1 k 0 1 0 k 1 ) = 1 ( 0 − k ) − 4 ( k − 0 ) + ( k 2 − 0 ) = k 2 − 5 k \det\begin{pmatrix} 1 & 4 & 1 \\ k & 0 & 1 \\ 0 & k & 1 \end{pmatrix} = 1(0 - k) - 4(k - 0) + (k^2 - 0) = k^2 - 5k det 1 k 0 4 0 k 1 1 1 = 1 ( 0 − k ) − 4 ( k − 0 ) + ( k 2 − 0 ) = k 2 − 5 k .
Area = ∣ k 2 − 5 k ∣ / 2 = 4 ⇒ k 2 − 5 k = ± 8 = |k^2 - 5k|/2 = 4 \Rightarrow k^2 - 5k = \pm 8 = ∣ k 2 − 5 k ∣/2 = 4 ⇒ k 2 − 5 k = ± 8 .
Solve: k 2 − 5 k − 8 = 0 k^2 - 5k - 8 = 0 k 2 − 5 k − 8 = 0 gives k = ( 5 ± 57 ) / 2 k = (5 \pm \sqrt{57})/2 k = ( 5 ± 57 ) /2 . Or k 2 − 5 k + 8 = 0 k^2 - 5k + 8 = 0 k 2 − 5 k + 8 = 0 has no real roots (Δ = 25 − 32 < 0 \Delta = 25 - 32 < 0 Δ = 25 − 32 < 0 ). So k = ( 5 + 57 ) / 2 k = (5 + \sqrt{57})/2 k = ( 5 + 57 ) /2 or ( 5 − 57 ) / 2 (5 - \sqrt{57})/2 ( 5 − 57 ) /2 .
Example 5. Show that the points ( a , b + c ) , ( b , c + a ) , ( c , a + b ) (a, b + c), (b, c + a), (c, a + b) ( a , b + c ) , ( b , c + a ) , ( c , a + b ) are collinear.
det ( a b + c 1 b c + a 1 c a + b 1 ) \det\begin{pmatrix} a & b + c & 1 \\ b & c + a & 1 \\ c & a + b & 1 \end{pmatrix} det a b c b + c c + a a + b 1 1 1 . Add column 1 1 1 to column 2 2 2 : ( a a + b + c 1 b a + b + c 1 c a + b + c 1 ) \begin{pmatrix} a & a + b + c & 1 \\ b & a + b + c & 1 \\ c & a + b + c & 1 \end{pmatrix} a b c a + b + c a + b + c a + b + c 1 1 1 . Pull out a + b + c a + b + c a + b + c : ( a + b + c ) det ( a 1 1 b 1 1 c 1 1 ) = 0 (a + b + c) \det\begin{pmatrix} a & 1 & 1 \\ b & 1 & 1 \\ c & 1 & 1 \end{pmatrix} = 0 ( a + b + c ) det a b c 1 1 1 1 1 1 = 0 (two equal columns).
So area = 0 = 0 = 0 ; the points are collinear.
Example 6. Find the area of the parallelogram with sides as vectors ( 2 , 3 ) (2, 3) ( 2 , 3 ) and ( 5 , 1 ) (5, 1) ( 5 , 1 ) starting from origin.
Area = ∣ det ( 2 3 5 1 ) ∣ = ∣ 2 − 15 ∣ = 13 \text{Area} = |\det\begin{pmatrix} 2 & 3 \\ 5 & 1 \end{pmatrix}| = |2 - 15| = 13 Area = ∣ det ( 2 5 3 1 ) ∣ = ∣2 − 15∣ = 13 .
Try it yourself
Find the area of the triangle with vertices ( 0 , 0 ) , ( 4 , 0 ) , ( 0 , 3 ) (0, 0), (4, 0), (0, 3) ( 0 , 0 ) , ( 4 , 0 ) , ( 0 , 3 ) .
Check collinearity of ( 2 , 3 ) , ( 4 , 5 ) , ( 6 , 7 ) (2, 3), (4, 5), (6, 7) ( 2 , 3 ) , ( 4 , 5 ) , ( 6 , 7 ) .
Find the area of the triangle with vertices ( 1 , 2 ) , ( − 1 , 3 ) , ( 3 , − 1 ) (1, 2), (-1, 3), (3, -1) ( 1 , 2 ) , ( − 1 , 3 ) , ( 3 , − 1 ) .
Find the equation of the line through ( 2 , 1 ) (2, 1) ( 2 , 1 ) and ( 4 , 5 ) (4, 5) ( 4 , 5 ) using determinants.
Show that the points ( a , 0 ) , ( 0 , b ) , ( a , b ) (a, 0), (0, b), (a, b) ( a , 0 ) , ( 0 , b ) , ( a , b ) are not collinear unless a = 0 a = 0 a = 0 or b = 0 b = 0 b = 0 .
If the area of the triangle with vertices ( x , 4 ) , ( 2 , − 6 ) , ( 5 , 4 ) (x, 4), (2, -6), (5, 4) ( x , 4 ) , ( 2 , − 6 ) , ( 5 , 4 ) is 35 35 35 sq units, find x x x .
Determine k k k so that the points ( k , 2 k ) , ( − 2 , 6 ) , ( 3 , 1 ) (k, 2k), (-2, 6), (3, 1) ( k , 2 k ) , ( − 2 , 6 ) , ( 3 , 1 ) are collinear.
Find the area of the parallelogram with vertices ( 0 , 0 ) , ( 3 , 0 ) , ( 4 , 5 ) , ( 1 , 5 ) (0, 0), (3, 0), (4, 5), (1, 5) ( 0 , 0 ) , ( 3 , 0 ) , ( 4 , 5 ) , ( 1 , 5 ) . Hint: divide into two triangles.
Find the equation of the line through ( 3 , − 1 ) (3, -1) ( 3 , − 1 ) that is parallel to the line through ( 2 , 4 ) (2, 4) ( 2 , 4 ) and ( 6 , 4 ) (6, 4) ( 6 , 4 ) .
If ( a , b ) , ( c , d ) , ( e , f ) (a, b), (c, d), (e, f) ( a , b ) , ( c , d ) , ( e , f ) are collinear, prove det ( a b 1 c d 1 e f 1 ) = 0 \det\begin{pmatrix} a & b & 1 \\ c & d & 1 \\ e & f & 1 \end{pmatrix} = 0 det a c e b d f 1 1 1 = 0 .
Find the area of the triangle with vertices ( 2 , 0 ) , ( 0 , 3 ) , ( 4 , 5 ) (2, 0), (0, 3), (4, 5) ( 2 , 0 ) , ( 0 , 3 ) , ( 4 , 5 ) .
Are the points ( 0 , 0 ) , ( 1 , 2 ) , ( 3 , 6 ) (0, 0), (1, 2), (3, 6) ( 0 , 0 ) , ( 1 , 2 ) , ( 3 , 6 ) collinear?
Find the area of the triangle whose vertices are ( 1 , 1 ) , ( 3 , 2 ) , ( 5 , 1 ) (1, 1), (3, 2), (5, 1) ( 1 , 1 ) , ( 3 , 2 ) , ( 5 , 1 ) .
Show that the line det ( x y 1 − 1 2 1 3 − 4 1 ) = 0 \det\begin{pmatrix} x & y & 1 \\ -1 & 2 & 1 \\ 3 & -4 & 1 \end{pmatrix} = 0 det x − 1 3 y 2 − 4 1 1 1 = 0 passes through both ( − 1 , 2 ) (-1, 2) ( − 1 , 2 ) and ( 3 , − 4 ) (3, -4) ( 3 , − 4 ) .
Pitfalls / Tricks
Always take the absolute value at the end; area is positive.
A determinant of zero means area zero, i.e., collinear points (degenerate triangle).
The third column of 1 1 1 s is what makes the formula work; do not omit it.
For a parallelogram with vectors u ⃗ , v ⃗ \vec u, \vec v u , v from a vertex, the area is the absolute value of det ( u ⃗ , v ⃗ ) \det(\vec u, \vec v) det ( u , v ) , no 1 / 2 1/2 1/2 factor.
Next we systematise minors and cofactors.