Turn (geometry): Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Iain.dalton
m →‎History: Fixed mismatched parentheses
en>ArnoldReinhold
→‎Examples of use: Electromagnetic coils
Line 1: Line 1:
In [[linear algebra]], a '''rotation matrix''' is a [[matrix (mathematics)|matrix]] that is used to perform a [[rotation (mathematics)|rotation]] in [[Euclidean space]]. For example the matrix
You probably have your desired number most typically associated with gems, you can get yourself prepared intelligently to defend myself against any floor you like. Wishes exciting since it aids you enjoy like a veteran and you can malfunction just about anyone should playing skills are robust.<br><br>Trying the higher level: what is important when it comes in order to some game, but when you are looking for Clash of Clans, you will have a lot more subtle techniques. Despite making use of clash of clans hack tools, you may also acquire experience points through the process of matching on top off other players. Most important purpose of earning Player vs player is to enable some other enhancements for your indigneous group. The augmentation consists of better the battle equipment, properties, troops with tribe people.<br><br>Throne Rush has an related for just about everything in Clash. Instead within your Town Hall, it incorporates a Castle. Instead connected Clans, it has Brotherhoods. Instead of Trophies, it has Morale. Perhaps the one element it takes to the next level is its Immortal Celebrities. clash of clans has a Barbarian King and your Archer Queen which are typical special units that can be reused in battle in they just require work hours of time to alleviate back to full healthy. Throne Rush has similar heroes that could be hired, but they will extreme and more many. They play almost the same way, on the other hand think players will enjoy using four or top 5 Immortal Heroes instead of just two, as long as they dont throw off the balance of the sport too severely.<br><br>It's got possible, but the volume of absence one visit would abatement by sixty one. 5% from 260 treasures to hundred or so gems. Or, whether you capital to erect up the 1 time bulk at 260 gems, the band would grab to acceleration added steeply and also 1 wedding anniversary would turn into added expensive.<br><br>View your child's xbox online enjoying. Video gaming are now rated just like films and which can help. For those who have any questions about exactly where in addition to how to utilize [http://prometeu.net clash of clans hack android download], you are able to email us with the web-site. This kind enables you to maintain your an eye on unquestionably the information your kids are exposed to. Dependant upon your child's age, continue to keep the boy clear of video games that happen to you should be meant for people who are more fully accumulated than him.<br><br>A [http://Search.Un.org/search?ie=utf8&site=un_org&output=xml_no_dtd&client=UN_Website_en&num=10&lr=lang_en&proxystylesheet=UN_Website_en&oe=utf8&q=person%27s+war&Submit=Go person's war] abject is agnate in your approved village, except that your gua abject will not manage resources. Barrio when your warfare abject will not be anon improved or rearranged, as it by it's self mimics this adjustment and in addition accomplished completed advancement programs of your apple throughout the time of alertness day. World war bases additionally never offense to take their of add-ons rearmed, defenses reloaded perhaps characters healed, as some people are consistently ready. The association alcazar around the your war abject service charge be abounding alone after the one in your whole village.<br><br>Basically, it would alone acquiesce all of us to tune 2 volume points. If you appetite for you to instruments added than in just what - as Supercell extremely acquainted t had actually been all-important - you claims assorted beeline segments. Theoretically they could maintain a record of alike added bulk gadgets. If they capital to help allegation offered or beneath for a 2 day skip, they may possibly calmly familiarize 1 appended segment.
 
:<math>R =
\begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}
</math>
 
rotates '''points''' in the ''xy''-[[Cartesian coordinate system|Cartesian plane]] counter-clockwise 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]] ''R'''''v'''.
 
Since matrix multiplication has no effect on the zero vector (the coordinates of the origin), rotation matrices can only be used to describe rotations about the origin of the coordinate system. Rotation matrices provide an algebraic description of such rotations, and are used extensively for computations in [[geometry]], [[physics]], and [[computer graphics]].
 
Rotation matrices are [[square matrix|square matrices]], with [[real number|real]] entries. More specifically they can be characterized as [[orthogonal matrix|orthogonal matrices]] with [[determinant]]&nbsp;1:
 
:<math>R^{T} = R^{-1}, \det R = 1\,</math>.
 
In some literature, the term ''rotation'' is generalized to include [[improper rotation]]s, characterized by orthogonal matrices with determinant&nbsp;−1 (instead of +1). These combine '''proper''' rotations with ''reflections'' (which invert [[orientation (mathematics)|orientation]]). In other cases, where reflections are not being considered, the label ''proper'' may be dropped. This convention is followed in this article.
 
The [[set (mathematics)|set]] of all orthogonal matrices of size ''n'' with determinant +1 forms a [[group (mathematics)|group]] known as the [[special orthogonal group]] {{math|SO(''n'')}}. The set of all orthogonal matrices of size ''n'' with determinant +1 or -1 forms the (general) [[orthogonal group]] {{math|O(''n'')}}.
 
==In two dimensions==
[[Image:Counterclockwise rotation.png|thumb|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:
 
:<math>
R(\theta) = \begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}</math>.
 
This rotates [[column vector]]s by means of the following [[matrix multiplication]]:
 
:<math>
\begin{bmatrix}
x' \\
y' \\
\end{bmatrix} = \begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}\begin{bmatrix}
x \\
y \\
\end{bmatrix}</math>.
 
So the coordinates (x',y') of the point (x,y) after rotation are:<ref>{{cite book|last=Swokowski|first=Earl|title=Calculus with Analytic Geometry|year=1979|issue=Prindle, Weber, and Schmidt}}</ref>
 
:<math>x' = x \cos \theta - y \sin \theta\,</math>,
:<math>y' = x \sin \theta + y \cos \theta\,</math>.
 
The direction of vector rotation is counterclockwise if θ is positive (e.g. 90°), and clockwise if θ is negative (e.g. -90°). Thus the clockwise rotation matrix is found as:
 
:<math>
R(-\theta) = \begin{bmatrix}
\cos \theta & \sin \theta \\
-\sin \theta & \cos \theta \\
\end{bmatrix}\,</math>.
 
Note that the two-dimensional case is the only non-trivial (e.g. one dimension) case where the rotation matrices group is commutative, so that it does not matter the order in which multiple rotations are performed.
 
===Non-standard orientation of the coordinate system===
 
