You are on page 1of 553

Rotation matrix

From Wikipedia, the free encyclopedia

Jump to: navigation, search In linear algebra, a rotation matrix is a matrix that is used to perform a rotation in Euclidean space. For example the matrix

rotates points in the xy-Cartesian plane counterclockwise through an angle about the origin of the Cartesian coordinate system. To perform the rotation using a rotation matrix R, the position of each point must be represented by a column vector v, containing the coordinates of the point. A rotated vector is obtained by using the matrix multiplication Rv. Since matrix multiplication always fixes the zero vector, rotation matrices can only be used to describe rotations that fix the origin. Rotation matrices provide a simple algebraic description of such rotations, and are used extensively for computations in geometry, physics, and computer graphics. These rotations can be in dimension 2, where they are determined by the angle of rotation, or in dimension 3, where in addition an axis of rotation is involved; the angle and axis are implicitly represented by the entries of the rotation matrix. The notion of rotation is not commonly used in dimensions higher than 3; there is a notion of a rotational displacement, which can be represented by a matrix, but no associated single axis or angle. Rotation matrices are square matrices, with real entries. More specifically they can be characterized as orthogonal matrices with determinant 1: . The set of all such matrices of size n forms a group, known as the special orthogonal group SO(n).

Contents

1 Rotations in two dimensions o 1.1 Non-standard orientation of the coordinate system o 1.2 Common rotations 2 Rotations in three dimensions o 2.1 Basic rotations o 2.2 General rotations o 2.3 Conversion from and to axis-angle 2.3.1 Determining the axis 2.3.2 Determining the angle 2.3.3 Rotation matrix from axis and angle

3 Properties of a rotation matrix 4 Examples 5 Geometry 6 Multiplication 7 Ambiguities 8 Decompositions o 8.1 Independent planes o 8.2 Sequential angles o 8.3 Nested dimensions o 8.4 Skew parameters via Cayley's formula 9 Lie theory o 9.1 Lie group o 9.2 Lie algebra o 9.3 Exponential map o 9.4 BakerCampbellHausdorff formula o 9.5 Spin group 10 Infinitesimal rotations 11 Conversions o 11.1 Quaternion o 11.2 Polar decomposition o 11.3 Axis and angle o 11.4 Euler angles 12 Uniform random rotation matrices 13 See also 14 Notes 15 References 16 External links

[edit] Rotations in two dimensions

A counterclockwise rotation of a vector through angle . The vector is initially aligned with the x-axis. In two dimensions every rotation matrix has the following form:

. This rotates column vectors by means of the following matrix multiplication:

. So the coordinates (x',y') of the point (x,y) after rotation are: , . The direction of vector rotation is counterclockwise if is positive (e.g. 90), and clockwise if is negative (e.g. -90).

[edit] Non-standard orientation of the coordinate system

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 R() is counterclockwise. If a left-handed Cartesian coordinate system is used, with x directed to the right but y directed down, 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.[1]

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

[edit] Common rotations


Particularly useful are the matrices for 90 and 180 rotations:

(90 counterclockwise rotation)

(180 rotation in either direction a half-turn)

(270 counterclockwise rotation, the same as a 90 clockwise rotation)

[edit] Rotations in three dimensions


See also: Rotation representation

[edit] Basic rotations


The following three basic (gimbal-like) rotation matrices rotate vectors about the x, y, or z axis, in three dimensions:

Each of these basic vector rotations typically appears counter-clockwise when the axis about

which they occur points toward the observer, and the coordinate system is right-handed. Rz, for instance, would rotate toward the y-axis a vector aligned with the x-axis. This is similar to the rotation produced by the above mentioned 2-D rotation matrix. See below for alternative conventions which may apparently or actually invert the sense of the rotation produced by these matrices.

[edit] General rotations


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

represents a rotation whose yaw, pitch, and roll are , , and , respectively. Similarly, the product

represents a rotation whose Euler angles are , , and (using the y-x-z convention for Euler angles). The orthogonal matrix (post-multiplying a column vector) corresponding to a clockwise/left-handed rotation with Euler angles ,,, with x-y-z convention, is given by:

[edit] Conversion from and to axis-angle


Every rotation in three dimensions is defined by its axis a direction that is left fixed by the rotation and its angle the amount of rotation about that axis (Euler rotation theorem).

There are several methods to compute an axis and an angle from a rotation matrix (see also axis-angle). 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. [edit] Determining the axis

A rotation R around axis u can be decomposed using 3 endomorphisms P, (I - P), and Q (click to enlarge). Given a rotation matrix R, a vector u parallel to the rotation axis must satisfy

since the rotation of around the rotation axis must result in . The equation above may be solved for which is unique up to a scalar factor. Further, the equation may be rewritten

which shows that is the null space of R I. Viewed

another way, is an eigenvector of R corresponding to the eigenvalue = 1 (every rotation matrix must have this eigenvalue). [edit] Determining the angle To find the angle of a rotation, once the axis of the rotation is known, select a vector perpendicular to the axis. Then the angle of the rotation is the angle between and . A much easier method, however, is to calculate the trace (i.e. the sum of the diagonal elements of the rotation matrix) which is 1 + 2cos . [edit] Rotation matrix from axis and angle For some applications, it is helpful to be able to make a rotation with a given axis. Given a unit vector u = (ux, uy, uz), where ux2 + uy2 + uz2 = 1, the matrix for a rotation by an angle of about an axis in the direction of u is

