# Rotation operator (vector space)

{{#invoke:Hatnote|hatnote}}

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

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2}\ ,\ {\hat {e}}_{3}}$

be a coordinate system fixed in the body that through a change in orientation is brought to the new directions

${\displaystyle {\mathbf {A} }{\hat {e}}_{1}\ ,\ {\mathbf {A} }{\hat {e}}_{2}\ ,\ {\mathbf {A} }{\hat {e}}_{3}.}$

Any vector

${\displaystyle {\bar {x}}\ =x_{1}{\hat {e}}_{1}+x_{2}{\hat {e}}_{2}+x_{3}{\hat {e}}_{3}}$

rotating with the body is then brought to the new direction

${\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}}$

i.e. this is a linear operator

The matrix of this operator relative to the coordinate system

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2}\ ,\ {\hat {e}}_{3}}$

is

${\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}}}$

As

${\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}}}$

or equivalently in matrix notation

${\displaystyle {\begin{bmatrix}A_{11}&A_{12}&A_{13}\\A_{21}&A_{22}&A_{23}\\A_{31}&A_{32}&A_{33}\end{bmatrix}}^{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}}}$

the matrix is orthogonal and as a "right hand" base vector system is re-orientated into another "right hand" system the determinant of this matrix has the value 1.

### Rotation around an axis

Let

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2}\ ,\ {\hat {e}}_{3}}$

be an orthogonal positively oriented base vector system in ${\displaystyle R^{3}}$.

The linear operator

"Rotation with the angle ${\displaystyle \theta }$ around the axis defined by ${\displaystyle {\hat {e}}_{3}}$"

has the matrix representation

${\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}}}$

relative to this basevector system.

This then means that a vector

${\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}}}$

is rotated to the vector

${\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}}}$

by the linear operator.

The determinant of this matrix is

${\displaystyle \det {\begin{bmatrix}\cos \theta &-\sin \theta &0\\\sin \theta &\cos \theta &0\\0&0&1\end{bmatrix}}=1}$

and the characteristic polynomial is

{\displaystyle {\begin{aligned}\det {\begin{bmatrix}\cos \theta -\lambda &-\sin \theta &0\\\sin \theta &\cos \theta -\lambda &0\\0&0&1-\lambda \end{bmatrix}}&={\big (}{(\cos \theta -\lambda )}^{2}+{\sin \theta }^{2}{\big )}(1-\lambda )\\&=-\lambda ^{3}+(2\ \cos \theta \ +\ 1)\ \lambda ^{2}-(2\ \cos \theta \ +\ 1)\ \lambda +1\\\end{aligned}}}

The matrix is symmetric if and only if ${\displaystyle \sin \theta =0}$, i.e. for ${\displaystyle \theta =0}$ and for ${\displaystyle \theta =\pi }$.

The case ${\displaystyle \theta =0}$ is the trivial case of an identity operator.

${\displaystyle -(\lambda -1){(\lambda +1)}^{2}}$

i.e. the rotation operator has the eigenvalues

${\displaystyle \lambda =1\quad \lambda =-1}$

The eigenspace corresponding to ${\displaystyle \lambda =1}$ is all vectors on the rotation axis, i.e. all vectors

${\displaystyle {\bar {x}}=\alpha \ {\hat {e}}_{3}\quad -\infty <\alpha <\infty }$

The eigenspace corresponding to ${\displaystyle \lambda =-1}$ consists of all vectors orthogonal to the rotation axis, i.e. all vectors

${\displaystyle {\bar {x}}=\alpha \ {\hat {e}}_{1}+\beta \ {\hat {e}}_{2}\quad -\infty <\alpha <\infty \quad -\infty <\beta <\infty }$

For all other values of ${\displaystyle \theta }$ the matrix is un-symmetric and as ${\displaystyle {\sin \theta }^{2}>0}$ there is only the eigenvalue ${\displaystyle \lambda =1}$ with the one-dimensional eigenspace of the vectors on the rotation axis:

${\displaystyle {\bar {x}}=\alpha \ {\hat {e}}_{3}\quad -\infty <\alpha <\infty }$

The rotation matrix by angle ${\displaystyle \theta }$ around a general axis of rotation ${\displaystyle {\mathbf {k} }=\left[{\begin{array}{ccc}k_{1}\\k_{2}\\k_{3}\end{array}}\right]}$ is given by Rodrigues' rotation formula.

