Awesome explanation. Just a little thing that you might want to create a video to explain. There are two matrices that we can extract from a quaternion multiplication p * q. We can extract the matrix for p (which corresponds to multiplying by a quaternion on the left) and we can extract the matrix for q (which corresponds to multiplying by a quaternion on the right). Fastforward to the video where you describe 3D rotations by using quaternions: here the formula is given by q * v * conj(q). Now people who write code are often presented with a routine to convert from quaternion to rotation matrix. This can be done by extracting the matrix for q (call it A) and extracting the matrix for conj(q) (call it B) and then multiplying B by A (or A by B). The matrices commute in this case. I hope that I did not make mistakes.
+Saad Taame Could you clarify what you mean by "extracting a matrix", perhaps with a numerical example? Furthermore, what is the point of converting the quaternion to a rotation matrix?
mdphdguy1 I mean representing the quaternion multiplication as a matrix-vector product. You showed the matrix corresponding to p in the video but there is another matrix corresponding to q. As for the rotation matrix, this is used in computer graphics.
+Mathoma The point of converting a quaternion to a rotation 3x3 matrix is for computer graphics. The graphics processors (GPUs) expect matrices, so they need to be converted. The formula to convert a quaternion to a rotation matrix looks very different[1] from the template you described in the video. Not sure if that's something you've explained in another video. If not, perhaps a video in the near future? [1] en.wikipedia.org/wiki/Rotation_matrix#Quaternion
+ray This matrix you cite is this way because the quaternions act in a two-sided manner to do rotations, i.e. the quaternion and its conjugate act on vectors by a left- and right-multiplication, both of which are linear operators. The matrix I have in this video does a left mutiplication and there's another matrix that does right multiplication. If you compose those two matrices/ linear transformations (multiply them together) you get a 4x4 matrix that looks like the one here and if you get rid of the first row and second column you get this matrix (after some substitutions based on the assumption you're using a unit quaternion: a^2+b^2+c^2+d^2=1). Although this might work well in practice, thinking of quaternions as acting through a one-sided transformation, i.e. represented by that single matrix you cite is no good at the abstract level because rotations in general act through two-sided transformation laws.
In other words, there is a ring isomorphism between the ring of quaternions and a subring of 4x4 real antisymmetric matrices. There is also a similar isomorphism between the ring of quaternions and a subring of 2x2 *complex* matrices: through it, the four quaternionic units are translated into the Pauli matrices. To see this, divide the 4x4 matrices corresponding to the units into 2x2 blocks and "reverse" the usual isomorphism between complex numbers and 2x2 real antisymmetric matrices with identical elements on the diagonal ("2D rotation matrices")
Great Videos. Question for you though. When you represented a quaternion as a 4x4 matrix in the beginning of this video, why did represent only one of the quaternions as a 4x4, the other as a 4x1, and not both matrices as 4x4's? Thank You in advanced for you response bruceam
Bruce Moore You can write two 4x4 and do the normal calculation, it will give you a 4x4 as a result matrix. On that result, you only care about the first column which is the new a,b,c,d. He was doing a simplified version by only calculate one column. He did mention it in the video. Pretty smart guy.
On the dodgy computer that I use, the CPU adds on small random errors whenever it does a multiplication. This will be disastrous if the graphics system uses vectors and t-matrices to do a chain of rotations. However with quaternions we can continually renormalise newly-generated quaternions so it isn’t so bad. If you replace quaternions with 4x4 matrices, well yes you can do it, but you are throwing away a principal merit of quaternions.
If a matrix times a matrix equal the matrix times a vector, then I think of eigenvalues and eigenvectors. What's the relation of quaternions to eigenvectors?
+SandburgNounouRs Remember we're converting the quaternion on the right to a column vector which is a 4 x 1 matrix (4 rows and 1 column). That's being multiplied on the left by a 4 x 4 matrix (the representation for the left quaternion) so the dimensions are compatible for matrix multiplication. Alternatively, I could have converted both left and right quaternions to their 4 x 4 matrix representation and multiplied those but using a column vector. That's actually what I'm thinking of when I say the quaternions can be thought of as a special subset of 4 x 4 matrices over the reals (this subset also forms a _ring_ ) of the form given in the video. The whole business of thinking of the one on the right as a column vector is a computational trick just because I didn't feel like multiplying out the whole 4 x 4 matrix, which is redundant anyway, and gives you the same quaternion in the end.
+Gideon Buckwalter Well, the identity matrix is equal to its inverse but for the i,j,k matrices, remember that these three matrices will square to -1. That implies that the inverse is actually the negative of these i,j,k matrices. This also happens to be the conjugate, just like in the complex numbers.
+Gideon Buckwalter Yes, the quaternion conjugate works just like complex numbers - you just negate all the imaginary parts and keep the real part the same. Furthermore, if you examine the matrix representation, taking the matrix transpose gives the representation for the conjugate. Another reason for the inverse being equal to the conjugate is that the conjugate is set up so that q.q*=|q|^2 where |q| is the magnitude of the quaternion (same deal in the complex numbers). All those quaternions, 1,i,j,k all have a magnitude of 1 so that means q.q*=1 which means q^(-1)=q*.
Awesome explanation. Just a little thing that you might want to create a video to explain. There are two matrices that we can extract from a quaternion multiplication p * q. We can extract the matrix for p (which corresponds to multiplying by a quaternion on the left) and we can extract the matrix for q (which corresponds to multiplying by a quaternion on the right). Fastforward to the video where you describe 3D rotations by using quaternions: here the formula is given by q * v * conj(q). Now people who write code are often presented with a routine to convert from quaternion to rotation matrix. This can be done by extracting the matrix for q (call it A) and extracting the matrix for conj(q) (call it B) and then multiplying B by A (or A by B). The matrices commute in this case. I hope that I did not make mistakes.
+Saad Taame
Could you clarify what you mean by "extracting a matrix", perhaps with a numerical example? Furthermore, what is the point of converting the quaternion to a rotation matrix?
mdphdguy1 I mean representing the quaternion multiplication as a matrix-vector product. You showed the matrix corresponding to p in the video but there is another matrix corresponding to q. As for the rotation matrix, this is used in computer graphics.
+Mathoma The point of converting a quaternion to a rotation 3x3 matrix is for computer graphics. The graphics processors (GPUs) expect matrices, so they need to be converted.
The formula to convert a quaternion to a rotation matrix looks very different[1] from the template you described in the video. Not sure if that's something you've explained in another video. If not, perhaps a video in the near future?
[1] en.wikipedia.org/wiki/Rotation_matrix#Quaternion
+ray
This matrix you cite is this way because the quaternions act in a two-sided manner to do rotations, i.e. the quaternion and its conjugate act on vectors by a left- and right-multiplication, both of which are linear operators. The matrix I have in this video does a left mutiplication and there's another matrix that does right multiplication. If you compose those two matrices/ linear transformations (multiply them together) you get a 4x4 matrix that looks like the one here and if you get rid of the first row and second column you get this matrix (after some substitutions based on the assumption you're using a unit quaternion: a^2+b^2+c^2+d^2=1).
Although this might work well in practice, thinking of quaternions as acting through a one-sided transformation, i.e. represented by that single matrix you cite is no good at the abstract level because rotations in general act through two-sided transformation laws.
Many thanks, makes it very easy to follow without excessive effort. This is how one should be taught to retain infomation!
Thank you so much, this is best explanation I have seen.
In other words, there is a ring isomorphism between the ring of quaternions and a subring of 4x4 real antisymmetric matrices. There is also a similar isomorphism between the ring of quaternions and a subring of 2x2 *complex* matrices: through it, the four quaternionic units are translated into the Pauli matrices. To see this, divide the 4x4 matrices corresponding to the units into 2x2 blocks and "reverse" the usual isomorphism between complex numbers and 2x2 real antisymmetric matrices with identical elements on the diagonal ("2D rotation matrices")
Yes Einstein!
Great Videos. Question for you though. When you represented a quaternion as a 4x4 matrix in the beginning of this video, why did represent only one of the quaternions as a 4x4, the other as a 4x1, and not both matrices as 4x4's?
Thank You in advanced for you response
bruceam
Bruce Moore You can write two 4x4 and do the normal calculation, it will give you a 4x4 as a result matrix. On that result, you only care about the first column which is the new a,b,c,d. He was doing a simplified version by only calculate one column. He did mention it in the video. Pretty smart guy.
On the dodgy computer that I use, the CPU adds on small random errors whenever it does a multiplication. This will be disastrous if the graphics system uses vectors and t-matrices to do a chain of rotations. However with quaternions we can continually renormalise newly-generated quaternions so it isn’t so bad. If you replace quaternions with 4x4 matrices, well yes you can do it, but you are throwing away a principal merit of quaternions.
Some awesome explanations here! Thank you for this amazing video, really helful
THANKS A LOT FOR EXCELLENT VIDEO!!!
Very insightful. Have never seen it done like this before.
If a matrix times a matrix equal the matrix times a vector, then I think of eigenvalues and eigenvectors. What's the relation of quaternions to eigenvectors?
Is there a way to do qvq-1 using matrices?
great series!!
Spinors?
another one great video! thank u
S tier video
Certainly the most tiresome array of ones and zeroes and minuses that I have ever -- with a wee bit of admiration -- awarded a thumbs-up to!
👌😊
How can you multiply a (1,4) matrix (vector) by another (1,4) matrix and have for result a vector (1,4), the dimensions are incompatible, right ?
+SandburgNounouRs
Remember we're converting the quaternion on the right to a column vector which is a 4 x 1 matrix (4 rows and 1 column). That's being multiplied on the left by a 4 x 4 matrix (the representation for the left quaternion) so the dimensions are compatible for matrix multiplication.
Alternatively, I could have converted both left and right quaternions to their 4 x 4 matrix representation and multiplied those but using a column vector. That's actually what I'm thinking of when I say the quaternions can be thought of as a special subset of 4 x 4 matrices over the reals (this subset also forms a _ring_ ) of the form given in the video. The whole business of thinking of the one on the right as a column vector is a computational trick just because I didn't feel like multiplying out the whole 4 x 4 matrix, which is redundant anyway, and gives you the same quaternion in the end.
In effect, instead of multiplying two matrices, we're applying one to the other.
SO(4)
Omg that is so helpful
thanks
YES!!
Valuable insights
Cool, so 1, i, j, and k are their own inverses!
+Gideon Buckwalter
Well, the identity matrix is equal to its inverse but for the i,j,k matrices, remember that these three matrices will square to -1. That implies that the inverse is actually the negative of these i,j,k matrices. This also happens to be the conjugate, just like in the complex numbers.
Oh right! So the conjugate of 1, i, j, and k are 1, -i, -j, and -k which means the conjugate of any of these is their matrix inverse. Is that right?
+Gideon Buckwalter
Yes, the quaternion conjugate works just like complex numbers - you just negate all the imaginary parts and keep the real part the same. Furthermore, if you examine the matrix representation, taking the matrix transpose gives the representation for the conjugate.
Another reason for the inverse being equal to the conjugate is that the conjugate is set up so that q.q*=|q|^2 where |q| is the magnitude of the quaternion (same deal in the complex numbers). All those quaternions, 1,i,j,k all have a magnitude of 1 so that means q.q*=1 which means q^(-1)=q*.