A rotation of 3D space can be written down in several ways. Each panel below shows the same rotation in a different representation. Drag the airplane or edit any panel and the others follow.

Drag to rotate the airplane. Hold Shift (or choose “view” below) to turn the camera instead. While it spins, drag and let go to fling it.

Drag rotates:

Euler angles three rotations about coordinate axes

Axis and angle one rotation about one axis

Axis n = (, , )

Unit quaternion q = w + x𝐢 + y𝐣 + z𝐤

−q is the same rotation as q.

Rotation matrix R ∈ SO(3)

Column j of R is where the rotation sends the j-th coordinate axis, which is the airplane's matching body axis. An entered matrix is replaced by the nearest rotation matrix.

Angular velocity how fast the rotation is changing

Show the motion ahead

Faint copies show where the airplane will be over the next few seconds, without moving it: while it's paused, they flow out of it at the speed it would move, fading as they go. Dotted curves show the paths of the nose, wingtips, and fin. Each velocity arrow v = ω × r is tangent to its path.

ω = (, , ) ωb = Rᵀω = (, , )

In rad/s: ω in the fixed coordinates, ωb in the airplane's body coordinates.

Spin about

Rates of change

How the representations are related

A rotation matrix is a \(3 \times 3\) matrix \(R\) with \(R^\top R = I\) and \(\det R = 1\). These matrices form the group \(\mathrm{SO}(3)\), and a vector \(v\) is rotated to \(Rv\). The columns of \(R\) are the rotated coordinate axes \(Re_1, Re_2, Re_3\).

Every rotation turns space by some angle \(\theta\) about some unit axis \(n\) (Euler's rotation theorem). Rodrigues' formula gives the matrix: \[ R = I + \sin\theta\,[n]_\times + (1 - \cos\theta)\,[n]_\times^2, \qquad [n]_\times = \begin{bmatrix} 0 & -n_z & n_y \\ n_z & 0 & -n_x \\ -n_y & n_x & 0 \end{bmatrix}. \] The pair \((n, \theta)\) is the same rotation as \((-n, -\theta)\) and as \((n, \theta + 2\pi)\).

The unit quaternion for the axis \(n\) and angle \(\theta\) is \( q = \cos\tfrac{\theta}{2} + \sin\tfrac{\theta}{2}\,(n_x \mathbf{i} + n_y \mathbf{j} + n_z \mathbf{k}) \). It rotates a vector \(v\), written as the quaternion \(v_x \mathbf{i} + v_y \mathbf{j} + v_z \mathbf{k}\), to \(q v q^{-1}\). Because of the half angles, \(q\) and \(-q\) give the same rotation: the unit quaternions (a 3-sphere) cover \(\mathrm{SO}(3)\) twice. Composing rotations is multiplying quaternions, and with \(q = w + x\mathbf{i} + y\mathbf{j} + z\mathbf{k}\), \[ R = \begin{bmatrix} 1 - 2(y^2 + z^2) & 2(xy - wz) & 2(xz + wy) \\ 2(xy + wz) & 1 - 2(x^2 + z^2) & 2(yz - wx) \\ 2(xz - wy) & 2(yz + wx) & 1 - 2(x^2 + y^2) \end{bmatrix}. \]

Euler angles write a rotation as three rotations about coordinate axes, \(R = R_{1}(\alpha)\, R_{2}(\beta)\, R_{3}(\gamma)\), where, for example, \[ R_x(\gamma) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\gamma & -\sin\gamma \\ 0 & \sin\gamma & \cos\gamma \end{bmatrix}. \] Read from left to right, the product rotates about the axes of the body as it turns (intrinsic rotations: z, then the new y′, then the newer x″). Read from right to left, the same product rotates about the fixed axes (extrinsic rotations: x, then y, then z). So intrinsic z-y-x and extrinsic x-y-z are the same rotation, with the angles listed in reverse.

Unlike the other representations, Euler angles have gimbal lock: when the middle angle is \(\pm 90^\circ\) (Tait–Bryan) or \(0^\circ\) or \(180^\circ\) (proper Euler), the first and third rotations are about the same axis. Then only their sum (or difference) matters, and a small change of the airplane's orientation can need a large change of the angles. Turn on “Euler gimbals” and set the middle angle near the lock to see the outer and inner rings line up.

Angular velocity

When the rotation \(R(t)\) changes with time, differentiating \(R R^\top = I\) shows that \(\dot R R^\top\) is skew-symmetric, so \[ \dot R = [\omega]_\times R = R\,[\omega_b]_\times, \qquad \omega_b = R^\top \omega, \] for a vector \(\omega\), the angular velocity. Its direction is the axis the body is turning about at that instant and its length is the rate of turning (in rad/s). The vector \(\omega\) is in fixed coordinates and \(\omega_b\) is the same vector in the body's coordinates. A point attached to the body at \(r\) moves with velocity \(v = \omega \times r\) (the thin arrows at the nose, wingtips, and fin). Note that \(\omega\) is generally not the axis \(n\) of the rotation from the starting position: \(n\) describes where the body is, and \(\omega\) how it is moving.

For the other representations, \[ \dot q = \tfrac12\, \omega\, q = \tfrac12\, q\, \omega_b, \] with \(\omega\) written as the quaternion \(\omega_x \mathbf{i} + \omega_y \mathbf{j} + \omega_z \mathbf{k}\), and for intrinsic z-y-x Euler angles, \[ \omega = \dot\alpha\, e_z + \dot\beta\, R_z(\alpha)\, e_y + \dot\gamma\, R_z(\alpha) R_y(\beta)\, e_x = J \begin{bmatrix} \dot\alpha \\ \dot\beta \\ \dot\gamma \end{bmatrix}. \] The columns of \(J\) are the axes of the three gimbal rings, and \(\det J = -\cos\beta\). At gimbal lock \(J\) is singular, so an angular velocity outside its column space needs infinite Euler-angle rates. Quaternions and rotation matrices have no such trouble: their rates are always proportional to \(\omega\).

With no torque on it, a rigid body keeps its angular momentum \(L = R\, \mathbb{I}\, \omega_b\) fixed in space, where \(\mathbb{I}\) is its inertia matrix. Its angular velocity obeys Euler's equations \(\mathbb{I}\, \dot\omega_b = (\mathbb{I}\, \omega_b) \times \omega_b\), so \(\omega\) stays put only when it is along a principal axis. Here the airplane's principal moments are \(\mathbb{I} = \operatorname{diag}(1, 1.6, 2.4)\) about its body axes. A spin about the axis with the smallest or largest moment (\(Re_1\) or \(Re_3\)) is stable, but a spin about the middle axis (\(Re_2\), along the wings) is not, and the airplane flips over and over: the tennis racket theorem, or Dzhanibekov effect. Choose “free (no torque)” and spin about \(Re_2\) to see it.