${\displaystyle R=I\cos \theta +[{\mathbf {k} }]_{\times }\sin \theta +(1-\cos \theta ){\mathbf {k} }{\mathbf {k} }^{\mathsf {T}}}$,
${\displaystyle [{\mathbf {k} }]_{\times }=\left[{\begin{array}{ccc}0&-k_{3}&k_{2}\\k_{3}&0&-k_{1}\\-k_{2}&k_{1}&0\end{array}}\right]}$.

### The general case

The operator

"Rotation with the angle ${\displaystyle \theta }$ 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, i.e. that for any orthogonal linear mapping in ${\displaystyle R^{3}}$ having determinant = 1 there exist base vectors

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2}\ ,\ {\hat {e}}_{3}}$

such that the matrix takes the "canonical form"

${\displaystyle {\begin{bmatrix}\cos \theta &-\sin \theta &0\\\sin \theta &\cos \theta &0\\0&0&1\end{bmatrix}}}$

for some value of ${\displaystyle \theta }$.

In fact, if a linear operator has the orthogonal matrix

${\displaystyle {\begin{bmatrix}A_{11}&A_{12}&A_{13}\\A_{21}&A_{22}&A_{23}\\A_{31}&A_{32}&A_{33}\end{bmatrix}}}$

relative some base vector system

${\displaystyle {\hat {f}}_{1}\ ,\ {\hat {f}}_{2}\ ,\ {\hat {f}}_{3}}$

and this matrix is symmetric, the "Symmetric operator theorem" valid in ${\displaystyle R^{n}}$ (any dimension) applies saying

that it has n orthogonal eigenvectors. This means for the 3-dimensional case that there exists a coordinate system

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2}\ ,\ {\hat {e}}_{3}}$

such that the matrix takes the form

${\displaystyle {\begin{bmatrix}B_{11}&0&0\\0&B_{22}&0\\0&0&B_{33}\end{bmatrix}}}$

As it is an orthogonal matrix these diagonal elements ${\displaystyle B_{ii}}$ 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 ${\displaystyle \theta =0}$.

In the second case it has the form

${\displaystyle {\begin{bmatrix}-1&0&0\\0&-1&0\\0&0&1\end{bmatrix}}}$

if the basevectors are numbered such that the one with eigenvalue 1 has index 3. This matrix is then of the desired form for ${\displaystyle \theta =\pi }$.

If the matrix is un-symmetric, the vector

${\displaystyle {\bar {E}}=\alpha _{1}\ {\hat {f}}_{1}+\alpha _{2}\ {\hat {f}}_{2}+\alpha _{3}\ {\hat {f}}_{3}}$

where

${\displaystyle \alpha _{1}={\frac {A_{32}-A_{23}}{2}}}$
${\displaystyle \alpha _{2}={\frac {A_{13}-A_{31}}{2}}}$
${\displaystyle \alpha _{3}={\frac {A_{21}-A_{12}}{2}}}$

is non-zero. This vector is an eigenvector with eigenvalue

${\displaystyle \lambda =1}$

Setting

${\displaystyle {\hat {e}}_{3}={\frac {\bar {E}}{|{\bar {E}}|}}}$

and selecting any two orthogonal unit vectors in the plane orthogonal to ${\displaystyle {\hat {e}}_{3}}$:

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2}}$

such that

${\displaystyle {\hat {e}}_{1}\ ,\ {\hat {e}}_{2},\ {\hat {e}}_{3}}$

form a positively oriented triple, the operator takes the desired form with

${\displaystyle \cos \theta ={\frac {A_{11}+A_{22}+A_{33}-1}{2}}}$
${\displaystyle \sin \theta =|{\bar {E}}|}$

The expressions above are in fact valid also for the case of a symmetric rotation operator corresponding to a rotation with ${\displaystyle \theta =0}$ or ${\displaystyle \theta =\pi }$. But the difference is that for ${\displaystyle \theta =\pi }$ the vector

${\displaystyle {\bar {E}}=\alpha _{1}\ {\hat {f}}_{1}+\alpha _{2}\ {\hat {f}}_{2}+\alpha _{3}\ {\hat {f}}_{3}}$

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

Defining ${\displaystyle E_{4}}$ as ${\displaystyle \cos \theta }$ the matrix for the rotation operator is

${\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}}}$

provided that

${\displaystyle {E_{1}}^{2}+{E_{2}}^{2}+{E_{3}}^{2}>0}$

