es

This section is divided into a number of subsections, links to which are:

# Euler Theorem

A two-dimensional x-y coordinate frame can be considered to be a part of the three-dimensional coordinate frame by adding a z-axis perpendicular to the x- and y-axes. However, there are two orientations for this line: one in which the positive direction of the axis is out of the paper and another where the positive direction of the axis is into the paper. It doesn’t matter which one we choose as long as the choice is consistent.

Consistency is made more difficult when the sciences do not agree. Elsewhere we have made a point about how physicists and mathematicians do not agree on a naming convention for axes in the complex plane. Similarly, and confusingly, geometers and topologists cannot agree on a convention for numbering coordinates in space underlying equations. A useful article covering this may be found in the Hypersphere section of Wolfram MathWorld at this link. The message here is that you must adapt your consistency to the context and conform to parochial rules laid down by those who passed before you.

The conventional choice is the right hand rule. Curl the ﬁngers of your right hand so that they go by the shortest path from the one axis to another axis. Your thumb now points in the positive direction of the third axis. For the familiar x- and y-axes on paper, curl your ﬁngers on the short 90◦ path from the x-axis to the y-axis (not on the long 270◦ path from the x-axis to the y-axis). When you do so your thumb points out of the paper and this is taken as the positive direction of the z-axis.

The following diagram shows the right-hand coordinate system. Note that the arrow is a semi-circle that begins and ends touching the y plane. The arrow direction is the same as the curl of your fingers.

Roger
Ben-Ari, page 8

 Rotate the coordinate frame counterclockwise. Rotate the coordinate frame counterclockwise.
Leonhard Euler (1707--1783) is held to be one of the greatest mathematicians in history and the greatest of the 18th century. Euler was born in Basel (Swiss Confederacy), but at age of 18, he left for Russia and never returned. There is a rumor that all mathematical problems would have been solved by Leonhard Euler if he had been acquainted with a computer algebra system.

Leonhard Euler proved the following theorem in 1775 that states that in three-dimensional space, any displacement of a rigid body such that a point on the rigid body remains fixed, is equivalent to a single rotation about some axis that runs through the fixed point.

Euler's Rotation Theorem: A rotation by θ about an arbitrary line L through the origin can be decomposed into the concatenation of rotations about the x, y, and z axes $\mathbf{R}[\theta , L] = \mathbf{R}_z \left( \theta_z \right) \mathbf{R}_y \left( \theta_y \right) \mathbf{R}_x \left( \theta_x \right) ,$ where θx, θy, θz are called the Euler angles.
Unfortunately, there are dozens of mutually exclusive ways to define Euler angles. Different authors are likely to use different conventions, often without clearly stating the underlying assumptions, which makes it difficult to combine equations and code from more than one source. In this tutorial, we mostly use classical Yaw-pitch-roll rotation order, rotating around the z, y and x axes respectively. There are some others:
• Tait-Bryan variant of Euler Angles. In the Tait-Bryan convention, each of the three angles in a Euler angle triplet defines the rotation around a different Cartesian axis. For example, the first angle may specify the rotation around the z axis, the second around the y axis, and the third around the x axis. For classic Euler angles, the three elemental rotations are performed around only two axes. For example, the first rotation may be around the z axis, the second around the y, and the third around the z axis again. Both systems are capable of representing all possible 3D rotations, and there is no inherent advantage of one over the other. However, most modern authors use the Tait-Bryan convention, and that is what we will use here. [Note: purists will claim that Tait-Bryan angles are not true Euler angles, but that view contravenes common usage.]
• Intrinsic rotation (the axes move with each rotation). In an intrinsic system, each of the elemental rotations is performed on the coordinate system as rotated by the previous operation(s). In an extrinsic system, each rotation is performed around the axes of the world coordinate system, which does not move. As an example, suppose the three angles of the Euler triplet specify rotations around the z, y, and x axes respectively, and in that order. The first elemental rotation around the z axis will be identical for both intrinsic and extrinsic conventions. However, for the intrinsic convention the second elemental rotation is performed around the y axis in its new position resulting from the first rotation, while in the extrinsic convention it is performed around the original (unrotated) y axis. Similarly, the final rotation around the x axis will be performed around the x axis as rotated by the first two operations in the intrinsic system, and around the original (unrotated) x axis in the extrinsic system. This paper will adhere to the intrinsic convention: i.e., the axes move with each rotation.
• Active (otherwise known as alibi) rotation when the point is rotated, not the coordinate system.
• Passive rotation—also known as alias rotation—is when the coordinate system rotates with respect to the point . The two conventions produce opposite rotations.
• Right-handed coordinate system with right-handed rotations. We will use a right-handed Cartesian coordinate system with right-handed rotations. In a right-handed coordinate system, if x̂, ŷ, and ẑ̂ are unit vectors along each of the three axis, then x̂ cross ŷ = ẑ. Right-handed rotation means rotations are positive clockwise when looking in the positive direction of any of the three axes.
Yaw-pitch-roll rotation order, rotating around the z, y and x axes respectively