[[Image:Clockwise rotation.png|thumb|A rotation through angle ''θ'' with non-standard axes.]]
If a standard [[Orientation (mathematics)|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.<ref>{{Citation|url=http://www.w3.org/TR/SVG/coords.html#InitialCoordinateSystem|title=Scalable Vector Graphics – the initial coordinate system|author=W3C recommendation|year=2003}}</ref>
 
See [[Rotation matrix#Ambiguities|below]] for other alternative conventions which may change the sense of the rotation produced by a rotation matrix.
 
===Common rotations===
 
Particularly useful are the matrices for 90° and 180° rotations:
:<math>
R(90^\circ) = \begin{bmatrix}
0 & -1 \\[3pt]
1 & 0 \\
\end{bmatrix}</math> (90° counterclockwise rotation)
:<math>R(180^\circ) = \begin{bmatrix}
-1 & 0 \\[3pt]
0 & -1 \\
\end{bmatrix}</math> (180° rotation in either direction – a half-turn)
:<math>R(270^\circ) = \begin{bmatrix}
0 & 1 \\[3pt]
-1 & 0 \\
\end{bmatrix}</math> (270° counterclockwise rotation, the same as a 90° clockwise rotation)
 
==In three dimensions==
{{See also|Rotation formalisms in three dimensions}}
 
===Basic rotations===
 
A basic 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:
 
:<math>
\begin{alignat}{1}
R_x(\theta) &= \begin{bmatrix}
1 & 0 & 0 \\
0 & \cos \theta &  -\sin \theta \\[3pt]
0 & \sin \theta  &  \cos \theta \\[3pt]
\end{bmatrix} \\[6pt]
R_y(\theta) &= \begin{bmatrix}
\cos \theta & 0 & \sin \theta \\[3pt]
0 & 1 & 0 \\[3pt]
-\sin \theta & 0 & \cos \theta \\
\end{bmatrix} \\[6pt]
R_z(\theta) &= \begin{bmatrix}
\cos \theta &  -\sin \theta & 0 \\[3pt]
\sin \theta & \cos \theta & 0\\[3pt]
0 & 0 & 1\\
\end{bmatrix}
\end{alignat}
</math>
 
For [[column vector]]s, each of these basic vector rotations appears counter-clockwise when the axis about which they occur points toward the observer, the coordinate system is right-handed, and the angle ''θ'' is positive. R<sub>z</sub>, for instance, would rotate toward the ''y''-axis a vector aligned with the ''x''-axis, as can easily be checked by operating with R<sub>z</sub> on the vector (1,0,0):
:<math> R_z(90^\circ) \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} =
\begin{bmatrix} \cos 90^\circ &  -\sin 90^\circ & 0 \\ \sin 90^\circ & \cos 90^\circ & 0\\ 0 & 0 & 1\\ \end{bmatrix}
\begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} =
\begin{bmatrix} 0 &  -1 & 0 \\ 1 & 0 & 0\\ 0 & 0 & 1\\ \end{bmatrix}
\begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ 0 \\ \end{bmatrix}
</math>
 
This is similar to the rotation produced by the above mentioned 2-D rotation matrix. See [[Rotation matrix#Ambiguities|below]] for alternative conventions which may apparently or actually invert the sense of the rotation produced by these matrices.
 
===General rotations===
 
Other rotation matrices can be obtained from these three using [[matrix multiplication]].  For example, the product
:<math>R = R_x(\gamma) \, R_y(\beta) \, R_z(\alpha)\,\!</math>
represents a rotation whose [[yaw, pitch, and roll]] angles are ''α'', ''β'', and ''γ'', respectively. More formally, it is an [[Euler angles#Extrinsic rotations|extrinsic rotation]] whose [[Euler angles]] are ''α'', ''β'', ''γ'', about axes ''z'', ''y'', ''x'' respectively.
Similarly, the product
:<math>R = R_z(\gamma) \, R_x(\beta) \, R_y(\alpha)\,\!</math>
represents an extrinsic rotation whose Euler angles are ''α'', ''β'', ''γ'' about axes ''y'', ''x'', ''z''.
 
These matrices produce the desired effect only if they are used to pre-multiply [[column vector]]s (see [[#Ambiguities|Ambiguities]] for more details).
 
===Conversion from and to axis-angle===
{{merge section to|Rotation formalisms in three dimensions#Rotation matrix ↔ Euler axis/angle|date=September 2013}}
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 [[eigenvector]]s and [[eigenvalue]]s of the rotation matrix. It is also possible to use the [[Trace (mathematics)|trace]] of the rotation matrix.
 
====Determining the axis====
[[Image:Rotation decomposition.png|thumb|A rotation '''R''' around axis '''u''' can be decomposed using 3 endomorphisms '''P''', '''(I − P)''', and '''Q''' (click to enlarge).]]
 
Given a 3x3 rotation matrix ''R'', a vector '''u''' parallel to the rotation axis must satisfy
 
:<math>R\textbf{u} = \textbf{u}</math>
 
since the rotation of <math>\textbf{u}</math> around the rotation axis must result in <math>\textbf{u}</math>. The equation above may be solved for <math>\textbf{u}</math> which is  unique up to a scalar factor.
 
Further, the equation may be rewritten
 
:<math>R\textbf{u} = I \textbf{u} \quad \Rightarrow \quad (R - I) \textbf{u} = 0</math>
 
which shows that <math>\textbf{u}</math> is the [[null space]] of <math>R - I</math>.
 
Viewed another way, <math>\textbf{u}</math> is an [[eigenvector]] of ''R'' corresponding to the [[eigenvalue]] <math>\lambda = 1</math> (every rotation matrix must have this eigenvalue).
 
====Determining the angle====
To find the angle of a rotation, once the axis of the rotation is known, select a vector <math>\textbf{v}</math> perpendicular to the axis. Then the angle of the rotation is the angle between <math>\textbf{v}</math> and <math>R\textbf{v}</math>.
 
A much easier method, however, is to calculate the ''trace'' (i.e. the sum of the diagonal elements of the rotation matrix) which is <math>1+2\cos\theta</math>. Care should be taken to select the right sign for the angle <math>\theta</math> to match the chosen axis.
 
====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'''&nbsp;=&nbsp;(''u''<sub>''x''</sub>,&nbsp;''u''<sub>''y''</sub>,&nbsp;''u''<sub>''z''</sub>), where ''u''<sub>''x''</sub><sup>2</sup>&nbsp;+&nbsp;''u''<sub>''y''</sub><sup>2</sup>&nbsp;+&nbsp;''u''<sub>''z''</sub><sup>2</sup>&nbsp;=&nbsp;1, the matrix for a rotation by an angle of ''θ'' about an axis in the direction of '''u''' is
:<math>R = \begin{bmatrix} \cos \theta +u_x^2 \left(1-\cos \theta\right) & u_x u_y \left(1-\cos \theta\right) - u_z \sin \theta & u_x u_z \left(1-\cos \theta\right) + u_y \sin \theta \\ u_y u_x \left(1-\cos \theta\right) + u_z \sin \theta & \cos \theta + u_y^2\left(1-\cos \theta\right) & u_y u_z \left(1-\cos \theta\right) - u_x \sin \theta \\ u_z u_x \left(1-\cos \theta\right) - u_y \sin \theta & u_z u_y \left(1-\cos \theta\right) + u_x \sin \theta & \cos \theta + u_z^2\left(1-\cos \theta\right)
\end{bmatrix}.
</math><ref>{{cite journal|last=Taylor|first=Camillo|coauthors=Kriegman|title=Minimization on the Lie Group SO(3) and Related Manifolds|journal=Technical Report|year=1994|series=No. 9405|issue=Yale University}}</ref>
 
This can be written more concisely as
:<math>R = I\cos\theta + \sin\theta[\mathbf u]_{\times} + (1-\cos\theta)\mathbf{u}\otimes\mathbf{u},</math>
where <math>[\mathbf u]_{\times}</math> is the [[Cross product#Conversion to matrix multiplication|cross product matrix]] of '''u''', <math>\otimes</math> is the [[tensor product]] and ''I'' is the [[Identity matrix]]. This is a matrix form of [[Rodrigues' rotation formula]], with
:<math> \mathbf{u}\otimes\mathbf{u}  = \begin{bmatrix}
u_x^2  & u_x u_y & u_x u_z \\[3pt]
u_x u_y & u_y^2 & u_y u_z \\[3pt]
u_x u_z & u_y u_z & u_z^2
\end{bmatrix},\qquad  [\mathbf u]_{\times} = \begin{bmatrix}
0  & -u_z & u_y \\[3pt]
u_z & 0 & -u_x \\[3pt]
-u_y & u_x & 0
\end{bmatrix}.
</math>
 
If the 3D space is right-handed, this rotation will be counterclockwise for an observer placed so that the axis '''u''' goes in her direction ([[Right-hand rule]]).
 
== Properties of a rotation matrix ==
 
In three dimensions, for any rotation matrix <math>R_{a,\theta}</math> acting on <math>\mathbb{R}^3 </math>, where ''a'' is a rotation axis and θ a rotation angle,
 
:* <math> R_{a, \theta}^T = R_{a, \theta}^{-1} </math> (i.e., <math>R_{a,\theta} \ </math> is an [[orthogonal matrix]])
:* <math> \det\left(R_{a, \theta}\right) = 1 </math> (i.e, the [[determinant]] of <math>R_{a,\theta} \ </math> is 1)
:* <math>R_{a, (\theta + r)} = R_{a, \theta} \cdot R_{a,r}</math>
:* <math> R_{a, 0} = I \ </math> (where <math>I \in \mathbb{R}^n</math> is the [[identity matrix]])
:* The [[eigenvalues]] of <math>R_{a,\theta} \ </math> are
:::<math>\{1, e^{\pm i\theta} \} = \{1,\ \cos(\theta)+i\sin(\theta),\ \cos(\theta)-i\sin(\theta)\}, </math>
::where ''i'' is the standard [[imaginary unit]] with the property <math>i^2 = -1</math>
:* The [[Trace (linear algebra)|trace]] of <math>R_{a,\theta} \ </math> is <math>1 + 2\cos(\theta) \,</math> equivalent to the sum of its eigenvalues.
 
Some of these properties can be generalised to any number of dimensions. In other words, they hold for any rotation matrix <math>R_{a,\theta} \in \mathbb{R}^n </math>.
 
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 <math>R_{\theta} \ </math>, rather than <math>R_{a,\theta} \ </math>
:* The [[eigenvalues]] of <math>R_{\theta} \ </math> are <math>\{e^{\pm i\theta} \} = \{\cos(\theta)+i\sin(\theta),\ \cos(\theta)-i\sin(\theta)\}. </math>
:* The [[Trace (linear algebra)|trace]] of <math>R_{\theta} \ </math> is  <math>2\cos(\theta) \,</math> equivalent to the sum of its eigenvalues.
 
== Examples ==
{{col-begin}}
{{col-1-of-2}}
<ul>
<li>The 2×2 rotation matrix
:<math> Q = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} </math>
corresponds to a 90° planar rotation.</li>
 
<li>The transpose of the 2×2 matrix
:<math> M = \begin{bmatrix} 0.936 & 0.352 \\ 0.352 & -0.936 \end{bmatrix} </math>
is its inverse, but since its determinant is −1, this is not a rotation matrix; it is a reflection across the line 11''y''&nbsp;=&nbsp;2''x''.
 
<li>The 3×3 rotation matrix
:<math> Q = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \frac{\sqrt{3}}{2} & \frac12 \\ 0 & -\frac12 & \frac{\sqrt{3}}{2} \end{bmatrix} </math>
corresponds to a −30° rotation around the ''x'' axis in three-dimensional space.</li>
 
<li>The 3×3 rotation matrix
:<math> Q = \begin{bmatrix} 0.36 & 0.48 & -0.8 \\ -0.8 & 0.60 & 0 \\ 0.48 & 0.64 & 0.60 \end{bmatrix} </math>
corresponds to a rotation of approximately −74° around the axis (−<sup>1</sup>⁄<sub>3</sub>,<sup>2</sup>⁄<sub>3</sub>,<sup>2</sup>⁄<sub>3</sub>) in three-dimensional space.</li>
 
<li>The 3×3 [[permutation matrix]]
:<math> P = \begin{bmatrix} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix} </math>
is a rotation matrix, as is the matrix of any [[even permutation]], and rotates through 120° about the axis ''x'' = ''y'' = ''z''.</li>
</ul>
{{col-2-of-2}}
<ul>
<li>The 3×3 matrix
:<math> M = \begin{bmatrix} 3 & -4 & 1 \\ 5 & 3 & -7 \\ -9 & 2 & 6 \end{bmatrix} </math>
has determinant +1, but its transpose is not its inverse, so it is not a rotation matrix.</li>
 
<li>The 4×3 matrix
:<math> M = \begin{bmatrix} 0.5 & -0.1 & 0.7 \\ 0.1 & 0.5 & -0.5 \\ -0.7 & 0.5 & 0.5 \\ -0.5 & -0.7 & -0.1 \end{bmatrix} </math>
is not square, and so cannot be a rotation matrix; yet ''M''<sup>''T''</sup>''M'' yields a 3×3 identity matrix (the columns are orthonormal).</li>
 
<li>The 4×4 matrix
:<math> Q = \begin{bmatrix} -1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} </math>
describes an [[SO(4)#Isoclinic rotations|isoclinic rotation]], a rotation through equal angles (180°) through two orthogonal planes.
 
<li>The 5×5 rotation matrix
:<math> Q = \begin{bmatrix} 0 & -1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & -1 & 0 & 0 \\ 0 & 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{bmatrix} </math>
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.
</ul>
{{col-end}}
 
== 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. By contrast, a [[translation (geometry)|translation]] moves every point, a [[reflection (geometry)|reflection]] exchanges left- and right-handed ordering, and a [[glide reflection]] does both.
 
A rotation that does not leave "handedness" unchanged is an [[improper rotation]] or a rotoinversion.
 
If we take the fixed point as the origin of a [[Cartesian coordinate system]], then every point can be given coordinates as a displacement from the origin. Thus we may work with the [[vector space]] of displacements instead of the points themselves. Now suppose (''p''<sub>1</sub>,…,''p''<sub>''n''</sub>) are the coordinates of the vector '''p''' from the origin, ''O'', to point ''P''. Choose an [[orthonormal basis]] for our coordinates; then the squared distance to ''P'', by [[Pythagorean theorem|Pythagoras]], is
::<math> d^2(O,P) = \| \bold{p} \|^2 = \sum_{r=1}^n p_r^2 </math>
which we can compute using the matrix multiplication
:<math> \| \bold{p} \|^2 = \begin{bmatrix}p_1 \cdots p_n\end{bmatrix} \begin{bmatrix}p_1 \\ \vdots \\ p_n \end{bmatrix} = \bold{p}^T \bold{p} . </math>
 
A geometric rotation transforms lines to lines, and preserves ratios of distances between points. From these properties we can show that a rotation is a [[linear transformation]] of the vectors, and thus can be written in [[matrix (mathematics)|matrix]] form, ''Q'''''p'''. The fact that a rotation preserves, not just ratios, but distances themselves, we can state as
:<math> \bold{p}^T \bold{p} = (Q \bold{p})^T (Q \bold{p}) , \,\!</math>
or
:<math>\begin{align}
\bold{p}^T  I \bold{p}&{}= (\bold{p}^T Q^T) (Q \bold{p}) \\
                    &{}= \bold{p}^T (Q^T Q) \bold{p} .
\end{align}</math>
Because this equation holds for all vectors, '''p''', we conclude that every rotation matrix, ''Q'', satisfies the ''orthogonality'' condition,
:<math> Q^T Q = I . \,\!</math>
Rotations preserve handedness because they cannot change the ordering of the axes, which implies the ''special matrix'' condition,
:<math> \det Q = +1 . \,\!</math>
Equally important, we can show 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:
:<math>\begin{align} (Q^T)^T (Q^T) &{}= Q Q^T = I\\ \det Q^T &{}= \det Q = +1. \end{align}</math>
The product of two rotation matrices is a rotation matrix:
:<math>\begin{align}
(Q_1 Q_2)^T (Q_1 Q_2) &{}= Q_2^T (Q_1^T Q_1) Q_2 = I \\
\det (Q_1 Q_2) &{}= (\det Q_1) (\det Q_2) = +1.
\end{align}</math>
For ''n'' greater than 2, multiplication of ''n''×''n'' rotation matrices is not commutative.
:<math>\begin{align}
Q_1 &{}= \begin{bmatrix}0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1\end{bmatrix} &
Q_2 &{}= \begin{bmatrix}0 & 0 & 1 \\ 0 & 1 & 0 \\ -1 & 0 & 0\end{bmatrix} \\
Q_1 Q_2 &{}= \begin{bmatrix}0 & -1 & 0 \\ 0 & 0 & 1 \\ -1 & 0 & 0\end{bmatrix} &
Q_2 Q_1 &{}= \begin{bmatrix}0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0\end{bmatrix}.
\end{align}</math>
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''×''n'' rotation matrices form a [[group (mathematics)|group]], which for ''n''&nbsp;&gt;&nbsp;2 is [[nonabelian group|non-abelian]]. Called a [[special orthogonal group]], and denoted by SO(''n''), SO(''n'','''R'''), SO<sub>''n''</sub>, or SO<sub>''n''</sub>('''R'''), the group of ''n''×''n'' rotation matrices is isomorphic to the group of rotations in an ''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 ==
[[Image:Alias and alibi rotations.png|thumb|350px|right|Alias and alibi rotations]]
The interpretation of a rotation matrix can be subject to many ambiguities.
 
; Alias or alibi (passive or active) transformation
: The coordinates of a point ''P'' may change due to either a rotation of the coordinate system ''CS'' ([[Active and passive transformation|alias]]), or a rotation of the point ''P'' ([[Active and passive transformation|alibi]]). In the latter case, the rotation of ''P'' also produces a rotation of the vector '''v''' representing ''P''. In other words, either ''P'' and '''v''' are fixed while ''CS'' rotates (alias), or ''CS'' is fixed while ''P'' and '''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,
::<math>
R(\theta) = \begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta \\
\end{bmatrix}</math>
: represents a counterclockwise rotation of a vector ''v'' by an angle ''θ'', or a rotation of ''CS'' by the same angle but in the opposite direction (i.e. clockwise). Alibi and alias transformations are also known as [[active and passive transformation]]s, respectively.
; Pre-multiplication or post-multiplication
: The same point ''P'' can be represented either by a [[column vector]] '''v''' or a [[row vector]] '''w'''. Rotation matrices can either pre-multiply column vectors (''R'''''v'''), or post-multiply row vectors ('''w'''''R''). However, ''R'''''v''' produces a rotation in the opposite direction with respect to '''w'''''R''. Throughout this article, we described rotations produced on column vectors by means of a pre-multiplication. To obtain exactly the same rotation (i.e. the same final coordinates of point ''P''), the row vector must be post-multiplied by the [[transpose]] of R ('''w'''''R''<sup>T</sup>).
; Right- or left-handed coordinates
: The matrix and the vector can be represented with respect to a [[Cartesian coordinate system#Orientation and handedness|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 form]]s, and the matrix can act on either vectors or forms.
 
In most cases the effect of the ambiguity is equivalent to the effect of a [[Transpose|transposition]] of the rotation matrix.
 
== Decompositions ==
 
=== Independent planes ===
Consider the 3×3 rotation matrix
:<math> Q = \begin{bmatrix} 0.36 & 0.48 & -0.8 \\ -0.8 & 0.60 & 0 \\ 0.48 & 0.64 & 0.60 \end{bmatrix} . </math>
If ''Q'' acts in a certain direction, '''v''', purely as a scaling by a factor λ, then we have
:<math> Q \bold{v} = \lambda \bold{v}, \,\!</math>
so that
:<math> \bold{0} = (\lambda I - Q) \bold{v} . \,\!</math>
Thus λ is a root of the [[characteristic polynomial]] for ''Q'',
:<math>\begin{align}
0 &{}= \det (\lambda I - Q) \\
  &{}= \lambda^3 - \tfrac{39}{25} \lambda^2  + \tfrac{39}{25} \lambda - 1 \\
  &{}= (\lambda-1) (\lambda^2 - \tfrac{14}{25} \lambda + 1).
\end{align}</math>
Two features are noteworthy. First, one of the roots (or [[eigenvalue]]s) 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&nbsp;cos&nbsp;θ (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''×''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 <sup>''n''</sup>⁄<sub>2</sub> of them.
 
The sum of the entries on the main diagonal of a matrix is called the [[trace (linear algebra)|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 (sub-)space. For a 2×2 matrix the trace is 2&nbsp;cos(θ), and for a 3×3 matrix it is 1+2&nbsp;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
:<math>Q = \begin{bmatrix} a & -b \\ b & a \end{bmatrix}</math>
with ''a''<sup>2</sup>+''b''<sup>2</sup>&nbsp;= 1. Therefore we may set ''a''&nbsp;= cos&nbsp;θ and ''b''&nbsp;= sin&nbsp;θ, 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 [[Cartesian coordinate system#Cartesian coordinates in two dimensions|quadrant]], using a [[atan2|two-argument arctangent]] function.
 
Now consider the first column of a 3×3 rotation matrix,
:<math>\begin{bmatrix}a\\b\\c\end{bmatrix} . </math>
Although ''a''<sup>2</sup>+''b''<sup>2</sup> will probably not equal 1, but some value ''r''<sup>2</sup>&nbsp;&lt;&nbsp;1, we can use a slight variation of the previous computation to find a so-called [[Givens rotation]] that transforms the column to
:<math>\begin{bmatrix}r\\0\\c\end{bmatrix} , </math>
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
:<math>Q_{xz}Q_{xy}Q = \begin{bmatrix}1&0&0\\0&\ast&\ast\\0&\ast&\ast\end{bmatrix} . </math>
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
:<math>Q_{yz}Q_{xz}Q_{xy}Q = \begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix} , </math>
which is an identity matrix. Thus we have decomposed ''Q'' as
:<math>Q = Q_{xy}^{-1}Q_{xz}^{-1}Q_{yz}^{-1} . </math>
 
An ''n''×''n'' rotation matrix will have (''n''−1)+(''n''−2)+⋯+2+1, or
:<math>\sum_{k=1}^{n-1} k = \frac{n(n-1)}{2} \,\!</math>
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''×''n'' rotation matrices, each of which has ''n''<sup>2</sup> entries, can be parameterized by ''n''(''n''−1)/2 angles.
 
{| border="1" cellspacing="0" cellpadding="4" style="float:right; margin-left:1em"
|-
| ''xzx''<sub>w</sub> || ''xzy''<sub>w</sub> || ''xyx''<sub>w</sub> || ''xyz''<sub>w</sub>
|-
| ''yxy''<sub>w</sub> || ''yxz''<sub>w</sub> || ''yzy''<sub>w</sub> || ''yzx''<sub>w</sub>
|-
| ''zyz''<sub>w</sub> || ''zyx''<sub>w</sub> || ''zxz''<sub>w</sub> || ''zxy''<sub>w</sub>
|-
| ''xzx''<sub>b</sub> || ''yzx''<sub>b</sub> || ''xyx''<sub>b</sub> || ''zyx''<sub>b</sub>
|-
| ''yxy''<sub>b</sub> || ''zxy''<sub>b</sub> || ''yzy''<sub>b</sub> || ''xzy''<sub>b</sub>
|-
| ''zyz''<sub>b</sub> || ''xyz''<sub>b</sub> || ''zxz''<sub>b</sub> || ''yxz''<sub>b</sub>
|}
In three dimensions this restates in matrix form an observation made by [[Leonhard Euler|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 (Euler, 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 [[vector space|vectors]]'', despite a similarity in appearance as a triple of numbers.
 
=== Nested dimensions ===
A 3×3 rotation matrix like
:<math>Q_{3 \times 3} = \begin{bmatrix}\cos \theta & \sin \theta & {\color{CadetBlue}0} \\ -\sin \theta & \cos \theta & {\color{CadetBlue}0} \\ {\color{CadetBlue}0} & {\color{CadetBlue}0} & {\color{CadetBlue}1}\end{bmatrix} </math>
suggests a 2×2 rotation matrix,
:<math>Q_{2 \times 2} = \begin{bmatrix}\cos \theta & \sin \theta \\ -\sin \theta & \cos \theta\end{bmatrix} , </math>
is embedded in the upper left corner:
:<math>Q_{3 \times 3} = \left[ \begin{matrix} Q_{2 \times 2} & \bold{0} \\ \bold{0}^T & 1 \end{matrix} \right] . </math>
This is no illusion; not just one, but many, copies of ''n''-dimensional rotations are found within (''n''+1)-dimensional rotations, as [[subgroup]]s. Each embedding leaves one direction fixed, which in the case of 3×3 matrices is the rotation axis. For example, we have
:<math>Q_{\bold{x}}(\theta) = \begin{bmatrix}1 & 0 & 0 \\ 0 & \cos \theta & \sin \theta \\ 0 & -\sin \theta & \cos \theta\end{bmatrix} , </math>
:<math>Q_{\bold{y}}(\theta) = \begin{bmatrix}\cos \theta & 0 & -\sin \theta \\ 0 & 1 & 0 \\ \sin \theta & 0 & \cos \theta\end{bmatrix} , </math>
:<math>Q_{\bold{z}}(\theta) = \begin{bmatrix}\cos \theta & \sin \theta & 0 \\ -\sin \theta & \cos \theta & 0  \\ 0 & 0 & 1\end{bmatrix} , </math>
fixing the ''x'' axis, the ''y'' axis, and the ''z'' axis, respectively. The rotation axis need not be a coordinate axis; if '''u'''&nbsp;= (''x'',''y'',''z'') is a unit vector in the desired direction, then
:<math>\begin{align}
Q_{\bold{u}}(\theta)
&{}=
  \begin{bmatrix}
    0&-z&y\\
    z&0&-x\\
    -y&x&0
  \end{bmatrix} \sin \theta + (I - \bold{u}\bold{u}^T) \cos \theta + \bold{u}\bold{u}^T \\
&{}=
  \begin{bmatrix}
    (1-x^2) c_{\theta} + x^2 & - z s_{\theta} - x y c_{\theta} + x y & y s_{\theta} - x z c_{\theta} + x z \\
    z s_{\theta} - x y c_{\theta} + x y & (1-y^2) c_{\theta} + y^2 & -x s_{\theta} - y z c_{\theta} + y z \\
    -y s_{\theta} - x z c_{\theta} + x z & x s_{\theta} - y z c_{\theta} + y z & (1-z^2) c_{\theta} + z^2
  \end{bmatrix} \\
&{}=
  \begin{bmatrix}
    x^2 (1-c_{\theta}) + c_{\theta} & x y (1-c_{\theta}) - z s_{\theta} & x z (1-c_{\theta}) + y s_{\theta} \\
    x y (1-c_{\theta}) + z s_{\theta} & y^2 (1-c_{\theta}) + c_{\theta} & y z (1-c_{\theta}) - x s_{\theta} \\
    x z (1-c_{\theta}) - y s_{\theta} & y z (1-c_{\theta}) + x s_{\theta} & z^2 (1-c_{\theta}) + c_{\theta}
  \end{bmatrix} ,
\end{align}</math>
where ''c''<sub>θ</sub>&nbsp;= cos&nbsp;θ, ''s''<sub>θ</sub>&nbsp;= sin&nbsp;θ, is a rotation by angle θ leaving axis '''u''' fixed.
 
A direction in (''n''+1)-dimensional space will be a unit magnitude vector, which we may consider a point on a generalized sphere, ''S''<sup>''n''</sup>. Thus it is natural to describe the rotation group SO(''n''+1) as combining SO(''n'') and ''S''<sup>''n''</sup>. A suitable formalism is the [[fiber bundle]],
:<math> SO(n) \hookrightarrow SO(n+1) \to S^n , \,\!</math>
where for every direction in the "base space", ''S''<sup>''n''</sup>, the "fiber" over it in the "total space", SO(''n''+1), is a copy of the "fiber space", SO(''n''), namely the rotations that keep that direction fixed.
 
Thus we can build an ''n''×''n'' rotation matrix by starting with a 2×2 matrix, aiming its fixed axis on ''S''<sup>2</sup> (the ordinary sphere in three-dimensional space), aiming the resulting rotation on ''S''<sup>3</sup>, and so on up through ''S''<sup>''n''−1</sup>. A point on ''S''<sup>''n''</sup> can be selected using ''n'' numbers, so we again have ''n''(''n''−1)/2 numbers to describe any ''n''×''n'' rotation matrix.
 
In fact, we can view the sequential angle decomposition, discussed previously, as reversing this process. The composition of ''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 ===
{{main|Skew-symmetric matrix}}
When an ''n''×''n'' rotation matrix, ''Q'', does not include −1 as an eigenvalue, so that none of the planar rotations of which it is composed are 180° rotations, then ''Q''+''I'' is an [[invertible matrix]]. Most rotation matrices fit this description, and for them we can show that (''Q''−''I'')(''Q''+''I'')<sup>−1</sup> is a [[skew-symmetric matrix]], ''A''. Thus ''A''<sup>T</sup>&nbsp;= −''A''; and since the diagonal is necessarily zero, and since the upper triangle determines the lower one, ''A'' contains ''n''(''n''−1)/2 independent numbers. Conveniently, ''I''−''A'' is invertible whenever ''A'' is skew-symmetric; thus we can recover the original matrix using the ''[[Cayley transform]]'',
:<math> A \mapsto (I+A)(I-A)^{-1} , \,\!</math>
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 {{Harv|Cayley|1846}}
:<math>\begin{align}
&\begin{bmatrix}0&-z&y\\z&0&-x\\-y&x&0\end{bmatrix} \mapsto {} \\
&\quad \frac{1}{1+x^2+y^2+z^2}
\begin{bmatrix}
1+x^2-y^2-z^2 & 2 x y-2 z & 2 y+2 x z \\
2 x y+2 z & 1-x^2+y^2-z^2 & 2 y z-2 x \\
2 x z-2 y & 2 x+2 y z & 1-x^2-y^2+z^2
\end{bmatrix} .
\end{align}</math>
If we condense the skew entries into a vector, (''x'',''y'',''z''), 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 ''x'' goes to infinity, (''x'',0,0) 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 matrix|shear matrices]] ({{Harvnb|Paeth|1986}}):
 
<math>\begin{align}
R(\theta)
&{}=
  \begin{bmatrix}
    1 & -\tan (\theta/2)\\
    0 & 1
  \end{bmatrix}
  \begin{bmatrix}
    1 & 0\\
    \sin \theta & 1 
  \end{bmatrix}
  \begin{bmatrix}
    1 & -\tan (\theta/2)\\
    0 & 1
  \end{bmatrix}
\end{align}
</math>
 
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.
 
== Group theory ==
 
=== Lie group ===
We have established that ''n''×''n'' rotation matrices form a [[group (mathematics)|group]], the [[special orthogonal group]], SO(''n''). This [[algebraic structure]] is coupled with a [[topological structure]], in that the operations of multiplication and taking the inverse (which here is merely transposition) are continuous functions of the matrix entries. Thus SO(''n'') is a classic example of a [[topological group]]. (In purely topological terms, it is a [[compact manifold]].) Furthermore, the operations are not only continuous, but [[smooth function|smooth]], so SO(''n'') is a [[differentiable manifold]] and a [[Lie group]].<ref>{{Harvtxt|Baker|2003}}; {{Harvtxt|Fulton|Harris|1991}}</ref>
 
Most properties of rotation matrices depend very little on the dimension, ''n''; yet in Lie group theory we see systematic differences between even dimensions and odd dimensions. As well, there are some irregularities below ''n''&nbsp;= 5; for example, SO(4) is, anomalously, not a [[simple Lie group]], but instead [[isomorphic]] to the [[direct product of groups|product]] of ''S''<sup>3</sup> and SO(3).
 
=== Lie algebra ===
Associated with every Lie group is a [[Lie algebra]], a linear space equipped with a bilinear alternating product called a bracket. The algebra for SO(''n'') is denoted by
:<math> \mathfrak{so}(n) , \,\!</math>
and consists of all [[skew-symmetric matrix|skew-symmetric]] ''n''×''n'' matrices (as implied by differentiating the [[orthogonal matrix|orthogonality condition]], {{math|''I'' {{=}} ''Q''<sup>T</sup>''Q''}}). The bracket, {{math|[''A''<sub>1</sub>,''A''<sub>2</sub>]}}, of two skew-symmetric matrices is defined to be {{math|''A''<sub>1</sub>''A''<sub>2</sub>−''A''<sub>2</sub>''A''<sub>1</sub>}}, which is again a skew-symmetric matrix. This Lie algebra bracket captures the essence of the Lie group product via infinitesimals.
 
For 2×2 rotation matrices, the Lie algebra '''so(2)''' is a one-dimensional vector space, mere multiples of
:<math>J = \begin{bmatrix}0&-1\\1&0\end{bmatrix} . </math>
Here the bracket always vanishes, which tells us that, in two dimensions, rotations commute. Not so in any higher dimension.
 
For 3×3 rotation matrices, one has a three-dimensional vector space with the convenient basis
:<math>
A_{\bold{x}} = \begin{bmatrix}0&0&0\\0&0&-1\\0&1&0\end{bmatrix} , \quad
A_{\bold{y}} = \begin{bmatrix}0&0&1\\0&0&0\\-1&0&0\end{bmatrix} , \quad
A_{\bold{z}} = \begin{bmatrix}0&-1&0\\1&0&0\\0&0&0\end{bmatrix} .
</math>
The Lie brackets of these generators are as follows,
:<math>
[A_{\bold{x}}, A_{\bold{y}}] = A_{\bold{z}}, \quad
[A_{\bold{z}}, A_{\bold{x}}] = A_{\bold{y}}, \quad
[A_{\bold{y}}, A_{\bold{z}}] = A_{\bold{x}}.
</math>
 
We can conveniently identify any matrix in this Lie algebra with a vector in '''R'''<sup>3</sup>,
:<math>\begin{align}
\boldsymbol{\omega} &= (x,y,z) \\
\boldsymbol{\tilde{\omega}}  &=\boldsymbol{\omega\cdot A} = x A_{\bold{x}} + y A_{\bold{y}} + z A_{\bold{z}} \\
                            &= \begin{bmatrix}0&-z&y\\z&0&-x\\-y&x&0\end{bmatrix} .
\end{align}</math>
Under this identification, the '''so'''(3) bracket has a memorable description; it is the vector [[cross product]],
:<math> [\tilde{\bold{u}},\tilde{\bold{v}}] = \widetilde{\bold{u}\!\times\!\bold{v} } ~.</math>
 
The matrix identified with a vector '''v''' is also memorable, because
:<math> \tilde{\bold{v}} \bold{u} = \bold{v} \times \bold{u} . \,\!</math>
Notice this implies that '''v''' is in the [[null space]] of the skew-symmetric matrix with which it is identified, because '''v'''×'''v''' is always the zero vector.
 
=== Exponential map ===
Connecting the Lie algebra to the Lie group is the ''[[exponential map]]'', which is defined using the standard [[matrix exponential]]  series for {{math|''e<sup>A''</sup>}},<ref>{{Harv|Wedderburn|1934|loc=§8.02}}</ref>
:<math>\begin{align}
\exp \colon \mathfrak{so}(n) &{}\to SO(n) \\
A &{}\mapsto I + A + \tfrac{1}{2} A^2 + \tfrac{1}{6} A^3 + \cdots + \tfrac{1}{k!} A^k + \cdots \\
  &{}= \sum_{k=0}^{\infty} \frac{1}{k!} A^k.
\end{align}</math>
For any [[skew-symmetric matrix]] {{mvar|A}}, exp({{mvar|A}}) is always a rotation matrix. Note that this exponential  map of skew-symmetric matrices to rotation matrices is quite different from the Cayley transform discussed earlier, differing to 3rd order,
:<math>e^{2A} - \frac{I+A}{I-A}=- \frac{2}{3} A^3 +\mathrm{O}  (A^4)  ~.  </math>
 
An important practical example is the 3×3 case, where we have seen we can identify every skew-symmetric matrix with a vector {{math|'''''ω''''' {{=}} ''θ'' '''''u'''''}}, where {{math|'''''u''''' {{=}} (''x'',''y'',''z'')}} is a unit magnitude vector. Recall that {{math|'''''u'''''}} is in the null space of the matrix associated with '''ω'''; so that, if we use a basis with  {{math|'''u'''}} as the {{mvar|z}} axis, the final column and row will be zero. Thus, we know in advance that the exponential matrix must leave  {{math|'''''u'''''}}  fixed. It is mathematically impossible to supply a straightforward formula for such a basis as a function of {{math|'''''u'''''}} (its existence would violate the [[hairy ball theorem]]); but direct exponentiation is possible, and yields
:<math>\begin{align}
\exp( \tilde{\boldsymbol{\omega}} )
&{}= \exp \left( \begin{bmatrix} 0 & -z \theta & y \theta \\ z \theta & 0&-x \theta \\ -y \theta & x \theta & 0 \end{bmatrix} \right)= \boldsymbol{I} + 2cs~\boldsymbol{\tilde{u}\cdot A} + 2s^2 ~(\boldsymbol{\tilde{u}\cdot A} )^2 =\\
&{}= \begin{bmatrix}
    2 (x^2 - 1) s^2 + 1 & 2 x y s^2 - 2 z c s & 2 x z s^2 + 2 y c s \\
    2 x y s^2 + 2 z c s & 2 (y^2 - 1) s^2 + 1 & 2 y z s^2 - 2 x c s \\
    2 x z s^2 - 2 y c s & 2 y z s^2 + 2 x c s & 2 (z^2 - 1) s^2 + 1
  \end{bmatrix} ,
\end{align}</math>
where ''c''&nbsp;= cos&nbsp;<sup>''θ''</sup>⁄<sub>2</sub>, ''s''&nbsp;= sin&nbsp;<sup>''θ''</sup>⁄<sub>2</sub>. We recognize this as our matrix for a rotation around axis  {{math|'''''u'''''}}  by the angle {{mvar|θ}}.
 
In any dimension, if we choose some nonzero {{mvar|A}} and consider all its scalar multiples, exponentiation yields rotation matrices along a ''[[geodesic]]'' of the group manifold, forming a [[one-parameter subgroup]] of the Lie group. More broadly, the exponential map provides a [[homeomorphism]] between a neighborhood of the origin in the Lie algebra and a neighborhood of the identity in the Lie group. In fact, we can produce any rotation matrix as the exponential of some skew-symmetric matrix, so for these groups the exponential map is a ''[[surjection]]''.
 
=== Campbell–Baker–Hausdorff formula ===
{{main|Baker–Campbell–Hausdorff formula}}
Suppose we are given ''A'' and ''B'' in the Lie algebra. Their exponentials, exp(''A'') and exp(''B''), are rotation matrices, which we can multiply. Since the exponential map is a surjection, we know that, for some ''C'' in the Lie algebra, {{math|exp(''A'')exp(''B'') {{=}} exp(''C'')}}, and so we may write
:<math> A \ast B = C~ . </math>
When exp(''A'') and exp(''B'') commute, then {{math|''C'' {{=}} ''A''+''B''}}, mimicking the behavior of complex exponentiation. However, the general case is given by the more elaborate [[BCH formula]], a series expansion of  nested  brackets.<ref>{{Harvnb|Hall|2004|loc=Ch.&nbsp;3}}; {{Harvnb|Varadarajan|1984|loc=§2.15}}</ref> For matrices, the bracket is the same operation as the [[commutator]], which monitors lack of commutativity in multiplication. This general expansion unfolds  as follows,
:<math> A \ast B = A + B + \tfrac12 [A,B] + \tfrac{1}{12} [A,[A,B]] - \tfrac{1}{12} [B,[A,B]] + \cdots ~.</math>
 
Representation of a rotation matrix as a sequential angle decomposition, as in Euler angles, may tempt one to treat rotations as a vector space, but the higher order terms in the BCH formula deprecate such an  approach for large angles.
 
We again take special interest in the 3×3 case, where {{math|[''A'',''B'']}} equals the cross product, {{math|''A''×''B''}}. If ''A'' and ''B'' are [[linearly independent]], then {{math|''A'', ''B''}}, and {{math|''A''×''B''}} provide a complete  basis; if not, then ''A'' and ''B'' commute. Evidently,  in this dimension, the infinite expansion in the BCH formula for group conposition has a compact form,  as  {{math|''C'' {{=}}  ''αA+βB+γA×B''}} for suitable coefficients.<ref>{{Harv|Engø|2001}}</ref> (See the straightforward  [[Pauli matrices#Exponential of a Pauli vector|2×2 derivation for SU(2)]].)
 
=== Spin group ===
The Lie group of ''n''×''n'' rotation matrices, SO(''n''), is a [[compact space|compact]] and [[connected space|path-connected]] [[manifold]], and thus [[locally compact space|locally compact]] and [[connected space|connected]]. However, it is not [[simply connected space|simply connected]], so Lie theory tells us it is a kind of "shadow" (a homomorphic image) of a [[universal covering group]]. Often the covering group, which in this case is the [[spin group]] denoted by Spin(''n''), is simpler and more natural to work with.<ref>{{Harvnb|Baker|2003|loc=Ch.&nbsp;5}}; {{Harvnb|Fulton|Harris|1991|pp=299–315}}</ref>
 
In the case of planar rotations, SO(2) is topologically a [[sphere|circle]], ''S''<sup>1</sup>. Its universal covering group, Spin(2), is isomorphic to the [[real line]], '''R''', under addition. In other words, whenever we use angles of arbitrary magnitude, which we often do, we are essentially taking advantage of the convenience of the "mother space". Every 2×2 rotation matrix is produced by a countable infinity of angles, separated by integer multiples of 2π. Correspondingly, the [[fundamental group]] of SO(2) is isomorphic to the integers, '''Z'''.
 
In the case of spatial rotations, SO(3) is topologically equivalent to three-dimensional [[real projective space]], '''RP'''<sup>3</sup>. Its universal covering group, Spin(3), is isomorphic to the 3-sphere, ''S''<sup>3</sup>. 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, '''Z'''<sub>2</sub>. We can also describe Spin(3) as isomorphic to [[quaternion]]s of unit norm under multiplication, or to certain 4×4 real matrices, or to 2×2 complex [[special unitary group|special unitary matrices]].
 
Concretely, a unit quaternion, ''q'', with
:<math>\begin{align}
q &{}= w + \bold{i}x + \bold{j}y + \bold{k}z , \\
1 &{}= w^2 + x^2 + y^2 + z^2 ,
\end{align}</math>
produces the rotation matrix
:<math> Q = \begin{bmatrix}
    1 - 2 y^2 - 2 z^2 & 2 x y - 2 z w & 2 x z + 2 y w \\
    2 x y + 2 z w & 1 - 2 x^2 - 2 z^2 & 2 y z - 2 x w \\
    2 x z - 2 y w & 2 y z + 2 x w & 1 - 2 x^2 - 2 y^2
\end{bmatrix} . </math>
This is our third version of this matrix, here as a rotation around the now ''non-unit'' axis vector (''x'',''y'',''z'') by angle 2θ, where cos&nbsp;θ&nbsp;= ''w'' and |sin&nbsp;θ|&nbsp;= ||(''x'',''y'',''z'')||. (The proper sign for sin&nbsp;θ is implied once the signs of the axis components are fixed.)
 
Many features of this case are the same for higher dimensions. The coverings are all two-to-one, with SO(''n''), ''n''&nbsp;&gt;&nbsp;2, having fundamental group '''Z'''<sub>2</sub>. The natural setting for these groups is within a [[Clifford algebra]]. And the action of the rotations is produced by a kind of "sandwich", denoted by ''qvq''<sup>∗</sup>.
 
=== Infinitesimal rotations ===
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
:<math> I + A \, d\theta ~,</math>
where {{math|''dθ''}} is vanishingly small.
 
These matrices do not satisfy all the same properties as ordinary finite rotation matrices under the usual treatment of infinitesimals .<ref>{{Harv|Goldstein|Poole|Safko|2002|loc=§4.8}}</ref> To understand what this means, consider
:<math> dA_{\bold{x}} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & -d\theta \\ 0 & d\theta & 1 \end{bmatrix}~ . </math>
First, test the orthogonality condition, {{math|''Q<sup>T</sup>Q'' {{=}} ''I''}}. The product is
:<math> dA_{\bold{x}}^T \, dA_{\bold{x}} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1+d\theta^2 & 0 \\ 0 & 0 & 1+d\theta^2 \end{bmatrix} , </math>
differing from an identity matrix by second order infinitesimals, discarded here. So, to first order, an infinitesimal rotation matrix is an orthogonal matrix.
 
Next, examine the square of the matrix,
:<math> dA_{\bold{x}}^2 = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1-d\theta^2 & -2d\theta \\ 0 & 2d\theta & 1-d\theta^2 \end{bmatrix}~. </math>
Again discarding second order effects, note that the angle simply doubles. This hints at the most essential difference in behavior, which we can exhibit with the assistance of a second infinitesimal rotation,
:<math> dA_{\bold{y}} = \begin{bmatrix} 1 & 0 & d\phi \\ 0 & 1 & 0 \\ -d\phi & 0 & 1 \end{bmatrix} . </math>
 
Compare the products {{math|''dA''<sub>'''x'''</sub>''dA''<sub>'''y'''</sub>}} to {{math|''dA''<sub>'''y'''</sub>''dA''<sub>'''x'''</sub>}},
:<math>\begin{align}
dA_{\bold{x}}\,dA_{\bold{y}} &{}= \begin{bmatrix} 1 & 0 & d\phi \\ d\theta\,d\phi & 1 & -d\theta \\ -d\phi & d\theta & 1 \end{bmatrix} \\
dA_{\bold{y}}\,dA_{\bold{x}} &{}= \begin{bmatrix} 1 & d\theta\,d\phi & d\phi \\ 0 & 1 & -d\theta \\ -d\phi & d\theta & 1 \end{bmatrix}. \\
\end{align}</math>
Since {{math| ''dθ dφ''}}  is second order, we discard it: thus, to first order, multiplication of infinitesimal rotation matrices is ''commutative''. In fact,
:<math> dA_{\bold{x}}\,dA_{\bold{y}} = dA_{\bold{y}}\,dA_{\bold{x}} , \,\!</math>
again to first order. In other words, '''the order in which infinitesimal rotations are applied is irrelevant'''.
 
This useful fact makes, for example, derivation of rigid body rotation relatively simple.  But we must always be careful to distinguish (the first order treatment of) these infinitesimal rotation matrices from both finite rotation matrices and from derivatives of rotation matrices (namely skew-symmetric matrices). Contrast the behavior of finite rotation matrices in the BCH formula above with that of infinitesimal rotation matrices, where all the commutator terms will be second order infinitesimals so we ''do'' have a bona fide vector space. (Technically, this dismissal of any second order terms amounts to [[Group contraction]].)
 
== Conversions ==
{{merge section to|Rotation formalisms in three dimensions#Conversion formulae between formalisms|date=September 2013}}
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 {{Harv|Stuelpnagel|1964}}.
 
=== Quaternion ===
{{Main|Quaternions and spatial rotation}}
 
Given the unit quaternion ''q'' = (''w'',''x'',''y'',''z''), the equivalent left-handed (Post-Multiplied) 3×3 rotation matrix is
:<math> Q = \begin{bmatrix}
    1 - 2 y^2 - 2 z^2 & 2 x y - 2 z w & 2 x z + 2 y w \\
    2 x y + 2 z w & 1 - 2 x^2 - 2 z^2 & 2 y z - 2 x w \\
    2 x z - 2 y w & 2 y z + 2 x w & 1 - 2 x^2 - 2 y^2
\end{bmatrix} . </math>
Now every [[quaternion]] component appears multiplied by two in a term of degree two, and if all such terms are zero what's left is an identity matrix. This leads to an efficient, robust conversion from any quaternion – whether unit, nonunit, or even zero – to a 3×3 rotation matrix.
 
Nq = w^2 + x^2 + y^2 + z^2
if Nq > 0.0 then s = 2/Nq else s = 0.0
X = x*s; Y = y*s; Z = z*s
wX = w*X; wY = w*Y; wZ = w*Z
xX = x*X; xY = x*Y; xZ = x*Z
yY = y*Y; yZ = y*Z; zZ = z*Z
[ 1.0-(yY+zZ)      xY-wZ        xZ+wY  ]
[      xY+wZ  1.0-(xX+zZ)      yZ-wX  ]
[      xZ-wY        yZ+wX  1.0-(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 ''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 (linear algebra)|trace]]), plus one, equals 4−4(''x''<sup>2</sup>+''y''<sup>2</sup>+''z''<sup>2</sup>), which is 4''w''<sup>2</sup>. Thus we can write the trace itself as 2''w''<sup>2</sup>+2''w''<sup>2</sup>−1; and from the previous version of the matrix we see that the diagonal entries themselves have the same form: 2''x''<sup>2</sup>+2''w''<sup>2</sup>−1, 2''y''<sup>2</sup>+2''w''<sup>2</sup>−1, and 2''z''<sup>2</sup>+2''w''<sup>2</sup>−1. 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 = Q<sub>xx</sub>+Q<sub>yy</sub>+Q<sub>zz</sub> (trace of Q)
r = [[sqrt]](1+t)
w = 0.5*r
x = copysign(0.5*sqrt(1+Q<sub>xx</sub>-Q<sub>yy</sub>-Q<sub>zz</sub>), Q<sub>zy</sub>-Q<sub>yz</sub>)
y = copysign(0.5*sqrt(1-Q<sub>xx</sub>+Q<sub>yy</sub>-Q<sub>zz</sub>), Q<sub>xz</sub>-Q<sub>zx</sub>)
z = copysign(0.5*sqrt(1-Q<sub>xx</sub>-Q<sub>yy</sub>+Q<sub>zz</sub>), Q<sub>yx</sub>-Q<sub>xy</sub>)
where copysign(''x'',''y'') is ''x'' with the sign of ''y'':
:<math>\operatorname{copysign}(x,y) = \operatorname{sign}(y) \; |x|.</math>
Alternatively, use a single square root and division
t = Q<sub>xx</sub>+Q<sub>yy</sub>+Q<sub>zz</sub>
r = sqrt(1+t)
s = 0.5/r
w = 0.5*r
x = (Q<sub>zy</sub>-Q<sub>yz</sub>)*s
y = (Q<sub>xz</sub>-Q<sub>zx</sub>)*s
z = (Q<sub>yx</sub>-Q<sub>xy</sub>)*s
This is numerically stable so long as the trace, <tt>t</tt>, is not negative; otherwise, we risk dividing by (nearly) zero. In that case, suppose <tt>Q<sub>xx</sub></tt> is the largest diagonal entry, so ''x'' will have the largest magnitude (the other cases are similar); then the following is safe.
t = Q<sub>xx</sub>+Q<sub>yy</sub>+Q<sub>zz</sub>
r = sqrt(1+Q<sub>xx</sub>-Q<sub>yy</sub>-Q<sub>zz</sub>)
s = 0.5/r
w = (Q<sub>zy</sub>-Q<sub>yz</sub>)*s
x = 0.5*r
y = (Q<sub>xy</sub>+Q<sub>yx</sub>)*s
z = (Q<sub>zx</sub>+Q<sub>xz</sub>)*s
If the matrix contains significant error, such as accumulated numerical error, we may construct a symmetric 4×4 matrix,
:<math> K = \frac13
\begin{bmatrix}
  Q_{xx}-Q_{yy}-Q_{zz} & Q_{yx}+Q_{xy} & Q_{zx}+Q_{xz} & Q_{yz}-Q_{zy} \\
  Q_{yx}+Q_{xy} & Q_{yy}-Q_{xx}-Q_{zz} & Q_{zy}+Q_{yz} & Q_{zx}-Q_{xz} \\
  Q_{zx}+Q_{xz} & Q_{zy}+Q_{yz} & Q_{zz}-Q_{xx}-Q_{yy} & Q_{xy}-Q_{yx} \\
  Q_{yz}-Q_{zy} & Q_{zx}-Q_{xz} & Q_{xy}-Q_{yx} & Q_{xx}+Q_{yy}+Q_{zz}
\end{bmatrix} ,
</math>
and find the [[eigenvector]], (''w'',''x'',''y'',''z''), 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 {{Dubious|date=December 2009}} {{Harv|Bar-Itzhack|2000}}.
 
=== Polar decomposition ===
If the ''n''×''n'' matrix ''M'' is non-singular, 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]] ({{Harvnb|Fan|Hoffman|1955}}; {{Harvnb|Higham|1989}}).
 
To measure closeness, we may use any [[matrix norm]] invariant under orthogonal transformations. A convenient choice is the [[Frobenius norm]], ||''Q''−''M''||<sub>F</sub>, squared, which is the sum of the squares of the element differences. Writing this in terms of the [[trace (linear algebra)|trace]], Tr, our goal is,
* Find ''Q'' minimizing Tr( (''Q''−''M'')<sup>T</sup>(''Q''−''M'') ), subject to ''Q''<sup>T</sup>''Q''&nbsp;= ''I''.
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 Tr( (''Q''−''M'')<sup>T</sup>(''Q''−''M'') + (''Q''<sup>T</sup>''Q''−''I'')''Y'' ) with respect to (the entries of) ''Q'', and equate to zero.
<div style="float:right;font-size:80%;border:1px solid black;padding:1em">
Consider a 2×2 example. Including constraints, we seek to minimize
:<math>\begin{align}
&\scriptstyle{ (Q_{xx}-M_{xx})^2 + (Q_{xy}-M_{xy})^2 } \\
&\scriptstyle{ {} + (Q_{yx}-M_{yx})^2 + (Q_{yy}-M_{yy})^2 } \\
&\scriptstyle{ {} + (Q_{xx}^2+Q_{yx}^2-1)Y_{xx} + (Q_{xy}^2+Q_{yy}^2-1)Y_{yy} } \\
&\scriptstyle{ {} + 2(Q_{xx} Q_{xy} + Q_{yx} Q_{yy})Y_{xy} . }
\end{align}</math>
Taking the derivative with respect to ''Q''<sub>xx</sub>, ''Q''<sub>xy</sub>, ''Q''<sub>yx</sub>, ''Q''<sub>yy</sub> in turn, we assemble a matrix.
:<math>\scriptstyle{ 2
\begin{bmatrix}
\scriptstyle{ Q_{xx}-M_{xx} + Q_{xx} Y_{xx} + Q_{xy} Y_{xy} } & \scriptstyle{ Q_{xy}-M_{xy} + Q_{xx} Y_{xy} + Q_{xy} Y_{yy} } \\
\scriptstyle{ Q_{yx}-M_{yx} + Q_{yx} Y_{xx} + Q_{yy} Y_{xy} } & \scriptstyle{ Q_{yy}-M_{yy} + Q_{yx} Y_{xy} + Q_{yy} Y_{yy} }
\end{bmatrix}}</math>
</div>
In general, we obtain the equation
:<math> 0 = 2(Q-M) + 2QY , \,\!</math>
so that
:<math> M = Q(I+Y) = QS , \,\!</math>
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 ''S''<sup>2</sup>&nbsp;= ''M''<sup>T</sup>''M''.
:<math> S^2 = (Q^T M)^T (Q^T M) = M^T Q Q^ T M = M^T M \,\!</math>
When ''M'' is [[non-singular matrix|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 ===
{{Main|Axis-angle representation}}
To efficiently construct a rotation matrix Q from an angle θ and a unit axis '''u''', 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
 
:<math>\begin{align}
c &=& \cos \theta\\
s &=& \sin \theta\\
C &=& 1-c\end{align}
</math>
 
then
 
:<math>Q(\theta) = \begin{bmatrix}
xxC+c  & xyC-zs & xzC+ys\\
yxC+zs & yyC+c  & yzC-xs\\
zxC-ys & zyC+xs & zzC+c
\end{bmatrix}</math>
 
Determining an axis and angle, like determining a quaternion, is only possible up to sign; that is, ('''u''',θ) and (−'''u''',−θ) correspond to the same rotation matrix, just like ''q'' and −''q''. As well, 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 [[Atan2|two-argument arctangent]] with <tt>[[atan2]](sin&nbsp;θ,cos&nbsp;θ)</tt> equal to θ avoids the insensitivity of arccosine; and in computing the axis magnitude in order to force unit magnitude, a brute-force approach can lose accuracy through underflow {{Harv|Moler|Morrison|1983}}.
 
A partial approach is as follows:
 
:<math>\begin{align}
x &=& Q_{zy} - Q_{yz}\\
y &=& Q_{xz} - Q_{zx}\\
z &=& Q_{yx} - Q_{xy}\\
r &=& \sqrt{x^2 + y^2 + z^2}\\
t &=& Q_{xx} + Q_{yy} + Q_{zz}\\
\theta &=& \mbox{atan2}(r,t-1)\end{align}</math>
 
The ''x'', ''y'', and ''z'' components of the axis would then be divided by ''r''. A fully robust approach will use different code when ''t'', the [[Trace (mathematics)|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 θ<sub>1</sub>, θ<sub>2</sub>, θ<sub>3</sub>; physics and chemistry may interpret these as
<!--
Don't even THINK of "fixing" this; it is NOT a typo. Read the @#*%! article; "zyz" is correct.
-->
:<math> Q(\theta_1,\theta_2,\theta_3)=  Q_{\bold{x}}(\theta_1) Q_{\bold{y}}(\theta_2) Q_{\bold{z}}(\theta_3) , \,\!</math>
<!--                                            ^ --- That's right, this is MEANT to be a "z", not an "x". -->
while aircraft dynamics may use
:<math> Q(\theta_1,\theta_2,\theta_3)=  Q_{\bold{z}}(\theta_3) Q_{\bold{y}}(\theta_2) Q_{\bold{x}}(\theta_1) . \,\!</math>
One systematic approach begins with choosing the right-most axis. Among all [[permutation]]s of (''x'',''y'',''z''), 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&nbsp;= 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 '''zyz''' convention above; then we have the following equivalent pairs:
:{| style="text-align:right"
| (90°,||45°,||−105°) || ≡ || (−270°,||−315°,||255°) || &emsp; ''multiples of 360°''
|-
| (72°,||0°,||0°) || ≡ || (40°,||0°,||32°) || &emsp; ''singular alignment''
|-
| (45°,||60°,||−30°) || ≡ || (−135°,||−60°,||150°) || &emsp; ''bistable flip''
|}
Angles for any order can be found using a concise common routine ({{Harvnb|Herter|Lott|1993}}; {{Harvnb|Shoemake|1994}}).
 
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 'right'-vector, 'up'-vector and 'out'-vector) instead of as angles. The singularities are also avoided when working with quaternions.
 
== 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 <sup>1</sup>⁄<sub>π</sub>(θ&nbsp;−&nbsp;sin&nbsp;θ), for 0&nbsp;≤&nbsp;θ&nbsp;≤&nbsp;π.
 
Since SO(''n'') 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]]''. {{Harvtxt|León|Massé|Rivest|2006}} 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 {{Harvtxt|Diaconis|Shashahani|1987}}. This recursively exploits the nested dimensions group structure of SO(''n''), as follows. Generate a uniform angle and construct a 2×2 rotation matrix. To step from ''n'' to ''n''+1, generate a vector '''v''' uniformly distributed on the ''n-''sphere, ''S''<sup>''n''</sup>, embed the ''n''×''n'' matrix in the next larger size with last column (0,…,0,1), and rotate the larger matrix so the last column becomes '''v'''.
 
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. {{Harvtxt|Arvo|1992}} 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 ''S''<sup>3</sup>.
 
Euler angles can also be used, though not with each angle uniformly distributed ({{Harvnb|Murnaghan|1962}}; {{Harvnb|Miles|1965}}).
 
For the axis-angle form, the axis is uniformly distributed over the unit sphere of directions, ''S''<sup>2</sup>, while the angle has the non-uniform distribution over [0,π] noted previously {{Harv|Miles|1965}}.
 
==See also==
* [[Isometry]]
* [[Kabsch algorithm]]
* [[Orthogonal matrix]]
* [[Plane of rotation]]
* [[Rodrigues' rotation formula]]
* [[Rotation formalisms in three dimensions]]
* [[Rotation operator (vector space)]]
* [[Transformation matrix]]
* [[Yaw, pitch and roll|Yaw-pitch-roll system]]
 
== Notes ==
{{reflist}}
 
== References ==
* {{Citation
| last=Arvo
| first=James
| year=1992
| contribution=Fast random rotation matrices
| title=Graphics Gems III
| editor=David Kirk
| publisher=[[Academic Press]] Professional
| place=San Diego
| pages=117–120
| isbn=978-0-12-409671-4
| url=http://www.graphicsgems.org/
}}
* {{Citation
| last=Baker
| first=Andrew
| title=Matrix Groups: An Introduction to Lie Group Theory
| year=2003
| publisher=[[Springer-Verlag|Springer]]
| isbn=978-1-85233-470-3
}}
* {{Citation
| last=Bar-Itzhack
| first=Itzhack Y.
| author-link=
|date=Nov–Dec 2000
| title=New method for extracting the quaternion from a rotation matrix
| journal=AIAA Journal of Guidance, Control and Dynamics
| volume=23
| issue=6
| pages=1085–1087
| issn=0731-5090
| doi=10.2514/2.4654
}}
* {{Citation
| last1=Björck
| first1=Åke
| author1-link=
| last2=Bowie
| first2=Clazett
| author2-link=
|date=June 1971
| title=An iterative algorithm for computing the best estimate of an orthogonal matrix
| journal=[[Society for Industrial and Applied Mathematics|SIAM]] Journal on Numerical Analysis
| volume=8
| issue=2
| pages=358–364
| issn=0036-1429
| doi=10.1137/0708036
}}
* {{Citation
| last=Cayley
| first=Arthur
| author-link=Arthur Cayley
| year=1846
| title=Sur quelques propriétés des déterminants gauches
| journal=[[Journal für die reine und angewandte Mathematik]]
| volume=32
| pages=119–123
| issn=0075-4102
}}; reprinted as article 52 in {{Citation
| last=Cayley
| first=Arthur
| author-link=Arthur Cayley
| year=1889
| title=The collected mathematical papers of Arthur Cayley
| publisher=[[Cambridge University Press]]
| volume=I (1841–1853)
| pages=332–336
| isbn=<!-- none given -->
| url=http://www.hti.umich.edu/cgi/t/text/pageviewer-idx?c=umhistmath;cc=umhistmath;rgn=full%20text;idno=ABS3153.0001.001;didno=ABS3153.0001.001;view=image;seq=00000349
}}
* {{Citation
| last1=Diaconis
| first1=Persi
| author1-link=Persi Diaconis
| last2=Shahshahani
| first2=Mehrdad
| title=The subgroup algorithm for generating uniform random variables
| journal=Probability in the Engineering and Informational Sciences
| volume=1
| pages=15–32
| year=1987
| issn=0269-9648
| doi=10.1017/S0269964800000255
}}
* {{Citation
| last=Engø
| first=Kenth
| author-link=
|date=June 2001
| title=On the BCH-formula in '''so'''(3)
| journal=BIT Numerical Mathematics
| volume=41
| pages=629–632
| issn=0006-3835
| doi=10.1023/A:1021979515229
| url=http://www.ii.uib.no/publikasjoner/texrap/abstract/2000-201.html
| issue=3
}}
* {{Citation
| last1=Fan
| first1=Ky
| author1-link=
| last2=Hoffman
| first2=Alan J.
| author2-link=
|date=February 1955
| title=Some metric inequalities in the space of matrices
| journal=[[Proceedings of the American Mathematical Society|Proc. AMS]]
| volume=6
| issue=1
| pages=111–116
| issn=0002-9939
| doi=10.2307/2032662
| publisher=Proceedings of the American Mathematical Society, Vol. 6, No. 1
| jstor=2032662
}}
* {{Citation
| last1=Fulton
| first1=William
| author1-link=William Fulton (mathematician)
| last2=Harris
| first2=Joe
| author2-link=Joe Harris (mathematician)
| year=1991
| title=Representation Theory: A First Course  <!--
| chapter=Spin Representations of '''so'''<sub>''m''</sub>&nbsp;'''C'''
| pages=299–315
-->
| publisher=[[Springer-Verlag|Springer]]
| place=New York, Berlin, Heidelberg
| isbn=978-0-387-97495-8
| series=[[Graduate Texts in Mathematics|GTM]]
| volume=129
| mr=1153249
}}
* {{Citation
| last1=Goldstein
| first1=Herbert
| author1-link=Herbert Goldstein
| last2=Poole
| first2=Charles P.
| author2-link=
| last3=Safko
| first3=John L.
| author3-link=
| year=2002<!-- January 15 -->
| title=Classical Mechanics
| edition=third
| publisher=[[Addison Wesley]]
| isbn=978-0-201-65702-9
}}
* {{Citation
| last=Hall
| first=Brian C.
| title=Lie Groups, Lie Algebras, and Representations: An Elementary Introduction
| year=2004
| publisher=[[Springer-Verlag|Springer]]
| isbn=978-0-387-40122-5
}} ([[Graduate Texts in Mathematics|GTM]] 222)
* {{Citation
| last1=Herter
| first1=Thomas
| author1-link=
| last2=Lott
| first2=Klaus
| author2-link=
|date=September–October 1993
| title=Algorithms for decomposing 3-D orthogonal matrices into primitive rotations
| journal=Computers &amp; Graphics
| volume=17
| pages=517–527
| issn=0097-8493
| doi=10.1016/0097-8493(93)90003-R
| issue=5
}}
* {{Citation
| last=Higham
| first=Nicholas J.
| author-link=
| date=October 1, 1989
| contribution=Matrix nearness problems and applications
| title=Applications of Matrix Theory
| editor1-last=Gover
| editor1-first=Michael J. C.
| editor2-last=Barnett
| editor2-first=Stephen
| pages=1–27
| publisher=[[Oxford University Press]]
| isbn=978-0-19-853625-3
| url=http://scholar.google.co.uk/scholar?hl=en&lr=&q=author%3AHigham+intitle%3AApplications+of+Matrix+Theory&as_publication=&as_ylo=1989&as_yhi=1989&btnG=Search
}}
* {{Citation
| last1=León
| first1=Carlos A.
| author1-link=
| last2=Massé
| first2=Jean-Claude
| author2-link=
| last3=Rivest
| first3=Louis-Paul
| author3-link=
|date=February 2006
| title=A statistical model for random rotations
| journal=Journal of Multivariate Analysis
| volume=97
| pages=412–430
| issn=0047-259X
| doi=10.1016/j.jmva.2005.03.009
| url=http://www.mat.ulaval.ca/pages/lpr/
| issue=2
}}
* {{Citation
| last=Miles
| first=Roger E.
| author-link=
|date=December 1965
| title=On random rotations in ''R''<sup>3</sup>
| journal=[[Biometrika]]
| volume=52
| pages=636–639
| issn=0006-3444
| doi=10.2307/2333716
| issue=3/4
| publisher=Biometrika, Vol. 52, No. 3/4
| jstor=2333716
}}
* {{Citation
| last1=Moler
| first1=Cleve
| author1-link=Cleve Moler
| last2=Morrison
| first2=Donald
| title=Replacing square roots by pythagorean sums
| journal=IBM Journal of Research and Development
| volume=27
| pages=577–581
| year=1983<!--
| month=November-->
| url=http://domino.watson.ibm.com/tchjr/journalindex.nsf/0b9bc46ed06cbac1852565e6006fe1a0/0043d03ee1c1013c85256bfa0067f5a6?OpenDocument
| issn=0018-8646
| issue=6
| doi=10.1147/rd.276.0577
}}
* {{Citation
| last=Murnaghan
| first=Francis D.
| author-link=Francis Dominic Murnaghan (mathematician)
| year=1950<!-- November 15 -->
| title=The element of volume of the rotation group
| journal=[[Proceedings of the National Academy of Sciences]]
| volume=36
| issue=11
| pages=670–672
| url=http://www.pnas.org/content/vol36/issue11/
| issn=0027-8424
| doi=10.1073/pnas.36.11.670
}}
* {{Citation
| last=Murnaghan
| first=Francis D.
| author-link=Francis Dominic Murnaghan (mathematician)
| year=1962
| title=The Unitary and Rotation Groups
| series=Lectures on applied mathematics
| publisher=Spartan Books
| place=Washington
| isbn=<!-- none -->
}}
*{{Citation
| last=Cayley
| first=Arthur
| author-link=Arthur Cayley
| year=1889
| title=The collected mathematical papers of Arthur Cayley
| publisher=[[Cambridge University Press]]
| volume=I (1841–1853)
| pages=332–336
| isbn=<!-- none given -->
| url=http://www.hti.umich.edu/cgi/t/text/pageviewer-idx?c=umhistmath;cc=umhistmath;rgn=full%20text;idno=ABS3153.0001.001;didno=ABS3153.0001.001;view=image;seq=00000349
}}
*{{Citation
| last=Paeth
| first=Alan W.
| author-link=
| year=1986
| title=A Fast Algorithm for General Raster Rotation
| journal=Proceedings, Graphics Interface '86
| pages=77–81
| url=http://www.cipprs.org/papers/VI/VI1986/pp077-081-Paeth-1986.pdf
}}
* {{Citation
| last=Pique
| first=Michael E.
| author-link=
| year=1990
| contribution=Rotation Tools
| title=Graphics Gems
| editor=Andrew S. Glassner
| publisher=[[Academic Press]] Professional
| place=San Diego
| pages=465–469
| isbn=978-0-12-286166-6
| url=http://www.graphicsgems.org/
}}
*{{Citation
|last1=Press |first1=William H.
|last2=Teukolsky |first2=Saul A.
|last3=Vetterling |first3=William T.
|last4=Flannery |first4=Brian P.
|year=2007 |title=Numerical Recipes: The Art of Scientific Computing |edition=3rd |publisher=Cambridge University Press |publication-place=New York |isbn=978-0-521-88068-8 |chapter=Section 21.5.2. Picking a Random Rotation Matrix |chapter-url=http://apps.nrbook.com/empanel/index.html#pg=1130 }}
 
* {{Citation
| last=Shepperd
| first=Stanley W.
| author-link=
|date=May–June 1978
| title=Quaternion from rotation matrix
| journal=AIAA Journal of Guidance, Control and Dynamics
| volume=1
| issue=3
| pages=223–224
| issn=0731-5090
}}
* {{Citation
| last=Shoemake
| first=Ken
| author-link=
| year=1994
| contribution=Euler angle conversion
| title=Graphics Gems IV
| editor=Paul Heckbert
| publisher=[[Academic Press]] Professional
| place=San Diego
| pages=222–229
| isbn=978-0-12-336155-4
| url=http://www.graphicsgems.org/
}}
* {{Citation
| last=Stuelpnagel
| first=John
| author-link=
|date=October 1964
| title=On the parameterization of the three-dimensional rotation group
| journal=SIAM Review
| volume=6
| pages=422–430
| issn=0036-1445
| doi=10.1137/1006093
| issue=4
}} (Also [http://ntrs.nasa.gov/search.jsp NASA-CR-53568].)
* {{Citation
| last=Varadarajan
| first=Veeravalli S.
| title=Lie Groups, Lie Algebras, and Their Representation
| year=1984
| publisher=[[Springer-Verlag|Springer]]
| isbn=978-0-387-90969-1
}} ([[Graduate Texts in Mathematics|GTM]] 102)
* {{Citation
| last=Wedderburn
| first=Joseph H. M.
| author-link=Joseph Wedderburn
| year=1934
| title=Lectures on Matrices
| publisher=[[American Mathematical Society|AMS]]
| isbn=978-0-8218-3204-2
| url=http://scholar.google.co.uk/scholar?hl=en&lr=&q=author%3AWedderburn+intitle%3ALectures+on+Matrices&as_publication=&as_ylo=1934&as_yhi=1934&btnG=Search
}}
 
==External links==
* {{springer|title=Rotation|id=p/r082620}}
* [http://mathworld.wolfram.com/RotationMatrix.html Rotation matrices at Mathworld]
* [http://www.mathaware.org/mam/00/master/dimension/demos/plane-rotate.html Math Awareness Month 2000 interactive demo] (requires [[Java (programming language)|Java]])
* [http://www.mathpages.com/home/kmath593/kmath593.htm Rotation Matrices] at MathPages
* {{it}} [http://ansi.altervista.org A parametrization of SOn(R) by generalized Euler Angles]
* [http://www.euclideanspace.com/maths/geometry/affine/aroundPoint/ Rotation about any point]
 
[[Category:Transformation (function)]]
[[Category:Matrices]]

Revision as of 03:48, 3 March 2014

You probably have your desired number most typically associated with gems, you can get yourself prepared intelligently to defend myself against any floor you like. Wishes exciting since it aids you enjoy like a veteran and you can malfunction just about anyone should playing skills are robust.

Trying the higher level: what is important when it comes in order to some game, but when you are looking for Clash of Clans, you will have a lot more subtle techniques. Despite making use of clash of clans hack tools, you may also acquire experience points through the process of matching on top off other players. Most important purpose of earning Player vs player is to enable some other enhancements for your indigneous group. The augmentation consists of better the battle equipment, properties, troops with tribe people.

Throne Rush has an related for just about everything in Clash. Instead within your Town Hall, it incorporates a Castle. Instead connected Clans, it has Brotherhoods. Instead of Trophies, it has Morale. Perhaps the one element it takes to the next level is its Immortal Celebrities. clash of clans has a Barbarian King and your Archer Queen which are typical special units that can be reused in battle in they just require work hours of time to alleviate back to full healthy. Throne Rush has similar heroes that could be hired, but they will extreme and more many. They play almost the same way, on the other hand think players will enjoy using four or top 5 Immortal Heroes instead of just two, as long as they dont throw off the balance of the sport too severely.

It's got possible, but the volume of absence one visit would abatement by sixty one. 5% from 260 treasures to hundred or so gems. Or, whether you capital to erect up the 1 time bulk at 260 gems, the band would grab to acceleration added steeply and also 1 wedding anniversary would turn into added expensive.

View your child's xbox online enjoying. Video gaming are now rated just like films and which can help. For those who have any questions about exactly where in addition to how to utilize clash of clans hack android download, you are able to email us with the web-site. This kind enables you to maintain your an eye on unquestionably the information your kids are exposed to. Dependant upon your child's age, continue to keep the boy clear of video games that happen to you should be meant for people who are more fully accumulated than him.

A person's war abject is agnate in your approved village, except that your gua abject will not manage resources. Barrio when your warfare abject will not be anon improved or rearranged, as it by it's self mimics this adjustment and in addition accomplished completed advancement programs of your apple throughout the time of alertness day. World war bases additionally never offense to take their of add-ons rearmed, defenses reloaded perhaps characters healed, as some people are consistently ready. The association alcazar around the your war abject service charge be abounding alone after the one in your whole village.

Basically, it would alone acquiesce all of us to tune 2 volume points. If you appetite for you to instruments added than in just what - as Supercell extremely acquainted t had actually been all-important - you claims assorted beeline segments. Theoretically they could maintain a record of alike added bulk gadgets. If they capital to help allegation offered or beneath for a 2 day skip, they may possibly calmly familiarize 1 appended segment.