Finding out the area of a triangle if the coordinates of the three vertices are given
What is the simplest way to find out the area of a triangle if the coordinates of the three vertices are given in $x$-$y$ plane?
One approach is to find the length of each side from the coordinates given and then apply Heron's formula. Is this the best way possible?
Is it possible to compare the area of triangles with their coordinates provided without actually calculating side lengths?
geometry triangles coordinate-systems area
nbro
TSP1993TSP1993
What you are looking for is called the shoelace formula:
\begin{align*} \text{Area} &= \frac12 \big| (x_A - x_C) (y_B - y_A) - (x_A - x_B) (y_C - y_A) \big|\\ &= \frac12 \big| x_A y_B + x_B y_C + x_C y_A - x_A y_C - x_C y_B - x_B y_A \big|\\ &= \frac12 \Big|\det \begin{bmatrix} x_A & x_B & x_C \\ y_A & y_B & y_C \\ 1 & 1 & 1 \end{bmatrix}\Big| \end{align*}
The last version tells you how to generalize the formula to higher dimensions.
PS. Another generalization of the formula is obtained by noting that it follows from a discrete version of the Green's theorem:
$$ \text{Area} = \iint_{\text{domain}}dx\,dy = \frac12\oint_{\text{boundary}}x\,dy - y\,dx $$
Thus the signed (oriented) area of a polygon with $n$ vertexes $(x_i,y_i)$ is
$$ \frac12\sum_{i=0}^{n-1} x_i y_{i+1} - x_{i+1} y_i $$
where indexes are added modulo $n$.
sdssds
You know that AB x AC is a vector perpendicular to the plane ABC such that |AB x AC|= Area of the parallelogram ABA'C. Thus this area is equal to ½ |AB x AC|.
From AB= $(x_2 -x_1, y_2-y_1)$; AC= $(x_3-x_1, y_3-y_1)$, we deduce then
Area of $\Delta ABC$ = $\frac12$$[(x_2-x_1)(y_3-y_1)- (x_3-x_1)(y_2-y_1)]$
J. W. Tanner
PiquitoPiquito
$\begingroup$ This is the best answer, as it covers the 6005 and the Jailcu answers. Vector cross product. $\endgroup$ – richard1941 Aug 24 '16 at 21:09
$\begingroup$ By this way can area come as negative value? I am trying to understand this problem. geeksforgeeks.org/orientation-3-ordered-points $\endgroup$ – SRIDHARAN Dec 19 '17 at 13:39
$\begingroup$ What has been taken is the absolute value of the cross product. $\endgroup$ – Piquito Dec 20 '17 at 14:31
$\begingroup$ Yes it can be negative. The sign depends on the orientation of the three vertices. $\endgroup$ – steven gregory Feb 9 '18 at 7:03
$\begingroup$ Looking at the parallelogram, why not drop a perpendicular from C to AB. Now there are two right triangles whose area is easily found (You KNOW some coordinates.) No need to divide by 2 b/c the two right triangles cover the triangle under observation. $\endgroup$ – David Dyer Jul 12 '19 at 18:29
Heron's formula is inefficient; there is in fact a direct formula. If the triangle has one vertex at the origin, and the other two vertices are $(a,b)$ and $(c,d)$, the formula for its area is $$ A = \frac{\left| ad - bc \right|}{2} $$
To get a formula where the vertices can be anywhere, just subtract the coordinates of the third vertex from the coordinates of the other two (translating the triangle) and then use the above formula.
The simplest way to remember how to calculate is by taking $\frac{1}{2}$ the value of the determinant of the matrix $$ \begin{bmatrix} 1 & 1 & 1 \\ x_1 & x_2 & x_3 \\ y_1 & y_2 & y_3 \end{bmatrix} $$
BunsOfWrath
JailcuJailcu
$\begingroup$ See also: Show that the area of a triangle is given by this determinant $\endgroup$ – Zaz Aug 17 '16 at 16:21
if $(x_1,y_1),(x_2,y_2),(x_3,y_3)$ are the vertices of a triangle then its area is given by:-
$$\frac{ 1}{2}|(x_1(y_2-y_3)+x_2(y_3-y_1)+x_3(y_1-y_2))|$$
ShobhitShobhit
The area of a triangle $P(x_1, y_1)$, $Q(x_2, y_2)$ and $R(x_3, y_3)$ is given by $$\triangle= \left|\frac{1}{2}(x_{1} (y_{2} – y_{3}) + x_{2} (y_{3} – y_{1}) + x_{3} (y_{1} – y_{2}))\right| $$ If the area of triangle is zero, it means the points are collinear.
If we code this in Python3, it will look like
def triangle_area(x1, y1, x2, y2, x3, y3):
return abs(0.5*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)))
If we code in js, it will look like this
function triangle_area(x1, y1, x2, y2, x3, y3){
return Math.abs(0.5*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)))
Nadir Laskar
aryamanaryaman
7111 silver badge11 bronze badge
Now here's a solution which works in any vector space with an inner product: take the half of the root of the Gram-Determinant of two sides of the triangle, that is $$\frac12\sqrt{\det\begin{pmatrix}\langle b-a,b-a\rangle& \langle b-a,c-a\rangle\\ \langle b-a,c-a\rangle & \langle c-a,c-a\rangle \end{pmatrix}}.$$
Michael HoppeMichael Hoppe
For fun, I'll just throw out the really long way that I learned in 3rd grade, only because it hasn't been submitted. I don't endorse this, the Shoelace/Surveyor's formula is way better.
Determine the distance between two of the three points, say $ \big( x_{1}, y_{1} \big) $ and $ \big( x_{2}, y_{2} \big) $. $d = \sqrt{ \big(x_{2} - x_{1}\big) ^{2} + \big(y_{2} - y_{1}\big) ^{2} } $
Determine the slope $m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}} $ and y-intercept, $a = y_{1} - \big(m \times x_{1}\big)$, of the line between $ \big( x_{1}, y_{1} \big) $ and $ \big( x_{2}, y_{2} \big) $.
Determine the slope of the a line perpendicular the line from $ \big( x_{1}, y_{1} \big) $ and $ \big( x_{2}, y_{2} \big) $, which is the negative reciprocal of the first slope. $n = \frac{-1}{m} $
Determine the equation of the line parallel to this second line, that passes through the third point $ \big( x_{3}, y_{3} \big)$, by finding the y-intercept in $y = n*x+b$, since you already have the slope and a point on the line. $ y_{3} - \big(n \times x_{3}\big)=b$.
Determine where this new line intersects the line between $ \big( x_{1}, y_{1} \big) $ and $ \big( x_{2}, y_{2} \big) $, by solving the system of equations of the new line and the original line: $y = m*x+b$ and $y = n*x+b$. Call this point $ \big( x_{4}, y_{4} \big) $. I won't write this out, I'll leave it as an "exercise for the reader".
Determine the distance between $ \big( x_{3}, y_{3} \big) $ and the new point$ \big( x_{4}, y_{4} \big) $. $c = \sqrt{ \big(x_{4} - x_{3}\big) ^{2} + \big(y_{4} - y_{3}\big) ^{2} } $
If $d$ is the base of the triangle, and $c$ the height, the area is $A = \frac{1}{2} c*d$.
Realize you've spent several minutes solving a trivial problem... cry silently.
iwantmyphdiwantmyphd
$\begingroup$ You learnt this in third grade?! $\endgroup$ – YiFan Jan 12 '19 at 0:34
The area $A$ of the triangle two of whose vertices lie on the axes, with coordinates $(a, 0)$, $(0, b)$, and a third vertex $(c, d)$ is obtained from previous formula by a mere horizontal axis shift of -a units as $$A = \frac{|-ad + b(a - c)|}{2}$$
Kamil Jarosz
Beedassy LekrajBeedassy Lekraj
$\begingroup$ What "previous formula" do you mean? $\endgroup$ – Rory Daulton May 25 '15 at 11:41
$\begingroup$ Sorry to be vague about that ! I meant the formula A = |ad - bc|/2 for triangle with coordinates (a, b) , (c, d) and origin. $\endgroup$ – Beedassy Lekraj May 27 '15 at 4:56
Not the answer you're looking for? Browse other questions tagged geometry triangles coordinate-systems area or ask your own question.
Find area of triangle RTS when $R=(-3,-4),$ $S=(3,-1),$ $T=(2,4)$
Show that the area of a triangle is given by this determinant
Why area of a triangle is negative based on naming order?
Calculate area of triangle in space given points
Expected area of Triangle with vertices on concentric circles.
Area of triangle formed by normal distributed points
what is the coordinate of the third point in a triangle?
Given 3 points ((x1, y1), (x2, y2), (x3, y3)), how can I find if the point (a, b) is between all of these points?
Finding the area of an orthic triangle (DEF) when given vertices of triangle ABC.
What does the determinant form of triangle area imply "transformation-wise"?
Given the area and perimeter of a triangle, find its coordinates
Similar triangle side lengths given its area and similar triangle side lengths
Finding all coordinates of a triangle on a graph using three vertices.
Area of a triangle from vector coordinates of vertices in 3D
Find area of triangle given one angle
Find the area of a triangle using the sides lengths
How to find the length of one of the sides of a triangle given the area
Given only the lengths of the three sides of a triangle, can we find if the triangle is impossible?