# Given unit quaternions $q_0,q_1$, find $q$ such that $q_1 = q^* q_0 q$

I rotate an object in space and find two orientation (unit) quaternions. $q_0 = {}^{M_2}_{M_1} q$ is the orientation at the 2nd position relative to the 1st position, measured in frame M. $q_1 = {}^{S_2}_{S_1}q$ is the same change in orientation, but measured in frame S.

I also know that $q = {}^{S_1}_{M_1}q = {}^{S_2}_{M_2}q$, that is, the relative orientation of the two frames is fixed. This gives $qq_1 = q_0 q$, that is $q_1 = q^*q_0 q$.

Is there a way to find $q$? If so, how? Is it unique?

• Certainly not unique: if $q$ is a solution, so is $-q$. Oct 30, 2014 at 13:55

$$q_i = r_i + s v_i$$ where $r_i$ is the real part, $v_i$ is a unit vector in 3-space, and $s^2 + r^2 = 1$. Note that the "s" values for the two quaternions must be the same, as $s$ is the sine of the angle of rotation represented by the quaternion, and the two differ only by coordinate system, so the amounts of rotation are equal.
Now let $R$ be any rotation that takes $v_0$ to $v_1$. Write this as a quaternion, $q$, whose vector part is in the direction of the axis of the rotation $R$. Then $q_1 = q ^{*} q_0 q$ (or maybe you have to swap $0$ and $1$, but I don't think so).
In your case, I expect that $R$ is just the change-of-basis matrix between the two coordinate systems, but I don't understand your notation; even if I did, I couldn't tell you, without working carefully, which direction you want $R$ to go. :(