rambling about polar quaternions (and some clifford algebra)
posted
I’ve wanted to make my own “how to actually understand and work with quaternions” thing for a bit now. it’d try to explain things in a way that doesn’t require any visualization, but also doesn’t try going too much into the formalities that tend to come with non-visualizations of quaternions.
this isn’t that explanation, but rather some miscellaneous rambles in my journey to re-derive all of quaternion stuff from only the definition.
the core of this kind of explanation relies on euler’s formula:
this is familiar to most who are already content with complex numbers, and easily provable from knowing the taylor expansions of , , and . in any case, the key to this is the idea that specifically isn’t special here. any “thing” that squares to -1 will work in this formula, and this includes quaternions.
polar complex numbers
to get back to complex numbers, say we have a complex number . to express it as an exponential:
e.g.
this is what’s called the polar form (or exponential form) of a complex number, because the number outside the is the length of the resulting complex number, while the number in the exponential is the between the complex number and
I used those vector terms because complex numbers actually map quite nicely to vectors, and by mapping vectors into complex space, operations can be done on them that have geometric meaning, mainly rotation. if we only care about rotational complex numbers, then , so no need to worry about that part.
take this complex number (note: I am using to mean ):
look what happens when we multiply it by, say, :
check that out! it sorta “rotated” that complex number 135 degrees. this is what stems from that polar transformation, and why it’s so useful for multiplying complex numbers together. you can do that same computation in the rectangular (”standard”) form of complex numbers and see that you end up with the same result
thus, if we use a mapping from a euclidean vector to the complex numbers, the polar form of a complex number can be interpreted as rotation by in the xy plane.
but wait
there’s a different way to convert a normalized complex number to the same polar form. instead of the bit determining the sign of the thing, we can just use a “normalized” imaginary part, which with only 1 component means the sign of . for determining the of rotation, that’s just :
do note that this only works for magnitude-1 complex numbers, since the will start going imaginary outside of . you can probably adapt this equation to be more general, but that’s not important for this at all. what’s important is that this works and will be relevant for the next section.
quaternions
how does this get adapted to quaternions? how do we get a quaternion to square to -1? well, as it turns out, any quaternion composed of only imaginary components that also has magnitude of 1 will square to -1:
this can be used to create the polar form of a normalized quaternion, derived directly from the way we did a normalized complex number:
e.g.
this leads to a (tentative) geometric meaning of the polar quaternion : it’ll rotate by in the plane that gets defined by . this plane can also be thought of as a vector axis with no loss of generality
how does this manifest into reality? take a very simple quaternion . here would represent the x-y plane, or the upwards-pointing z axis, and would represent a rotation of 45 degrees. so this should, somehow, rotate some mapping of a euclidean vector into the quaternions 45 degrees in the xy plane.
the “some mapping” there is the key crux here. in the complex number system, a simple mapping from a euclidean vector to the real and imaginary part worked wonderfully, but there’s a less clear idea here. there’s three imaginary parts and 1 real part. if we use one real part like the complex numbers, one of the imaginary numbers gets left out. that feels weird. so perhaps we can map vectors to the imaginary part and find something that comes from that
so, taking the simple vector , this would get mapped to . in theory, our quaternion would, when multiplied by this vector, perform a 45 degree rotation in the x-y plane, resulting in . does this come into fruition?
no.
there’s one idea to try to remedy this: multiplying a quaternion (or any complex thing) by its conjugate will always result in a real number:
moreover, this real number will be equal to 1 with normalized quaternions. can this be used to “cancel” the adverse effect of the quaternion?
would you look at that. we’re no longer getting a weird quaternion that can’t be mapped back to a vector. this appeared to have rotated the vector in the x-y plane by twice the angle specified by the quaternion. this is a general thing that can be applied to any quaternion. the construction of
will “rotate” the “vector” by radians in the plane defined by (or, as a more familiar notion, the axis defined by that imaginary quaternion)
ok now polar multiplication
now it’s time for the actual reason why I was going to write this. it was originally going to be just this part and nothing else, but that felt weird. everything before was review, now this is where intrigue sets in
so, complex numbers can be composed via multiplication. you get a new complex number that represents both rotations at once. this is the same thing with quaternions: multiplying them gives you a new quaternion that represents applying one rotation and then the other.
with complex numbers, multiplying is extremely easy in the exponential form:
you can verify this by converting to and fro the two forms while multiplying them.
however, this construct does not generalize to the quaternion form:
I believe this is because of the anticommutativity of quaternions. when converting to exponents and multiplying, that anticommutativity gets lost. I found this page that describes a scheme for multiplying two polar quaternions, but I can’t really make sense of it. very bad notation on the page.
something about clifford algebra
this section is unrelated to the polar stuff, but I do want to mention it
complex numbers and quaternions seem to be fundamentally different from each other when viewed through this lens, but they’re actually subalgebras of a very general algebraic structure called a clifford algebra. this is not the post to start explaining what a clifford algebra is; I want to make something like that for realsies eventually. but the core idea is that the mappings used for complex/quaternion stuff, while they do enable for the transformations so long as rules are followed, are not very generalizable. how would these mappings be done in 4d? 5d? not the easiest.
clifford algebra is a much more generalized framework that both complex numbers and quaternions are subalgebras of (as well as several, several other complex-like algebras). it separates the notion of a vector and what we consider “imaginary” sections of complex numbers/quaternions. after all, it’s a bit weird how in complex numbers, a 1:1 mapping from vectors to complex numbers can be done, but in quaternions, the mapping has to be done to the imaginary part only.
I hinted at this by not refering to rotations as “around an axis” by default, but rather “in a plane” by default. this was a hint to the existence of bivectors and the different way of thought they bring to the table.
but again, conversation for another day
there wasn’t really a point to this post
I kinda just wanted to coalesce this curiosity about quaternions in this post. there wasn’t really a point to it nor did I really desire to make it “organized”, which is probably evident. this was mainly trying to re-derive quaternion stuff without trying to say anything super formal or making absolute 100% sense of anything, but rather experimentation and seeing where ideas and threads lead.
…but that seems to have become the point of the post. math is about doing experiments with structure, finding patterns, and seeing if those patterns have a relation to something more tangible. there’s no real “nice” way to fundamentally explain why the “sandwich” “product” exists other than it’s an interesting emergent pattern of the created algebra that was then realized to have geometric meaning. sometimes stuff just happens in math, and we derive meaning from the things that happen. that’s what it’s all about! discovery, experimentation, and making relations.
so, go out there and experiment