Rotation matrix

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Template:Short description Template:MOS 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

R=[cosθsinθsinθcosθ]

rotates points in the Template:Mvar plane counterclockwise through an angle Template:Mvar about the origin of a two-dimensional Cartesian coordinate system. To perform the rotation on a plane point with standard coordinates v = (x, y)Script error: No such module "Check for unknown parameters"., it should be written as a column vector, and multiplied by the matrix Template:Mvar:

R𝐯=[cosθsinθsinθcosθ][xy]=[xcosθysinθxsinθ+ycosθ].

If Template:Mvar and Template:Mvar are the coordinates of the endpoint of a vector with the length r and the angle ϕ with respect to the Template:Mvar-axis, so that x=rcosϕ and y=rsinϕ, then the above equations become the trigonometric summation angle formulae:R𝐯=r[cosϕcosθsinϕsinθcosϕsinθ+sinϕcosθ]=r[cos(ϕ+θ)sin(ϕ+θ)].Indeed, these are 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 Template:Mvar-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 (Template:Mvar counterclockwise from Template:Mvar) by pre-multiplication (the rotation matrix Template:Mvar applied on the left of the column vector vScript error: No such module "Check for unknown parameters". to be rotated). 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). An improper rotation combines a proper rotation 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 RScript error: No such module "Check for unknown parameters". is a rotation matrix if and only if RT = R−1Script error: No such module "Check for unknown parameters". and det R = 1Script error: No such module "Check for unknown parameters".. The set of all orthogonal matrices of size Template:Mvar with determinant +1 is a representation of a group known as the special orthogonal group SO(n)Script error: No such module "Check for unknown parameters"., one example of which is the rotation group SO(3). The set of all orthogonal matrices of size Template:Mvar with determinant +1 or −1 is a representation of the (general) orthogonal group O(n)Script error: No such module "Check for unknown parameters"..

In two dimensions

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

In two dimensions, the standard rotation matrix has the following form: R(θ)=[cosθsinθsinθcosθ].

This rotates column vectors by means of the following matrix multiplication, [xy]=[cosθsinθsinθcosθ][xy].

Thus, the new coordinates (x′, y′)Script error: No such module "Check for unknown parameters". of a point (x, y)Script error: No such module "Check for unknown parameters". after rotation are x=xcosθysinθy=xsinθ+ycosθ.

Examples

For example, when the vector (initially aligned with the x-axis of the Cartesian coordinate system) x^=[10] is rotated by an angle Template:Mvar, its new coordinates are [cosθsinθ],

and when the vector (initially aligned with the y-axis of the coordinate system) y^=[01] is rotated by an angle Template:Mvar, its new coordinates are [sinθcosθ].

Direction

The direction of vector rotation is counterclockwise if Template:Mvar is positive (e.g. 90°), and clockwise if Template:Mvar is negative (e.g. −90°) for R(θ). Thus the clockwise rotation matrix is found as (by replacing Template:Mvar with Template:Mvar and using the trigonometric symmetry of sin(θ)=sin(θ) and cos(θ)=cos(θ)) R(θ)=[cosθsinθsinθcosθ].

An alternative convention uses rotating axes (instead of rotating a vector),[1] and the above matrices also represent a rotation of the axes clockwise through an angle Template:Mvar.

The two-dimensional case is the only non-trivial case where the rotation matrices group is commutative; it does not matter in which order rotations are multiply performed. For the 3-dimensional case, for example, a different order of multiple rotations gives a different result. (E.g., rotating a cell phone along z-axis then y-axis is not equal to rotations along the y-axis then z-axis.)

Non-standard orientation of the coordinate system

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

If a standard right-handed Cartesian coordinate system is used, with the Template:Mvar-axis to the right and the Template:Mvar-axis up, the rotation R(θ)Script error: No such module "Check for unknown parameters". is counterclockwise. If a left-handed Cartesian coordinate system is used, with Template:Mvar directed to the right but Template:Mvar directed down, R(θ)Script error: No such module "Check for unknown parameters". 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 Template:Mvar-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

Matrices [1001],[0110],[1001],[0110] are 2D rotation matrices corresponding to counter-clockwise rotations of respective angles of 0°, 90°, 180°, and 270°.

Relationship with complex plane

The matrices of the shape [xyyx] form a ring, since their set is closed under addition and multiplication. Since [0110]2 = [1001] =I (where I is the identity matrix), the map [xyyx]=x[1001]+y[0110]x+iy (where [0110] corresponds to i) is a ring isomorphism from this ring to the field of the complex numbers Template:Tmath (incidentally, this shows that this ring is a field). Under this isomorphism, the rotation matrices [costsintsintcost]=cost[1001]+sint[0110]correspond to the circle of the unit complex numbers, the complex numbers of modulus 1Script error: No such module "Check for unknown parameters"., since cost2+sint2=1. As a result, the following equality holds,eit=cost+isint=cost[1001]+sint[0110]=(costsintsintcost)where the first equality is Euler's formula, the matrix I=[1001]corresponds to 1, and the matrix [0110] corresponds to the imaginary unit i.

If one identifies 2 with through the linear isomorphism (a,b)a+ib, where (a,b)2 and a+ib, the action of a matrix [xyyx] on a vector (a,b) corresponds to multiplication on the complex number a+ib by x + iyScript error: No such module "Check for unknown parameters".. In other words, a vector rotation corresponds to multiplication on a complex number (corresponding to the vector being rotated) by a complex number of modulus 1Script error: No such module "Check for unknown parameters". (corresponding to the rotation matrix).

In three dimensions

Script error: No such module "Labelled list hatnote".

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 Template:Mvar about the Template:Mvar-, Template:Mvar-, or Template:Mvar-axis, in three dimensions, using the right-hand rule—which codifies their alternating signs.[3] Notice that the right-hand rule only works when multiplying Rx. The same matrices can also represent a clockwise rotation of the axes keeping the vectors unchanged.[nb 1]

