Rotation matrix

Matrix representing a Euclidean rotation

In linear algebra, a rotation matrix is a transformation matrix that is used to perform a rotation in Euclidean space. For example, using the convention below, the matrix

rotates points in the xy plane counterclockwise through an angle θ about the origin of a two-dimensional Cartesian coordinate system. To perform the rotation on a plane point with standard coordinates <span class="texhtml " {{#if:v = (x, y), it should be written as a column vector, and multiplied by the matrix R:

If x and y are the endpoint coordinates of a vector, where x is cosine and y is sine, then the above equations become the trigonometric summation angle formulae. Indeed, a rotation matrix can be seen as the trigonometric summation angle formulae in matrix form. One way to understand this is to say we have a vector at an angle 30° from the x axis, and we wish to rotate that angle by a further 45°. We simply need to compute the vector endpoint coordinates at 75°.

The examples in this article apply to active rotations of vectors counterclockwise in a right-handed coordinate system (y counterclockwise from x) by pre-multiplication (R on the left). If any one of these is changed (such as rotating axes instead of vectors, a passive transformation), then the inverse of the example matrix should be used, which coincides with its transpose.

Since matrix multiplication has no effect on the zero vector (the coordinates of the origin), rotation matrices describe rotations about the origin. Rotation matrices provide an algebraic description of such rotations, and are used extensively for computations in geometry, physics, and computer graphics. In some literature, the term rotation is generalized to include improper rotations, characterized by orthogonal matrices with a determinant of −1 (instead of +1). These combine proper rotations with reflections (which invert orientation). In other cases, where reflections are not being considered, the label proper may be dropped. The latter convention is followed in this article.

Rotation matrices are square matrices, with real entries. More specifically, they can be characterized as orthogonal matrices with determinant 1; that is, a square matrix <span class="texhtml " {{#if:R is a rotation matrix if and only if <span class="texhtml " {{#if:RT = R−1 and <span class="texhtml " {{#if:det R = 1. The set of all orthogonal matrices of size n with determinant +1 is a representation of a group known as the special orthogonal group <span class="texhtml " {{#if:SO(n), one example of which is the rotation group SO(3). The set of all orthogonal matrices of size n with determinant +1 or −1 is a representation of the (general) orthogonal group <span class="texhtml " {{#if:O(n).

In two dimensions

File:Counterclockwise rotation.png
A counterclockwise rotation of a vector through angle θ. The vector is initially aligned with the x-axis.

In two dimensions, the standard rotation matrix has the following form:

This rotates column vectors by means of the following matrix multiplication,

Thus, the new coordinates <span class="texhtml " {{#if:(x′, y′) of a point <span class="texhtml " {{#if:(x, y) after rotation are

Examples

For example, when the vector

is rotated by an angle θ, its new coordinates are

and when the vector

is rotated by an angle θ, its new coordinates are

Direction

The direction of vector rotation is counterclockwise if θ is positive (e.g. 90°), and clockwise if θ is negative (e.g. −90°) for . Thus the clockwise rotation matrix is found as

The two-dimensional case is the only non-trivial (i.e. not one-dimensional) case where the rotation matrices group is commutative, so that it does not matter in which order multiple rotations are performed. An alternative convention uses rotating axes,[1] and the above matrices also represent a rotation of the axes clockwise through an angle θ.

Non-standard orientation of the coordinate system

File:Clockwise rotation.png
A rotation through angle θ with non-standard axes.

If a standard right-handed Cartesian coordinate system is used, with the x-axis to the right and the y-axis up, the rotation <span class="texhtml " {{#if:R(θ) is counterclockwise. If a left-handed Cartesian coordinate system is used, with x directed to the right but y directed down, <span class="texhtml " {{#if:R(θ) is clockwise. Such non-standard orientations are rarely used in mathematics but are common in 2D computer graphics, which often have the origin in the top left corner and the y-axis down the screen or page.[2]

See below for other alternative conventions which may change the sense of the rotation produced by a rotation matrix.

Common 2D rotations

Particularly useful are the matrices

for 90°, 180°, and 270° counter-clockwise rotations.

A 180° rotation (middle) followed by a positive 90° rotation (left) is equivalent to a single negative 90° (positive 270°) rotation (right). Each of these figures depicts the result of a rotation relative to an upright starting position (bottom left) and includes the matrix representation of the permutation applied by the rotation (center right), as well as other related diagrams. See "Permutation notation" on Wikiversity for details.

Relationship with complex plane

Since

the matrices of the shape

form a ring isomorphic to the field of the complex numbers . Under this isomorphism, the rotation matrices correspond to circle of the unit complex numbers, the complex numbers of modulus <span class="texhtml " {{#if:1.

If one identifies with through the linear isomorphism the action of a matrix of the above form on vectors of corresponds to the multiplication by the complex number <span class="texhtml " {{#if:x + iy, and rotations correspond to multiplication by complex numbers of modulus <span class="texhtml " {{#if:1.

As every rotation matrix can be written

the above correspondence associates such a matrix with the complex number

(this last equality is Euler's formula).

In three dimensions

A positive 90° rotation around the y-axis (left) after one around the z-axis (middle) gives a 120° rotation around the main diagonal (right).
In the top left corner are the rotation matrices, in the bottom right corner are the corresponding permutations of the cube with the origin in its center.

Basic 3D rotations

A basic 3D rotation (also called elemental rotation) is a rotation about one of the axes of a coordinate system. The following three basic rotation matrices rotate vectors by an angle θ about the x-, y-, or z-axis, in three dimensions, using the right-hand rule—which codifies their alternating signs. Notice that the right-hand rule only works when multiplying . (The same matrices can also represent a clockwise rotation of the axes.[nb 1])

For column vectors, each of these basic vector rotations appears counterclockwise when the axis about which they occur points toward the observer, the coordinate system is right-handed, and the angle θ is positive. <span class="texhtml " {{#if:Rz, for instance, would rotate toward the <span class="texhtml " {{#if:y-axis a vector aligned with the <span class="texhtml " {{#if:x-axis, as can easily be checked by operating with <span class="texhtml " {{#if:Rz on the vector <span class="texhtml " {{#if:(1,0,0):

This is similar to the rotation produced by the above-mentioned two-dimensional rotation matrix. See below for alternative conventions which may apparently or actually invert the sense of the rotation produced by these matrices.

General 3D rotations

Other 3D rotation matrices can be obtained from these three using matrix multiplication. For example, the product

represents a rotation whose yaw, pitch, and roll angles are α, β and γ, respectively. More formally, it is an intrinsic rotation whose Tait–Bryan angles are α, β, γ, about axes z, y, x, respectively. Similarly, the product

represents an extrinsic rotation whose (improper) Euler angles are α, β, γ, about axes x, y, z.

These matrices produce the desired effect only if they are used to premultiply column vectors, and (since in general matrix multiplication is not commutative) only if they are applied in the specified order (see Ambiguities for more details). The order of rotation operations is from right to left; the matrix adjacent to the column vector is the first to be applied, and then the one to the left.[3]

Conversion from rotation matrix to axis–angle

Every rotation in three dimensions is defined by its axis (a vector along this axis is unchanged by the rotation), and its angle — the amount of rotation about that axis (Euler rotation theorem).

There are several methods to compute the axis and angle from a rotation matrix (see also axis–angle representation). Here, we only describe the method based on the computation of the eigenvectors and eigenvalues of the rotation matrix. It is also possible to use the trace of the rotation matrix.

Determining the axis

File:Rotation decomposition.png
A rotation R around axis <span class="texhtml " {{#if:u can be decomposed using 3 endomorphisms <span class="texhtml " {{#if:P, <span class="texhtml " {{#if:(IP), and <span class="texhtml " {{#if:Q (click to enlarge).

Given a 3 × 3 rotation matrix R, a vector <span class="texhtml " {{#if:u parallel to the rotation axis must satisfy

since the rotation of <span class="texhtml " {{#if:u around the rotation axis must result in <span class="texhtml " {{#if:u. The equation above may be solved for <span class="texhtml " {{#if:u which is unique up to a scalar factor unless <span class="texhtml " {{#if:R = I.

Further, the equation may be rewritten

which shows that <span class="texhtml " {{#if:u lies in the null space of <span class="texhtml " {{#if:RI.

Viewed in another way, <span class="texhtml " {{#if:u is an eigenvector of R corresponding to the eigenvalue <span class="texhtml " {{#if:λ = 1. Every rotation matrix must have this eigenvalue, the other two eigenvalues being complex conjugates of each other. It follows that a general rotation matrix in three dimensions has, up to a multiplicative constant, only one real eigenvector.

One way to determine the rotation axis is by showing that:

Since <span class="texhtml " {{#if:(RRT) is a skew-symmetric matrix, we can choose <span class="texhtml " {{#if:u such that

The matrix–vector product becomes a cross product of a vector with itself, ensuring that the result is zero:

Therefore, if

then

The magnitude of <span class="texhtml " {{#if:u computed this way is <span class="texhtml " {{#if:u‖ = 2 sin θ, where θ is the angle of rotation.

This does not work if R is symmetric. Above, if <span class="texhtml " {{#if:RRT is zero, then all subsequent steps are invalid. In this case, it is necessary to diagonalize R and find the eigenvector corresponding to an eigenvalue of 1.

Determining the angle

To find the angle of a rotation, once the axis of the rotation is known, select a vector <span class="texhtml " {{#if:v perpendicular to the axis. Then the angle of the rotation is the angle between <span class="texhtml " {{#if:v and <span class="texhtml " {{#if:Rv.

A more direct method, however, is to simply calculate the trace: the sum of the diagonal elements of the rotation matrix. Care should be taken to select the right sign for the angle θ to match the chosen axis:

from which follows that the angle's absolute value is

Rotation matrix from axis and angle

The matrix of a proper rotation R by angle θ around the axis <span class="texhtml " {{#if:u = (ux, uy, uz), a unit vector with <span class="texhtml " {{#if:u2
x
+ u2
y
+ u2
z
= 1
, is given by:[4]

A derivation of this matrix from first principles can be found in section 9.2 here.[5] The basic idea to derive this matrix is dividing the problem into few known simple steps.

  1. First rotate the given axis and the point such that the axis lies in one of the coordinate planes (xy, yz or zx)
  2. Then rotate the given axis and the point such that the axis is aligned with one of the two coordinate axes for that particular coordinate plane (x, y or z)
  3. Use one of the fundamental rotation matrices to rotate the point depending on the coordinate axis with which the rotation axis is aligned.
  4. Reverse rotate the axis-point pair such that it attains the final configuration as that was in step 2 (Undoing step 2)
  5. Reverse rotate the axis-point pair which was done in step 1 (undoing step 1)

This can be written more concisely as

where <span class="texhtml " {{#if:[u]× is the cross product matrix of <span class="texhtml " {{#if:u; the expression <span class="texhtml " {{#if:uu is the outer product, and I is the identity matrix. Alternatively, the matrix entries are:

where εjkl is the Levi-Civita symbol with <span class="texhtml " {{#if:ε123 = 1. This is a matrix form of Rodrigues' rotation formula, (or the equivalent, differently parametrized Euler–Rodrigues formula) with[nb 2]

In the rotation of a vector <span class="texhtml " {{#if:x around the axis <span class="texhtml " {{#if:u by an angle θ can be written as:

If the 3D space is right-handed and <span class="texhtml " {{#if:θ > 0, this rotation will be counterclockwise when <span class="texhtml " {{#if:u points towards the observer (Right-hand rule). Explicitly, with a right-handed orthonormal basis,

Note the striking merely apparent differences to the equivalent Lie-algebraic formulation below.

Properties

For any n-dimensional rotation matrix R acting on

(The rotation is an orthogonal matrix)

It follows that:

A rotation is termed proper if <span class="texhtml " {{#if:det R = 1, and improper (or a roto-reflection) if <span class="texhtml " {{#if:det R = –1. For even dimensions <span class="texhtml " {{#if:n = 2k, the n eigenvalues λ of a proper rotation occur as pairs of complex conjugates which are roots of unity: <span class="texhtml " {{#if:λ = e±j for <span class="texhtml " {{#if:j = 1, ..., k, which is real only for <span class="texhtml " {{#if:λ = ±1. Therefore, there may be no vectors fixed by the rotation (<span class="texhtml " {{#if:λ = 1), and thus no axis of rotation. Any fixed eigenvectors occur in pairs, and the axis of rotation is an even-dimensional subspace.

For odd dimensions <span class="texhtml " {{#if:n = 2k + 1, a proper rotation R will have an odd number of eigenvalues, with at least one <span class="texhtml " {{#if:λ = 1 and the axis of rotation will be an odd dimensional subspace. Proof:

Here I is the identity matrix, and we use <span class="texhtml " {{#if:det(RT) = det(R) = 1, as well as <span class="texhtml " {{#if:(−1)n = −1 since n is odd. Therefore, <span class="texhtml " {{#if:det(RI) = 0, meaning there is a null vector <span class="texhtml " {{#if:v with <span class="texhtml " {{#if:(R – I)v = 0, that is <span class="texhtml " {{#if:Rv = v, a fixed eigenvector. There may also be pairs of fixed eigenvectors in the even-dimensional subspace orthogonal to <span class="texhtml " {{#if:v, so the total dimension of fixed eigenvectors is odd.

For example, in 2-space <span class="texhtml " {{#if:n = 2, a rotation by angle θ has eigenvalues <span class="texhtml " {{#if:λ = e and <span class="texhtml " {{#if:λ = e, so there is no axis of rotation except when <span class="texhtml " {{#if:θ = 0, the case of the null rotation. In 3-space <span class="texhtml " {{#if:n = 3, the axis of a non-null proper rotation is always a unique line, and a rotation around this axis by angle θ has eigenvalues <span class="texhtml " {{#if:λ = 1, e, e. In 4-space <span class="texhtml " {{#if:n = 4, the four eigenvalues are of the form <span class="texhtml " {{#if:e±, e±. The null rotation has <span class="texhtml " {{#if:θ = φ = 0. The case of <span class="texhtml " {{#if:θ = 0, φ ≠ 0 is called a simple rotation, with two unit eigenvalues forming an axis plane, and a two-dimensional rotation orthogonal to the axis plane. Otherwise, there is no axis plane. The case of <span class="texhtml " {{#if:θ = φ is called an isoclinic rotation, having eigenvalues <span class="texhtml " {{#if:e± repeated twice, so every vector is rotated through an angle θ.

The trace of a rotation matrix is equal to the sum of its eigenvalues. For <span class="texhtml " {{#if:n = 2, a rotation by angle θ has trace <span class="texhtml " {{#if:2 cos θ. For <span class="texhtml " {{#if:n = 3, a rotation around any axis by angle θ has trace <span class="texhtml " {{#if:1 + 2 cos θ. For <span class="texhtml " {{#if:n = 4, and the trace is <span class="texhtml " {{#if:2(cos θ + cos φ), which becomes <span class="texhtml " {{#if:4 cos θ for an isoclinic rotation.

Examples

Template:Col-1-of-2
  • The 2 × 2 rotation matrix
corresponds to a 90° planar rotation clockwise about the origin.
is its inverse, but since its determinant is −1, this is not a proper rotation matrix; it is a reflection across the line <span class="texhtml " {{#if:11y = 2x.
  • The 3 × 3 rotation matrix
corresponds to a −30° rotation around the x-axis in three-dimensional space.
  • The 3 × 3 rotation matrix
corresponds to a rotation of approximately −74° around the axis (−1/2,1,1) in three-dimensional space.
is a rotation matrix, as is the matrix of any even permutation, and rotates through 120° about the axis <span class="texhtml " {{#if:x = y = z.
Template:Col-2-of-2
  • The 3 × 3 matrix
has determinant +1, but is not orthogonal (its transpose is not its inverse), so it is not a rotation matrix.
  • The 4 × 3 matrix
is not square, and so cannot be a rotation matrix; yet <span class="texhtml " {{#if:MTM yields a 3 × 3 identity matrix (the columns are orthonormal).
  • The 4 × 4 matrix
describes an isoclinic rotation in four dimensions, a rotation through equal angles (180°) through two orthogonal planes.
  • The 5 × 5 rotation matrix
rotates vectors in the plane of the first two coordinate axes 90°, rotates vectors in the plane of the next two axes 180°, and leaves the last coordinate axis unmoved.

Geometry

In Euclidean geometry, a rotation is an example of an isometry, a transformation that moves points without changing the distances between them. Rotations are distinguished from other isometries by two additional properties: they leave (at least) one point fixed, and they leave "handedness" unchanged. In contrast, a translation moves every point, a reflection exchanges left- and right-handed ordering, a glide reflection does both, and an improper rotation combines a change in handedness with a normal rotation.

If a fixed point is taken as the origin of a Cartesian coordinate system, then every point can be given coordinates as a displacement from the origin. Thus one may work with the vector space of displacements instead of the points themselves. Now suppose <span class="texhtml " {{#if:(p1, ..., pn) are the coordinates of the vector <span class="texhtml " {{#if:p from the origin O to point P. Choose an orthonormal basis for our coordinates; then the squared distance to P, by Pythagoras, is

which can be computed using the matrix multiplication

A geometric rotation transforms lines to lines, and preserves ratios of distances between points. From these properties it can be shown that a rotation is a linear transformation of the vectors, and thus can be written in matrix form, <span class="texhtml " {{#if:Qp. The fact that a rotation preserves, not just ratios, but distances themselves, is stated as

or

Because this equation holds for all vectors, <span class="texhtml " {{#if:p, one concludes that every rotation matrix, <span class="texhtml " {{#if:Q, satisfies the orthogonality condition,

Rotations preserve handedness because they cannot change the ordering of the axes, which implies the special matrix condition,

Equally important, it can be shown that any matrix satisfying these two conditions acts as a rotation.

Multiplication

The inverse of a rotation matrix is its transpose, which is also a rotation matrix:

The product of two rotation matrices is a rotation matrix:

For <span class="texhtml " {{#if:n > 2, multiplication of <span class="texhtml " {{#if:n × n rotation matrices is generally not commutative.

Noting that any identity matrix is a rotation matrix, and that matrix multiplication is associative, we may summarize all these properties by saying that the <span class="texhtml " {{#if:n × n rotation matrices form a group, which for <span class="texhtml " {{#if:n > 2 is non-abelian, called a special orthogonal group, and denoted by <span class="texhtml " {{#if:SO(n), <span class="texhtml " {{#if:SO(n,R), <span class="texhtml " {{#if:SOn, or <span class="texhtml " {{#if:SOn(R), the group of <span class="texhtml " {{#if:n × n rotation matrices is isomorphic to the group of rotations in an <span class="texhtml " {{#if:n-dimensional space. This means that multiplication of rotation matrices corresponds to composition of rotations, applied in left-to-right order of their corresponding matrices.

Ambiguities

File:Alias and alibi rotations.png
Alias and alibi rotations

The interpretation of a rotation matrix can be subject to many ambiguities.

In most cases the effect of the ambiguity is equivalent to the effect of a rotation matrix inversion (for these orthogonal matrices equivalently matrix transpose).

Alias or alibi (passive or active) transformation
The coordinates of a point <span class="texhtml " {{#if:P may change due to either a rotation of the coordinate system <span class="texhtml " {{#if:CS (alias), or a rotation of the point <span class="texhtml " {{#if:P (alibi). In the latter case, the rotation of <span class="texhtml " {{#if:P also produces a rotation of the vector <span class="texhtml " {{#if:v representing <span class="texhtml " {{#if:P. In other words, either <span class="texhtml " {{#if:P and <span class="texhtml " {{#if:v are fixed while <span class="texhtml " {{#if:CS rotates (alias), or <span class="texhtml " {{#if:CS is fixed while <span class="texhtml " {{#if:P and <span class="texhtml " {{#if:v rotate (alibi). Any given rotation can be legitimately described both ways, as vectors and coordinate systems actually rotate with respect to each other, about the same axis but in opposite directions. Throughout this article, we chose the alibi approach to describe rotations. For instance,
represents a counterclockwise rotation of a vector <span class="texhtml " {{#if:v by an angle <span class="texhtml " {{#if:θ, or a rotation of <span class="texhtml " {{#if:CS by the same angle but in the opposite direction (i.e. clockwise). Alibi and alias transformations are also known as active and passive transformations, respectively.
Pre-multiplication or post-multiplication
The same point <span class="texhtml " {{#if:P can be represented either by a column vector <span class="texhtml " {{#if:v or a row vector <span class="texhtml " {{#if:w. Rotation matrices can either pre-multiply column vectors (<span class="texhtml " {{#if:Rv), or post-multiply row vectors (<span class="texhtml " {{#if:wR). However, <span class="texhtml " {{#if:Rv produces a rotation in the opposite direction with respect to <span class="texhtml " {{#if:wR. Throughout this article, rotations produced on column vectors are described by means of a pre-multiplication. To obtain exactly the same rotation (i.e. the same final coordinates of point <span class="texhtml " {{#if:P), the equivalent row vector must be post-multiplied by the transpose of R (i.e. <span class="texhtml " {{#if:wRT).
Right- or left-handed coordinates
The matrix and the vector can be represented with respect to a right-handed or left-handed coordinate system. Throughout the article, we assumed a right-handed orientation, unless otherwise specified.
Vectors or forms
The vector space has a dual space of linear forms, and the matrix can act on either vectors or forms.

Decompositions

Independent planes

Consider the 3 × 3 rotation matrix

If <span class="texhtml " {{#if:Q acts in a certain direction, <span class="texhtml " {{#if:v, purely as a scaling by a factor λ, then we have

so that

Thus λ is a root of the characteristic polynomial for Q,

Two features are noteworthy. First, one of the roots (or eigenvalues) is 1, which tells us that some direction is unaffected by the matrix. For rotations in three dimensions, this is the axis of the rotation (a concept that has no meaning in any other dimension). Second, the other two roots are a pair of complex conjugates, whose product is 1 (the constant term of the quadratic), and whose sum is <span class="texhtml " {{#if:2 cos θ (the negated linear term). This factorization is of interest for 3 × 3 rotation matrices because the same thing occurs for all of them. (As special cases, for a null rotation the "complex conjugates" are both 1, and for a 180° rotation they are both −1.) Furthermore, a similar factorization holds for any <span class="texhtml " {{#if:n × n rotation matrix. If the dimension, n, is odd, there will be a "dangling" eigenvalue of 1; and for any dimension the rest of the polynomial factors into quadratic terms like the one here (with the two special cases noted). We are guaranteed that the characteristic polynomial will have degree n and thus n eigenvalues. And since a rotation matrix commutes with its transpose, it is a normal matrix, so can be diagonalized. We conclude that every rotation matrix, when expressed in a suitable coordinate system, partitions into independent rotations of two-dimensional subspaces, at most <span class="texhtml " {{#if:n/2 of them.

The sum of the entries on the main diagonal of a matrix is called the trace; it does not change if we reorient the coordinate system, and always equals the sum of the eigenvalues. This has the convenient implication for 2 × 2 and 3 × 3 rotation matrices that the trace reveals the angle of rotation, θ, in the two-dimensional space (or subspace). For a 2 × 2 matrix the trace is <span class="texhtml " {{#if:2 cos θ, and for a 3 × 3 matrix it is <span class="texhtml " {{#if:1 + 2 cos θ. In the three-dimensional case, the subspace consists of all vectors perpendicular to the rotation axis (the invariant direction, with eigenvalue 1). Thus we can extract from any 3 × 3 rotation matrix a rotation axis and an angle, and these completely determine the rotation.

Sequential angles

The constraints on a 2 × 2 rotation matrix imply that it must have the form

with <span class="texhtml " {{#if:a2 + b2 = 1. Therefore, we may set <span class="texhtml " {{#if:a = cos θ and <span class="texhtml " {{#if:b = sin θ, for some angle θ. To solve for θ it is not enough to look at a alone or b alone; we must consider both together to place the angle in the correct quadrant, using a two-argument arctangent function.

Now consider the first column of a 3 × 3 rotation matrix,

Although <span class="texhtml " {{#if:a2 + b2 will probably not equal 1, but some value <span class="texhtml " {{#if:r2 < 1, we can use a slight variation of the previous computation to find a so-called Givens rotation that transforms the column to

zeroing b. This acts on the subspace spanned by the x- and y-axes. We can then repeat the process for the xz-subspace to zero c. Acting on the full matrix, these two rotations produce the schematic form

Shifting attention to the second column, a Givens rotation of the yz-subspace can now zero the z value. This brings the full matrix to the form

which is an identity matrix. Thus we have decomposed Q as

An <span class="texhtml " {{#if:n × n rotation matrix will have <span class="texhtml " {{#if:(n − 1) + (n − 2) + ⋯ + 2 + 1, or

entries below the diagonal to zero. We can zero them by extending the same idea of stepping through the columns with a series of rotations in a fixed sequence of planes. We conclude that the set of <span class="texhtml " {{#if:n × n rotation matrices, each of which has <span class="texhtml " {{#if:n2 entries, can be parameterized by <span class="texhtml " {{#if:1/2n(n − 1) angles.

<span class="texhtml " {{#if:xzxw <span class="texhtml " {{#if:xzyw <span class="texhtml " {{#if:xyxw <span class="texhtml " {{#if:xyzw
<span class="texhtml " {{#if:yxyw <span class="texhtml " {{#if:yxzw <span class="texhtml " {{#if:yzyw <span class="texhtml " {{#if:yzxw
<span class="texhtml " {{#if:zyzw <span class="texhtml " {{#if:zyxw <span class="texhtml " {{#if:zxzw <span class="texhtml " {{#if:zxyw
<span class="texhtml " {{#if:xzxb <span class="texhtml " {{#if:yzxb <span class="texhtml " {{#if:xyxb <span class="texhtml " {{#if:zyxb
<span class="texhtml " {{#if:yxyb <span class="texhtml " {{#if:zxyb <span class="texhtml " {{#if:yzyb <span class="texhtml " {{#if:xzyb
<span class="texhtml " {{#if:zyzb <span class="texhtml " {{#if:xyzb <span class="texhtml " {{#if:zxzb <span class="texhtml " {{#if:yxzb

In three dimensions this restates in matrix form an observation made by Euler, so mathematicians call the ordered sequence of three angles Euler angles. However, the situation is somewhat more complicated than we have so far indicated. Despite the small dimension, we actually have considerable freedom in the sequence of axis pairs we use; and we also have some freedom in the choice of angles. Thus we find many different conventions employed when three-dimensional rotations are parameterized for physics, or medicine, or chemistry, or other disciplines. When we include the option of world axes or body axes, 24 different sequences are possible. And while some disciplines call any sequence Euler angles, others give different names (Cardano, Tait–Bryan, roll-pitch-yaw) to different sequences.

One reason for the large number of options is that, as noted previously, rotations in three dimensions (and higher) do not commute. If we reverse a given sequence of rotations, we get a different outcome. This also implies that we cannot compose two rotations by adding their corresponding angles. Thus Euler angles are not vectors, despite a similarity in appearance as a triplet of numbers.

Nested dimensions

A 3 × 3 rotation matrix such as

suggests a 2 × 2 rotation matrix,

is embedded in the upper left corner:

This is no illusion; not just one, but many, copies of n-dimensional rotations are found within <span class="texhtml " {{#if:(n + 1)-dimensional rotations, as subgroups. Each embedding leaves one direction fixed, which in the case of 3 × 3 matrices is the rotation axis. For example, we have

fixing the x-axis, the y-axis, and the z-axis, respectively. The rotation axis need not be a coordinate axis; if <span class="texhtml " {{#if:u = (x,y,z) is a unit vector in the desired direction, then

where <span class="texhtml " {{#if:cθ = cos θ, <span class="texhtml " {{#if:sθ = sin θ, is a rotation by angle θ leaving axis <span class="texhtml " {{#if:u fixed.

A direction in <span class="texhtml " {{#if:(n + 1)-dimensional space will be a unit magnitude vector, which we may consider a point on a generalized sphere, <span class="texhtml " {{#if:Sn. Thus it is natural to describe the rotation group <span class="texhtml " {{#if:SO(n + 1) as combining <span class="texhtml " {{#if:SO(n) and <span class="texhtml " {{#if:Sn. A suitable formalism is the fiber bundle,

where for every direction in the base space, <span class="texhtml " {{#if:Sn, the fiber over it in the total space, <span class="texhtml " {{#if:SO(n + 1), is a copy of the fiber space, <span class="texhtml " {{#if:SO(n), namely the rotations that keep that direction fixed.

Thus we can build an <span class="texhtml " {{#if:n × n rotation matrix by starting with a 2 × 2 matrix, aiming its fixed axis on <span class="texhtml " {{#if:S2 (the ordinary sphere in three-dimensional space), aiming the resulting rotation on <span class="texhtml " {{#if:S3, and so on up through <span class="texhtml " {{#if:Sn−1. A point on <span class="texhtml " {{#if:Sn can be selected using n numbers, so we again have <span class="texhtml " {{#if:1/2n(n − 1) numbers to describe any <span class="texhtml " {{#if:n × n rotation matrix.

In fact, we can view the sequential angle decomposition, discussed previously, as reversing this process. The composition of <span class="texhtml " {{#if:n − 1 Givens rotations brings the first column (and row) to (1, 0, ..., 0), so that the remainder of the matrix is a rotation matrix of dimension one less, embedded so as to leave (1, 0, ..., 0) fixed.

Skew parameters via Cayley's formula

When an <span class="texhtml " {{#if:n × n rotation matrix Q, does not include a −1 eigenvalue, thus none of the planar rotations which it comprises are 180° rotations, then <span class="texhtml " {{#if:Q + I is an invertible matrix. Most rotation matrices fit this description, and for them it can be shown that <span class="texhtml " {{#if:(QI)(Q + I)−1 is a skew-symmetric matrix, A. Thus <span class="texhtml " {{#if:AT = −A; and since the diagonal is necessarily zero, and since the upper triangle determines the lower one, A contains <span class="texhtml " {{#if:1/2n(n − 1) independent numbers.

Conveniently, <span class="texhtml " {{#if:IA is invertible whenever A is skew-symmetric; thus we can recover the original matrix using the Cayley transform,

which maps any skew-symmetric matrix A to a rotation matrix. In fact, aside from the noted exceptions, we can produce any rotation matrix in this way. Although in practical applications we can hardly afford to ignore 180° rotations, the Cayley transform is still a potentially useful tool, giving a parameterization of most rotation matrices without trigonometric functions.

In three dimensions, for example, we have Lua error: not enough memory.

If we condense the skew entries into a vector, <span class="texhtml " {{#if:(x,y,z)Lua error: not enough memory., then we produce a 90° rotation around the x-axis for (1, 0, 0), around the y-axis for (0, 1, 0), and around the z-axis for (0, 0, 1). The 180° rotations are just out of reach; for, in the limit as <span class="texhtml " {{#if:x → ∞Lua error: not enough memory., <span class="texhtml " {{#if:(x, 0, 0)Lua error: not enough memory. does approach a 180° rotation around the x axis, and similarly for other directions.

Decomposition into shears

For the 2D case, a rotation matrix can be decomposed into three shear matrices (Lua error: not enough memory.):

This is useful, for instance, in computer graphics, since shears can be implemented with fewer multiplication instructions than rotating a bitmap directly. On modern computers, this may not matter, but it can be relevant for very old or low-end microprocessors.

A rotation can also be written as two shears and scaling (Lua error: not enough memory.):

Group theory

Below follow some basic facts about the role of the collection of all rotation matrices of a fixed dimension (here mostly 3) in mathematics and particularly in physics where rotational symmetry is a requirement of every truly fundamental law (due to the assumption of isotropy of space), and where the same symmetry, when present, is a simplifying property of many problems of less fundamental nature. Examples abound in classical mechanics and quantum mechanics. Knowledge of the part of the solutions pertaining to this symmetry applies (with qualifications) to all such problems and it can be factored out of a specific problem at hand, thus reducing its complexity. A prime example – in mathematics and physics – would be the theory of spherical harmonics. Their role in the group theory of the rotation groups is that of being a representation space for the entire set of finite-dimensional irreducible representations of the rotation group SO(3). For this topic, see Rotation group SO(3) § Spherical harmonics.

The main articles listed in each subsection are referred to for more detail.

Lie group

Lua error: not enough memory. The <span class="texhtml " {{#if:n × nLua error: not enough memory. rotation matrices for each n form a group, the special orthogonal group, <span class="texhtml " {{#if:SO(n)Lua error: not enough memory.. This algebraic structure is coupled with a topological structure inherited from in such a way that the operations of multiplication and taking the inverse are analytic functions of the matrix entries. Thus <span class="texhtml " {{#if:SO(n)Lua error: not enough memory. is for each n a Lie group. It is compact and connected, but not simply connected. It is also a semi-simple group, in fact a simple group with the exception SO(4).[6] The relevance of this is that all theorems and all machinery from the theory of analytic manifolds (analytic manifolds are in particular smooth manifolds) apply and the well-developed representation theory of compact semi-simple groups is ready for use.

Lie algebra

Lua error: not enough memory. The Lie algebra <span class="texhtml " {{#if:so(n)Lua error: not enough memory. of <span class="texhtml " {{#if:SO(n)Lua error: not enough memory. is given by

and is the space of skew-symmetric matrices of dimension <span class="texhtml " {{#if:nLua error: not enough memory., see classical group, where <span class="texhtml " {{#if:o(n)Lua error: not enough memory. is the Lie algebra of <span class="texhtml " {{#if:O(n)Lua error: not enough memory., the orthogonal group. For reference, the most common basis for <span class="texhtml " {{#if:so(3)Lua error: not enough memory. is

Exponential map

Lua error: not enough memory. Connecting the Lie algebra to the Lie group is the exponential map, which is defined using the standard matrix exponential series for eA[7] For any skew-symmetric matrix A, <span class="texhtml " {{#if:exp(A)Lua error: not enough memory. is always a rotation matrix.[nb 3]

An important practical example is the 3 × 3 case. In rotation group SO(3), it is shown that one can identify every <span class="texhtml " {{#if:Aso(3)Lua error: not enough memory. with an Euler vector <span class="texhtml " {{#if:ω = θuLua error: not enough memory., where <span class="texhtml " {{#if:u = (x, y, z)Lua error: not enough memory. is a unit magnitude vector.

By the properties of the identification , <span class="texhtml " {{#if:uLua error: not enough memory. is in the null space of A. Thus, <span class="texhtml " {{#if:uLua error: not enough memory. is left invariant by <span class="texhtml " {{#if:exp(A)Lua error: not enough memory. and is hence a rotation axis.

According to Rodrigues' rotation formula on matrix form, one obtains,

where

This is the matrix for a rotation around axis <span class="texhtml " {{#if:uLua error: not enough memory. by the angle θ. For full detail, see exponential map SO(3).

Baker–Campbell–Hausdorff formula

Lua error: not enough memory. The BCH formula provides an explicit expression for <span class="texhtml " {{#if:Z = log(eXeY)Lua error: not enough memory. in terms of a series expansion of nested commutators of X and Y.[8] This general expansion unfolds as[nb 4]

In the 3 × 3 case, the general infinite expansion has a compact form,[9]

for suitable trigonometric function coefficients, detailed in the Baker–Campbell–Hausdorff formula for SO(3).

As a group identity, the above holds for all faithful representations, including the doublet (spinor representation), which is simpler. The same explicit formula thus follows straightforwardly through Pauli matrices; see the 2 × 2 derivation for SU(2). For the general <span class="texhtml " {{#if:n × nLua error: not enough memory. case, one might use Ref.[10]

Spin group

Lua error: not enough memory. The Lie group of <span class="texhtml " {{#if:n × nLua error: not enough memory. rotation matrices, <span class="texhtml " {{#if:SO(n)Lua error: not enough memory., is not simply connected, so Lie theory tells us it is a homomorphic image of a universal covering group. Often the covering group, which in this case is called the spin group denoted by <span class="texhtml " {{#if:Spin(n)Lua error: not enough memory., is simpler and more natural to work with.[11]

In the case of planar rotations, SO(2) is topologically a circle, <span class="texhtml " {{#if:S1Lua error: not enough memory.. Its universal covering group, Spin(2), is isomorphic to the real line, <span class="texhtml " {{#if:RLua error: not enough memory., under addition. Whenever angles of arbitrary magnitude are used one is taking advantage of the convenience of the universal cover. Every 2 × 2 rotation matrix is produced by a countable infinity of angles, separated by integer multiples of 2π. Correspondingly, the fundamental group of <span class="texhtml " {{#if:SO(2)Lua error: not enough memory. is isomorphic to the integers, <span class="texhtml " {{#if:ZLua error: not enough memory..

In the case of spatial rotations, SO(3) is topologically equivalent to three-dimensional real projective space, <span class="texhtml " {{#if:RP3Lua error: not enough memory.. Its universal covering group, Spin(3), is isomorphic to the 3-sphere, <span class="texhtml " {{#if:S3Lua error: not enough memory.. Every 3 × 3 rotation matrix is produced by two opposite points on the sphere. Correspondingly, the fundamental group of SO(3) is isomorphic to the two-element group, <span class="texhtml " {{#if:Z2Lua error: not enough memory..

We can also describe Spin(3) as isomorphic to quaternions of unit norm under multiplication, or to certain 4 × 4 real matrices, or to 2 × 2 complex special unitary matrices, namely SU(2). The covering maps for the first and the last case are given by

and

For a detailed account of the SU(2)-covering and the quaternionic covering, see spin group SO(3).

Many features of these cases are the same for higher dimensions. The coverings are all two-to-one, with <span class="texhtml " {{#if:SO(n)Lua error: not enough memory., <span class="texhtml " {{#if:n > 2Lua error: not enough memory., having fundamental group <span class="texhtml " {{#if:Z2Lua error: not enough memory.. The natural setting for these groups is within a Clifford algebra. One type of action of the rotations is produced by a kind of "sandwich", denoted by <span class="texhtml " {{#if:qvqLua error: not enough memory.. More importantly in applications to physics, the corresponding spin representation of the Lie algebra sits inside the Clifford algebra. It can be exponentiated in the usual way to give rise to a 2-valued representation, also known as projective representation of the rotation group. This is the case with SO(3) and SU(2), where the 2-valued representation can be viewed as an "inverse" of the covering map. By properties of covering maps, the inverse can be chosen ono-to-one as a local section, but not globally.

Infinitesimal rotations

Lua error: not enough memory. The matrices in the Lie algebra are not themselves rotations; the skew-symmetric matrices are derivatives, proportional differences of rotations. An actual "differential rotation", or infinitesimal rotation matrix has the form

where <span class="texhtml " {{#if:Lua error: not enough memory. is vanishingly small and <span class="texhtml " {{#if:Aso(n)Lua error: not enough memory., for instance with <span class="texhtml " {{#if:A = LxLua error: not enough memory.,

The computation rules are as usual except that infinitesimals of second order are routinely dropped. With these rules, these matrices do not satisfy all the same properties as ordinary finite rotation matrices under the usual treatment of infinitesimals.[12] It turns out that the order in which infinitesimal rotations are applied is irrelevant. To see this exemplified, consult infinitesimal rotations SO(3).

Conversions

Lua error: not enough memory. We have seen the existence of several decompositions that apply in any dimension, namely independent planes, sequential angles, and nested dimensions. In all these cases we can either decompose a matrix or construct one. We have also given special attention to 3 × 3 rotation matrices, and these warrant further attention, in both directions Lua error: not enough memory..

Quaternion

Lua error: not enough memory.

Given the unit quaternion <span class="texhtml " {{#if:q = w + xi + yj + zkLua error: not enough memory., the equivalent pre-multiplied (to be used with column vectors) 3 × 3 rotation matrix is [13]

Now every quaternion component appears multiplied by two in a term of degree two, and if all such terms are zero what is left is an identity matrix. This leads to an efficient, robust conversion from any quaternion – whether unit or non-unit – to a 3 × 3 rotation matrix. Given:

we can calculate

Freed from the demand for a unit quaternion, we find that nonzero quaternions act as homogeneous coordinates for 3 × 3 rotation matrices. The Cayley transform, discussed earlier, is obtained by scaling the quaternion so that its w component is 1. For a 180° rotation around any axis, w will be zero, which explains the Cayley limitation.

The sum of the entries along the main diagonal (the trace), plus one, equals <span class="texhtml " {{#if:4 − 4(x2 + y2 + z2)Lua error: not enough memory., which is <span class="texhtml " {{#if:4w2Lua error: not enough memory.. Thus we can write the trace itself as <span class="texhtml " {{#if:2w2 + 2w2 − 1Lua error: not enough memory.; and from the previous version of the matrix we see that the diagonal entries themselves have the same form: <span class="texhtml " {{#if:2x2 + 2w2 − 1Lua error: not enough memory., <span class="texhtml " {{#if:2y2 + 2w2 − 1Lua error: not enough memory., and <span class="texhtml " {{#if:2z2 + 2w2 − 1Lua error: not enough memory.. So we can easily compare the magnitudes of all four quaternion components using the matrix diagonal. We can, in fact, obtain all four magnitudes using sums and square roots, and choose consistent signs using the skew-symmetric part of the off-diagonal entries:

Alternatively, use a single square root and division

This is numerically stable so long as the trace, t, is not negative; otherwise, we risk dividing by (nearly) zero. In that case, suppose Qxx is the largest diagonal entry, so x will have the largest magnitude (the other cases are derived by cyclic permutation); then the following is safe.

If the matrix contains significant error, such as accumulated numerical error, we may construct a symmetric 4 × 4 matrix,

and find the eigenvector, <span class="texhtml " {{#if:(x, y, z, w)Lua error: not enough memory., of its largest magnitude eigenvalue. (If Q is truly a rotation matrix, that value will be 1.) The quaternion so obtained will correspond to the rotation matrix closest to the given matrix Lua error: not enough memory. (Note: formulation of the cited article is post-multiplied, works with row vectors).

Polar decomposition

If the <span class="texhtml " {{#if:n × nLua error: not enough memory. matrix M is nonsingular, its columns are linearly independent vectors; thus the Gram–Schmidt process can adjust them to be an orthonormal basis. Stated in terms of numerical linear algebra, we convert M to an orthogonal matrix, Q, using QR decomposition. However, we often prefer a Q closest to M, which this method does not accomplish. For that, the tool we want is the polar decomposition (Lua error: not enough memory.; Lua error: not enough memory.).

To measure closeness, we may use any matrix norm invariant under orthogonal transformations. A convenient choice is the Frobenius norm, <span class="texhtml " {{#if:QMFLua error: not enough memory., squared, which is the sum of the squares of the element differences. Writing this in terms of the trace, <span class="texhtml " {{#if:TrLua error: not enough memory., our goal is,

Find Q minimizing <span class="texhtml " {{#if:Tr( (QM)T(QM) )Lua error: not enough memory., subject to <span class="texhtml " {{#if:QTQ = ILua error: not enough memory..

Though written in matrix terms, the objective function is just a quadratic polynomial. We can minimize it in the usual way, by finding where its derivative is zero. For a 3 × 3 matrix, the orthogonality constraint implies six scalar equalities that the entries of Q must satisfy. To incorporate the constraint(s), we may employ a standard technique, Lagrange multipliers, assembled as a symmetric matrix, Y. Thus our method is:

Differentiate <span class="texhtml " {{#if:Tr( (QM)T(QM) + (QTQI)Y )Lua error: not enough memory. with respect to (the entries of) Q, and equate to zero.

Consider a 2 × 2 example. Including constraints, we seek to minimize

Taking the derivative with respect to Qxx, Qxy, Qyx, Qyy in turn, we assemble a matrix.

In general, we obtain the equation

so that

where Q is orthogonal and S is symmetric. To ensure a minimum, the Y matrix (and hence S) must be positive definite. Linear algebra calls QS the polar decomposition of M, with S the positive square root of <span class="texhtml " {{#if:S2 = MTMLua error: not enough memory..

When M is non-singular, the Q and S factors of the polar decomposition are uniquely determined. However, the determinant of S is positive because S is positive definite, so Q inherits the sign of the determinant of M. That is, Q is only guaranteed to be orthogonal, not a rotation matrix. This is unavoidable; an M with negative determinant has no uniquely defined closest rotation matrix.

Axis and angle

Lua error: not enough memory. To efficiently construct a rotation matrix Q from an angle θ and a unit axis <span class="texhtml " {{#if:uLua error: not enough memory., we can take advantage of symmetry and skew-symmetry within the entries. If x, y, and z are the components of the unit vector representing the axis, and

then

Determining an axis and angle, like determining a quaternion, is only possible up to the sign; that is, <span class="texhtml " {{#if:(u, θ)Lua error: not enough memory. and <span class="texhtml " {{#if:(−u, −θ)Lua error: not enough memory. correspond to the same rotation matrix, just like <span class="texhtml " {{#if:qLua error: not enough memory. and <span class="texhtml " {{#if:qLua error: not enough memory.. Additionally, axis–angle extraction presents additional difficulties. The angle can be restricted to be from 0° to 180°, but angles are formally ambiguous by multiples of 360°. When the angle is zero, the axis is undefined. When the angle is 180°, the matrix becomes symmetric, which has implications in extracting the axis. Near multiples of 180°, care is needed to avoid numerical problems: in extracting the angle, a two-argument arctangent with <span class="texhtml " {{#if:atan2(sin θ, cos θ)Lua error: not enough memory. equal to θ avoids the insensitivity of arccos; and in computing the axis magnitude in order to force unit magnitude, a brute-force approach can lose accuracy through underflow Lua error: not enough memory..

A partial approach is as follows:

The x-, y-, and z-components of the axis would then be divided by r. A fully robust approach will use a different algorithm when t, the trace of the matrix Q, is negative, as with quaternion extraction. When r is zero because the angle is zero, an axis must be provided from some source other than the matrix.

Euler angles

Complexity of conversion escalates with Euler angles (used here in the broad sense). The first difficulty is to establish which of the twenty-four variations of Cartesian axis order we will use. Suppose the three angles are <span class="texhtml " {{#if:θ1Lua error: not enough memory., <span class="texhtml " {{#if:θ2Lua error: not enough memory., <span class="texhtml " {{#if:θ3Lua error: not enough memory.; physics and chemistry may interpret these as

while aircraft dynamics may use

One systematic approach begins with choosing the rightmost axis. Among all permutations of <span class="texhtml " {{#if:(x,y,z)Lua error: not enough memory., only two place that axis first; one is an even permutation and the other odd. Choosing parity thus establishes the middle axis. That leaves two choices for the left-most axis, either duplicating the first or not. These three choices gives us 3 × 2 × 2 = 12 variations; we double that to 24 by choosing static or rotating axes.

This is enough to construct a matrix from angles, but triples differing in many ways can give the same rotation matrix. For example, suppose we use the <span class="texhtml " {{#if:zyzLua error: not enough memory. convention above; then we have the following equivalent pairs:

(90°, 45°, −105°) (−270°, −315°, 255°) multiples of 360°
(72°, 0°, 0°) (40°, 0°, 32°) singular alignment
(45°, 60°, −30°) (−135°, −60°, 150°) bistable flip

Angles for any order can be found using a concise common routine (Lua error: not enough memory.; Lua error: not enough memory.).

The problem of singular alignment, the mathematical analog of physical gimbal lock, occurs when the middle rotation aligns the axes of the first and last rotations. It afflicts every axis order at either even or odd multiples of 90°. These singularities are not characteristic of the rotation matrix as such, and only occur with the usage of Euler angles.

The singularities are avoided when considering and manipulating the rotation matrix as orthonormal row vectors (in 3D applications often named the right-vector, up-vector and out-vector) instead of as angles. The singularities are also avoided when working with quaternions.

Vector to vector formulation

In some instances it is interesting to describe a rotation by specifying how a vector is mapped into another through the shortest path (smallest angle). In this completely describes the associated rotation matrix. In general, given <span class="texhtml " {{#if:x, ynLua error: not enough memory., the matrix

belongs to <span class="texhtml " {{#if:SO(n + 1)Lua error: not enough memory. and maps x to y.[14]

Uniform random rotation matrices

We sometimes need to generate a uniformly distributed random rotation matrix. It seems intuitively clear in two dimensions that this means the rotation angle is uniformly distributed between 0 and 2π. That intuition is correct, but does not carry over to higher dimensions. For example, if we decompose 3 × 3 rotation matrices in axis–angle form, the angle should not be uniformly distributed; the probability that (the magnitude of) the angle is at most θ should be <span class="texhtml " {{#if:Lua error: not enough memory.(θ − sin θ)Lua error: not enough memory., for <span class="texhtml " {{#if:0 ≤ θ ≤ πLua error: not enough memory..

Since <span class="texhtml " {{#if:SO(n)Lua error: not enough memory. is a connected and locally compact Lie group, we have a simple standard criterion for uniformity, namely that the distribution be unchanged when composed with any arbitrary rotation (a Lie group "translation"). This definition corresponds to what is called Haar measure. Lua error: not enough memory. show how to use the Cayley transform to generate and test matrices according to this criterion.

We can also generate a uniform distribution in any dimension using the subgroup algorithm of Lua error: not enough memory.. This recursively exploits the nested dimensions group structure of <span class="texhtml " {{#if:SO(n)Lua error: not enough memory., as follows. Generate a uniform angle and construct a 2 × 2 rotation matrix. To step from <span class="texhtml " {{#if:nLua error: not enough memory. to <span class="texhtml " {{#if:n + 1Lua error: not enough memory., generate a vector <span class="texhtml " {{#if:vLua error: not enough memory. uniformly distributed on the n-sphere <span class="texhtml " {{#if:SnLua error: not enough memory., embed the <span class="texhtml " {{#if:n × nLua error: not enough memory. matrix in the next larger size with last column (0, ..., 0, 1), and rotate the larger matrix so the last column becomes <span class="texhtml " {{#if:vLua error: not enough memory..

As usual, we have special alternatives for the 3 × 3 case. Each of these methods begins with three independent random scalars uniformly distributed on the unit interval. Lua error: not enough memory. takes advantage of the odd dimension to change a Householder reflection to a rotation by negation, and uses that to aim the axis of a uniform planar rotation.

Another method uses unit quaternions. Multiplication of rotation matrices is homomorphic to multiplication of quaternions, and multiplication by a unit quaternion rotates the unit sphere. Since the homomorphism is a local isometry, we immediately conclude that to produce a uniform distribution on SO(3) we may use a uniform distribution on <span class="texhtml " {{#if:S3Lua error: not enough memory.. In practice: create a four-element vector where each element is a sampling of a normal distribution. Normalize its length and you have a uniformly sampled random unit quaternion which represents a uniformly sampled random rotation. Note that the aforementioned only applies to rotations in dimension 3. For a generalised idea of quaternions, one should look into Rotors.

Euler angles can also be used, though not with each angle uniformly distributed (Lua error: not enough memory.; Lua error: not enough memory.).

For the axis–angle form, the axis is uniformly distributed over the unit sphere of directions, <span class="texhtml " {{#if:S2Lua error: not enough memory., while the angle has the nonuniform distribution over [0,π] noted previously Lua error: not enough memory..

See also

Remarks

  1. Note that if instead of rotating vectors, it is the reference frame that is being rotated, the signs on the <span class="texhtml " {{#if:sin θLua error: not enough memory. terms will be reversed. If reference frame A is rotated anti-clockwise about the origin through an angle θ to create reference frame B, then Rx (with the signs flipped) will transform a vector described in reference frame A coordinates to reference frame B coordinates. Coordinate frame transformations in aerospace, robotics, and other fields are often performed using this interpretation of the rotation matrix.
  2. Note that
    so that, in Rodrigues' notation, equivalently,
  3. Note that this exponential map of skew-symmetric matrices to rotation matrices is quite different from the Cayley transform discussed earlier, differing to the third order,
    Conversely, a skew-symmetric matrix A specifying a rotation matrix through the Cayley map specifies the same rotation matrix through the map <span class="texhtml " {{#if:exp(2 artanh A)Lua error: not enough memory..
  4. For a detailed derivation, see Derivative of the exponential map. Issues of convergence of this series to the right element of the Lie algebra are here swept under the carpet. Convergence is guaranteed when <span class="texhtml " {{#if:X‖ + ‖Y‖ < log 2Lua error: not enough memory. and <span class="texhtml " {{#if:Z‖ < log 2Lua error: not enough memory.. If these conditions are not fulfilled, the series may still converge. A solution always exists since <span class="texhtml " {{#if:expLua error: not enough memory. is ontoLua error: not enough memory. in the cases under consideration.

Lua error: not enough memory.

Notes

  1. Lua error: not enough memory.
  2. Lua error: not enough memory.
  3. Lua error: not enough memory.
  4. Lua error: not enough memory.
  5. Lua error: not enough memory.
  6. Lua error: not enough memory.; Lua error: not enough memory.
  7. Lua error: not enough memory.
  8. Lua error: not enough memory.; Lua error: not enough memory.
  9. Lua error: not enough memory.
  10. Lua error: not enough memory.
  11. Lua error: not enough memory.; Lua error: not enough memory.
  12. Lua error: not enough memory.
  13. Lua error: not enough memory.
  14. Lua error: not enough memory.

Lua error: not enough memory.

References

  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.; reprinted as article 52 in Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory. (GTM 222)
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory.
  • Lua error: not enough memory. (Also NASA-CR-53568.)
  • Lua error: not enough memory. (GTM 102)
  • Lua error: not enough memory.

External links

Lua error: not enough memory.