Gauss's magic shoelace area formula and its calculus companion
Вставка
- Опубліковано 2 сер 2024
- Gauss's shoelace formula is a very ingenious and easy-to-use method for calculating the area of complicated shapes. In this video I tell you how to use this formula and I let you in on the mathematical area-cancelling magic that powers it. Other highlights include a very cute animated proof of the area interpretation of 2x2 determinants, a really elementary high-school level proof of the integral area formula for parametric curves that's usually only derived in university level multivariable calculus. Oh, and you'll also see the integral formula in action when I calculate the surprisingly nice value of the deltoid rolling curve that played an important role in the Kakeya needle problem video.
As usual thank you very much to Marty Ross and Danil Dimitriev for their help with this video.
Enjoy!
I actually stumbled across this beauty a couple of years ago while pondering some mathematics relating the the real lacing of shoes :)
Mathologer
That's pretty funny.
I'd be interested to know what maths you were doing related to tying shoelaces.
First one in the second row :)
www.qedcat.com/books.html
Mathologer
Thanks! :D
it's flower....
Mathologer Great video. It's very concerning to me that US math education in K-12 does not require the rigor of mathematical proofs any longer. It seems that we are only teaching the utility of mathematics and not it's beauty.
Nice.
Also you can use triple product (determinant of 3x3 matrix) divided by 6 to calculate volume
Absolutely :)
does this extend into further dimensions?
Consider my mind blown. I've seen the integral that was discussed but I never knew the maths behind it! What an awesome piece of math and a great explanation.
Im constantly blown away by how awesome calculus is! I love this place and how you explain complex ideas in such simple ways. I appreciate you guys for the joy I get from this.
This is fucking awesome.
I can't believe I've never heard of this before!
Jonathan Fowler same
What'll really blow your mind is that you can do a similar thing for triangulated 3d objects. Ie. you can break up the shape into tetrahedra and calculate the volume of each and therefore know the volume of the entire object
thebackyardmovies It's probably possible to do it to any hyperpolygon of dimension k
thebackyardmovies The shoelace volume calculation works, but it's worth noting that you can't neccesarily tetrahedronalize a volume, though you can always triangulate an area (in both cases assuming it has linear boundaries). It still works because you can handle negative volumes.
Same
Couldn't you split up any shape that intersects itself into other shapes then use the shoelace formula?
Sure :)
Mathologer Nice ;)
As long as you can figure out what the functions for the sub-shapes are.
But all you need to do is find out the co-ordinates. With the cat shape Mathologer didn't figure out the functions for the cat, so why should you do so with the sub-shapes?
When they were line segments, yes. But with the deltoid, there was a function for the x coordinate of a given point and a function for the y coordinate. If I took the deltoid and arbitrarily cut a line through it, You would either need a new function for the new shape, or put further constraints on t.
If they're line segments, you only need to know the coordinates of the point of intersection.
If a curve intersects itself, I think the area after the intersect will be counted as negative.
I agree. So the formula should work for the shape as a whole as long as you switch direction when you reach an intersection so that you're still going counterclockwise around the interior.
And to get rid of this problem you should simply proceed to the next point not by intersecting, but by bouncing - then only the problematic point will make a not-quite-intersection
I don't think that you can just bounce to the next point you still must account for the intersecting point otherwise you you are creating a different and in this case external triangle which would be added to the area. So yes you need to bounce as you put it but you also must know the point of intersection to to change your rotation.
But then, how do you decide which pieces of the self-intersecting shape are negative?
Is it just whichever one (or ones) would result in a positive area?
If there's multiple sets of pieces which do that, which one is the "correct" set?
@@certainlynotthebestpianist5638 you could use the same method as riemman integrating curves and just redefine the function between intersections.
Another delightful nugget of knowledge infused with insight and garnished with fun. Thanks Mathologer!
When I first saw the shoelace of coordinates, I instantly thought *determinants* , and immediately after: areas of parallelograms, and then halves of them = triangles connecting each pair of coordinates - the triangles the entire shape can be built of.
It also reminds me of a clever device once used by geometers and map makers, called the *planimeter* . It was made of an arm with a roller which drove a little wheel with a scale. The user was supposed to track the contour of the area with the stylus attached to the end of the arm, and then the roller accounted for the area described, depending on the angle of the arm of the device and the speed it was drawn on the paper. When the user traced the entire closed contour, the planimeter's wheel displayed the area inside that contour. The principle of operation of this device was based on the extension of this shoelace formula, called *Green's Theorem* , which uses calculus to convert contour integrals to area integrals of the region inside that contour and vice versa, basing exactly on the same principles.
Nevertheless, that shoelace trick is a cool way to speed up the calculations and avoid mistakes, so thanks for that ;)
This is amazing! I understood all of the math that comes together to prove the formula already, but you put it all together in a way that explains it very nicely.
This brings back nice memories! Thanks so much :) If first came across the formula doing math contests in middle school. Then derived it when after learning coordinate geometry in high school. Finally came full circle in uni with Gauss.
Very interesting and fascinating video. Guess I've never seen such a relatively easy formula with such a beautiful visual proof. Well done!!
What an excellent video-- you've done a masterful job of using visuals to move from the strict procedure of the shoelace formula to the geometric concepts behind the formula. Loved it!
I Gauss the shoelace formula is pretty cool
hehepothesis
hehe, get it :D!
Please stop
@@joelhaggis5054 Eulereally don't have a sense of humor do you? Rieman calm, either you Cantor won't recognize how Godel damn good that pun was. Maybe you have Tychonoff your glasses or maybe Urysohn drugs. Either way you should edit your comment a Titze bit, to be more polite. Nashtag mathematician puns.
@@abstractapproach634 This comment shouldnt exsist, its to complex
Liked both your perfect explanations to the shoelace formula and its continuous counterpart! It's great to listen to you!
love all your videos! it has helped me revive my interest in mathematics since after uni!
That's great ;)
What a nice birthday gift for me. ^_^ I started using this formula back in high school geometry just to annoy the teacher and save time; I never expected to start using its cousins later on (e.g. determinants, cross-products - which don't really involve the 1/2 but I always thought in terms of the shoelace formula), even in college. I just realized I never considered its derivation despite using or considering it so much; so yeah, thanks for the birthday gift. :p
Keep up the good work. I love your videos. :D
Happy birthday from me too then :)
Daniel Chaviers happy birthday
This video is so well done, you completely blew my mind! I've seen a number of explanations of this formula over the years, but never one so clearly laid out and so intuitive. Bravo!
Glad this worked for you :)
A clear and intuitive explanation of an amazingly useful and beautiful formula - it's just perfect! I also liked how you show the connection between calculating areas and matrices :) I presume that most students, when first encountering linear algebra, think that it's not that intuitive, useful or even simply neat. However, this video manages to show how even pretty basic stuff from linear algebra is connected to something we are used to from childhood. And it gives one extra bit to a general understanding of how deeply interconnected mathematics is. Fascinating :)
Self-intersecting curves: ISTM the shoelace formula is a little more robust than that.
The reason it doesn't agree with the apparent area of the self-intersecting curve as colored at 3:20 is that the coloring is, well, wrong, or at least hard to justify. There's no point at the "X" between the fish head and fish tail. So - let's pick one of the X-crossing lines, say the top of the head/bottom of the tail. Since there's no point at the X crossing, the inside vs outside direction of the line shouldn't change. But it does. Walking along the line, the inside of the fish head becomes the outside of the tail.
The coloring, of course does not keep up with that switch. It would be hard to draw if it did. If you try to make it consistent, the outside of the fish (the common-sense outside) should stay white and the tail should be the negative of the inside color, whatever the negative of a color is.
The shoelace formula gives exactly that result: tail is negative. So it holds up.
What if we do put a point at the X? Then the fish coloring becomes more reasonable, but the shoelace formula runs into a problem - or rather, an ambiguity. There are two ways for the curve to go around both the head and the tail. We always start counterclockwise from the head. We can then go clockwise around the tail or counterclockwise. If we go clockwise, the tail is negative area again. So the formula gives two different answers, and they can't both be right.
The problem is that our point at X is doing too many things; it's joining too many lines. To remove the ambiguity, we can say that X is really two points in the same position, or N points if N lines are crossing or 2N line segments are intersecting. Then we insist that the common-sense coloring area and the shoelace formula agree about which line segments meet at which points, and voila, they agree again. The common-sense coloring area may have to be negative in some places if we choose poorly, but it will agree with the formula.
This idea comes up in computer graphics, but you probably knew that.
SPOILERS!!
There's no better way to start my day than watching the new episode of Mathloger!!! You did a great job, as always.
Is there any way to get your T-shirts ???
By the way I would love to see a collaboration between you and 3 blue one brown, you guys are really good for explaining super nice math to everyone !
That would be amazinh
I think they already did... Well, kinda. 3Blue1Brown didn't actually get into the video, but I they did collaborate.
7 years ago I was taught how to apply the shoelace formula in coordinate geometry class, but was never shown why it actually works. Cant believe i missed out on such a gorgeous explanation and proof that explains why the formula works :)
Thanks! You turn Maths into Magic with your intriguing logic. Much appreciated!
excelent video, I know the shoelace formula from some weeks ago and I have my interest in knowing where this comes from and your video comes from heaven with the answer
Great video! You make the shoelace method so easy to understand. Thank you!
This one I truly loved. The explanation as cross product made it clear why it works
Dear Sir,
you have the most beautiful style of explaining mathematical connections and relations. Very clear, very easy to follow and to top it all: very entertaining!
Thank you for your videos :-)
Very good one! I had never seen (or completely blocked out) this formula before.
It was a fun excercise to find the contour integral for the area from the polygonal approximations. Thanks for the mental stimulation, I look forward to the next video :)
Good day. I find this fascinating, and I have actually used this in an actual, practical application in an open cast mine. If you go clockwise, the sign is negative but the absolute value is the same. I used this to determine from location data (GPS) whether a truck was loaded to the left of a rope shovel, or to the right. The input is three coordinates (x and y) for a shovel, it's dig-point and the place where the truck was when loaded. It has an enurmous impact on shovel tonnes per hour if the shovel loads one truck left and the next right and so on. It gives the next truck time to position itself on the other side, meaning there is less shovel time wasted by the truck positioning itself.
Hi ! I had been playing with the shoelace formula derivation and geometrical meaning for 3 days.....did grasp only a few aspects but most of them still seemed evasive.... THIS LESSON is so satisfaying !! THANKYOU VERY MUCH .....the only thing I just feel a bit beaten by not being aneble to come throough these topics on my own.
I love your animations. I wish I could have done the same kind of thing on my channel
You are brilliant and very creative at finding new ways of explaining things
This is the most beautiful thing I have ever seen in the world of mathematics
Nicely demonstrated. It serves as a great supplement to Theorema Egregium and Gauss Bonnet theorem of simple closed curves on surfaces!
For the twist, with your visualisation trick, we can see that the area in the tail will be counted as negative area. So you won't get the right answer when summing it up.
In the end, it is because the tail is counted clockwise, and not anticlockwise.
We
T
I really have been amazed by this demonstration. I am a student from Spain and have done a work regarding this problem. By taking some examples and taking them to practice, I have discovered something. Its actually a doubt. It is explained than when we move in the clockwise direction, the area of the triangle obtained is negative. Thus, when xi > xi+1 the area will be positive, whereas when xi < xi+1 the area will be negative. However, if we demonstrate the working of a polygon whose vertices are (8,10) (2,14) (-6,12) (-4,4) (4,2) [Just for giving an example of it], we obtain a different result. When searching for the area of the triangle(-6,12) (-4,4) (0,0), it gives that the area is positive even when xi < xi+1. Now my question comes, ¿when does the "counter-clockwise direction" concept work? When looking for "how" it works, it is simple to understand that when a triangle overlaps another one, its area is subtracted. But how can we express in a "mathematical" way its functioning.
Really interesting. The best part was that you answered every question that came to mind as I was watching!
I tried to solve for the area of the triangle with vertex at the origin by breaking the triangle into two parts, each with base along one of the two coordinate axes, and taking the difference of the two triangles just to convince myself that the visual method you showed really matches :), of course, it works!
:)
One of the best so far.
This is one of my favorite videos.
The animations are fantastic. Great video!
that integral formula is also the consequence of Green's theorem
Yes, that's how it is usually presented and that's also the way I was taught this formula first :)
Thank you both for this insight. I have been casually reviewing some vector Calculus material and just happened to be going over Green's Theorem yesterday.
I'm glad to see it taught this way. I never fundamentally understood the area formula for closed curves until now, and I've known it for about 7 years. You're never done learning!
+Eli Berkowitz Thanks for your proof! It took a couple days for me find time to sit down with a clear head and read through it carefully, but I appreciate how carefully you laid it out and took time to explain each step.
Ah! I was wondering this after I saw the special integrand...vaguely stirring up some Calc III memories of areas and parametric functions; always enjoyed the 3D shapes and graphing those. Cool to see this explained this way. Made a lot more sense.
When I taught computer programming, using this method (in the CRC book) was a always a favorite of students who were delighted to learn something most of their math teachers didn't even know. The animations sure make the "why" easier to understand.
It's a shame that this method is not more widely taught :)
Thank you for explaining the reason behind parallelogram's area being equal to the determinant of two vectors. In my school we were just forced to memorize it without understanding why it's true.
These explanations are amazing!
this is the best explanation so far...
Mathloger I really love you so much to bring me one more pretty cool tool to find area of curves without using integration (at least directly).I know two more tool which are 1) Pick's theorem and 2) Monto Carlo methods.Please make a video with collecting all cool tricks to find area of curves without integration.
Great pedagogy - your videos are a pleasure to watch because of the clarity with witch you expalin things. By the way the fellow's name to the left is Gauss; he is a 5 years old Weimaraner Retriever. He lives with a German Short Haired Pointer call Newton, also 5. Together they claim that F = MA (Fulfillmennt = Mathematics x Acuity) which I agree with and so must you.
Please continue to do these vector calculus/differential geometry videos. Very enjoyable.
You mathematicians are cheaters in the youtube game. Indeed, we need to watch several times your videos to understand it generating youtube money. Smart Guys!
Hm, if I watch "History of Japan" hundreds of times, does Bill Wurtz get a hundred times the money?
I do not know, but now I'm gonna watch it^^
columbus8myhw Depends on what advertisement you end up watching each time. The algorithms are pretty fascinating. But, on average, the revenue generated from watching 100 times should be roughly equal to 100 times the amount generated from a single view.
@@galoomba5559 100 times 0 is still 0, so yes it would be exactly a hundred times the worth
Let's say there's some math you don't know, and I want to profit off that fact. I could start a casino (if it's probability you don't know), or a real estate surveying scam (if it's geometry), or whatever… or I could create and monetize a Mathologer video.
The only difference is that the casino is cheating you to steal your wealth, while Mathologer is cheating the universe to create wealth out of nothing. His profit comes from UA-cam, their profit comes from advertisers, and the advertisers' profit is a lot more diffused and complicated but it must be there (they're getting a definite eyeball when they paid for just a likely eyeball-if that's not profitable, then advertising wouldn't exist), so everybody wins.
Well, everybody wins unless we're connected to an economic anti-universe, where all of our value production counts as value destruction to them, and vice-versa. In which case, any patriotic citizen of our universe should try to make Mathologer as much money as possible, because screw those anti-universe guys.
Excellent as always!
Love your explanation. Thanks!
Excellent video! Loved it
Very nice video. The solution to the self intersecting curve is that the second curve is evaluated in the clockwise direction so the area is counted negatively. Thus area = area anti-clockwise - area clockwise.
Exactly :)
A nice little throw back to Calc III, thanks Mathologer.
I would be super happy if you could make a video on Stokes and Gauss theorem. Your visual explanation of Greens theorem is unforgettable and I'm sure you will be able to make a video accessible to a large public and especially useful for maths students, just like this one!
All the best :)
That would definitely be a great topic to cover. We'll see :)
Nice explanation! I admit I was too lazy to try to understand everything regarding integrals, because at school we never worked with curves where x and y depend on t (much less using such functions in combination with geometry), but I like that you put difficult parts into your videos as well.
Ooooh that’s why determinants are calculating like that! It always felt so arbitrary to me and only now it makes sense
That is amazing. Never heard of this formula before and very easy to follow.
:)
Well done as always!
Awesome explanations as always thanks!!
this is absolutely beautiful!!
my intuition tells me that the intersection causes the direction of the sweep to flip, which means the tail of the fish would be subtracted from the body of the fish, leaving the area of a triangle; and similarly the left hand side of the infinity symbol would just cancel out the right hand side, leaving an area of 0
Yes, at least in general the area inside the curve to the left of the intersection become negative. Using the sweeping radius illustration shows this. So, the result is the difference between the two closed areas.
thats true i made a mistake doing this formula by going out of order making the shape intersecting and every time i got the answer 0
I really like that finding the area of a polygon can be translated as calculating the determinant of N 2 by 2 matrices.
This legit made my day!
Very good indeed !
Thank you
I love that channel! Great explaination
Amazing, amazing and super amazing!!
This is amazing!
The continuous version is a special case of Green's theorem, the same special case used to implement mechanical planimeters. I think you could fill half an episode with the planimeter.
Awesome video and explanation!!
If the loop self-intersects, then the shoelace formula gives the area of each "sub-loop", where the area of the "sub-loops" that run counter-clockwise are counted as positive, and the area of the "sub-loops" that run clockwise are counted as negative.
Thank you, that was so nice.
Excellent! This will help me in my geometry class for sure! :)
I love ALL OF YOUR VIDEOS. MATH IS Beautiful!!!!
Great video!
YOUR SHIRT IS SO COOL!!!
Many thanks!
That's cool. I've always wondered why shoelace work. We can let the area of a triangle with vertices (0,0), (a,b), (c,d) = area of triangle with vertices (0,0) , (1,0), (0,1) times determinant of a,c,b,d using the geometric interpretation of the matrix. which gives 1/2 * det(a,c,b,d)
Perfect. I enjoyed your video.
The Wikipedia article on this theorem is surprisingly missing a lot of justification. Your video filled in a lot of the blanks. So thank you. The part starting at 4:30 was incredibly helpful to me.
I love your videos you are awesome!!
Watching this video just now and I can see a computer algo using this formula, but at the last step, you perform an absolute value function on it so that the direction you traverse the path no longer matters, or rather, the algo doesn't need to know about directionality.
Like, imagine a circularly linked list that holds X-Y coordinates for a closed loop (assuming no self-intersections and straight segments). Traverse said list using the shoelace method and find its absolute value to find the area. I oughta try that, actually.
If you've done linear algebra it makes this so much easier to grasp
People familiar with basic CGI algorithms would likely come up with a different variation of the proof that doesn't need the generalised formula for the triangle area. TL;DR: Instead of (0,0) assume a point at (-inf, 0).
A simple algorithm for a polygon flood fill works as follows:
* Remember a number for each pixel on your screen, initialise that number to zero for every pixel.
* For each segment (x(j),y(j)) -> (x(j+1),y(j+1)) do this:
* If y(j) < y(j+1), then add 1 to all pixels to the left of that segment (i.e. all pixels with y(j) < y < y(j+1), 0 < x < line(y)).
* If y(j) > y(j+1), subtract 1 from all pixels to the left of that segment.
At the end, each pixel will have a value of 0 if it is outside the polygon, and a value of 1 if it is inside. This is because a pixel that has an odd number of segments to its right must necessarily be inside, and one with an even number of lines to its right must be outside. (Side-note #1: In fact, you don't need to remember an integer for each pixel, you need just one bit to store the parity. Side note #2: The algorithm can thus be implemented as a repeated line-wise XOR. The video memory is stored line-by-line, which makes the algorithm efficient).
To finish the proof: In each step, the area to the left of a line-segment corresponds to a quadrilateral that can be obtained by gluing together a triangle with an area of y((j+1)-y(j))*(x(j+1)-x(j))/2 and a rectangle with an area of (y(j+1)-y(j))*x(j). When you sum this over j and simplify, you get the shoe-lace formula. Incidentally, each quadrilateral can be considered a truncated triangle with a third point at (-inf, 0).
Cool video! Also, I love your shirt!
very nice. thank you.
Awesome.
Thank you
thanks for the help! :)
What!! I am amazed
Add two identical points to the place where the curve intersects itself, those two points can count as new vertices of a normal shape that doesn't intersect itself. The same goes for parametric shapes, when traveling along the curve and you hit an intersection, always chose the path that keeps the inside of the area to your left, in the case of the infinity shape, it's the one that has a non continuous derivative.
perfectly explained thank u
Excellent! That's actually a teaser video for my bored students!
This is so cool
Very nice.
If a curve intersects itself , the direction of traversal reverses from anticlockwise to clockwise. Therefore the area after the intersection is counted as negative.
Thanks stinky boy
Just from inspection, the self intersecting curves will produce a signed area opposite to the at the point at which they 'flip'. This is because the point of intersection changes the clockwise direction to the bottom of the area and the anticlockwise negative to the top - or vice-versa thus reversing the signs of the areas flipped.
Das war echt cool
As a Civil Engineering student in Surveying class, I realized that I could use cross-products of vectors to solve my area problems. It irritated my professor because I wasn’t following his approach, but he let me do it because the answers were always correct. As he begins to mention here when he brings up determinants, this shoelace format is just a slightly rewritten cross-product math approach.
For a self-intersecting curve, the formula should yield the total net area enclosed by the corresponding simple curves which 'go' counterclockwise (clockwise boundary produces negative area contributions).
This gives me flashbacks to contour integration in Complex Analysis and winding numbers.
"If you can't explain it simple you don't understand it." You certainly understand math perfectly!