Rx(θ)=[1000cosθsinθ0sinθcosθ]Ry(θ)=[cosθ0sinθ010sinθ0cosθ]Rz(θ)=[cosθsinθ0sinθcosθ0001]

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 Template:Mvar is positive. RzScript error: No such module "Check for unknown parameters"., for instance, would rotate toward the yScript error: No such module "Check for unknown parameters".-axis a vector aligned with the xScript error: No such module "Check for unknown parameters".-axis, as can easily be checked by operating with RzScript error: No such module "Check for unknown parameters". on the vector (1,0,0)Script error: No such module "Check for unknown parameters".: Rz(90)[100]=[cos90sin900sin90cos900001][100]=[010100001][100]=[010]

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 R=Rz(α)Ry(β)Rx(γ)=[cosαsinα0sinαcosα0001]yaw[cosβ0sinβ010sinβ0cosβ]pitch[1000cosγsinγ0sinγcosγ]roll=[cosαcosβcosαsinβsinγsinαcosγcosαsinβcosγ+sinαsinγsinαcosβsinαsinβsinγ+cosαcosγsinαsinβcosγcosαsinγsinβcosβsinγcosβcosγ]

represents a rotation whose yaw, pitch, and roll angles are Template:Mvar, Template:Mvar and Template:Mvar, respectively. More formally, it is an intrinsic rotation whose Tait–Bryan angles are Template:Mvar, Template:Mvar, Template:Mvar, about axes Template:Mvar, Template:Mvar, Template:Mvar, respectively. Similarly, the product R=Rx(γ)Ry(β)Rz(α)=[cosγsinγ0sinγcosγ0001]roll[cosβ0sinβ010sinβ0cosβ]pitch[1000cosαsinα0sinαcosα]yaw=[cosβcosγsinαsinβcosγcosαsinγcosαsinβcosγ+sinαsinγcosβsinγsinαsinβsinγ+cosαcosγcosαsinβsinγsinαcosγsinβsinαcosβcosαcosβ] represents an extrinsic rotation whose (improper) Euler angles are Template:Mvar, Template:Mvar, Template:Mvar, about axes Template:Mvar, Template:Mvar, Template:Mvar.

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.[4]

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 Template:Mvar around axis uScript error: No such module "Check for unknown parameters". can be decomposed using 3 endomorphisms PScript error: No such module "Check for unknown parameters"., (IP)Script error: No such module "Check for unknown parameters"., and QScript error: No such module "Check for unknown parameters". (click to enlarge).

Given a 3 × 3 rotation matrix Template:Mvar, a vector uScript error: No such module "Check for unknown parameters". parallel to the rotation axis must satisfy R𝐮=𝐮, since the rotation of uScript error: No such module "Check for unknown parameters". around the rotation axis must result in uScript error: No such module "Check for unknown parameters".. The equation above may be solved for uScript error: No such module "Check for unknown parameters". which is unique up to a scalar factor unless Template:Mvar is the identity matrix Template:Mvar.

Further, the equation may be rewritten R𝐮=I𝐮(RI)𝐮=0, which shows that uScript error: No such module "Check for unknown parameters". lies in the null space of RIScript error: No such module "Check for unknown parameters"..

This means precisely that that uScript error: No such module "Check for unknown parameters". is an eigenvector of Template:Mvar corresponding to the eigenvalue λ = 1Script error: No such module "Check for unknown parameters".. 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:

0=RT0+0=RT(RI)𝐮+(RI)𝐮=(RTRRT+RI)𝐮=(IRT+RI)𝐮=(RRT)𝐮

Since (RRT)Script error: No such module "Check for unknown parameters". is a skew-symmetric matrix, we can choose uScript error: No such module "Check for unknown parameters". such that [𝐮]×=(RRT). The matrix–vector product becomes a cross product of a vector with itself, ensuring that the result is zero:

(RRT)𝐮=[𝐮]×𝐮=𝐮×𝐮=0

Therefore, if R=[abcdefghi], then 𝐮=[hfcgdb]. The magnitude of uScript error: No such module "Check for unknown parameters". computed this way is Template:Norm = 2 sin θScript error: No such module "Check for unknown parameters"., where Template:Mvar is the angle of rotation.

This does not work if Template:Mvar is symmetric. Above, if RRTScript error: No such module "Check for unknown parameters". is zero, then all subsequent steps are invalid. In this case, the angle of rotation is 0° or 180° and any nonzero column of I + RScript error: No such module "Check for unknown parameters". is an eigenvector of Template:Mvar with eigenvalue 1 because R(I + R) = R + R2 = R + RRT = I + RScript error: No such module "Check for unknown parameters"..[5]

Determining the angle

To find the angle of a rotation, once the axis of the rotation is known, select a vector vScript error: No such module "Check for unknown parameters". perpendicular to the axis. Then the angle of the rotation is the angle between vScript error: No such module "Check for unknown parameters". and RvScript error: No such module "Check for unknown parameters"..

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 Template:Mvar to match the chosen axis: tr(R)=1+2cosθ,

from which follows that the angle's absolute value is |θ|=arccos(tr(R)12).

For the rotation axis 𝐧=(n1,n2,n3), you can get the correct angle[6] from

