# Gauss’s magic shoelace area formula and its calculus companion

welcome to another mythology 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 relief Gauss was impressed by his formula and mentions 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 pick one of these points and move its coordinates to the right now we

Traversed a 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 drawing the crosses okay this green segment stands for the product of the two numbers at its ends so four times one equals four this red segment stands for minus the product of the numbers at its two ends

So four times zero equals zero – that is – zero oh well obviously the – is not important here but it will be later green again so zero times five equals zero red again we need to calculate – the product so 1

Times minus 2 equals minus 2 minus that and so on so we get two products for every cross one taking positive and one negative now adding up all the numbers gives 110 ok almost there the formula tells us to divide by 2 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 come 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 1/2 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 ok now the area of the second triangle is

1/2 times the second cross and so on ok 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 mathematicians Solomon Golomb

What we want to convince ourselves of is this so let's calculate the area of this try 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 this 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 feel exactly the parallelogram and the little rectangle since we started out with the colored bits filling the 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 two times two matrix ABCD anyway back to the shoelace formula

At this point we just need to divide by two to get the area of the triangle and that's it right that's completes the proof the shoelace 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 zero zero is no longer inside and again move around the curve and highlight the triangles whose area the shoelace formula heads

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 zero zero in the counterclockwise direction something does not look right here the

Yellow triangles are sticking out of the cat head and a disappoint 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 area of the blue triangles and this means

That the error calculated by the Shoeless 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 so 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 Shoeless formula will always give the correct area here's an animated complicated example in which I dynamically update what era –

Earliest 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 reverse in 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 in 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 time stable 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 we 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 and closed by complicated curves like two deltoids 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 us well we'll see fingers crossed a curve like this is often given in parametric form for example this is a parameterization of

This deltoid here XT and YT are the coordinates of a moving point that traces the curve as the parameter T changes from this case 0 to 2 pi let's have a look so here's the position of the point at T equal

Zero and once it gets going the slider up there tells you what T were 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&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 at DX and dy drew coordinates of our first point to get the coordinates of the second point now of course these displacements are not independent of

Each other the connection is most easily established in terms of derivatives of the coordinate functions so the derivative of the x coordinate with respect to the parameter T is DX 2 DT which I write as X prime of T and

Similarly for the y coordinate function solve for the X and dy here's this and this then links post DX and dy to an increment DT of the parameter T that's changing right now we substitute like this and now we are ready to calculate

The area of our infinitesimal triangle as before 1/2 times across and this evaluates to this expression here and this we can write in a slightly more compact form like that ok 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 deltoids 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 the spare showcase our integral can be written like this now evaluating and simplified expression in the brackets gives this

Integral here which can be broken up into two parts mat students won't be surprised that the trick integral on the right evaluates to zero which then means that the area we're after is equal to this baby

Integral which of course is equal to two pi now the little rolling circle that is used to produce our deltoids is of radius one 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 this 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 work for you actually since I mentioned a kakeya video and fish I did end up turning my kakeya fish into a t-shirt what do you think well that's really it for today

you