# Solve for two quaternions that transformed another quaternion

I have the following problem:

$$q_2 = q_aq_bq_1{q_b}^{-1}$$

All the $$q$$'s are quaternions and I want to solve for $$q_a$$ and $$q_b$$, given more than one $$[q_1, q_2]$$ pairs, the last term is the inverse of $$q_b$$.

I tried to solve them like a typical simultaneous equation problem, but the inverse and the non-commutative nature is giving me a hard time.

• Do you mean you want to find possible $q_1,\,q_2$? If so, it would be clearer to say "solve for given $q_a$ and $q_b$, since "solve for" often otherwise implying you're staying what is sought and unknown. – J.G. Mar 14 at 7:43
• Actually no, I want to find $q_a$ and $q_b$, let me clarify that – klWu Mar 14 at 7:46

Choose any $$q_b\ne 0$$ you want; then for given $$q_1,\,q_2$$, we can find a unique $$q_a$$ that works, viz. $$q_2=q_aq_bq_1q_b^{-1}\iff q_2q_b=q_aq_bq_1\iff q_2q_bq_1^{-1}=q_aq_b\iff q_a=q_2q_bq_1^{-1}q_b^{-1}.$$ Replacing $$q_1,\,q_2$$ with $$q_3,\,q_4$$ allows the same $$q_a,\,q_b$$ as a solution iff $$q_4q_bq_3^{-1}=q_2q_bq_1^{-1}$$, or equivalently $$q_b=q_4^{-1}q_2q_bq_1^{-1}q_3$$. So this gets into how one solves $$q=pqr$$ with $$|pr|=1$$. For $$p:=q_4^{-1}q_2,\,r:=q_1^{-1}q_3$$, I recommend solving this by simultaneous equations. Once you have $$q_b$$ up to real scaling, you get $$q_a$$. If there are three or more pairs $$q_a,\,q_b$$ have to work for, you'll get even more constraints that will still keep the same scaling redundancy, if there are still nonzero solutions.
• Thanks, but solving for $q=pqr$ is exactly where I'm stuck on. Isn't simultaneous equation solving exactly how we get to this step? I don't know how to isolate q to one side of the equal sign. – klWu Mar 14 at 8:46
• @KlWu I mean solve for the four parts of $q$ as real variables; each of the four parts of $q=pqr$ gives an equation in these variables, so in the end it's equivalent to solving $Mv=v$ for $v\in\Bbb R^4$, for some matrix $M\in\Bbb R^{4\times 4}$ whose entries are expressible in terms of the components of $p,\,r$. Note $M$ won't be invertible, but you can get $v$ up to scaling. – J.G. Mar 14 at 8:49
• I have been solving it with the $Mv=v$ way by looking for the eigenvector of M with eigenvalue of 1. I ended up with 4 complex eigen values all with modus of 1 and 4 sets of eigen vectors with complex coefficients. What went wrong? – klWu Mar 15 at 8:29