Geometric Algebra, First Course, Episode 12: Rotations

Channel: David Geo Holmes (STEMCstudio) Published: 2021-05-20 2,185 words Source: auto_caption
Advanced Mathematics & Geometric Physics

Transcript

hello and welcome to the stem ce studio channel in this video we will take a look at how reflections are defined in geometric algebra in doing so we will discover a new geometric object that we call a rota and this rotor is responsible for rotating things in our case vectors but in higher dimensions it can wrote any element of the geometric algebra in a nice uniform way the rotor is also going to be extremely important to us because the rotor is the analog of the position of a body which we want in 2d physics simulations so just as the position of a body tells you where the body is the rotor is going to be used to rotate the body from a standard configuration which is normally kind of maybe up to some particular configuration which is the current attitude of the body so that rotor is often called the attitude but anyway we're getting a little bit ahead of ourselves let's see how rotations are defined and how incredibly simply simple it is once you start with reflections okay let's begin so here's the idea from a previous video a reflection of a vector in a plane which has a normal n or in our case because we're in two dimensions that plane is actually a line is given by this expression here the reflected vector is created by a sandwich of the unit normal surrounding the vector that we want to reflect and a minus sign is put at the front and here the multiplication that you're actually seeing is actually the geometric product that we've seen before so for example here's vector a here's a unit vector n which is perpendicular to this line here and when a is reflected in that line so imagine this line to be like a mirror when a is reflected it ends up where the green arrow is okay so that's all all pretty simple and that was described in the previous video video on reflections now there is a theorem that says that two reflections compose to give a rotation okay so let's just kind of look at look at that in our diagram here we have the vector a being reflected first in this plane here where the normal is in so it ends up over here and i've set up another normal here with it with this line here and that vector here then gets reflected in that plane so if you look at what's happened the blue vector here has been rotated over into this position and you can see actually because i've done a fairly simple example by similar triangles that we've got one unit here one unit here two units here two units here so the length of the vector is preserved as you'd expect and the rotation angle is actually twice the angle this angle in here is 45 degrees is actually twice the angle between either the planes or the unit normals so while it's fairly easy to prove using a two column proof for euclidean style proof that two reflections do compose to give a rotation this may not very be very convincing if you're concerned about how this works in three dimensions so a more rigorous way of doing it would be to actually prove that this expression here actually really does give a give a rotation and i'm not going to give that proof here um in fact i haven't done it myself although i've done part of the proof um but i believe we could actually do that prove that this rigorously does give a rotation and uh maybe that will be a subject of a future video a rotation um does result from um two reflections and you know from the theorem the angle through which you rotate is twice this angle in here okay now we can separate out this initial mn and give it a different name and call it a rotor okay so we call it a rotor by convention we use the word ah the symbol r and then we can write our reflected vector is the rotor multiplied by the original vector and then multiplied by the reverse that little tilde sign over the top of the r recall means the reverse of r and the reverse of r is of course n times m which is what we have here i've added a couple of notes here because we've been working in two dimensions and you know you may not be convinced that this is going to work in three dimensions um or how exactly it will work in three dimensions so there are a couple of things that i at this point i can only you know tell you that this is true um and until we until we meet three dimensions you know you won't be able to verify it but this double-sided rule of having r on the left and then r tilde the reverse of r on the right is what you need in 3d to make the rotations come out correctly or what you need generally in in any algebra to make rotations come out correctly in 2d you actually don't need it just as in complex numbers you can perform a rotation by just multiplying from one side however we're going to use this more general formula because this really is collect the correct formula for rotations the second thing i i should tell you is that this rotor formula formula also works to rotate other things like bivectors for example but since in 2d we only have the bivector of the plane that's not very interesting if you rotate the bivector in the plane nothing really happens so you can't see very much but if if this was in three dimensions this would actually correctly rotate by vectors as well okay so let's go and look at the the the code that actually generated this diagram just to see how that happened and then let's go and actually calculate this formula here to verify that everything actually does work okay so we'll go and hide our documentation and here is our code and here's our output okay now i'm not going to go through the entirety of this because much of it is similar to um to the reflection code that we did in the previous video but what i will say is that this these these vectors were actually generated uh using constructions from jsx graph so for example um i can with jxs jsx graph i can create the reflection of a point okay like here is the point a and i can reflect it in mirror n that's just a perpendicular and so there's a kind of a way to actually generate this you know this point from this point and then this point from this point and then i just draw the arrows to those points so the point i want to make is that this construction was constructed entirely using jsx graph and so it really doesn't have a lot to do with our geometric algebra so what i want to do right now is i want to compute this vector here starting with this vector here using our geometric number and i want to show that the vector that we compute in all cases is the same so we'll come down here and the first thing i'm going to do is uh well i was going to construct the rotor but i think the first thing i'm going to do is actually just constructed the reflected vector explicitly so we need m times n oops m times n times a and and then times n and then times m so let's write that to the dom here's b and as you can see b is minus two e one so it's minus two in the e one direction and then add and then we've got a little bit of a rounding error but we add one e2 so essentially it's plus e2 which is that so it is actually correct okay now we could have factored out if we look over here we could have factored out this m times n into a rota r and instead of computing m times n here we could have used r and we could have used r dot reverse okay and that also computes the same thing or we could use the operator approach which is to put a tilde in front of the r and that works too okay so that somewhat should convince you that we're computing the same thing let's let's change some of these angles a little bit so um theta is the angle the n makes to the x-axis and phi is the angle that m makes to the x-axis let's change phi to be 90 degrees okay so m is pointing upwards now so a first gets reflected in this plane so it ends up over here and then this vector gets reflected in this plane here so it comes down to here so we can see the result is minus one e one and then minus two e two and here's b minus one e one and minus two e two okay all good so one final thing let's take a look at our rope rotor our rotor is the product of two vectors and so we expect it to be something like a scalar because the the geometric product of two vectors is their dot product which is a scalar plus a bivector which is the wedge product so let's just take a look at that one minute if you look at this rotor you'll see that we have a very very small number it's actually scientific notation saying this is practically zero and the rotor is actually minus e1 where g2 so it's really as you might expect it's it's actually um it looks a lot like m and n which are unit vectors which are perpendicular so you've got e1 by g2 let's actually change the angle one moment and let make m have a 45 degree angle okay and you'll see now that our rotor is 0.707 minus 0.7071 e1 wedge e2 okay so what we're expecting is that our rotor will have a scalar part and it will have a bivector part we will see in future videos that actually this rotor can be expressed as something like a cosine of an angle and a sine of an angle with a quantity that is that squares to minus one and you should know that e1 where g2 which is just e1 e2 squares to minus one so essentially what we're looking at with our rotor is a manifestation of a sort of generalized euler formula the edi eats the i pi plus 1 equals 0 remember that formula or e to the i theta is cos theta plus i sine theta that formula actually works for anything where where i can be replaced by e1 by g2 so we'll see that in future videos the other thing that we will see in future videos is that a rotor from two directions can be calculated by that is a rotor that rotates from one direction to another direction can be calculated by considering the vector the unit vector that is halfway between them okay so if you if you kind of compute that rota and you make sure that you normalize this in between rotor to 1 then you'll get an expression for a rotor that rotates from this vector to this vector okay so that takes into account the normal angle doubling that we see with with the double-sided application of the rotor so that's how it works in geometric algebra rotations are very easily composed out of two reflections just by performing the two successive rotations together and we get an angle of rotation which is twice the angle between the two vectors and in addition if we so desire we can compute a formula for a rotor which will give us precisely a rotation through a given angle that we will do in a future video but if you actually want to try to compute that rodeo rotor yourself and try it out go ahead all right i hope this was useful this is going to allow us to move on and use our rotor as a kinematic variable when we're doing physics simulations so that's going to be super exciting we've actually got now got all of the tools that we need to really progress and do basically the elements of a physics engine i hope you enjoyed this uh if you did hit the like button so i know that i'm on track uh and if you want to see more videos like this then do hit the subscribe button below if you have any suggestions please leave comments okay take care and happy coding bye