2
$\begingroup$

I'm reading Ken Shoemake's explanation of quaternions in David Eberly's book Game Physics. In it, he defines the rotation matrix for a quaternion $q = x\mathbf{i} + y\mathbf{j} + z\mathbf{k} + w\mathbf{1}$ to be the product of two matrices:

$\begin{align} \mathbf{Q\overleftarrow{Q}}^T &= \begin{bmatrix} w & -z & y & x \\ z & w & -x & y \\ -y & x & w & z \\ -x & -y & -z & w \end{bmatrix} \begin{bmatrix} w & -z & y & -x \\ z & w & -x & -y \\ -y & x & w & -z \\ x & y & z & w \end{bmatrix} \\ &= \begin{bmatrix} \mathbf{R} & 0 \\ 0 & xx + yy + zz + ww \end{bmatrix} \end{align} $

where $ \mathbf{R} = \begin{bmatrix} ww - zz - yy + xx & -wz -zw + yx + xy & wy + zx + yw + xz \\ zw + wz + xy + yx & -zz + ww - xx + yy & zy - wx - xw + yz \\ -yw + xz - wy + zx & yz + xw + wx + zy & -yy - xx + ww + zz \end{bmatrix} $

I can follow this so far. $\mathbf{R}$ is easy to see from the rules of matrix multiplication. But then the book goes on to say that because the bottom right corner of the block matrix (ie, $xx + yy + zz + ww$) is $\textrm{N}(q)$, and because we're concerned with normalized rotations $\textrm{N}(q) = 1$, $\mathbf{R}$ can be simplified to

$ \begin{bmatrix} 1 - 2(z^2 + y^2) & 2(xy - wz) & 2(zx + wy) \\ 2(xy + wz) & 1-2(x^2 + z^2) & 2(yz - wx) \\ 2(zx - wy) & 2(yz + wx) & 1 - 2(x^2 + y^2) \end{bmatrix} $

I don't understand why the elements of the main diagonal can be simplified this way. How does $x^2 + w^2 - y^2 - z^2 = 1 - 2(z^2 + y^2)$? Does this only work because $x^2 + y^2 + z^2 + w^2 = 1$?

$\endgroup$
1
  • 1
    $\begingroup$ PS: I like the format of your question, it made it very easy to see where your problem was and provided the context needed. (Which unfortunately is not the case for most questions here on math.SE.) $\endgroup$
    – flawr
    Dec 14, 2015 at 19:12

1 Answer 1

1
$\begingroup$

Exactly, you can easily see that

$\begin{align}x^2 + w^2 - y^2 - z^2 &= x^2+w^2+(y^2-2y^2)+(z^2-2z^2) \\ &= \underbrace{x^2+w^2+y^2+z^2}_{=1} - 2(z^2+y^2) \\ &= 1 - 2(z^2 + y^2)\end{align}$

It works exactly the same way for all the entries of the diagonal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.