# Area of a triangle in the complex plane

I recently ran across an elegant equation for the area of a triangle in the complex plane with vertices at z1, z2, and z3. . This formula gives the signed area: the area is positive if the points are given in countclockwise order and negative otherwise.

I’ll illustrate the formula with a little Python code. Let’s generate a random triangle.

    import numpy as np

np.random.seed(20221204)
r = 100*np.random.random(6)
z1 = r + 1j*r
z2 = r + 1j*r
z3 = r + 1j*r


Here’s what our triangle looks like plotted. Now let’s calculate the area using the formula above and using Heron’s formula.


def area_det(z1, z2, z3):
det = 0
det += z2*z3.conjugate() - z3*z2.conjugate()
det -= z1*z3.conjugate() - z3*z1.conjugate()
det += z1*z2.conjugate() - z2*z1.conjugate()
return 0.25j*det

def area_heron(z1, z2, z3):
a = abs(z1-z2)
b = abs(z2-z3)
c = abs(z3-z1)
s = 0.5*(a + b + c)
return np.sqrt(s*(s-a)*(s-b)*(s-c))

print(area_heron(z1, z2, z3))
print(area_det(z1, z2, z3))


This prints -209.728 and 209.728. The determinate gives a negative area because it was given the points in clockwise order.

 Philip J. Davis. Triangle Formulas in the Complex Plane. Mathematics of Computation. January 1964.

## 2 thoughts on “Area of a triangle in the complex plane”

1. This technique is easy to teach to high school geometry students that have no knowledge of complex numbers or determinants.

A little analytical geometry is all.
Fun fact for them.