These notes have been developed for a lecture on the kinematics of movements in 3-dimensional (3D) space. The lecture introduces the mathematics underlying the measurement and analysis of 3D movements. Rotation matrices, rotation vectors, and quaternions are presented, and their relations described. The practical meaning of rotation matrices is explained, as well as the connection between angular orientation and angular velocity.

Only a relatively small group of people have become comfortable with the complex formalisms, and many researchers without a strong mathematical background have been deterred by the mathematics involved. In the following the geometrical background is presented in such a way that the reader can develop a basic intuitive understanding of 3D rotations. Although most relevant formulas are discussed, mathematical proofs which have been published elsewhere have been largely omitted.

Conventions and Basics

Movements in 3-dimensional space consist of translations as well as rotations. We will use the following conventions:


  • scalars are indicated by plain letters (e.g. a)

  • vectors are written with an arrow above (e.g. \(\vec{r}\) ) or in round brackets

    \[\begin{split}e.g.\left( {\begin{array}{*{20}{c}} {{r_1}}\\ {{r_2}}\\ {{r_3}} \end{array}} \right)\end{split}\]
  • matrices are written bold (e.g. R) or in square brackets

    \[\begin{split}\left[ {\begin{array}{*{20}{c}} {{R_{11}}}&{{R_{12}}}&{{R_{13}}}\\ {{R_{21}}}&{{R_{22}}}&{{R_{23}}}\\ {{R_{31}}}&{{R_{32}}}&{{R_{33}}} \end{array}} \right]\end{split}\]
  • vector- and matrix-elements are written in plain style, with indices denoted by subscripts (e.g. \(r_1; R_{12}\))

  • multiplications with a scalar are denoted by \(\ast\) (e.g. \(tan(\theta/2) \ast \vec{n}\) )

  • scalar-vector-products and matrix-multiplications are denoted by \(\cdot\) (e.g. \(\vec{p} \cdot \vec{q}\) )

  • vector-cross-products are denoted by \(\times\) (e.g. \(\vec{p} \times \vec{q}\) )

  • combinations of rotation vectors or quaternions are denoted by \(\circ\) (e.g. \(r_p \circ r_q\) )

Coordinate Systems

A frequent point of confusion is the choice of coordinate system. Let us denote a unit vector in the direction of the “1”, “2”, and “3”- axis with \({\vec n_1},{\vec n_2},and\,{\vec n_3}\), respectively. The direction of \({\vec n_1}\) can be chosen freely. For example, it can point forward, left, or up. In the following, we will commonly use a coordinate system where \({\vec n_1}\) points forward. \({\vec n_2}\) has to be perpendicular to \({\vec n_1}\) , and we choose \({\vec n_2}\) pointing to the left. \({\vec n_3}\) has to be perpendicular to \({\vec n_1}\) and \({\vec n_2}\), so it has to point up or down. A right-handed coordinate system – which is what is typically used – has to obey

\[{\vec n_1} \times {\vec n_2} = {\vec n_3}\]

So in our case \({\vec n_3}\) has to point up.


Figure 39: Right handed coordinate system.

Note that instead of the axis labeling (“1”, “2”, “3”) sometimes the alternative labeling (“x”, “y”, “z”) is found. In other applications, like image processing, one can often find a different choice of coordinate system, e.g. \({\vec n_1}\) pointing to the left, \({\vec n_2}\) pointing up, and \({\vec n_3}\) pointing forward. It is important to make sure which coordinate system is chosen.


Figure 40: Right-hand Rule. Remember where “x” is pointing to! (from Wikipedia, by R. Hewitt)

Mathematical Basis

Scalar Product

The scalar product of two vectors \(\vec{a}\) and \(\vec{b}\) is defined as

\[\begin{split}\left( {\begin{array}{{20}{c}} {{a_1}}\\ {{a_2}}\\ {{a_3}} \end{array}} \right) \cdot \left( {\begin{array}{{20}{c}} {{b_1}}\\ {{b_2}}\\ {{b_3}} \end{array}} \right) = {a_1}{b_1} + {a_2}{b_2} + {a_3}{b_3} = |\vec a|\, \cdot |\vec b| \cdot \cos (\theta )\end{split}\]

Figure 41: Graphical interpretation of scalar- (left) and vector-product (right).

Cross Product

The cross product of two vectors \(\vec{a}\) and \(\vec{b}\) is defined as

\[\begin{split}\left( {\begin{array}{{20}{c}} {{a_1}}\\ {{a_2}}\\ {{a_3}} \end{array}} \right) \times \left( {\begin{array}{{20}{c}} {{b_1}}\\ {{b_2}}\\ {{b_3}} \end{array}} \right) = \left( {\begin{array}{{20}{c}} {{a_2}{b_3} - {a_3}{b_2}}\\ {{a_3}{b_1} - {a_1}{b_3}}\\ {{a_1}{b_2} - {a_2}{b_1}} \end{array}} \right)\end{split}\]

The resulting vector is perpendicular to \(\vec{a}\) and \(\vec{b}\) , and vanishes if \(\vec{a}\) and \(\vec{b}\) are parallel.

Matrix Multiplication

In general, the multiplication of two matrices A and B is defined as

\[A \cdot B = C\]

with \({C_{ik}}\, = \,\sum\limits_j {{A_{ij}}} {B_{jk}}\).

This equation can also be used for multiplication of a matrix with a vector, when the vector is viewed as a matrix with n rows and one column.

Basic Trigonometry

The basic elements of trigonometry are illustrated in the Figure below:


Figure 42: Basic trigonometry.

From a Tailor-series of the exponential function, or graphically, from the Figure above, one can get the first components for small angles (i.e. \(\theta << 1\) )

\[\theta \approx \sin (\theta ) \approx \tan (\theta )\]

Also remember that for small angles

\[\cos (\theta ) \approx 1 - \frac{\theta^2}{2}\]

Thus for small angles the change in cos is only a second order effect.

Introductory Exercise

Simple Pendulum

At first sight, a pendulum offers a deceptively simple motion. For example, for small swings the movement is nicely sinusoidal. The forces acting on the pendulum, and the corresponding movement, will provide a first insight into the measurement of movement with accelerometers, or more generally speaking with IMUs (Inertial Measurement Units).


Figure 43: Simple pendulum.

  • Assume that you deflect the pendulum by an angle of \(\theta_0\), and then let go at t=0. Find the position of the pendulum for times \(0 <= t <= 10\).

To do so, you have to make use of Newton’s Second Law

\[\label{eq:Newton} F=m \frac{d^2x(t)}{dt^2}\]

and iteratively solve the equations for position and velocity:

\[\begin{split}\begin{aligned} x(t_{n+1}) &=& x(t_n) + vel(t_n)*\Delta t \\ vel(t_{n+1}) &=& vel(t_n) + \frac{F(x_{n+1})}{m}*\Delta t\end{aligned}\end{split}\]


  • First, write down the equations for \(\theta(t_i)\) and \(\omega(t_i)\).
  • Since you know the number of samples, pre-allocate the memory for \(\theta\) and \(\omega\).
  • Note that to improve the stability of the solution, the Euler-Cromer method is used in the Equation above. \(F(x_{n+1})\), not \(F(x_n)\).