I've recently had a graphics programmer interview and I was asked about math that is under the hood of quaternions. I briefly mentioned the formulas of using quaternions as rotations, but the interviewer was not satisfied and pushed me to tell more about complex numbers and other relevant stuff in order to reveal my understanding of this topic.

I should admit that my knowledge is mostly limited to linear algebra and I never really dug deep enough to feel confident about quaterions questions. On the other hand, however, after reading about it a bit, I couldn't see any practical sense in knowning how quaternions are defined, their algebraic properties, etc... So I wonder if in fact just memorizing formulas is more than enough (especially provided this whole topic is beyond linear algebra) or you really can be more effective at applying it if you get familiar with the quaternions math?


1 Answer 1


From my own experience, I've got 70 answers in the tag with 1350 total score, so to a first approximation, it looks like over 100 people (and their games) have benefited from me knowing something about the innards of quaternion math. 😉 (And that's not counting the other 143 answers that use quaternions without being so tagged)

Greatest hits include mapping 3D models from one coordinate system to a different coordinate system used in an engine, or using tricks to average multiple orientations, as well as working with IMU sensor inputs.

Anecdotally, I do observe a number of bugs arising from folks misunderstanding the components of a quaternion and using them in inappropriate ways - bugs I'm able to spot because I have a decent handle on the underlying math.

That I'd say is probably the main benefit of knowing the internals: instead of glazing over when you see some code doing quaternion math and just assuming they know what they're doing, your sniff test tells you "...wait a minute...!" and you spot things a more quaternion-phobic programmer might miss. 😁

Quaternions are used for expressing and interpolating the poses of bones in animation and IK systems, and sometimes in orienting particles/ribbons in VFX systems, so it's reasonable to expect that as a graphics programmer you might occasionally touch code that works with quaternions in a low-level manner, manipulating imaginary numbers. Particularly in shader code, where you usually won't have a user-friendly library to abstract away the mathy details behind higher-level operations. Knowing tricks like the fact that a quaternion dot product gives a measure of similarity between two orientations can save you a pile of normalization and trig in performance-critical code.

So, I don't think it's unreasonable for an interviewer to ask a graphics programming candidate quaternion questions to gauge their confidence in this area. Or at least, no more unreasonable than tech interviews in general. Frankly, we have no idea how to interview candidates well in software generally, and games in particular. So, given that we have no idea what we're doing, I'd consider this line of questioning no worse than classics like "describe how to reverse a linked list". Is it an accurate guide to whether someone can do the job? No. Do we have a better filter? Unclear.

  • \$\begingroup\$ Thanks for the answer. Could you please share some books/materials one could refer to in order to get better in this area? It's unclear for me if you are supposed to know entire ring theory or the application of this knowledge is limited to some topics. Thank you \$\endgroup\$ Apr 2, 2022 at 8:33
  • 1
    \$\begingroup\$ Honestly, I get by with just the Wikipedia article. \$\endgroup\$
    – DMGregory
    Apr 2, 2022 at 11:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .