# The Shoelace Formula via Geometric Algebra

You should be familiar with all the concepts presented in An Introduction to Geometric Algebra over R^2 before proceeding.

Continuing our exploration of Geometric Algebra, let's look at calculating area. GA might have some advantages here since the exterior product of two vectors is the area of the parallelogram they define.

- $$ \boldsymbol{a} \wedge \boldsymbol{b} $$

We are being a little sloppy here as the exterior product really gives
you a scalar times **e _{12}**, but we'll ignore that for the
rest of this article, presuming we'll just read off the scalar as the
oriented area.

The oriented area of the triangle defined by the two vectors and the origin is half of the exterior product:

- $$\frac{1}{2} \boldsymbol{a} \wedge \boldsymbol{b}$$

Before going any further we need to pause for some nomenclature. Up until
this point we've only spoken of vectors. If we start talking about
geometric shapes in ℝ^{2} we are going to need to talk about
points, which we will also represent as vectors with the implicit
understanding that a point is a vector rooted at the origin,
and that the difference of two points is just a vector.

So let's look at determining the area of a triangle defined by any three points. One way would be to take the differences of pairs of points on the triange to construct vectors that represent two sides of the triange. Note that we are also picking an orientation, so we will work in a clockwise manner.

To calculate A, the area of the triangle, we take the exterior product of those two vectors. First we calculate 2A:

- $$ \begin{align*} 2 A &= (\boldsymbol{b} - \boldsymbol{a}) \wedge (\boldsymbol{c} - \boldsymbol{b}) \\ &= \boldsymbol{b} \wedge (\boldsymbol{c} - \boldsymbol{b}) - \boldsymbol{a} \wedge (\boldsymbol{c} - \boldsymbol{b}) \\ &= \boldsymbol{b} \wedge \boldsymbol{c} - \boldsymbol{b} \wedge \boldsymbol{b} - \boldsymbol{a} \wedge \boldsymbol{c} + \boldsymbol{a} \wedge \boldsymbol{b} \\ &= \boldsymbol{b} \wedge \boldsymbol{c} - 0 - \boldsymbol{a} \wedge \boldsymbol{c} + \boldsymbol{a} \wedge \boldsymbol{b} \\ &= \boldsymbol{b} \wedge \boldsymbol{c} - \boldsymbol{a} \wedge \boldsymbol{c} + \boldsymbol{a} \wedge \boldsymbol{b} \\ &= \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{a} + \boldsymbol{a} \wedge \boldsymbol{b} \\ &= \boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{a} \end{align*} $$

Which gives us:

- $$ \begin{align*} A = \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{a}) \end{align*} $$

So the oriented area of the triange is just half the exterior product of all the pairs of vectors as you progress clockwise around the triange.

Note that if you have a rectangle:

You can triangulate it:

And now we see that we can calculate the volume of the rectangle as the sum of the area of the two triangles:

- $$ \begin{align*} A &= \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{a}) + \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{d} + \boldsymbol{d} \wedge \boldsymbol{a}) \\ &= \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{a} + \boldsymbol{a} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{d} + \boldsymbol{d} \wedge \boldsymbol{a}) \\ &= \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{a} - \boldsymbol{c} \wedge \boldsymbol{a} + \boldsymbol{c} \wedge \boldsymbol{d} + \boldsymbol{d} \wedge \boldsymbol{a}) \\ &= \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + 0 + \boldsymbol{c} \wedge \boldsymbol{d} + \boldsymbol{d} \wedge \boldsymbol{a}) \\ &= \frac{1}{2} (\boldsymbol{a} \wedge \boldsymbol{b} + \boldsymbol{b} \wedge \boldsymbol{c} + \boldsymbol{c} \wedge \boldsymbol{d} + \boldsymbol{d} \wedge \boldsymbol{a}) \\ \end{align*} $$

Again we can see that to calculate the area we just take 1/2 the exterior product of pairs of points as you progress around the perimenter of the shape, and this can be applied to any simple polygon. You might recongize this as the Shoelace Formula, and comparing the above proof to the explanations in the Wikipedia article really drives home the succinct and expressive power of GA.