The order in which the rotations are performed is signiﬁcant. The primary problem with Euler angles is that they contain singularities at 0 or 90 degrees that lead to gimbal lock. When this occurs, 2 axes are parallel and it is not possible to rotate independently about a third “locked” axis. For example, if using Euler angles to describe an airplane that is rotated upward 90 degrees about it’s pitch axis so that it is pointing straight up, the yaw and roll axes become the same, and one degree of freedom is lost or “locked”. In this case, it’s not possible to independently describe tilt towards the left or right wings.

https://www.sagemotion.com/blog/how-do-euler-angles-work https://danceswithcode.net/engineeringnotes/rotations_in_3d/rotations_in_3d_part1.html

 Euler Angle Axes

If the application of Euler angles doesn’t involve angles at or near the singularities, then this problem goes away (e.g. commercial airplanes don’t fly vertically. Euler angles can also be computed by converting from 3D rotation matrix:

$\mathbf{R} = \begin{bmatrix} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{bmatrix} .$
Then Euler's angles (α, β, γ) can be computed as
$$\label{EqEuler.1} \alpha = \arctan \left( \frac{r_{31}}{r_{32}} \right) , \quad \beta = \mbox{arcos} \left( r_{33} \right) , \quad \gamma = - \arctan \left( \frac{r_{13}}{r_{23}} \right) .$$
When Euler's angles are determined, the components of the rotation matrix R can be calculated as
\begin{align*} r_{11} &= \cos\gamma \,\cos\alpha - \cos\beta\, \sin\alpha\,\sin\gamma , \\ r_{12} &= \cos\gamma \,\sin\alpha + \cos\beta\, \sin\alpha\,\sin\gamma , \\ r_{13} &= \sin\gamma \,\sin\beta , \\ r_{21} &= - \sin\gamma \,\cos\alpha - \cos\beta \,\sin\alpha \,\cos\gamma , \\ r_{22} &= - \sin\gamma \,\sin\alpha + \cos\beta \,\cos\alpha\, \cos\gamma , \\ r_{23} &= \cos\gamma \, \sin\beta , \\ r_{31} &= \sin\beta \,\sin\gamma , \\ r_{32} &= - \sin\beta \,\sin\gamma , \\ r_{33} &= \cos\beta . \end{align*}

Example 1: Here is an example of three successive rotations of a coordiante frame: ﬁrst, 90◦ around the z-axis, then 90◦ around the y-axis and ﬁnally 90◦ around the x-axis:
Ben-Azi, page 10
■
End of Example 1

There are three axes so there should be 3³ = 27 sequences of Euler angles. However, there is no point in rotating around the same axis twice in succession because the same result can be obtained by rotating once by the sum of the angles, so there are only 3 · 2 · 2 = 12 different Euler angle sequences:

 xyx xyz xzx xzy yxy yxz yzx yzy zxy zxz zyx zyz

## Euler--Rodrigues' rotation formula

This formula is variously credited to Leonhard Euler (see historical notes by Cheng & Gupta, 1989). Olinde Rodrigues (1795--1851) was a French banker, mathematician, and social reformer of Portuguese-Jewish descent. Besides other achievments in mathematics, he use Euler rotation formula for applications by compositions of rotation operations.

If v is a vector in ℝ³ and n is a unit vector describing an axis of rotation about which v rotates by an angle θ according to the right hand rule, the Euler--Rodrigues formula for the rotated vector vrot is

$$\label{EqEuler.2} \mathbf{v}_{rot} = \mathbf{v}\,\cos\theta + \left( \mathbf{n} \times \mathbf{v} \right) \sin\theta + \mathbf{n} \left( \mathbf{n} \bullet \mathbf{v} \right) \left( 1 - \cos\theta \right) .$$

The rotation matrix can be expressed through the cross-product matrix:

$$\label{EqEuler.3} \mathbf{R} = e^{\theta{\bf K}} = \mathbf{I} + \left( \sin\theta \right) \mathbf{K} +\left( 1 - \cos\theta \right) \mathbf{K}^2 ,$$
where K represents the cross-product matrix n × v = K v. So
$\mathbf{K} = \begin{bmatrix} 0&-k_z & k_y \\ k_z & 0 & -k_x \\ -k_y & k_x & 0 \end{bmatrix} ,$
where
$\begin{bmatrix} \left( \mathbf{n} \times \mathbf{v} \right)_x \\ \left( \mathbf{n} \times \mathbf{v} \right)_y \\ \left( \mathbf{n} \times \mathbf{v} \right)_z \end{bmatrix} = \begin{bmatrix} k_y v_z - k_z v_y \\ k_z v_x - k_x v_z \\ k_x v_y - k_y v_x \end{bmatrix} = \begin{bmatrix} 0& - k_z & k_y \\ k_z & 0& -k_x \\ -k_y & k_x &0 \end{bmatrix} \begin{bmatrix} x_x \\ v_y \\ v_z \end{bmatrix} = \mathbf{K} \begin{bmatrix} v_x \\ v_y \\ v_z \end{bmatrix} .$

Example 2:    ■
End of Example 2

## The matrix for an arbitrary rotation

Example 1 alowed rotations of a vector around the axes zyx by 90° each. The matrix for arbitrary rotations around these axes is obtained by multiplying the matrices for each axis using arbitrary angles: a rotation of ψ around the z-axis, a rotation of θ around the y-axis and a rotation of φ around the x-axis. The resulting matrix is computed as follows. First multiply the rotation around the x-axis by the rotation around the y-axis:
\begin{align*} \mathbf{R}_{y(\theta )} \mathbf{R}_{x(\phi )} &= \begin{bmatrix} \cos\theta &0&\sin\theta \\ 0&1&0 \\ -\sin\theta &0&\cos\theta \end{bmatrix} \begin{bmatrix} 1&0&0 \\ 0&\cos\phi &-\sin\phi \\ 0&\sin\phi &\cos\phi \end{bmatrix} \\ &= \begin{bmatrix} \cos\theta & \sin\theta \,\sin\phi & \sin\theta \,\cos\phi \\ 0& \cos\phi & \sin\phi \\ -\sin\theta & \cos\theta \,\sin\phi & \cos\theta \,\cos\phi \end{bmatrix} . \end{align*}
Then, multiply the result by the rotation around the z-axis:
$\mathbf{R}_{z(\psi )} \mathbf{R}_{y(\theta )} \mathbf{R}_{x(\phi )} = \begin{bmatrix} \cos\psi & -\sin\psi & 0 \\ \sin\psi & \cos\psi & 0 \\ 0&0&1 \end{bmatrix} \mathbf{R}_{y(\theta )} \mathbf{R}_{x(\phi )}$
$= \begin{bmatrix} \cos\psi\,\cos\theta & \cos\psi \,\sin\theta \,\sin\phi - \sin\psi\,\cos\phi & \cos\psi\,\sin\theta \,\cos\phi + \sin\psi\,\sin\phi \\ \sin\psi\,\cos\theta & \sin\psi \,\sin\theta \,\sin\phi + \cos\psi\,\cos\phi & \sin\psi\,\sin\theta \,\cos\phi - \cos\psi\,\sin\phi \\ -\sin\theta & \cos\theta\,\sin\phi & \cos\theta\,\cos\phi \end{bmatrix} .$

## Gimbal Lock

When, for instance, the pitch angle θ = +90° or −90°, both of these conditions, cos(θ) = 0, and we can see that r1,1, r2,1, r3,2, and r3,3 must all equal zero. Since the arctan function is not defined at (0,0), equations for Euler's angles are not valid when the pitch angle θ = ±90°.

It is worth noting that in the regions near the two gimbal lock points, the mapping from rotation-space to Euler angles is not continuous, meaning very small changes in orientation can result in discontinuous jumps in the corresponding Euler angles. For example, the Euler angles (0°,89°,0°) and (90°, 89°, 90°) represent orientations that are only about a degree apart, despite their very different numerical values. A good analogy is the way an aircraft’s longitude jumps discontinuously as it flies over the North or South Pole. This behavior causes problem when trying to interpolate between orientations, or find the average of multiple orientations (see below).

1. Anderson, R.U., Elementary geometric proof of Euler's rotation theorem, 2019.
2. Ben-Ari, M., A Tutorial on Euler Angles and Quaternions, Weizmann Institute of Science.
3. Cheng, Hui; Gupta, K. C. (March 1989). An Historical Note on Finite Rotations. Journal of Applied Mechanics. 56 (1). American Society of Mechanical Engineers: 139–145. Retrieved 2022-04-11.
4. Dunn, F. and Parberry, I. (2002). 3D math primer for graphics and game development. Plano, Tex.: Wordware Pub.
5. Foley, James D.; van Dam, Andries; Feiner, Steven K.; Hughes, John F. (1991), Computer Graphics: Principles and Practice (2nd ed.), Reading: Addison-Wesley, ISBN 0-201-12110-7
6. Palais, B., Palais, R., and Rodi, S., A Disorienting Look at Euler’s Theorem on the Axis of a Rotation, MAA,
7. Matrices and Linear Transformations
8. Rogers, D.F., Adams, J. A., Mathematical Elements for Computer Graphics, McGraw-Hill Science/Engineering/Math, 1989.
9. Watt, A., 3D Computer Graphics, Addison-Wesley; 3rd edition, 1999.