i.e. except for the cases ${\displaystyle \theta =0}$ (the identity operator) and ${\displaystyle \theta =\pi }$

## Quaternions

{{#invoke:main|main}}

Quaternions are defined similar to ${\displaystyle E_{1}\ ,\ E_{2}\ ,\ E_{3}\ ,\ E_{4}}$ with the difference that the half angle ${\displaystyle {\frac {\theta }{2}}}$ is used instead of the full angle ${\displaystyle \theta }$.

This means that the first 3 components ${\displaystyle q_{1}\ ,\ q_{2}\ ,\ q_{3}\ }$ are components of a vector defined from

${\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}}}$

and that the fourth component is the scalar

${\displaystyle q_{4}=\cos {\frac {\theta }{2}}}$

As the angle ${\displaystyle \theta }$ defined from the canonical form is in the interval

${\displaystyle 0\leq \theta \leq \pi }$

one would normally have that ${\displaystyle q_{4}\geq 0}$. But a "dual" representation of a rotation with quaternions is used, i.e.

${\displaystyle q_{1}\ ,\ q_{2}\ ,\ q_{3}\ ,\ q_{4}\ }$

and

${\displaystyle -q_{1}\ ,\ -q_{2}\ ,\ -q_{3}\ ,\ -q_{4}\ }$

are two alternative representations of one and the same rotation.

The entities ${\displaystyle E_{k}}$ are defined from the quaternions by

${\displaystyle E_{1}=2q_{4}q_{1}}$
${\displaystyle E_{2}=2q_{4}q_{2}}$
${\displaystyle E_{3}=2q_{4}q_{3}}$
${\displaystyle E_{4}={q_{4}}^{2}-({q_{1}}^{2}+{q_{2}}^{2}+{q_{3}}^{2})}$

Using quaternions the matrix of the rotation operator is

${\displaystyle {\begin{bmatrix}2({q_{1}}^{2}+{q_{4}}^{2})-1&2({q_{1}}{q_{2}}-{q_{3}}{q_{4}})&2({q_{1}}{q_{3}}+{q_{2}}{q_{4}})\\2({q_{1}}{q_{2}}+{q_{3}}{q_{4}})&2({q_{2}}^{2}+{q_{4}}^{2})-1&2({q_{2}}{q_{3}}-{q_{1}}{q_{4}})\\2({q_{1}}{q_{3}}-{q_{2}}{q_{4}})&2({q_{2}}{q_{3}}+{q_{1}}{q_{4}})&2({q_{3}}^{2}+{q_{4}}^{2})-1\\\end{bmatrix}}}$

## Numerical example

Consider the reorientation corresponding to the Euler angles ${\displaystyle \alpha =10^{\circ }\quad \beta =20^{\circ }\quad \gamma =30^{\circ }\quad }$ relative a given base vector system

${\displaystyle {\hat {f}}_{1}\ ,\ {\hat {f}}_{2},\ {\hat {f}}_{3}}$

Corresponding matrix relative to this base vector system is (see Euler angles#Matrix orientation)

${\displaystyle {\begin{bmatrix}0.771281&-0.633718&0.059391\\0.613092&0.714610&-0.336824\\0.171010&0.296198&0.939693\end{bmatrix}}}$

and the quaternion is

${\displaystyle (0.171010,\ -0.030154,\ 0.336824,\ 0.925417)}$

The canonical form of this operator

${\displaystyle {\begin{bmatrix}\cos \theta &-\sin \theta &0\\\sin \theta &\cos \theta &0\\0&0&1\end{bmatrix}}}$

with ${\displaystyle \theta =44.537^{\circ }}$ is obtained with

${\displaystyle {\hat {e}}_{3}=(0.451272,-0.079571,0.888832)}$

The quaternion relative to this new system is then

${\displaystyle (0,\ 0,\ 0.378951,\ 0.925417)=(0,\ 0,\ \sin {\frac {\theta }{2}},\ \cos {\frac {\theta }{2}})}$

Instead of making the three Euler rotations

${\displaystyle 10^{\circ },20^{\circ },30^{\circ }}$

the same orientation can be reached with one single rotation of size ${\displaystyle 44.537^{\circ }}$ around ${\displaystyle {\hat {e}}_{3}}$

## References

• {{#invoke:citation/CS1|citation

|CitationClass=citation }}.