[math-fun] Quaternion/vector algebra
The recent discussions of quaternions on math-fun reminded me that the algebraic manipulations of quaternions are quite alien and inscrutable to those familiar with commutative and/or matrix algebra. In particular, the appearance of a _quaternion square root_ in one standard quaternion formula heavily used in computer graphics seems completely contrived/deus ex machina. Notationally, I will use lowercase letters to represent quaternion variables and uppercase letters to represent vector variables, where vectors are a subset of quaternions which have zero scalar parts. Quaternion multiplication is represented by juxtaposition. It is a simple exercise in algebra to convince oneself that the function taking U->qUconj(q) takes vectors to vectors; i.e., the scalar part of the image is also zero, because the contributions from q and conj(q) cancel. It so happens that this transformation rotates U about the axis V(q), where V(q) is the vector part of q, and also scales the vector U by q conj(q)=N(q). Suppose that we are given a vector A which will be mapped into the vector A' by an unknown quaternion q; i.e., we want to find q such that A' = q A conj(q). How can we find q using algebra? The simplest rotation that maps A->A' has the axis AxA', where "x" here denotes the traditional Gibbs vector cross product. For our purposes, the most interesting fact about this axis is that it is perpendicular to both A and A'; i.e., A.(AxA')=A'.(AxA')=0, where "." here denotes the traditional Gibbs vector dot product. We now need a little lemma to show how algebraic manipulations of quaternions with perpendicular vector parts can be performed. Lemma. If the vector part of q is perpendicular to vector U, then Uq=conj(q)U. Proof: We express q in terms of its scalar and vector parts: q = S(q) + V(q) The perpendicularity condition is U.V(q)=0. Uq = U(S(q)+V(q)) = U S(q) + U V(q) = S(q)U + UxV(q) - U.V(q) = S(q)U + UxV(q) = S(q)U - V(q)xU = S(q)U - (V(q)xU - V(q).U) = S(q)U - V(q)U = conj(q)U QED Let us now go back to our equation A'=qAconj(q), which we would still like to solve for q. q A conj(q) = A' q q A = A' q^2 = A'/A q = +- sqrt(A'/A) Not only does algebra work, it works here even if |A'|/=|A|, i.e., even if the lengths of the vectors A,A' aren't equal. Note that A'/A = A'conj(A)/N(A) = A'(-A)/N(A) = -A'A/N(A) so q = +- sqrt(-A'A)/sqrt(N(A)) = +- sqrt(-A'A)/|A| which is the more traditional form of the quaternion solution.
participants (1)
-
Henry Baker