Obtain quaternion rotation from equation

94 Views Asked by At

I have this quaternion equation:

$$qaq^{-1}=b,$$

where values of $a$ and $b$ are known. I want to know if there is a unique solution for $q$, and in that case how to obtain it.

Thanks in advance.

EDIT: I forgot to mention that I'm using this for rotations, so i think $a$, $b$ and $q$ are unit quaternions. Sorry I'm new to quaternions.

2

There are 2 best solutions below

0
On

Certainly not unique, as if $q$ is a solution so is $t q$ for any real $t$. A necessary condition for existence is that $a$ and $b$ have the same norm.

0
On

As pointed out in other answers solution is not unique. However there is a simple algebraic expression to find a solution.

There exists a $q$ such that $q^{-1} a q = b$ iff $a$ and $b$ have the same real parts and the lengths of their pure quaternion parts are equal.

Lets assume that $a$ and $b$ are unit quaternions with zero real part (you might be interested im this case since this is the common way to embed 3D vectors in quaternion space), then $q=\frac{a(a+b)}{|a+b|}$ is a quaternion such that $q^{-1} a q = b$. However when $a$ and $b$ point in opposite directions then the division is undefined (in practice you can pick any 180 degree rotation in a plane containing the vectors to overcome that situation).

Now, lets assume $x$ and $y$ are unit quaternions with nonzero real parts (not equal) then you can still find $q$. Just apply the above expression to find $q$ casting the unit quaternions $x$ and $y$ to pure quaternions $a$ and $b$ (by zeroing the real parts). The resulting $q$ will still work for $q^{-1} x q = y$