Transcript for:
Understanding Coordinate Transformations and Rotations

Hey guys, welcome back to a new video. And this session will be the second one on coordinate transformations. Previously we looked at translations, where the origin of the new coordinate system is shifted in the x and y direction, and where both axes of the new coordinate system are still parallel to the original ones. In this video we will focus on rotations, where the origin of the new system remains unaltered, but the new coordinate axes are now rotated over a specific angle relative to the original coordinate system. The goal will then be to transform the coordinates from an object described in the original system to the coordinates as described from within our new rotated system. I will solve these exercises step by step, explaining the general method and the reasoning behind it. The timestamps for each exercise can be found in the comment section below. And with this intro out of the way, let's get into it. Any exercise on coordinate transformation starts out with drawing the original coordinate system. This means drawing an x and y coordinate axis. And in this particular exercise, we are interested in this vector, with the x component being 1 and the y component being 2. And if you're not familiar with vector components, I gladly refer you to my video where I go in-depth into vector components. What we're going to do now is we're going to consider a rotated coordinate system. This means an x' and a y' axis, which are both rotated over an angle alpha relative to the original x axis. The goal of this exercise is to find the new x' prime and y prime components of this vector. So what are the vector components as seen from this rotated coordinate system? So we know that in the original coordinate system the x and y components are simply 1 and 2. And as I said our goal now is to find the x prime and y prime components of the vector as seen in the rotated coordinate system. The first step is to realize that rotating the coordinate axis over an angle alpha and leaving the vector unchanged is exactly identical to leaving the coordinate axis unchanged and rotating the vector over an angle that is negative alpha. So the same magnitude but in the other direction. We can see this in our figure because in the original coordinate system the x component of our vector is much smaller than the y component. And therefore our vector is mostly pointing in the y direction. However for the rotated coordinate system, we see that the x component will be much larger than its y component. And therefore in this rotated frame of reference, the vector will mostly be pointing in the x prime direction. And this is of course completely identical to if we would have rotated our original vector over an angle minus alpha, so that in the original coordinate system, it would also point mostly in the x direction. And so we conclude that rotating the coordinate axis over an angle alpha is equivalent to rotating the vector itself. over an angle minus alpha. This allows us to write down the rotation matrix that we need in order to find the x prime and y prime components. Because we know the rotation matrix for rotating vectors over an angle alpha. And we know in this case that rotating the coordinate axis over an angle alpha is equal to rotating the vector over an angle minus alpha. So we can simply write down the regular rotation matrix, but now filled in for an angle minus alpha. And if you're not familiar with the rotation matrix, I will put a link down below to my very short video where I actually derive this matrix for any angle alpha. At this point we can use two properties of the cosine and the sine. We know that the cosine of minus alpha is equal to the cosine of alpha. So the cosine is a symmetric function. However we know that the sine of minus alpha is equal to minus the sine of alpha. So the sine is a odd function. Using these two relations we can simply rewrite our rotation matrix as follows. We get the cosine of alpha, the sine of alpha, because this minus sign and this minus sign combine to be a plus sign. We get minus the sine of alpha and the cosine of alpha. And this will be the rotation matrix we can now directly use to find the coordinates. of the vector in the rotated coordinate system. Having this general form, we can now simply fill in the fact that in our exercise, alpha, so the angle, is equal to 30 degrees, or equivalently pi over 6. This will give us a resulting rotation matrix, when alpha is equal to 30 degrees, of the following. The cosine of 30 degrees is the square root of 3 divided by 2. The sine of 30 degrees is simply one half minus the sine of 30 degrees will be minus one half and again the cosine of 30 degrees will be square root of 3 divided by 2. And at this point we have all the ingredients we need to find x prime and y prime of the vector in the rotated coordinate system. We have x prime and y prime which will be a vector. which is equal to our rotation matrix so square root of 3 divided by 2 one half minus one half and square root of three divided by two. And we multiply this with the original coordinates that we had for our vector in our original coordinate system. So one and two, one and two. Performing this simple matrix multiplication, we find that for the x component, we have the square root of two, which is the product of these two numbers, plus one. which is a product of these two numbers. And for the y component, we find minus one half, the product of these two numbers, plus the square root of three, which is a product of these two numbers. And these are the components of the original vector as seen from our rotated frame of reference. And we can even, by calculating what the square root of three is, give an approximate numerical solution to this, 1.86. and 1.22. So if we go back to our original sketch we see that indeed our x prime component is larger than our y prime component which reflects the fact that we are rotating our x-axis towards the vector that we are looking at. And this is how we can simply find the coordinates of our object in the rotated frame of reference. By using the rotation matrix of an angle opposite in sign of the angle that we rotate our coordinate system over. Let's now go to the next exercise which gives a very nice graphical application. Again we start out by drawing the original coordinate system, so an x and a y axis. and the vector which we are going to be looking at from a different rotated coordinate system. The x and y component in this case are equal, so they are both 1. And what we're going to do in this case is that we're going to be rotating the coordinate system over the same angle that our vector makes with the original coordinate system. So these will be our new coordinate axis, x prime and y prime. So what we want to do now is to find the coordinates of this vector in the new coordinate system, so the x prime and y prime coordinates. So we want to get from x and y, which are equal to 1. 1, 2, x' and y', which are unknown at this moment. Whereas in the previous exercise, alpha was given as being 30 degrees, in this case it's not given a priori. So we have to find alpha. We have to find this angle, which is of course the angle that the vector makes with the original x-axis, but is now also the angle that we rotate over for our coordinate. transformation. So how do we find the angle alpha starting from the x and y component of our vector in our original coordinate system? To do this we will use some very basic goniometric formulas. We draw a right angled triangle of which this side corresponds to our vector. So effectively we're redrawing this angle right here. So we see that this side corresponds to the y component and this side corresponds to the x component. And what we now need to know is this angle alpha. We know the very basic goniometric formula that the tangent of alpha of this angle is equal to the magnitude of this side. So in our case, this is y. divided by the magnitude of this side which is exactly the x component of our vector and we see that we can rewrite this formula such that alpha is equal to the inverse tangent of exactly the y component divided by the x component. Now in our case the x and y components are both 1. So we get the tangent inverse of 1 divided by 1 which is of course the inverse tangent of 1 and of course we know that this is 45 degrees which we could of course already known quite easily because this will always be the case if our x and y components are equal. Then our will always make an angle with 45 degrees with the x-axis. Now we can simply use the rotation matrix and directly write down the formula for the x prime and y prime components that we are looking for. For the rotation matrix we use of course the fact that we have to use the rotation matrix over an angle alpha that is opposite in sign of the angle that we are actually rotating over. So in this case it will be minus 45 degrees. And of course the original coordinates which will be 1 and 1. Using the relations of the cosine being an even function and the sine being an odd function we find of course the cosine of 45 degrees the sine of 45 degrees, minus the sine of 45 degrees and the cosine of 45 degrees. And our original components of course remain unaltered to be 1, 1. We now use the fact that the cosine of 45 degrees is equal to the sine of 45 degrees, which is equal to the square root of 2 divided by 2. And we can fill this directly in. So we get the square root of 2 divided by 2. Here again, also the square root of 2 divided by 2. Here minus the square root divided by 2. And end off with the square root of 2 divided by 2 times 1 and 1. 1. And at this point, we can do our basic matrix multiplication. So we have d square root of 2 divided by 2 plus d square root of 2 divided by 2, which is, of course, simply d square root of 2. And what we see now is that if we multiply these two numbers, we get minus d square root divided by 2. And we add to this plus d square root of 2 divided by 2. And of course, this will be 0. So So we see that our x component is the square root of 2, and the y component will actually be 0. So our vector will not have a y component or a 0 y component in our rotated coordinate system. And this now is immediately clear if we look at our original drawing. Because we see that indeed the x component here will simply be the magnitude of our original vector, and our original vector will have a magnitude of 0. of square root of 2, which can be simply found by the Pythagorean theorem if we have an x component being 1 and a y component being 1. And we see that the y component of this vector is simply 0, because this vector is completely along the x prime direction. So we see that this really checks out. This brings us to the end of this video, and I hope that you're now more familiar with the mathematical machinery used to rotate coordinate axes. It simply boils down to using the rotation matrix for an angle that is opposite in sign of the angle used to rotate our coordinate axes. If you have any questions or even suggestions for future topics, leave a comment down in the comment section below. If you liked the video, meaning if you learned something, Give it a thumbs up and if you want to get notified by future releases consider subscribing. And with that I thank you guys for watching and I will see you guys in the next one. Bye!