This can be written more concisely as

where is the cross product matrix of u, is the tensor product and I is the Identity matrix. This is a matrix form of Rodrigues' rotation formula, with

If the 3D space is right-handed, this rotation will be counterclockwise for an observer placed so that the axis u goes in his or her direction (Right-hand rule).

[edit] Properties of a rotation matrix


In three dimensions, for any rotation matrix , where a is a rotation axis and a rotation angle,

(i.e.,

is an orthogonal matrix) is 1)

(i.e, the determinant of (where The eigenvalues of

is the identity matrix) are

where i is the standard imaginary unit with the property i = 1

The trace of eigenvalues.

is

equivalent to the sum of its

Some of these properties can be generalised to any number of dimensions. In other words, they hold for any rotation matrix . For instance, in two dimensions the properties hold with the following exceptions:

a is not a given axis, but a point (rotation center) which must coincide with the origin of the coordinate system in which the rotation is represented. Consequently, the four elements of the rotation matrix depend only on , hence we write , rather than The eigenvalues of are The trace of is equivalent to the sum of its eigenvalues.

[edit] Exam ples

The 22 rotation mat

corresponds to a 9

The transpose of the 2

is its inverse, but is 1 this is not a a reflection acros

The 33 rotation mat

corresponds to a the x axis in three

The 33 rotation mat

corresponds to a r approximately -7 (13,23,23) in thre

The 33 permutation

is a rotation matri any even permuta through 120 abo

[edit] Geom etry


In Euclidean geometry ,a rotation is an example of an isometry, a transform ation that moves points without changing the distances between them. Rotations are distinguis hed from other isometrie s by two additional properties : they leave (at least) one point fixed, and they leave "handedn ess" unchange d. By contrast, a translatio n moves every

point, a reflection exchange s left- and righthanded ordering, and a glide reflection does both. A rotation that does not leave "handedn ess" unchange d is an improper rotation or a rotoinver sion. If we take the fixed point as the origin of a Cartesian coordinat e system, then every point can be given coordinat es as a displace ment from the origin. Thus we may work with the vector

space of displace ments instead of the points themselv es. Now suppose (p1,,pn) are the coordinat es of the vector p from the origin, O, to point P. Choose an orthonor mal basis for our coordinat es; then the squared distance to P, by Pythagor as, is

whic h we can comp ute using the matri x multi plicat ion

A g e o m et ri c r ot at io n tr a n sf o r m s li n e s to li n e s, a n d p re s er v e s ra ti o s

o f di st a n c e s b et w e e n p oi nt s. F r o m th e s e p r o p er ti e s w e c a n s h o w th at a r ot at

io n is a li n e ar tr a n sf o r m at io n o f th e v e ct o rs , a n d th u s c a n b e w ri tt e n in m at ri x f

o r m , Q p. T h e fa ct th at a r ot at io n p re s er v e s, n ot ju st ra ti o s, b ut di st a n c e s th e m s el v e

s, w e c a n st at e a s

o r

B e c a u s e t h i s e q u a t i o n h o l d s f

o r a l l v e c t o r s , p , w e c o n c l u d e t h a t e v e r y r o t a t i o n

m a t r i x , Q , s a t i s f i e s t h e o r t h o g o n a l i t y c o n d i t i o n ,

R o t a t i o n s p r e s e r v e h a n d e d n e s s b e c a u s e t h e y c a n n o

t c h a n g e t h e o r d e r i n g o f t h e a x e s , w h i c h i m p l i e s t

h e s p e c i a l m a t r i x c o n d i t i o n ,

E q u a l l y

i m p o r t a n t ,

w e

c a n

s h o w

t h a t

a n y

m a t r i x

s a t i s f y i n g

t h e s e

t w o

o n d i t i o n s

a c t s

a s

r o t a t i o n .

[ e d i t ]

M u l t i p

l i c a t i o n

T h e

i n v e r s e

o f

r o t a t i o n

m a t r i x i s i

t s

t r a n s p o s e ,

w h i c h i s

a l s o

r o t a t i o n

m a t r i x :

The change in a vector's coordinates can be due to a turn of the coordinate system (alias) or a turn of the vector (alibi). Any rotation can be legitimately described both ways, as vectors and coordinate systems actually rotate with respect to each other. Throughout this article, we chose the alibi approach to describe rotations.

The vector can be pre-multiplied by a rotation matrix (Rv, where v is a column vector), or post-multiplied by it (vR, where v is a row vector). Throughout this article, we described rotations produced by means of a pre-multiplication.

The matrix and the vector can be represented with respect to a right-handed or lefthanded coordinate system. Throughout the article, we assumed a right-handed orientation, unless otherwise specified.

The vector space has a dual space of linear forms, and the matrix can act on either vectors or forms.

(90, 45, 105) (270, 315, 255) (72, 0, 0) (40, 0, 32) (45, 60, 30) (135, 60, 150)

multiples of 360 singular alignment bistable flip

usage of Euler angles.

es in axis-angle form, the angle should not be uniformly distributed; the probability that (the magnitude of)

ow to use the Cayley transform to generate and test matrices according to this criterion.

rmly distributed on the n-sphere, Sn, embed the nn matrix in the next larger size with last column (0,,0,1),

lanar rotation.

niform distribution on S3.

You might also like