# Maths - Matrix Calculus - Forum Discussion with Tadd

 By: Tadd - twfeldt Derivative of rotation matrix   2006-10-04 11:33 This page  https://www.euclideanspace.com/maths/differential/matrixcalculus/  directed me here.  It's hard to tell what exactly the problem is in your first computations, since it's possible that you define things with some different convention than I am used to. But as far as I can tell you are doing things with normal conventions. So I'll try to explain what the right way is as I understand it, and maybe you can get that to work with your system.    Basically, the relation I know of is that Rdot = -omega*R (not Rdot = omega*R). This is for an R, which is the rotation matrix from some frame 1 to frame 2. So a vector in frame 1 would be rotated to frame 2 like this: V2 = R*V1  The rotation matrix is defined by a series of Euler rotation angles. This link shows the way I'm used to defining things:  http://mathworld.wolfram.com/RotationMatrix.html  (equation 5-7) Some of the signs there differ from your Euler page  https://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm  So that may be part of the problem.  For example, where R1 is first computed, the signs on the sine entries are backwards. Your R1 would be the rotation from frame 2 to frame 1 (since it's the transpose of the "normal" way). A handy way of checking your rotation matrices is to say "I want to rotate the frame 1 y-axis by 90 degrees" and then the result should lie along one of the axes of frame 2, which is easy to check with just 1's and 0's in your R1. Check this for each of the axes, and you should be good. If it doesn't do like you expect, something is probably wrong in the rotation matrix.    I'll use x1,y1,z1 for the frame 1 axes and x2,y2,z2 for the frame 2 axes. So looking at the figure above your R1 equation, if you start with the y1 axis and rotate an attitude of 90 deg, the new y2 is along the old -x1 and the new x2 is along the y1. So with that arrangement, a vector in frame 1 that lies along the y1 axis should be the same a vector in frame 2 along the x2 axis (same sign). But if you multiply that out using 90 deg in your R1, you get the following:  [0 -1 0  1 0 0  0 0 1]  So for V2 = R1*V1, if V1 is a unit vector on the y-axis like I was testing above [0 1 0]', then you'll get X2 = [-1 0 0]'. Which is wrong. As I described above a 90 deg rotation of y1 should give you +x1 (not -x1). It's possible that somehow you are doing things with some different sign convention or something, but I don't think you are based on how you are using things. You do seem to use R1 to go from frame 1 to frame 2 like I would think and you use right-hand axes and rotations, so that all seems right.    The other part is omega then, which is the skew-symmetric form of the rotation rates.  So for x,y,z axes, the rate of rotation about those axes is wx, wy, and wz. And the skew-symmetric matrix is  [0 -wz wy  wz 0 -wx  -wy wx 0]  Using those definitions, Rdot = -omega*R should be true.    Hope that helps some and isn't too confusing. If you haven't been there, check out the gamedev.net math and physics forums - they're good about helping with these kinds of things.
 By: Martin Baker - martinbaker  RE: Derivative of rotation matrix   2006-10-05 07:57 Thanks for this, I'll work through this page, read the references you gave and try to resolve these issues.    I think there may be two types of issues involved:    1) Definitions and conventions (as you mentioned) - This is always a problem. There is often no standard, if there is I use it, example VRML/X3D standard. Where there is no standard, like euler angles I choose the conventions that were most popular and consistent when the pages were written. Provided I keep the standards consistent across all the pages then I should get the correct result!  I have documented the standards I am using here:  https://www.euclideanspace.com/maths/standards/    2) Differences from linear case: I need to make sure I fully understand this. With linear movement we just use v = dx/dt and we treat velocity v as being the same thing as dx/dt but with rotation the equation is more complicated:  [~w]*[R(t)] = [d R(t) / dt]  I've not seen this with any minus signs, but as you say, this may be to correct for inconsistent standards,    I recently had a e-mail from Mark Ioffe about this and he was kind enough to send me a proof of this, see these pages,  https://www.euclideanspace.com/physics/kinematics/angularvelocity/mark.htm  https://www.euclideanspace.com/physics/kinematics/angularvelocity/    What I want to do is understand the deeper reasons for this extra complexity. I think its because these are time varying quantities, of course v = dx/dt works for time varying quantities but at least if we have constant velocity (and so constant linear momentum) then dx/dt will be constant. But if [R(t)] represents the orientation of an object rotating at a constant angular velocity (and constant angular momentum) then [d R(t) / dt] will still vary with time but [~w] = [d R(t) / dt]*[R(t)]^-1 will not vary with time and therefore is a better representation of angular velocity?    So I have a lot of work to do on this page, so it may take me some time, but I think it will be much better so thanks again. When I've done that I'll work it through with the example you give to check it.    Do you think this would be a good approach?    Martin
 By: Tadd - twfeldt RE: Derivative of rotation matrix   2006-10-06 11:16 Thanks for those links to those Mark Ioffe pages, that was actually close to what I was looking for when I found your site. I'll have to read over them when I can.    Hmm, I'd never thought about the time-varying difference between [d R(t) / dt] and [~w] for constant angular velocities. But what you say would be right [~w] would be constant and [d R(t) / dt] would still vary if R(t) changes. For me, only keep track of the w's and the Euler angles and only compute [d R(t) / dt] when needed (when I take the derivative of some equation and end up needing it).    Yeah, that sounds like a good approach. It's hard for me to say if anything is definitely wrong, but since some things didn't appear right (with my conventions) AND you were having problems on that page, I thought this might be the cause.