According to the wikipedia page on Quaternions:

The representations of rotations by quaternions are more compact and quicker to compute than the representations by matrices.

However, I have to admit, I don't fully understand what quaternions are and why they are useful. I have tried to read the article, but I don't understand why defining such a system is useful.

It appears to a define a four dimensional space in which 3 components are imaginary and one is real. Is this attempting to describe spacetime?

Regardless, I was hoping someone here could show how to represent a rotation using both quaternions and matrices and compare the two for me.

  • 1
    $\begingroup$ Have you looked at the questions already answered on our site? The list of Related questions in the margin is a good starting point. The use of quaternions in representing rotations is covered in many of those. $\endgroup$ – Jyrki Lahtonen Jul 9 '15 at 13:31
  • $\begingroup$ Quaternion algebra is used in many places in physics: SU(2) group is used in quantum mechanics and such. AFAICT it is not really to describe spacetime in spite of the apparent 3+1 dimensions. The metric of quaternions is Euclidean (as opposed to Lorentzian). Physicists can say something more precise. $\endgroup$ – Jyrki Lahtonen Jul 9 '15 at 13:35
  • $\begingroup$ You can see a symilar question here. math.stackexchange.com/questions/435680/… $\endgroup$ – Emilio Novati Jul 10 '15 at 17:31
  • $\begingroup$ Quaternions are always more compact: it uses fewer numbers, and then presumably less computation. $\endgroup$ – rschwieb Jul 16 '15 at 15:38

Consider the wikipedia article's section on performance considerations. For numerical computation, quaternions can be stored as 4 numbers, rather than 9 for a rotation matrix. When combining several successive rotations, quaternions save 17 floating point operations compared to multiplying rotation matrices together. Moreover, in a practical computation, one has to ensure that the quaternion is normalized (or account for its norm in some other way). It's quicker and more efficient to renormalize a quaternion than it is to renormalize a rotation matrix.

The cost for this convenience is that trying to compute a rotated vector from a quaternion takes 26 more floating point operations, so one has to consider whether the bulk of a computation is chaining rotations together or actually computing rotated vectors. For a computation that involves, say, tracking the orientation of a rigid body, that's all about chaining rotations, and quaternions would offer a reduction in memory and arithmetic operations needed.

Quaternions are substantially easier to work with as representations of individual rotations and when you need to chain those rotations together. They're a little more cumbersome to work with when you need to turn that representation into actually computing rotating vectors.

  • $\begingroup$ I'm assuming you are thinking about a rotation matrix in 3D. You can get away with storing a vector $\bf u$ and an angle $\theta$ which makes for 4 values, but then you have to do more cumbersome calculations building several matrices on the fly and using linearity of matrix multiplication. $\endgroup$ – mathreadler Jul 9 '15 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.