Three-dimensional rotation operator

From HandWiki

This article derives the main properties of rotations in 3-dimensional space.

The three Euler rotations are one way to bring a rigid body to any desired orientation by sequentially making rotations about axis' fixed relative to the object. However, this can also be achieved with one single rotation (Euler's rotation theorem). Using the concepts of linear algebra it is shown how this single rotation can be performed.

Mathematical formulation

Let (ê1, ê2, ê3) be a coordinate system fixed in the body that through a change in orientation A is brought to the new directions [math]\displaystyle{ \mathbf{A}\hat e_1 , \mathbf{A}\hat e_2 , \mathbf{A}\hat e_3 . }[/math]

Any vector [math]\displaystyle{ \bar x =x_1\hat e_1+x_2\hat e_2+x_3\hat e_3 }[/math] rotating with the body is then brought to the new direction [math]\displaystyle{ \mathbf{A}\bar x =x_1\mathbf{A}\hat e_1+x_2\mathbf{A}\hat e_2+x_3\mathbf{A}\hat e_3, }[/math]

that is to say, this is a linear operator

The matrix of this operator relative to the coordinate system (ê1, ê2, ê3) is [math]\displaystyle{ \begin{bmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{bmatrix} = \begin{bmatrix} \langle\hat e_1 | \mathbf{A}\hat e_1 \rangle & \langle\hat e_1 | \mathbf{A}\hat e_2 \rangle & \langle\hat e_1 | \mathbf{A}\hat e_3 \rangle \\ \langle\hat e_2 | \mathbf{A}\hat e_1 \rangle & \langle\hat e_2 | \mathbf{A}\hat e_2 \rangle & \langle\hat e_2 | \mathbf{A}\hat e_3 \rangle \\ \langle\hat e_3 | \mathbf{A}\hat e_1 \rangle & \langle\hat e_3 | \mathbf{A}\hat e_2 \rangle & \langle\hat e_3 | \mathbf{A}\hat e_3 \rangle \end{bmatrix}. }[/math]

As [math]\displaystyle{ \sum_{k=1}^3 A_{ki}A_{kj}= \langle \mathbf{A}\hat e_i | \mathbf{A}\hat e_j \rangle = \begin{cases} 0, & i\neq j, \\ 1, & i = j, \end{cases} }[/math] or equivalently in matrix notation [math]\displaystyle{ \begin{bmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{bmatrix}^\mathsf{T} \begin{bmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}, }[/math] the matrix is orthogonal and as a right-handed base vector system is reorientated into another right-handed system the determinant of this matrix has the value 1.

Rotation around an axis

Let (ê1, ê2, ê3) be an orthogonal positively oriented base vector system in R3. The linear operator "rotation by angle θ around the axis defined by ê3" has the matrix representation

[math]\displaystyle{ \begin{bmatrix} Y_1 \\ Y_2 \\ Y_3 \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} X_1 \\ X_2 \\ X_3 \end{bmatrix} }[/math] relative to this basevector system. This then means that a vector [math]\displaystyle{ \bar x= \begin{bmatrix} \hat e_1 & \hat e_2 & \hat e_3 \end{bmatrix} \begin{bmatrix} X_1 \\ X_2 \\ X_3 \end{bmatrix} }[/math] is rotated to the vector [math]\displaystyle{ \bar y = \begin{bmatrix} \hat e_1 & \hat e_2 & \hat e_3 \end{bmatrix} \begin{bmatrix} Y_1 \\ Y_2 \\ Y_3 \end{bmatrix} }[/math] by the linear operator. The determinant of this matrix is [math]\displaystyle{ \det\begin{bmatrix} \cos\theta & -\sin\theta & 0\\ \sin\theta & \cos\theta & 0\\ 0 & 0 & 1 \end{bmatrix} = 1 , }[/math] and the characteristic polynomial is [math]\displaystyle{ \begin{align} \begin{vmatrix} \cos\theta -\lambda & -\sin\theta & 0 \\ \sin\theta & \cos\theta -\lambda & 0 \\ 0 & 0 & 1-\lambda \end{vmatrix} &=\left(\left(\cos\theta -\lambda\right)^2 + \sin^2\theta \right)(1-\lambda) \\ &=-\lambda^3+(2 \cos\theta + 1) \lambda^2 - (2 \cos\theta + 1) \lambda + 1 . \end{align} }[/math]

The matrix is symmetric if and only if sin θ = 0, that is, for θ = 0 and θ = π. The case θ = 0 is the trivial case of an identity operator. For the case θ = π the characteristic polynomial is [math]\displaystyle{ -(\lambda-1)\left(\lambda +1\right)^2, }[/math] so the rotation operator has the eigenvalues [math]\displaystyle{ \lambda=1, \quad \lambda=-1. }[/math]

The eigenspace corresponding to λ = 1 is all vectors on the rotation axis, namely all vectors [math]\displaystyle{ \bar x = \alpha \hat e_3, \quad -\infty \lt \alpha \lt \infty. }[/math]

The eigenspace corresponding to λ = −1 consists of all vectors orthogonal to the rotation axis, namely all vectors [math]\displaystyle{ \bar x = \alpha \hat e_1 + \beta \hat e_2, \quad -\infty \lt \alpha \lt \infty, \quad -\infty \lt \beta \lt \infty. }[/math]

For all other values of θ the matrix is not symmetric and as sin2 θ > 0 there is only the eigenvalue λ = 1 with the one-dimensional eigenspace of the vectors on the rotation axis: [math]\displaystyle{ \bar x =\alpha \hat e_3, \quad -\infty \lt \alpha \lt \infty. }[/math]

The rotation matrix by angle θ around a general axis of rotation k is given by Rodrigues' rotation formula. [math]\displaystyle{ \mathbf{R} = \mathbf{I} \cos\theta + [\mathbf{k}]_\times \sin\theta + (1 - \cos\theta) \mathbf{k} \mathbf{k}^\mathsf{T}, }[/math] where I is the identity matrix and [k]× is the dual 2-form of k or cross product matrix, [math]\displaystyle{ [\mathbf{k}]_\times = \begin{bmatrix} 0 & -k_3 & k_2 \\ k_3 & 0 & -k_1 \\ -k_2 & k_1 & 0 \end{bmatrix}. }[/math]

Note that [k]× satisfies [k]×v = k × v for all vectors v.

The general case

The operator "rotation by angle θ around a specified axis" discussed above is an orthogonal mapping and its matrix relative to any base vector system is therefore an orthogonal matrix. Furthermore its determinant has the value 1. A non-trivial fact is the opposite, that for any orthogonal linear mapping in R3 with determinant 1 there exist base vectors ê1, ê2, ê3 such that the matrix takes the "canonical form" [math]\displaystyle{ \begin{bmatrix} \cos\theta & -\sin\theta & 0 \\ \sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix} }[/math] for some value of θ. In fact, if a linear operator has the orthogonal matrix [math]\displaystyle{ \begin{bmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{bmatrix} }[/math] relative to some base vector system (1, 2, 3), we can distinguish two cases.

Symmetric matrix case The "symmetric operator theorem" (Spectral theorem) valid in Rn (any dimension) applies saying that it has n orthogonal eigenvectors. This means for the 3-dimensional case that there exists a coordinate system ê1, ê2, ê3 such that the matrix takes the form [math]\displaystyle{ \begin{bmatrix} B_{11} & 0 & 0 \\ 0 & B_{22} & 0 \\ 0 & 0 & B_{33} \end{bmatrix}. }[/math]

As it is an orthogonal matrix these diagonal elements Bii are either 1 or −1. As the determinant is 1 these elements are either all 1 or one of the elements is 1 and the other two are −1. In the first case it is the trivial identity operator corresponding to θ = 0. In the second case it has the form [math]\displaystyle{ \begin{bmatrix} -1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{bmatrix} }[/math]

if the basevectors are numbered such that the one with eigenvalue 1 has index 3. This matrix is then of the desired form for θ = π.

Asymmetric matrix case If the matrix is asymmetric, the vector [math]\displaystyle{ \bar E = \alpha_1 \hat f_1 + \alpha_2 \hat f_2 + \alpha_3 \hat f_3, }[/math] where [math]\displaystyle{ \alpha_1=\frac{A_{32}-A_{23}}{2}, \quad \alpha_2=\frac{A_{13}-A_{31}}{2}, \quad \alpha_3=\frac{A_{21}-A_{12}}{2} }[/math] is nonzero. This vector is an eigenvector with eigenvalue λ = 1. Setting [math]\displaystyle{ \hat e_3=\frac{\bar E}{|\bar E|} }[/math]

and selecting any two orthogonal unit vectors ê1 and ê2 in the plane orthogonal to ê3 such that ê1, ê2, ê3 form a positively oriented triple, the operator takes the desired form with [math]\displaystyle{ \begin{align} \cos \theta &= \frac{A_{11}+A_{22}+A_{33}-1}{2},\\ \sin \theta &= |\bar{E}|. \end{align} }[/math]

The expressions above are in fact valid also for the case of a symmetric rotation operator corresponding to a rotation with θ = 0 or θ = π. But the difference is that for θ = π the vector

[math]\displaystyle{ \bar E = \alpha_1 \hat f_1 + \alpha_2 \hat f_2 + \alpha_3 \hat f_3 }[/math]

is zero and of no use for finding the eigenspace of eigenvalue 1, and thence the rotation axis.

Defining E4 as cos θ the matrix for the rotation operator is [math]\displaystyle{ \frac{1-E_4}{E_1^2+E_2^2+E_3^2} \begin{bmatrix} E_1 E_1 & E_1 E_2 & E_1 E_3 \\ E_2 E_1 & E_2 E_2 & E_2 E_3 \\ E_3 E_1 & E_3 E_2 & E_3 E_3 \end{bmatrix} + \begin{bmatrix} E_4 & -E_3 & E_2 \\ E_3 & E_4 & -E_1 \\ -E_2 & E_1 & E_4 \end{bmatrix}, }[/math]

provided that [math]\displaystyle{ E_1^2+E_2^2+E_3^2 \gt 0. }[/math] That is, except for the cases θ = 0 (the identity operator) and θ = π.

Quaternions

Main page: Quaternions and spatial rotation

Quaternions are defined similar to E1, E2, E3, E4 with the difference that the half angle θ/2 is used instead of the full angle θ. This means that the first 3 components q1, q2, q3 components of a vector defined from [math]\displaystyle{ q_1 \hat{f}_1 + q_2 \hat{f}_2 + q_3 \hat{f}_1 = \sin \frac{\theta}{2} ,\quad \hat{e}_3=\frac{\sin \frac{\theta}{2}}{\sin\theta} ,\quad \bar E, }[/math] and that the fourth component is the scalar [math]\displaystyle{ q_4=\cos \frac{\theta}{2}. }[/math]

As the angle θ defined from the canonical form is in the interval [math]\displaystyle{ 0 \le \theta \le \pi, }[/math] one would normally have that q4 ≥ 0. But a "dual" representation of a rotation with quaternions is used, that is to say (q1, q2, q3, q4)}} and (−q1, −q2, −'q3, −q4) are two alternative representations of one and the same rotation.

The entities Ek are defined from the quaternions by [math]\displaystyle{ \begin{align} E_1&=2 q_4 q_1, \quad E_2=2 q_4 q_2, \quad E_3=2 q_4 q_3, \\[8px] E_4&=q_4^2 -\left(q_1^2+q_2^2+q_3^2\right). \end{align} }[/math]

Using quaternions the matrix of the rotation operator is [math]\displaystyle{ \begin{bmatrix} 2\left(q_1^2+q_4^2\right)-1 &2\left(q_1q_2-q_3q_4\right) &2\left(q_1q_3+q_2q_4\right) \\ 2\left(q_1q_2+q_3q_4\right) &2\left(q_2^2+q_4^2\right)-1 &2\left(q_2q_3-q_1q_4\right) \\ 2\left(q_1q_3-q_2q_4\right) &2\left(q_2q_3+q_1q_4\right) &2\left(q_3^2+q_4^2\right)-1 \end{bmatrix}. }[/math]

Numerical example

Consider the reorientation corresponding to the Euler angles α = 10°, β = 20°, γ = 30° relative to a given base vector system (1, 2, 3). The corresponding matrix relative to this base vector system is (see Euler angles) [math]\displaystyle{ \begin{bmatrix} 0.771281 & -0.633718 & 0.059391 \\ 0.613092 & 0.714610 & -0.336824 \\ 0.171010 & 0.296198 & 0.939693 \end{bmatrix}, }[/math] and the quaternion is [math]\displaystyle{ (0.171010, -0.030154, 0.336824, 0.925417). }[/math]

The canonical form of this operator [math]\displaystyle{ \begin{bmatrix} \cos\theta & -\sin\theta & 0\\ \sin\theta & \cos\theta & 0\\ 0 & 0 & 1 \end{bmatrix} }[/math] with θ = 44.537° is obtained with [math]\displaystyle{ \hat e_3=(0.451272,-0.079571,0.888832). }[/math]

The quaternion relative to this new system is then [math]\displaystyle{ (0, 0, 0.378951, 0.925417) = \left(0, 0, \sin\frac{\theta}{2}, \cos\frac{\theta}{2}\right). }[/math]

Instead of making the three Euler rotations 10°, 20°, 30° the same orientation can be reached with one single rotation of size 44.537° around ê3.

References

  • Shilov, Georgi (1961), An Introduction to the Theory of Linear Spaces, Prentice-Hall, Library of Congress 61-13845 .