Welcome to another Mathologer video. The
shoelace formula is a super simple way to calculate the exact area inside any
convoluted curve made up of straight line segments, like my cat head curve
over there. Even the great mathematician Carl Friedrich Gauss was impressed by
this formula and mentioned it in his writings. The formula was certainly not
invented by him, however it's often also referred to as Gauss's area formula,
probably because a lot of people first learned about it from Gauss (and not
because someone calculated Gauss's area with it :) In today's video I'll show you
how and why this formula works. The visual proof I'll show you is just as
pretty as the formula itself and along the way I can promise you a couple of
very satisfying AHA moments to make your day. I've got a special treat for you at the end of the video: a simple way to morph
the shoelace formula into a very famous and very powerful integral formula for
calculating the area enclosed by really complicated curvy curves, like for
example this deltoid rolling curve here. Now obviously we call this crazy
formula the shoelace formula because it reminds us of the usual crisscross way
of lacing shoes. Now let's make sense of the shoelace formula and use it to
calculate the orange area. I start by filling in the coordinates of the blue
points. Take one of these points and move its coordinates to the right. Now we
traverse the curve in the counterclockwise direction and do the
same for the other blue points we come across. Here, there, there, there. Now we're
back at the point we started from and include its coordinates one more time at
the end of our list. Now draw in the crosses. Okay this green segment stands
for the product of the two numbers at its ends. So 4 times 1 equals 4.This red segment stands for minus the product of the number at its two ends.
So 4 times 0 equals 0. Minus that is - 0. Oh, well obviously
the "minus" is not important here but it will be later. Green again. So 0 times 5
equals 0. Red again, we need to calculate minus the product, so 1 times - 2
equals -2. Minus that, and so on. So we get two products for every cross, one taken
positive and one negative. Now adding up all the numbers gives 110. Okay, almost
there. The formula tells us to divide by two. So half of 110 is 55, and that's the area
of my cat head. Really pretty and super simple to use. And this works for any
closed curve in the xy-plane no matter how complicated. The only thing you have
to make sure of is that the curve does not intersect itself like this fish
curve here. And it will become clear later on why you have to be careful in this
respect. Okay now for the really interesting bit, the explanation why the
shoelace formula works. It turns out that the individual crosses in the formula
correspond to these triangles which cover the whole shape. Note that all
these triangles have the point (0,0) in common. Okay, so the area of the first triangle here is just 1/2 times the first cross.
So, again, the first cross is equal to 4 times 1 minus 4 times 0 equals 4, and
half that is 2. And it's actually easy to check that this is true using the good
old 1/2 base times height area formula for triangles. Now the area of the
second triangle is 1/2 times the second cross, and so on. But why is the area of
one of these triangles equal to 1/2 times the corresponding cross? Here's a
nice, really really nice visual argument due to the famous mathematician Solomon Golomb. What we want to convince ourselves of is this. So let's calculate
the area of this triangle from scratch. Actually what we'll do is
to calculate the area of this parallelogram here whose area is double
that of the triangle. Okay let's start with the special rectangle here. Then the
coordinates translate into the side lengths of these two triangles. First (a,b)
turns into these two side lengths, and then (c,d) into these. Color in the
remainder of the rectangle and shift the green triangles like this, and like
that, Now do you see the second small
rectangle materializing? Right there. The two triangles overlap in the dark
green area and so we can pull the colored bits apart so that they fill
exactly the parallelogram and the little rectangle. Since we started out with the
colored bits filling a large rectangle this means that "large rectangle area"
equals "parallelogram area" plus "small rectangle area". But now the areas of the
rectangles are ad and bc. That's almost it. Now, without any words... Pure magic,
right? And, of course, all of you who are familiar with vectors and matrices will
realize that another way of expressing what we just proved is the mega famous
result from elementary linear algebra that the area of the parallelogram spanned
by the two vectors (a,b) and (c,d) is equal to the determinant of the 2 x 2 matrix
a,b,c,d. Anyway, back to the shoeless formula. At this point we just need to divide by
2 to get the area of the triangle and that's it, right? That completes the proof
that the shoeless formula will always work, right? Well, not quite. We are still missing one very important very magical step. Let's have another
look at my cat hat, but let's shift it so that the point (0,0) is no longer inside
and again move around the curve and highlight the triangles whose area the
shoeless formula adds. This time let's start here. As we move around the curve
in the counterclockwise direction the green radius which chases us
also rotates around (0,0) in the counterclockwise direction. Something
does not look right here. The yellow triangles are sticking out of the cat
head and at this point the combined area of the triangle is larger than that of
the cat head and should get even larger as we keep going. However, whereas up to now the radius has been rotating in the counterclockwise direction, at this point
it starts rotating in the clockwise direction and this change in sweeping
direction has the effect that the shoeless formula subtracts the areas of
the blue triangles. And this means that the area calculated by the shoelace
formula will be the total area of the yellow triangles minus that of the blue
triangles which is exactly the area of our cat head again. The same sort of
nifty canceling of areas makes sure that no matter how convoluted a closed curve
is as long as it doesn't intersect itself the shoelace formula will always
give the correct area. Here's an animated complicated example in which I
dynamically update what area the shoelace formula has arrived at at
the different points of the radius changing sweeping direction. Real mathematical magic, isn't it?
It's also easy to see why reversing the sweeping direction leads to negative
area. Let's see. Sweeping in the counterclockwise
direction we first come across (a,b) and record it, followed by (c,d). When we sweep clockwise the order in which we come across (a,b)
and (c,d) is reversed and this leads to these changes in the formulas. And the
last swap obviously leads to the number turning into it's negative. And that's
really it. Now you know how the shoelace formula does what it does. In these
videos we keep encountering really fancy curves like this cardioid in a coffee
cup in the "Mandelbrot and times tables" video or this deltoid rolling curve
whose area actually already played a quite important role in the video on the
Kakeya needle problem. At first glance it looks like we won't be able to use the
shoelace formula to calculate the area of one of these curves because they are
not made up from line segments. Well you can definitely approximate the area by
calculating the area of a straight line approximation like this, with those blue
points on the curve. And by increasing the number of points we can get as close
to the true area as we wish. In fact, by taking this process to the limit in the
usual calculus way, we can turn the shoelace formula into a famous integral
formula for calculating the exact area enclosed by complicated curves like the
deltoid. Here's how you do this. I've tried to make sure that even if you've
never studied calculus you'll be able to get something out of this. Well we'll see,
fingers crossed :) A curve like this is often given in parametric form. For
example this is a parametrizations of this deltoid. Here x(t) and y(t) are the
coordinates of a moving point that traces the curve as the parameter t
changes from, in this case 0 to 2 pi. Let's have a look. So here's the position of the point at t=0. And once it gets going the
slider up there tells you what t we are up to. Right now we'll translate all this
into the language of calculus. Let's stop the point somewhere along its journey. A
little bit further along we find a second point. A tiny, tiny little bit
further on is usually expressed in terms of infinitesimal displacements in x and
y. It's a bit lazy to do it this way but mathematicians are a bit lazy and love
doing this because it captures the intuition perfectly and in the end can
be justified in a rigorous way. Anyway just add dx and dy to the coordinates of
our first point to get the coordinates of our second point. Now, of course, these
displacements are not independent of each other. The connection is most easily
established in terms of the derivatives of the coordinate functions. So the
derivative of the x coordinate with respect to the parameter t is dx/dt
which I write at x'(t) and similarly for the y coordinate function.
Solving for dx and dy gives this and this then links both dx and dy to an
increment dt of the parameter t that's changing, right? Now we substitute like this and now we're ready to calculate the area of our infinitesimal triangle as before. 1/2 times a cross. And this evaluates to
this expression here. And this we can write in a slightly more compact form
like that. Okay now what we have to do is to add all these infinitely many
infinitesimal areas and as usual in calculus this is done with one of those
magical integrals. The little circle twirling in the counterclockwise
direction says that we're supposed to integrate
around the curve exactly once in the counterclockwise direction.
Well let's see: for our deltoid we have this parameterization here. We've already
seen that a full trace is accomplished by having t run from 0
to 2 pi. This means that in this special case our integral can be written
like this. Now evaluating and simplifying the expression in the brackets gives
this integral here, which can be broken up into two parts. Maths students won't be
surprised that the trig(onometric) integral on the right evaluates to 0 which then means
that the area where after is equal to this baby integral which of course is equal
to 2 pi. Now the little rolling circle that is used to produce our deltoid is of
radius 1 and is therefore of area pi. This means that the area of the deltoid
is exactly double the area of the rolling circle. Neat isn't it? Okay, up for a couple of challenges? Then explain in the comments
what the number stands for that the shoeless formula or the integral formula
produce in the case of self intersecting curves like these here. Another thing worth
pondering is how the argument for our triangle formula has to be adapted to
account for the blue points ending up in different quadrants, for example, like
this. And that's it for today. I hope you enjoyed this video and as usual let me
know how well these explanations worked for you. Actually since I mentioned the Kakeya video and fish, I did end up turning my Kakeya fish
into a t-shirt. What do you think? Well and that's really it for today.
this channel is amazing, love the visualizations
This is probably the clearest and best explanation of the shoelace formula I've ever seen.
How do you make the limit procedure for the integral rigorous?
What does the shoelace with things that intersect with themselves mean?
EDIT: Reffering to the exercise to the reader in the video not the formula itself