# Inverse of quaternion kinematic matrix

In a robot or spacecraft attitude representation, using quaternion is relevant. The kinematic equation is as below

$$\begin{bmatrix} \dot{q}_0 \\ \dot{q} \end{bmatrix} = \frac{1}{2} \begin{bmatrix} -q^\top \\ q_0\,I_3 + q^\times \end{bmatrix} \omega.$$

In this equation quaternions derivative are calculated based on angular velocity $$\omega$$. I want to calculate $$\omega$$ based on quaternions derivatives. So I should inverse the matrix multiplied to $$\omega$$ in above equation. Is there any straight forward way to inverse it analytically?

## 1 Answer

In order to make the notation shorter for the remaining calculations in my answer I will denote the matrix with

$$H = \frac{1}{2} \begin{bmatrix} -q^\top \\ q_0\,I_3 + q^\times \end{bmatrix}.$$

In this case you have four equations but only three unknowns. So there might not be a solution that exactly matches all equations, especially when the time derivative of the quaternion is perturbed, i.e. by numerical rounding errors. However, there is an elegant least squares solution that minimizes $$\|\dot{\textbf{q}} - H\,\omega\|$$. Here I use $$\textbf{q}$$ to denote the entire quaternion $$\begin{bmatrix}q_0 & q^\top\end{bmatrix}^\top$$. This least squares solution can shown to be

$$\omega = \left(H^\top H\right)^{-1} H^\top \dot{\textbf{q}}.$$

It can be noted that if the quaternion is of unit length then the matrix, whose inverse is taken, simplifies to

$$\left(H^\top H\right)^{-1} = 4\,I_3.$$

Thus the solution for the angular velocity in a reduced form can also be written as

$$\omega = 4\,H^\top \dot{\textbf{q}} = 2 \begin{bmatrix} -q & q_0\,I_3 \!-\! q^\times \end{bmatrix} \begin{bmatrix} \dot{q}_0 \\ \dot{q} \end{bmatrix}.$$

• thank you @fibonatic
– King
May 2, 2021 at 8:53
• can you give me a few textbook or manuscript references for more details?
– King
May 9, 2021 at 3:10
• @King After a quick search I think this one is one of the better ones. If you would like more information you could look yourself using a search similar to "least squares using linear algebra". May 9, 2021 at 9:51
• I meant the reference for (H⊤H)^(−1)=4I part.
– King
May 14, 2021 at 8:18
• @King that follows from $\|\textbf{q}\|=1$. I am not aware of a specific reference for this result. May 14, 2021 at 8:54