{cosθ=tr(R)12sinθ=tr(KnR)2

where

Kn=[0n3n2n30n1n2n10]

Rotation matrix from axis and angle

The matrix of a proper rotation Template:Mvar by angle Template:Mvar around the axis u = (ux, uy, uz)Script error: No such module "Check for unknown parameters"., a unit vector with uScript error: No such module "Su". + uScript error: No such module "Su". + uScript error: No such module "Su". = 1Script error: No such module "Check for unknown parameters"., is given by:[7] [8] [9] [10] R=[ux2(1cosθ)+cosθuxuy(1cosθ)uzsinθuxuz(1cosθ)+uysinθuxuy(1cosθ)+uzsinθuy2(1cosθ)+cosθuyuz(1cosθ)uxsinθuxuz(1cosθ)uysinθuyuz(1cosθ)+uxsinθuz2(1cosθ)+cosθ].

A derivation of this matrix from first principles can be found in section 9.2 here.[11] 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 (Template:Mvar, Template:Mvar or Template:Mvar)
  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 (Template:Mvar, Template:Mvar or Template:Mvar)
  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 [12] R=(cosθ)I+(sinθ)[𝐮]×+(1cosθ)(𝐮𝐮), where [u]×Script error: No such module "Check for unknown parameters". is the cross product matrix of uScript error: No such module "Check for unknown parameters".; the expression uuScript error: No such module "Check for unknown parameters". is the outer product, and Template:Mvar is the identity matrix. Alternatively, the matrix entries are: Rjk={cos2θ2+sin2θ2(2uj21),if j=k2ujuksin2θ2εjklulsinθ,if jk

where Template:Mvar is the Levi-Civita symbol with ε123 = 1Script error: No such module "Check for unknown parameters".. This is a matrix form of Rodrigues' rotation formula, (or the equivalent, differently parametrized Euler–Rodrigues formula) with[nb 2]

𝐮𝐮=𝐮𝐮T=[ux2uxuyuxuzuxuyuy2uyuzuxuzuyuzuz2],[𝐮]×=[0uzuyuz0uxuyux0].

In 3 the rotation of a vector xScript error: No such module "Check for unknown parameters". around the axis uScript error: No such module "Check for unknown parameters". by an angle Template:Mvar can be written as: R𝐮(θ)𝐱=𝐮(𝐮𝐱)+cos(θ)(𝐮×𝐱)×𝐮+sin(θ)(𝐮×𝐱)

or equivalently: R𝐮(θ)𝐱=𝐱cos(θ)+𝐮(𝐱𝐮)(1cos(θ))𝐱×𝐮sinθ

This can also be written in tensor notation as:[13] (R𝐮(θ)𝐱)i=(R𝐮(θ))ij𝐱jwith(R𝐮(θ))ij=δijcos(θ)+𝐮i𝐮j(1cos(θ))sinθεijk𝐮k

If the 3D space is right-handed and θ > 0Script error: No such module "Check for unknown parameters"., this rotation will be counterclockwise when uScript error: No such module "Check for unknown parameters". points towards the observer (Right-hand rule). Explicitly, with (α,β,𝐮) a right-handed orthonormal basis, R𝐮(θ)α=cos(θ)α+sin(θ)β,R𝐮(θ)β=sin(θ)α+cos(θ)β,R𝐮(θ)𝐮=𝐮.

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

Properties

For any Template:Mvar-dimensional rotation matrix Template:Mvar acting on n,

RT=R1 (The rotation is an orthogonal matrix)
detR=±1

A rotation is termed proper if det R = 1Script error: No such module "Check for unknown parameters"., and improper (or a roto-reflection) if det R = –1Script error: No such module "Check for unknown parameters".. For even dimensions n = 2kScript error: No such module "Check for unknown parameters"., the Template:Mvar eigenvalues Template:Mvar of a proper rotation occur as pairs of complex conjugates which are roots of unity: λ = e±jScript error: No such module "Check for unknown parameters". for j = 1, ..., kScript error: No such module "Check for unknown parameters"., which is real only for λ = ±1Script error: No such module "Check for unknown parameters".. Therefore, there may be no vectors fixed by the rotation (λ = 1Script error: No such module "Check for unknown parameters".), 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 n = 2k + 1Script error: No such module "Check for unknown parameters"., a proper rotation Template:Mvar will have an odd number of eigenvalues, with at least one λ = 1Script error: No such module "Check for unknown parameters". and the axis of rotation will be an odd dimensional subspace. Proof:

det(RI)=det(RT)det(RI)=det(RTRRT)=det(IRT)=det(IR)=(1)ndet(RI)=det(RI).

Here Template:Mvar is the identity matrix, and we use det(RT) = det(R) = 1Script error: No such module "Check for unknown parameters"., as well as (−1)n = −1Script error: No such module "Check for unknown parameters". since Template:Mvar is odd. Therefore, det(RI) = 0Script error: No such module "Check for unknown parameters"., meaning there is a nonzero vector vScript error: No such module "Check for unknown parameters". with (R – I)v = 0Script error: No such module "Check for unknown parameters"., that is Rv = vScript error: No such module "Check for unknown parameters"., a fixed eigenvector. There may also be pairs of fixed eigenvectors in the even-dimensional subspace orthogonal to vScript error: No such module "Check for unknown parameters"., so the total dimension of fixed eigenvectors is odd.

For example, in 2-space n = 2Script error: No such module "Check for unknown parameters"., a rotation by angle Template:Mvar has eigenvalues λ = eScript error: No such module "Check for unknown parameters". and λ = eScript error: No such module "Check for unknown parameters"., so there is no axis of rotation except when θ = 0Script error: No such module "Check for unknown parameters"., the case of the null rotation. In 3-space n = 3Script error: No such module "Check for unknown parameters"., the axis of a non-null proper rotation is always a unique line, and a rotation around this axis by angle Template:Mvar has eigenvalues λ = 1, e, eScript error: No such module "Check for unknown parameters".. In 4-space n = 4Script error: No such module "Check for unknown parameters"., the four eigenvalues are of the form e±, e±Script error: No such module "Check for unknown parameters".. The null rotation has θ = φ = 0Script error: No such module "Check for unknown parameters".. The case of θ = 0, φ ≠ 0Script error: No such module "Check for unknown parameters". 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 θ = φScript error: No such module "Check for unknown parameters". is called an isoclinic rotation, having eigenvalues e±Script error: No such module "Check for unknown parameters". repeated twice, so every vector is rotated through an angle Template:Mvar.

The trace of a rotation matrix is equal to the sum of its eigenvalues. For n = 2Script error: No such module "Check for unknown parameters"., a rotation by angle Template:Mvar has trace 2 cos θScript error: No such module "Check for unknown parameters".. For n = 3Script error: No such module "Check for unknown parameters"., a rotation around any axis by angle Template:Mvar has trace 1 + 2 cos θScript error: No such module "Check for unknown parameters".. For n = 4Script error: No such module "Check for unknown parameters"., and the trace is 2(cos θ + cos φ)Script error: No such module "Check for unknown parameters"., which becomes 4 cos θScript error: No such module "Check for unknown parameters". for an isoclinic rotation.

Examples

<templatestyles src="Col-begin/styles.css"/>

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 (p1, ..., pn)Script error: No such module "Check for unknown parameters". are the coordinates of the vector pScript error: No such module "Check for unknown parameters". from the origin Template:Mvar to point Template:Mvar. Choose an orthonormal basis for our coordinates; then the squared distance to Template:Mvar, by Pythagoras, is d2(O,P)=𝐩2=r=1npr2 which can be computed using the matrix multiplication 𝐩2=[p1pn][p1pn]=𝐩T𝐩.

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, QpScript error: No such module "Check for unknown parameters".. The fact that a rotation preserves, not just ratios, but distances themselves, is stated as 𝐩T𝐩=(Q𝐩)T(Q𝐩), or 𝐩TI𝐩=(𝐩TQT)(Q𝐩)=𝐩T(QTQ)𝐩. Because this equation holds for all vectors, pScript error: No such module "Check for unknown parameters"., one concludes that every rotation matrix, QScript error: No such module "Check for unknown parameters"., satisfies the orthogonality condition, QTQ=I. Rotations preserve handedness because they cannot change the ordering of the axes, which implies the special matrix condition, detQ=+1. 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: (QT)T(QT)=QQT=IdetQT=detQ=+1. The product of two rotation matrices is a rotation matrix: (Q1Q2)T(Q1Q2)=Q2T(Q1TQ1)Q2=Idet(Q1Q2)=(detQ1)(detQ2)=+1. For n > 2Script error: No such module "Check for unknown parameters"., multiplication of n × nScript error: No such module "Check for unknown parameters". rotation matrices is generally not commutative. Q1=[010100001]Q2=[001010100]Q1Q2=[010001100]Q2Q1=[001100010]. 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 n × nScript error: No such module "Check for unknown parameters". rotation matrices form a group, which for n > 2Script error: No such module "Check for unknown parameters". is non-abelian, called a special orthogonal group, and denoted by SO(n)Script error: No such module "Check for unknown parameters"., SO(n,R)Script error: No such module "Check for unknown parameters"., SOnScript error: No such module "Check for unknown parameters"., or SOn(R)Script error: No such module "Check for unknown parameters"., the group of n × nScript error: No such module "Check for unknown parameters". rotation matrices is isomorphic to the group of rotations in an nScript error: No such module "Check for unknown parameters".-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 PScript error: No such module "Check for unknown parameters". may change due to either a rotation of the coordinate system CSScript error: No such module "Check for unknown parameters". (alias), or a rotation of the point PScript error: No such module "Check for unknown parameters". (alibi). In the latter case, the rotation of PScript error: No such module "Check for unknown parameters". also produces a rotation of the vector vScript error: No such module "Check for unknown parameters". representing PScript error: No such module "Check for unknown parameters".. In other words, either PScript error: No such module "Check for unknown parameters". and vScript error: No such module "Check for unknown parameters". are fixed while CSScript error: No such module "Check for unknown parameters". rotates (alias), or CSScript error: No such module "Check for unknown parameters". is fixed while PScript error: No such module "Check for unknown parameters". and vScript error: No such module "Check for unknown parameters". 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,
R(θ)=[cosθsinθsinθcosθ]
represents a counterclockwise rotation of a vector vScript error: No such module "Check for unknown parameters". by an angle θScript error: No such module "Check for unknown parameters"., or a rotation of CSScript error: No such module "Check for unknown parameters". 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 PScript error: No such module "Check for unknown parameters". can be represented either by a column vector vScript error: No such module "Check for unknown parameters". or a row vector wScript error: No such module "Check for unknown parameters".. Rotation matrices can either pre-multiply column vectors (RvScript error: No such module "Check for unknown parameters".), or post-multiply row vectors (wRScript error: No such module "Check for unknown parameters".). However, RvScript error: No such module "Check for unknown parameters". produces a rotation in the opposite direction with respect to wRScript error: No such module "Check for unknown parameters".. 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 PScript error: No such module "Check for unknown parameters".), the equivalent row vector must be post-multiplied by the transpose of Template:Mvar (i.e. wRTScript error: No such module "Check for unknown parameters".).
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 Q=[0.360.480.800.800.600.000.480.640.60]. If QScript error: No such module "Check for unknown parameters". acts in a certain direction, vScript error: No such module "Check for unknown parameters"., purely as a scaling by a factor Template:Mvar, then we have Q𝐯=λ𝐯, so that 𝟎=(λIQ)𝐯. Thus Template:Mvar is a root of the characteristic polynomial for Template:Mvar, 0=det(λIQ)=λ33925λ2+3925λ1=(λ1)(λ21425λ+1). 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 2 cos θScript error: No such module "Check for unknown parameters". (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 n × nScript error: No such module "Check for unknown parameters". rotation matrix. If the dimension, Template:Mvar, 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 Template:Mvar and thus Template:Mvar 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 Template:SfracScript error: No such module "Check for unknown parameters". 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, Template:Mvar, in the two-dimensional space (or subspace). For a 2 × 2 matrix the trace is 2 cos θScript error: No such module "Check for unknown parameters"., and for a 3 × 3 matrix it is 1 + 2 cos θScript error: No such module "Check for unknown parameters".. 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 Q=[abba] with a2 + b2 = 1Script error: No such module "Check for unknown parameters".. Therefore, we may set a = cos θScript error: No such module "Check for unknown parameters". and b = sin θScript error: No such module "Check for unknown parameters"., for some angle Template:Mvar. To solve for Template:Mvar it is not enough to look at Template:Mvar alone or Template:Mvar 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, [abc]. Although a2 + b2Script error: No such module "Check for unknown parameters". will probably not equal 1, but some value r2 < 1Script error: No such module "Check for unknown parameters"., we can use a slight variation of the previous computation to find a so-called Givens rotation that transforms the column to [r0c], zeroing Template:Mvar. This acts on the subspace spanned by the Template:Mvar- and Template:Mvar-axes. We can then repeat the process for the Template:Mvar-subspace to zero Template:Mvar. Acting on the full matrix, these two rotations produce the schematic form QxzQxyQ=[10000]. Shifting attention to the second column, a Givens rotation of the Template:Mvar-subspace can now zero the Template:Mvar value. This brings the full matrix to the form QyzQxzQxyQ=[100010001], which is an identity matrix. Thus we have decomposed Template:Mvar as Q=Qxy1Qxz1Qyz1.

An n × nScript error: No such module "Check for unknown parameters". rotation matrix will have (n − 1) + (n − 2) + ⋯ + 2 + 1Script error: No such module "Check for unknown parameters"., or k=1n1k=12n(n1) 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 n × nScript error: No such module "Check for unknown parameters". rotation matrices, each of which has n2Script error: No such module "Check for unknown parameters". entries, can be parameterized by Template:Sfracn(n − 1)Script error: No such module "Check for unknown parameters". angles.

xzxwScript error: No such module "Check for unknown parameters". xzywScript error: No such module "Check for unknown parameters". xyxwScript error: No such module "Check for unknown parameters". xyzwScript error: No such module "Check for unknown parameters".
yxywScript error: No such module "Check for unknown parameters". yxzwScript error: No such module "Check for unknown parameters". yzywScript error: No such module "Check for unknown parameters". yzxwScript error: No such module "Check for unknown parameters".
zyzwScript error: No such module "Check for unknown parameters". zyxwScript error: No such module "Check for unknown parameters". zxzwScript error: No such module "Check for unknown parameters". zxywScript error: No such module "Check for unknown parameters".
xzxbScript error: No such module "Check for unknown parameters". yzxbScript error: No such module "Check for unknown parameters". xyxbScript error: No such module "Check for unknown parameters". zyxbScript error: No such module "Check for unknown parameters".
yxybScript error: No such module "Check for unknown parameters". zxybScript error: No such module "Check for unknown parameters". yzybScript error: No such module "Check for unknown parameters". xzybScript error: No such module "Check for unknown parameters".
zyzbScript error: No such module "Check for unknown parameters". xyzbScript error: No such module "Check for unknown parameters". zxzbScript error: No such module "Check for unknown parameters". yxzbScript error: No such module "Check for unknown parameters".

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 Q3×3=[cosθsinθ0sinθcosθ0001]

suggests a 2 × 2 rotation matrix, Q2×2=[cosθsinθsinθcosθ],

is embedded in the upper left corner: Q3×3=[Q2×2𝟎𝟎T1].

This is no illusion; not just one, but many, copies of Template:Mvar-dimensional rotations are found within (n + 1)Script error: No such module "Check for unknown parameters".-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 Q𝐱(θ)=[1000cosθsinθ0sinθcosθ],[8px]Q𝐲(θ)=[cosθ0sinθ010sinθ0cosθ],[8px]Q𝐳(θ)=[cosθsinθ0sinθcosθ0001],

fixing the Template:Mvar-axis, the Template:Mvar-axis, and the Template:Mvar-axis, respectively. The rotation axis need not be a coordinate axis; if u = (x,y,z)Script error: No such module "Check for unknown parameters". is a unit vector in the desired direction, then Q𝐮(θ)=[0zyz0xyx0]sinθ+(I𝐮𝐮T)cosθ+𝐮𝐮T[8px]=[(1x2)cθ+x2zsθxycθ+xyysθxzcθ+xzzsθxycθ+xy(1y2)cθ+y2xsθyzcθ+yzysθxzcθ+xzxsθyzcθ+yz(1z2)cθ+z2][8px]=[x2(1cθ)+cθxy(1cθ)zsθxz(1cθ)+ysθxy(1cθ)+zsθy2(1cθ)+cθyz(1cθ)xsθxz(1cθ)ysθyz(1cθ)+xsθz2(1cθ)+cθ],

where cθ = cos θScript error: No such module "Check for unknown parameters"., sθ = sin θScript error: No such module "Check for unknown parameters"., is a rotation by angle Template:Mvar leaving axis uScript error: No such module "Check for unknown parameters". fixed.

A direction in (n + 1)Script error: No such module "Check for unknown parameters".-dimensional space will be a unit magnitude vector, which we may consider a point on a generalized sphere, SnScript error: No such module "Check for unknown parameters".. Thus it is natural to describe the rotation group SO(n + 1)Script error: No such module "Check for unknown parameters". as combining SO(n)Script error: No such module "Check for unknown parameters". and SnScript error: No such module "Check for unknown parameters".. A suitable formalism is the fiber bundle, SO(n)SO(n+1)Sn,

where for every direction in the base space, SnScript error: No such module "Check for unknown parameters"., the fiber over it in the total space, SO(n + 1)Script error: No such module "Check for unknown parameters"., is a copy of the fiber space, SO(n)Script error: No such module "Check for unknown parameters"., namely the rotations that keep that direction fixed.

Thus we can build an n × nScript error: No such module "Check for unknown parameters". rotation matrix by starting with a 2 × 2 matrix, aiming its fixed axis on S2Script error: No such module "Check for unknown parameters". (the ordinary sphere in three-dimensional space), aiming the resulting rotation on S3Script error: No such module "Check for unknown parameters"., and so on up through Sn−1Script error: No such module "Check for unknown parameters".. A point on SnScript error: No such module "Check for unknown parameters". can be selected using Template:Mvar numbers, so we again have Template:Sfracn(n − 1)Script error: No such module "Check for unknown parameters". numbers to describe any n × nScript error: No such module "Check for unknown parameters". rotation matrix.

In fact, we can view the sequential angle decomposition, discussed previously, as reversing this process. The composition of n − 1Script error: No such module "Check for unknown parameters". 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

Script error: No such module "Labelled list hatnote". When an n × nScript error: No such module "Check for unknown parameters". rotation matrix Template:Mvar, does not include a −1 eigenvalue, thus none of the planar rotations which it comprises are 180° rotations, then Q + IScript error: No such module "Check for unknown parameters". is an invertible matrix. Most rotation matrices fit this description, and for them it can be shown that (QI)(Q + I)−1Script error: No such module "Check for unknown parameters". is a skew-symmetric matrix, Template:Mvar. Thus AT = −AScript error: No such module "Check for unknown parameters".; and since the diagonal is necessarily zero, and since the upper triangle determines the lower one, Template:Mvar contains Template:Sfracn(n − 1)Script error: No such module "Check for unknown parameters". independent numbers.

Conveniently, IAScript error: No such module "Check for unknown parameters". is invertible whenever Template:Mvar is skew-symmetric; thus we can recover the original matrix using the Cayley transform, A(I+A)(IA)1, which maps any skew-symmetric matrix Template:Mvar 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 Script error: No such module "Footnotes". [0zyz0xyx0]11+x2+y2+z2[1+x2y2z22xy2z2y+2xz2xy+2z1x2+y2z22yz2x2xz2y2x+2yz1x2y2+z2].

If we condense the skew entries into a vector, (x,y,z)Script error: No such module "Check for unknown parameters"., then we produce a 90° rotation around the Template:Mvar-axis for (1, 0, 0), around the Template:Mvar-axis for (0, 1, 0), and around the Template:Mvar-axis for (0, 0, 1). The 180° rotations are just out of reach; for, in the limit as x → ∞Script error: No such module "Check for unknown parameters"., (x, 0, 0)Script error: No such module "Check for unknown parameters". does approach a 180° rotation around the Template:Mvar axis, and similarly for other directions.

Decomposition into shears

For the 2D case, a rotation matrix can be decomposed into three shear matrices (Script error: No such module "Footnotes".):

R(θ)=[1tanθ201][10sinθ1][1tanθ201]

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 a squeeze mapping (an area preserving scaling) (Script error: No such module "Footnotes".):

R(θ)=[10tanθ1][1sinθcosθ01][cosθ001cosθ]

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

Script error: No such module "Labelled list hatnote". The n × nScript error: No such module "Check for unknown parameters". rotation matrices for each Template:Mvar form a group, the special orthogonal group, SO(n)Script error: No such module "Check for unknown parameters".. This algebraic structure is coupled with a topological structure inherited from GLn() in such a way that the operations of multiplication and taking the inverse are analytic functions of the matrix entries. Thus SO(n)Script error: No such module "Check for unknown parameters". is for each Template:Mvar 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).[14] 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

Script error: No such module "Labelled list hatnote". The Lie algebra so(n)Script error: No such module "Check for unknown parameters". of SO(n)Script error: No such module "Check for unknown parameters". is given by 𝔰𝔬(n)=𝔬(n)={XMn()X=XT}, and is the space of skew-symmetric matrices of dimension nScript error: No such module "Check for unknown parameters"., see classical group, where o(n)Script error: No such module "Check for unknown parameters". is the Lie algebra of O(n)Script error: No such module "Check for unknown parameters"., the orthogonal group. For reference, the most common basis for so(3)Script error: No such module "Check for unknown parameters". is L𝐱=[000001010],L𝐲=[001000100],L𝐳=[010100000].

Exponential map

Script error: No such module "Labelled list hatnote". Connecting the Lie algebra to the Lie group is the exponential map, which is defined using the standard matrix exponential series for Template:Mvar[15] For any skew-symmetric matrix Template:Mvar, exp(A)Script error: No such module "Check for unknown parameters". 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 Aso(3)Script error: No such module "Check for unknown parameters". with an Euler vector ω = θuScript error: No such module "Check for unknown parameters"., where u = (x, y, z)Script error: No such module "Check for unknown parameters". is a unit magnitude vector.

By the properties of the identification 𝐬𝐮(2)3, uScript error: No such module "Check for unknown parameters". is in the null space of Template:Mvar. Thus, uScript error: No such module "Check for unknown parameters". is left invariant by exp(A)Script error: No such module "Check for unknown parameters". and is hence a rotation axis.

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

exp(A)=exp(θ(𝐮𝐋))=exp([0zθyθzθ0xθyθxθ0])=I+sinθ 𝐮𝐋+(1cosθ)(𝐮𝐋)2,

where

𝐮𝐋=[0zyz0xyx0].

This is the matrix for a rotation around axis uScript error: No such module "Check for unknown parameters". by the angle Template:Mvar. For full detail, see exponential map SO(3).

Baker–Campbell–Hausdorff formula

Script error: No such module "Labelled list hatnote". The BCH formula provides an explicit expression for Z = log(eXeY)Script error: No such module "Check for unknown parameters". in terms of a series expansion of nested commutators of Template:Mvar and Template:Mvar.[16] This general expansion unfolds as[nb 4] Z=C(X,Y)=X+Y+12[X,Y]+112[X,[X,Y]]112[Y,[X,Y]]+.

In the 3 × 3 case, the general infinite expansion has a compact form,[17] Z=αX+βY+γ[X,Y], 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 n × nScript error: No such module "Check for unknown parameters". case, one might use Ref.[18]

Spin group

Script error: No such module "Labelled list hatnote". The Lie group of n × nScript error: No such module "Check for unknown parameters". rotation matrices, SO(n)Script error: No such module "Check for unknown parameters"., 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 Spin(n)Script error: No such module "Check for unknown parameters"., is simpler and more natural to work with.[19]

In the case of planar rotations, SO(2) is topologically a circle, S1Script error: No such module "Check for unknown parameters".. Its universal covering group, Spin(2), is isomorphic to the real line, RScript error: No such module "Check for unknown parameters"., 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 2Template:Pi. Correspondingly, the fundamental group of SO(2)Script error: No such module "Check for unknown parameters". is isomorphic to the integers, ZScript error: No such module "Check for unknown parameters"..

In the case of spatial rotations, SO(3) is topologically equivalent to three-dimensional real projective space, RP3Script error: No such module "Check for unknown parameters".. Its universal covering group, Spin(3), is isomorphic to the 3-sphere, S3Script error: No such module "Check for unknown parameters".. 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, Z2Script error: No such module "Check for unknown parameters"..

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 {q:q=1}w+𝐢x+𝐣y+𝐤z[12y22z22xy2zw2xz+2yw2xy+2zw12x22z22yz2xw2xz2yw2yz+2xw12x22y2]SO(3), and SU(2)[αββα][12(α2β2+α2β2)i2(α2β2+α2+β2)αβαβi2(α2β2α2+β2)i2(α2+β2+α2+β2)i(+αβαβ)αβ+αβi(αβ+αβ)ααββ]SO(3).

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 SO(n)Script error: No such module "Check for unknown parameters"., n > 2Script error: No such module "Check for unknown parameters"., having fundamental group Z2Script error: No such module "Check for unknown parameters".. 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 qvqScript error: No such module "Check for unknown parameters".. 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

Script error: No such module "Labelled list hatnote". 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 I+Adθ, where Script error: No such module "Check for unknown parameters". is vanishingly small and Aso(n)Script error: No such module "Check for unknown parameters"., for instance with A = LxScript error: No such module "Check for unknown parameters"., dLx=[10001dθ0dθ1].

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.[20] It turns out that the order in which infinitesimal rotations are applied is irrelevant. To see this exemplified, consult infinitesimal rotations SO(3).

Conversions

Script error: No such module "Labelled list hatnote". 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 Script error: No such module "Footnotes"..

Quaternion

Script error: No such module "Labelled list hatnote".

Given the unit quaternion q = w + xi + yj + zkScript error: No such module "Check for unknown parameters"., the equivalent pre-multiplied (to be used with column vectors) 3 × 3 rotation matrix is [21] Q=[12y22z22xy2zw2xz+2yw2xy+2zw12x22z22yz2xw2xz2yw2yz+2xw12x22y2].

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: n=w×w+x×x+y×y+z×zs={0if n=02notherwise we can calculate Q=[1s(yy+zz)s(xywz)s(xz+wy)s(xy+wz)1s(xx+zz)s(yzwx)s(xzwy)s(yz+wx)1s(xx+yy)]

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 Template:Mvar component is 1. For a 180° rotation around any axis, Template:Mvar will be zero, which explains the Cayley limitation.

The sum of the entries along the main diagonal (the trace), plus one, equals 4 − 4(x2 + y2 + z2)Script error: No such module "Check for unknown parameters"., which is 4w2Script error: No such module "Check for unknown parameters".. Thus we can write the trace itself as 2w2 + 2w2 − 1Script error: No such module "Check for unknown parameters".; and from the previous version of the matrix we see that the diagonal entries themselves have the same form: 2x2 + 2w2 − 1Script error: No such module "Check for unknown parameters"., 2y2 + 2w2 − 1Script error: No such module "Check for unknown parameters"., and 2z2 + 2w2 − 1Script error: No such module "Check for unknown parameters".. 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: t=trQ=Qxx+Qyy+Qzz(the trace of Q)r=1+tw=12rx=sgn(QzyQyz)|121+QxxQyyQzz|y=sgn(QxzQzx)|121Qxx+QyyQzz|z=sgn(QyxQxy)|121QxxQyy+Qzz|

Alternatively, use a single square root and division t=trQ=Qxx+Qyy+Qzzr=1+ts=12rw=12rx=(QzyQyz)sy=(QxzQzx)sz=(QyxQxy)s

This is numerically stable so long as the trace, Template:Mvar, is not negative; otherwise, we risk dividing by (nearly) zero. In that case, suppose Template:Mvar is the largest diagonal entry, so Template:Mvar will have the largest magnitude (the other cases are derived by cyclic permutation); then the following is safe. r=1+QxxQyyQzzs=12rw=(QzyQyz)sx=12ry=(Qxy+Qyx)sz=(Qzx+Qxz)s

If the matrix contains significant error, such as accumulated numerical error, we may construct a symmetric 4 × 4 matrix, K=13[QxxQyyQzzQyx+QxyQzx+QxzQzyQyzQyx+QxyQyyQxxQzzQzy+QyzQxzQzxQzx+QxzQzy+QyzQzzQxxQyyQyxQxyQzyQyzQxzQzxQyxQxyQxx+Qyy+Qzz], and find the eigenvector, (x, y, z, w)Script error: No such module "Check for unknown parameters"., of its largest magnitude eigenvalue. (If Template:Mvar 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 Script error: No such module "Footnotes". (Note: formulation of the cited article is post-multiplied, works with row vectors).

Polar decomposition

If the n × nScript error: No such module "Check for unknown parameters". matrix Template:Mvar 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 Template:Mvar to an orthogonal matrix, Template:Mvar, using QR decomposition. However, we often prefer a Template:Mvar closest to Template:Mvar, which this method does not accomplish. For that, the tool we want is the polar decomposition (Script error: No such module "Footnotes".; Script error: No such module "Footnotes".).

To measure closeness, we may use any matrix norm invariant under orthogonal transformations. A convenient choice is the Frobenius norm, Template:NormFScript error: No such module "Check for unknown parameters"., squared, which is the sum of the squares of the element differences. Writing this in terms of the trace, TrScript error: No such module "Check for unknown parameters"., our goal is,

Find Template:Mvar minimizing Tr( (QM)T(QM) )Script error: No such module "Check for unknown parameters"., subject to QTQ = IScript error: No such module "Check for unknown parameters"..

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 Template:Mvar must satisfy. To incorporate the constraint(s), we may employ a standard technique, Lagrange multipliers, assembled as a symmetric matrix, Template:Mvar. Thus our method is:

Differentiate Tr( (QM)T(QM) + (QTQI)Y )Script error: No such module "Check for unknown parameters". with respect to (the entries of) Template:Mvar, and equate to zero.

Consider a 2 × 2 example. Including constraints, we seek to minimize (QxxMxx)2+(QxyMxy)2+(QyxMyx)2+(QyyMyy)2+(Qxx2+Qyx21)Yxx+(Qxy2+Qyy21)Yyy+2(QxxQxy+QyxQyy)Yxy.

Taking the derivative with respect to Template:Mvar, Template:Mvar, Template:Mvar, Template:Mvar in turn, we assemble a matrix. 2[QxxMxx+QxxYxx+QxyYxyQxyMxy+QxxYxy+QxyYyyQyxMyx+QyxYxx+QyyYxyQyyMyy+QyxYxy+QyyYyy]

In general, we obtain the equation 0=2(QM)+2QY, so that M=Q(I+Y)=QS, where Template:Mvar is orthogonal and Template:Mvar is symmetric. To ensure a minimum, the Template:Mvar matrix (and hence Template:Mvar) must be positive definite. Linear algebra calls Template:Mvar the polar decomposition of Template:Mvar, with Template:Mvar the positive square root of S2 = MTMScript error: No such module "Check for unknown parameters".. S2=(QTM)T(QTM)=MTQQTM=MTM

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

Axis and angle

Script error: No such module "Labelled list hatnote". To efficiently construct a rotation matrix Template:Mvar from an angle Template:Mvar and a unit axis uScript error: No such module "Check for unknown parameters"., we can take advantage of symmetry and skew-symmetry within the entries. If Template:Mvar, Template:Mvar, and Template:Mvar are the components of the unit vector representing the axis, and

c=cosθs=sinθC=1c

then

Q(θ)=[xxC+cxyCzsxzC+ysyxC+zsyyC+cyzCxszxCyszyC+xszzC+c]

Determining an axis and angle, like determining a quaternion, is only possible up to the sign; that is, (u, θ)Script error: No such module "Check for unknown parameters". and (−u, −θ)Script error: No such module "Check for unknown parameters". correspond to the same rotation matrix, just like qScript error: No such module "Check for unknown parameters". and qScript error: No such module "Check for unknown parameters".. 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 atan2(sin θ, cos θ)Script error: No such module "Check for unknown parameters". equal to Template:Mvar 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 Script error: No such module "Footnotes"..

A partial approach is as follows:

x=QzyQyzy=QxzQzxz=QyxQxyr=x2+y2+z2t=Qxx+Qyy+Qzzθ=atan2(r,t1)

The Template:Mvar-, Template:Mvar-, and Template:Mvar-components of the axis would then be divided by Template:Mvar. A fully robust approach will use a different algorithm when Template:Mvar, the trace of the matrix Template:Mvar, is negative, as with quaternion extraction. When Template:Mvar 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 θ1Script error: No such module "Check for unknown parameters"., θ2Script error: No such module "Check for unknown parameters"., θ3Script error: No such module "Check for unknown parameters".; physics and chemistry may interpret these as Q(θ1,θ2,θ3)=Q𝐳(θ1)Q𝐲(θ2)Q𝐳(θ3), while aircraft dynamics may use Q(θ1,θ2,θ3)=Q𝐳(θ3)Q𝐲(θ2)Q𝐱(θ1). One systematic approach begins with choosing the rightmost axis. Among all permutations of (x,y,z)Script error: No such module "Check for unknown parameters"., 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 zyzScript error: No such module "Check for unknown parameters". 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 (Script error: No such module "Footnotes".; Script error: No such module "Footnotes".).

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 3 this completely describes the associated rotation matrix. In general, given x, y𝕊nScript error: No such module "Check for unknown parameters"., the matrix R:=I+yxTxyT+11+x,y(yxTxyT)2 belongs to SO(n + 1)Script error: No such module "Check for unknown parameters". and maps Template:Mvar to Template:Mvar.[22]

Voigt notation

In materials science, the four-dimensional stiffness and compliance tensors are often simplified to a two-dimensional matrix using Voigt notation. When applying a rotational transform through angle θ in this notation, the rotation matrix is given by[23]

T=[cos2θsin2θ2sinθcosθsin2θcos2θ2sinθcosθsinθcosθsinθcosθcos2θsin2θ].

This is particularly useful in composite laminate design, where plies are often rotated by a certain angle to bring the properties of the laminate closer to isotropic.

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 2Template:Pi. 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 Template:Mvar should be Template:Sfrac(θ − sin θ)Script error: No such module "Check for unknown parameters"., for 0 ≤ θ ≤ πScript error: No such module "Check for unknown parameters"..

Since SO(n)Script error: No such module "Check for unknown parameters". 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. Script error: No such module "Footnotes". 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 Script error: No such module "Footnotes".. This recursively exploits the nested dimensions group structure of SO(n)Script error: No such module "Check for unknown parameters"., as follows. Generate a uniform angle and construct a 2 × 2 rotation matrix. To step from nScript error: No such module "Check for unknown parameters". to n + 1Script error: No such module "Check for unknown parameters"., generate a vector vScript error: No such module "Check for unknown parameters". uniformly distributed on the Template:Mvar-sphere SnScript error: No such module "Check for unknown parameters"., embed the n × nScript error: No such module "Check for unknown parameters". matrix in the next larger size with last column (0, ..., 0, 1), and rotate the larger matrix so the last column becomes vScript error: No such module "Check for unknown parameters"..

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. Script error: No such module "Footnotes". 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 S3Script error: No such module "Check for unknown parameters".. 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 (Script error: No such module "Footnotes".; Script error: No such module "Footnotes".).

For the axis–angle form, the axis is uniformly distributed over the unit sphere of directions, S2Script error: No such module "Check for unknown parameters"., while the angle has the nonuniform distribution over [0,Template:Pi] noted previously Script error: No such module "Footnotes"..

See also

<templatestyles src="Div col/styles.css"/>

Remarks

<templatestyles src="Reflist/styles.css" />

  1. Note that if instead of rotating vectors, it is the reference frame that is being rotated, the signs on the sin θScript error: No such module "Check for unknown parameters". terms will be reversed. If reference frame A is rotated anti-clockwise about the origin through an angle Template:Mvar to create reference frame B, then Template:Mvar (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 𝐮𝐮=([𝐮]×)2+𝐈 so that, in Rodrigues' notation, equivalently, 𝐑=𝐈+(sinθ)[𝐮]×+(1cosθ)([𝐮]×)2.
  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, e2AI+AIA=23A3+O(A4). Conversely, a skew-symmetric matrix Template:Mvar specifying a rotation matrix through the Cayley map specifies the same rotation matrix through the map exp(2 artanh A)Script error: No such module "Check for unknown parameters"..
  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 Template:Norm + Template:Norm < log 2Script error: No such module "Check for unknown parameters". and Template:Norm < log 2Script error: No such module "Check for unknown parameters".. If these conditions are not fulfilled, the series may still converge. A solution always exists since expScript error: No such module "Check for unknown parameters". is ontoScript error: No such module "Unsubst". in the cases under consideration.

Script error: No such module "Check for unknown parameters".

Notes

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "Citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "Citation/CS1".
  8. Script error: No such module "Citation/CS1".
  9. Script error: No such module "citation/CS1".
  10. Script error: No such module "Citation/CS1".
  11. Template:Cite thesis
  12. Script error: No such module "Citation/CS1".
  13. Script error: No such module "Citation/CS1".
  14. Script error: No such module "Footnotes".; Script error: No such module "Footnotes".
  15. Script error: No such module "Footnotes".
  16. Script error: No such module "Footnotes".; Script error: No such module "Footnotes".
  17. Script error: No such module "Footnotes".
  18. Script error: No such module "Citation/CS1".
  19. Script error: No such module "Footnotes".; Script error: No such module "Footnotes".
  20. Script error: No such module "Footnotes".
  21. Script error: No such module "citation/CS1".
  22. Script error: No such module "Citation/CS1".
  23. Clyne, T. W., & Hull, D. (2019). Tensor Analysis of Anisotropic Materials and the Elastic Deformation of Laminae. In An Introduction to Composite Materials (pp. 43–66). chapter, Cambridge: Cambridge University Press.

Script error: No such module "Check for unknown parameters".

References

  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".; reprinted as article 52 in Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1". (GTM 222)
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1".
  • Script error: No such module "citation/CS1". (Also NASA-CR-53568.)
  • Script error: No such module "citation/CS1". (GTM 102)
  • Script error: No such module "citation/CS1".

External links

Template:Matrix classes