Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Rotation matrix
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Decompositions == === Independent planes === Consider the {{nowrap|3 × 3}} rotation matrix :<math> Q = \begin{bmatrix} 0.36 & 0.48 & -0.80 \\ -0.80 & 0.60 & 0.00 \\ 0.48 & 0.64 & 0.60 \end{bmatrix} . </math> If {{math|''Q''}} acts in a certain direction, {{math|'''v'''}}, purely as a scaling by a factor {{mvar|λ}}, then we have :<math> Q \mathbf{v} = \lambda \mathbf{v}, </math> so that :<math> \mathbf{0} = (\lambda I - Q) \mathbf{v} . </math> Thus {{mvar|λ}} is a root of the [[characteristic polynomial]] for {{mvar|Q}}, :<math>\begin{align} 0 &{}= \det (\lambda I - Q) \\ &{}= \lambda^3 - \tfrac{39}{25} \lambda^2 + \tfrac{39}{25} \lambda - 1 \\ &{}= (\lambda-1) \left(\lambda^2 - \tfrac{14}{25} \lambda + 1\right). \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 {{math|2 cos ''θ''}} (the negated linear term). This factorization is of interest for {{nowrap|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 {{math|''n'' × ''n''}} rotation matrix. If the dimension, {{mvar|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 {{mvar|n}} and thus {{mvar|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 {{math|{{sfrac|''n''|2}}}} 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 {{nowrap|2 × 2}} and {{nowrap|3 × 3}} rotation matrices that the trace reveals the [[angle of rotation]], {{mvar|θ}}, in the two-dimensional space (or subspace). For a {{nowrap|2 × 2}} matrix the trace is {{math|2 cos ''θ''}}, and for a {{nowrap|3 × 3}} matrix it is {{math|1 + 2 cos ''θ''}}. In the three-dimensional case, the subspace consists of all vectors perpendicular to the rotation axis (the invariant direction, with eigenvalue 1). Thus we can extract from any {{nowrap|3 × 3}} rotation matrix a rotation axis and an angle, and these completely determine the rotation. === Sequential angles === The constraints on a {{nowrap|2 × 2}} rotation matrix imply that it must have the form :<math>Q = \begin{bmatrix} a & -b \\ b & a \end{bmatrix}</math> with {{math|''a''<sup>2</sup> + ''b''<sup>2</sup> {{=}} 1}}. Therefore, we may set {{math|''a'' {{=}} cos ''θ''}} and {{math|''b'' {{=}} sin ''θ''}}, for some angle {{mvar|θ}}. To solve for {{mvar|θ}} it is not enough to look at {{mvar|a}} alone or {{mvar|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 {{nowrap|3 × 3}} rotation matrix, :<math>\begin{bmatrix}a\\b\\c\end{bmatrix} . </math> Although {{math|''a''<sup>2</sup> + ''b''<sup>2</sup>}} will probably not equal 1, but some value {{math|''r''<sup>2</sup> < 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 {{mvar|b}}. This acts on the subspace spanned by the {{mvar|x}}- and {{mvar|y}}-axes. We can then repeat the process for the {{mvar|xz}}-subspace to zero {{mvar|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 {{mvar|yz}}-subspace can now zero the {{mvar|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 {{mvar|Q}} as :<math>Q = Q_{xy}^{-1}Q_{xz}^{-1}Q_{yz}^{-1} . </math> An {{math|''n'' × ''n''}} rotation matrix will have {{math|(''n'' − 1) + (''n'' − 2) + ⋯ + 2 + 1}}, or :<math>\sum_{k=1}^{n-1} k = \frac{1}{2}n(n - 1) </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 {{math|''n'' × ''n''}} rotation matrices, each of which has {{math|''n''<sup>2</sup>}} entries, can be parameterized by {{math|{{sfrac|1|2}}''n''(''n'' − 1)}} angles. {| border="1" cellspacing="0" cellpadding="4" style="float:right; margin-left:1em" |- | {{math|''xzx''<sub>w</sub>}} || {{math|''xzy''<sub>w</sub>}} || {{math|''xyx''<sub>w</sub>}} || {{math|''xyz''<sub>w</sub>}} |- | {{math|''yxy''<sub>w</sub>}} || {{math|''yxz''<sub>w</sub>}} || {{math|''yzy''<sub>w</sub>}} || {{math|''yzx''<sub>w</sub>}} |- | {{math|''zyz''<sub>w</sub>}} || {{math|''zyx''<sub>w</sub>}} || {{math|''zxz''<sub>w</sub>}} || {{math|''zxy''<sub>w</sub>}} |- | {{math|''xzx''<sub>b</sub>}} || {{math|''yzx''<sub>b</sub>}} || {{math|''xyx''<sub>b</sub>}} || {{math|''zyx''<sub>b</sub>}} |- | {{math|''yxy''<sub>b</sub>}} || {{math|''zxy''<sub>b</sub>}} || {{math|''yzy''<sub>b</sub>}} || {{math|''xzy''<sub>b</sub>}} |- | {{math|''zyz''<sub>b</sub>}} || {{math|''xyz''<sub>b</sub>}} || {{math|''zxz''<sub>b</sub>}} || {{math|''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 (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 triplet of numbers. === Nested dimensions === A {{nowrap|3 × 3}} rotation matrix such as :<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 {{nowrap|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} & \mathbf{0} \\ \mathbf{0}^\mathsf{T} & 1 \end{matrix} \right].</math> This is no illusion; not just one, but many, copies of {{mvar|n}}-dimensional rotations are found within {{math|(''n'' + 1)}}-dimensional rotations, as [[subgroup]]s. Each embedding leaves one direction fixed, which in the case of {{nowrap|3 × 3}} matrices is the rotation axis. For example, we have :<math>\begin{align} Q_{\mathbf{x}}(\theta) &= \begin{bmatrix} {\color{CadetBlue}1} & {\color{CadetBlue}0} & {\color{CadetBlue}0} \\ {\color{CadetBlue}0} & \cos \theta & -\sin \theta \\ {\color{CadetBlue}0} & \sin \theta & \cos \theta \end{bmatrix}, \\[8px] Q_{\mathbf{y}}(\theta) &= \begin{bmatrix} \cos \theta & {\color{CadetBlue}0} & \sin \theta \\ {\color{CadetBlue}0} & {\color{CadetBlue}1} & {\color{CadetBlue}0} \\ -\sin \theta & {\color{CadetBlue}0} & \cos \theta \end{bmatrix}, \\[8px] Q_{\mathbf{z}}(\theta) &= \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}, \end{align}</math> fixing the {{mvar|x}}-axis, the {{mvar|y}}-axis, and the {{mvar|z}}-axis, respectively. The rotation axis need not be a coordinate axis; if {{math|'''u''' {{=}} (''x'',''y'',''z'')}} is a unit vector in the desired direction, then :<math>\begin{align} Q_\mathbf{u}(\theta) &= \begin{bmatrix} 0 & -z & y \\ z & 0 & -x \\ -y & x & 0 \end{bmatrix} \sin\theta + \left(I - \mathbf{u}\mathbf{u}^\mathsf{T}\right) \cos\theta + \mathbf{u}\mathbf{u}^\mathsf{T} \\[8px] &= \begin{bmatrix} \left(1 - x^2\right) 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 & \left(1 - y^2\right) 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 & \left(1 - z^2\right) c_\theta + z^2 \end{bmatrix} \\[8px] &= \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 {{math|''c<sub>θ</sub>'' {{=}} cos ''θ''}}, {{math|''s<sub>θ</sub>'' {{=}} sin ''θ''}}, is a rotation by angle {{mvar|θ}} leaving axis {{math|'''u'''}} fixed. A direction in {{math|(''n'' + 1)}}-dimensional space will be a unit magnitude vector, which we may consider a point on a generalized sphere, {{math|''S''<sup>''n''</sup>}}. Thus it is natural to describe the rotation group {{math|SO(''n'' + 1)}} as combining {{math|SO(''n'')}} and {{math|''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, {{math|''S''<sup>''n''</sup>}}, the fiber over it in the total space, {{math|SO(''n'' + 1)}}, is a copy of the fiber space, {{math|SO(''n'')}}, namely the rotations that keep that direction fixed. Thus we can build an {{math|''n'' × ''n''}} rotation matrix by starting with a {{nowrap|2 × 2}} matrix, aiming its fixed axis on {{math|''S''<sup>2</sup>}} (the ordinary sphere in three-dimensional space), aiming the resulting rotation on {{math|''S''<sup>3</sup>}}, and so on up through {{math|''S''<sup>''n''−1</sup>}}. A point on {{math|''S''<sup>''n''</sup>}} can be selected using {{mvar|n}} numbers, so we again have {{math|{{sfrac|1|2}}''n''(''n'' − 1)}} numbers to describe any {{math|''n'' × ''n''}} rotation matrix. In fact, we can view the sequential angle decomposition, discussed previously, as reversing this process. The composition of {{math|''n'' − 1}} Givens rotations brings the first column (and row) to {{nowrap|(1, 0, ..., 0)}}, so that the remainder of the matrix is a rotation matrix of dimension one less, embedded so as to leave {{nowrap|(1, 0, ..., 0)}} fixed. === Skew parameters via Cayley's formula === {{main|Cayley transform|Skew-symmetric matrix}} When an {{math|''n'' × ''n''}} rotation matrix {{mvar|Q}}, does not include a −1 eigenvalue, thus none of the planar rotations which it comprises are 180° rotations, then {{math|''Q'' + ''I''}} is an [[invertible matrix]]. Most rotation matrices fit this description, and for them it can be shown that {{math|(''Q'' − ''I'')(''Q'' + ''I'')<sup>−1</sup>}} is a [[skew-symmetric matrix]], {{mvar|A}}. Thus {{math|''A''<sup>T</sup> {{=}} −''A''}}; and since the diagonal is necessarily zero, and since the upper triangle determines the lower one, {{mvar|A}} contains {{math|{{sfrac|1|2}}''n''(''n'' − 1)}} independent numbers. Conveniently, {{math|''I'' − ''A''}} is invertible whenever {{mvar|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 {{mvar|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 \\[3pt] \quad \frac{1}{1 + x^2 + y^2 + z^2} &\begin{bmatrix} 1 + x^2 - y^2 - z^2 & 2xy - 2z & 2y + 2xz \\ 2xy + 2z & 1 - x^2 + y^2 - z^2 & 2yz - 2x \\ 2xz - 2y & 2x + 2yz & 1 - x^2 - y^2 + z^2 \end{bmatrix} . \end{align}</math> If we condense the skew entries into a vector, {{math|(''x'',''y'',''z'')}}, then we produce a 90° rotation around the {{mvar|x}}-axis for (1, 0, 0), around the {{mvar|y}}-axis for (0, 1, 0), and around the {{mvar|z}}-axis for (0, 0, 1). The 180° rotations are just out of reach; for, in the limit as {{math|''x'' → ∞}}, {{math|(''x'', 0, 0)}} does approach a 180° rotation around the {{mvar|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 \frac{\theta}{2}\\ 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0\\ \sin \theta & 1 \end{bmatrix} \begin{bmatrix} 1 & -\tan \frac{\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. A rotation can also be written as two shears and a [[squeeze mapping]] (an area preserving [[scaling (geometry)|scaling]]) ({{Harvnb|Daubechies|Sweldens|1998}}): :<math>\begin{align} R(\theta) &{}= \begin{bmatrix} 1 & 0\\ \tan\theta & 1 \end{bmatrix} \begin{bmatrix} 1 & -\sin\theta\cos\theta\\ 0 & 1 \end{bmatrix} \begin{bmatrix} \cos\theta & 0\\ 0 & \frac{1}{\cos\theta} \end{bmatrix} \end{align} </math>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)