Rotation matrix: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Paul Wormer
No edit summary
mNo edit summary
 
(38 intermediate revisions by 3 users not shown)
Line 1: Line 1:
A '''rotation''' of a 3-dimensional rigid body is a motion of the body that leaves one point, ''O'', fixed. By [[Euler's theorem (rotation)|Euler's theorem]] follows that then not only the point is fixed but also an axis&mdash;the ''rotation axis''&mdash; through the fixed point. Write <math>\hat{n}</math> for the unit vector along the rotation axis and &phi; for the angle over which the body is rotated, then the rotation is written as <math> \mathcal{R}(\varphi, \hat{n}). </math>  
{{subpages}}
In [[mathematics]] and [[physics]] a '''rotation matrix''' is synonymous with a 3&times;3 [[orthogonal matrix]], which is a matrix  '''R''' satisfying
:<math>
\mathbf{R}^\mathrm{T} = \mathbf{R}^{-1},
</math>
where T stands for the [[transposed matrix]] and '''R'''<sup>&minus;1</sup> is the [[inverse matrix| inverse]] of '''R'''.
 
==Connection of an orthogonal matrix to a rotation==
In general a motion  of a rigid body (which is equivalent to an angle and distance preserving transformation of [[affine space]]) can be described as a translation of the body followed by a rotation. By a translation ''all'' points of the space are displaced, while under a rotation at least one point stays in place. Let the the fixed point be ''O''. By [[Euler's theorem (rotation)|Euler's theorem]] follows that then not only the point is fixed but also an axis&mdash;the ''rotation axis''&mdash; through the fixed point. Write <math>\hat{n}</math> for the unit vector along the rotation axis and &phi; for the angle over which the body is rotated, then the rotation operator on <math>\mathbb{R}^3</math> is written as <math> \mathcal{R}(\varphi, \hat{n}). </math>
 
Erect  three [[Cartesian coordinates|Cartesian coordinate]] axes with the origin in the fixed point ''O'' and take unit vectors <math>\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z</math> along the axes, then the 3&times;3 ''rotation matrix'' <math>\mathbf{R}(\varphi, \hat{n})</math> is defined by its elements
<math>R_{ji}(\varphi, \hat{n})</math> :


Erect  three [[Cartesian coordinates|Cartesian coordinate]] axes with the origin in the fixed point ''O'' and take unit vectors <math>\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z</math> along the axes, then the '''rotation matrix''' <math>\mathbf{R}(\varphi, \hat{n})</math> is defined by its elements
<math>R_{ji}(\varphi, \hat{n})</math>:
:<math>
:<math>
\mathcal{R}(\varphi, \hat{n})(\hat{e}_i) = \sum_{j=x,y,x} \hat{e}_j R_{ji}(\varphi, \hat{n})
\mathcal{R}(\varphi, \hat{n})(\hat{e}_i) = \sum_{j=x,y,x} \hat{e}_j R_{ji}(\varphi, \hat{n})
\quad\hbox{for}\quad i=x,y,z.
\quad\hbox{for}\quad i=x,y,z.
</math>
</math>
In a more condensed notation this equation is written as
 
In a more condensed notation this equation can be written as
:<math>
:<math>
\mathcal{R}(\varphi, \hat{n})\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) =
\mathcal{R}(\varphi, \hat{n})\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) =
\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) \; \mathbf{R}(\varphi, \hat{n}).
\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) \; \mathbf{R}(\varphi, \hat{n}).
</math>
</math>
Given a basis of a linear space, the association between a linear map and its matrix is one-to-one.  
Given a basis of a linear space, the association between a linear map and its matrix is one-to-one.
==Properties of matrix==
 
Since rotation conserves the shape of a rigid body, it leaves angles and distances invariant. In other words, for any pair of vectors  
Since rotation <math>\mathcal{R}</math> (for convenience sake  the rotation axis and angle are suppressed in the notation) leaves all angles and distances invariant, for any pair of vectors
<math>\vec{a}</math> and <math>\vec{b}</math> in <math>\mathbb{R}^3</math> the [[inner product]] is invariant,
<math>\vec{a}</math> and <math>\vec{b}</math> in <math>\mathbb{R}^3</math> the [[inner product]] is invariant, that is,
:<math>
:<math>
\left(\mathcal{R}(\vec{a}),\;\mathcal{R}(\vec{b}) \right) = \left(\vec{a},\;\vec{b}\right).
\left(\mathcal{R}(\vec{a}),\;\mathcal{R}(\vec{b}) \right) = \left(\vec{a},\;\vec{b}\right).
</math>
</math>
A linear map with this property is called ''orthogonal''.  It is easily shown that a similar  vector/matrix relation holds. First we define
A linear map with this property is called ''orthogonal''.  It is easily shown that a similar  vector-matrix relation holds. First we define column vectors (stacked triplets of real numbers given in bold face):
:<math>
:<math>
\vec{a} =\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right)\begin{pmatrix}a_x\\a_y\\a_z\end{pmatrix}
\vec{a} =\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right)\begin{pmatrix}a_x\\a_y\\a_z\end{pmatrix}
\equiv\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) \mathbf{a}
\;\stackrel{\mathrm{def}}{=}\; \left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) \mathbf{a}
\quad\hbox{and}\quad  
\quad\hbox{and}\quad
\vec{b}  
\vec{b}
=\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right)\begin{pmatrix}b_x\\b_y\\b_z\end{pmatrix}
=\left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right)\begin{pmatrix}b_x\\b_y\\b_z\end{pmatrix}
\equiv \left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) \mathbf{b}
\;\stackrel{\mathrm{def}}{=}\; \left(\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\right) \mathbf{b}
</math>
</math>
and observe that the inner product becomes by virtue of the orthonormality of the basis vectors
and observe that the inner product becomes by virtue of the orthonormality of the basis vectors
Line 33: Line 43:
\left(a_x,\;a_y,\;a_z\right) \begin{pmatrix}b_x\\b_y\\b_z\end{pmatrix} \equiv a_xb_x+a_yb_y+a_zb_z.
\left(a_x,\;a_y,\;a_z\right) \begin{pmatrix}b_x\\b_y\\b_z\end{pmatrix} \equiv a_xb_x+a_yb_y+a_zb_z.
</math>
</math>
The invariance of the inner product under <math>\mathcal{R}</math> leads to
The invariance of the inner product under the rotation operator <math>\mathcal{R}</math> leads to
:<math>
:<math>
\big(\mathbf{R}\mathbf{a}\big)^\mathrm{T}\; \mathbf{R}\mathbf{b} =  
\mathbf{a}^\mathrm{T}\; \mathbf{b} =\big(\mathbf{R}\mathbf{a}\big)^\mathrm{T}\; \mathbf{R}\mathbf{b} =
\mathbf{a}^\mathrm{T} \mathbf{R}^\mathrm{T}\; \mathbf{R}\mathbf{b}
\mathbf{a}^\mathrm{T} \mathbf{R}^\mathrm{T}\; \mathbf{R}\mathbf{b},
</math>
</math>
since this holds for any pair '''a''' and '''b''' it follows that a rotation matrix satisfies  
since this holds for any pair '''a''' and '''b''' it follows that a rotation matrix satisfies
:<math>
:<math>
\mathbf{R}^\mathrm{T} \mathbf{R}  = \mathbf{E}
\mathbf{R}^\mathrm{T} \mathbf{R}  = \mathbf{E},
</math>
</math>
where '''E''' is the 3&times;3 [[identity matrix]].
where '''E''' is the 3&times;3 [[identity matrix]].
Line 47: Line 57:
\mathbf{R}^\mathrm{T} \mathbf{R}  = \mathbf{E} \quad \Longleftrightarrow\quad\mathbf{R}\mathbf{R}^\mathrm{T}  = \mathbf{E}.
\mathbf{R}^\mathrm{T} \mathbf{R}  = \mathbf{E} \quad \Longleftrightarrow\quad\mathbf{R}\mathbf{R}^\mathrm{T}  = \mathbf{E}.
</math>
</math>
A matrix with this property is called ''orthogonal''. So, a rotation gives rise to a unique orthogonal matrix.
Conversely, consider an arbitrary  point ''P'' in the body and let the vector <font style="vertical-align: text-bottom"> <math>\overrightarrow{OP}</math></font> connect the fixed point  ''O''  with ''P''.  Expressing this vector with respect to a Cartesian frame in ''O'' gives the column vector '''p''' (three stacked real numbers). Multiply '''p''' by  the orthogonal matrix '''R''', then '''p'''&prime; = '''R'''<b>p</b> represents the rotated point ''P''&prime;  (or, more precisely, the vector <font style="vertical-align: text-bottom"> <math>\overrightarrow{OP'}</math></font> is represented  by column vector '''p'''&prime; with respect to the ''same'' Cartesian frame).  If we map all points ''P'' of the body by the same matrix  '''R''' in this manner, we have rotated the body. Thus, an orthogonal matrix leads to a unique rotation. Note that the Cartesian frame is fixed here  and that points of the body are rotated, this  is known as an ''active'' rotation. Instead, the rigid body could have been left invariant and the Cartesian frame could have been rotated, this also leads to new column vectors of the form '''p'''&prime; &equiv; '''R'''<b>p</b>, such rotations are called ''passive''.
==Properties of an orthogonal matrix==
Writing out  matrix products it follows that both the rows and the columns of the matrix are orthonormal (normalized and orthogonal). Indeed,
:<math>
\begin{align}
\mathbf{R}^\mathrm{T} \mathbf{R}  &= \mathbf{E} \quad\Longleftrightarrow\quad
\sum_{k=1}^{3} R_{ki}\, R_{kj} =\delta_{ij} \quad\hbox{(columns)} \\
\mathbf{R} \mathbf{R}^\mathrm{T}  &= \mathbf{E} \quad\Longleftrightarrow\quad
\sum_{k=1}^{3} R_{ik}\, R_{jk} =\delta_{ij} \quad\hbox{(rows)} \\
\end{align}
</math>
where &delta;<sub>ij</sub> is the [[Kronecker delta]].
Orthogonal matrices come in two flavors: ''proper'' (det = 1) and ''improper'' (det = &minus;1) rotations. Indeed, invoking some properties of determinants, one can prove
:<math>
1=\det(\mathbf{E})=\det(\mathbf{R}^\mathrm{T}\mathbf{R}) = \det(\mathbf{R}^\mathrm{T})\det(\mathbf{R})
= \det(\mathbf{R})^2 \quad\Longrightarrow \quad \det(\mathbf{R}) = \pm 1.
</math>
===Compact notation===
A compact way of presenting the same results is the following. Designate the columns of '''R''' by
'''r'''<sub>1</sub>,  '''r'''<sub>2</sub>,  '''r'''<sub>3</sub>,
i.e.,
:<math>
\mathbf{R} = \left(\mathbf{r}_1,\, \mathbf{r}_2,\, \mathbf{r}_3 \right)
</math>.
The matrix '''R''' is ''orthogonal''  if
:<math>
  \mathbf{r}_i^\mathrm{T} \mathbf{r}_j \equiv \mathbf{r}_i \cdot \mathbf{r}_j =
\delta_{ij}, \quad i,j = 1,2,3 .
</math>
The matrix '''R''' is a ''proper rotation matrix'', if it is
orthogonal ''and'' if '''r'''<sub>1</sub>,  '''r'''<sub>2</sub>,
'''r'''<sub>3</sub>  form a right-handed set, i.e.,
:<math>
\mathbf{r}_i \times \mathbf{r}_j = \sum_{k=1}^3 \, \varepsilon_{ijk}
\mathbf{r}_k .
</math>
Here the symbol &times; indicates a
[[cross product]] and <math>\varepsilon_{ijk}</math> is the
antisymmetric  [[Levi-Civita symbol]],
:<math>
\begin{align}
\varepsilon_{123} =&\; \varepsilon_{312} = \varepsilon_{231} = 1 \\
\varepsilon_{213} =&\; \varepsilon_{321} = \varepsilon_{132} = -1
\end{align}
</math>
and <math>\varepsilon_{ijk} = 0</math> if two or more indices are equal.
The matrix '''R''' is an ''improper rotation matrix'' if
its column vectors form a left-handed set, i.e.,
:<math>
\mathbf{r}_i \times \mathbf{r}_j = - \sum_{k=1}^3 \, \varepsilon_{ijk}
\mathbf{r}_k \; .
</math>
The last two equations  can be condensed into one equation
:<math>
\mathbf{r}_i \times \mathbf{r}_j = \det(\mathbf{R}) \sum_{k=1}^3 \;
\varepsilon_{ijk} \mathbf{r}_k
</math>
by virtue of the the fact that
the determinant of a proper rotation matrix is 1 and of an improper
rotation &minus;1. This was proved above, an alternative proof is the following:
The determinant of a  3&times;3  matrix with column vectors  '''a''',
'''b''',  and '''c''' can be written as [[scalar triple product#Triple product as determinant|scalar triple product]]
:<math>
\det\left(\mathbf{a},\,\mathbf{b},\, \mathbf{c}\right) =
\mathbf{a} \cdot (\mathbf{b}\times\mathbf{c})
</math>.
It was just shown that  for a proper rotation the  columns of '''R''' are orthonormal and satisfy,
:<math>
\mathbf{r}_1 \cdot (\mathbf{r}_2 \times \mathbf{r}_3 ) = \mathbf{r}_1 \cdot\left(\sum_{k=1}^3 \,
\varepsilon_{23k} \,
\mathbf{r}_k \right) = \varepsilon_{231} =  1 .
</math>
Likewise the determinant is &minus;1 for an improper rotation.
==Explicit expression of rotation operator==
{{Image|Rotation.png|right|350px|Rotation of vector <math>\scriptstyle \vec{r}</math> around axis <math>\scriptstyle \hat{n}</math> over an angle &phi;. The red vectors are in the plane of drawing spanned by <math>\scriptstyle \vec{r}</math> and <math>\scriptstyle \hat{n}</math>. The blue vectors are rotated, the green cross product points away from the reader and is perpendicular to the plane of drawing.}}
Let <math>\overrightarrow{OP} \equiv \vec{r}</math> be a vector pointing from the fixed point ''O'' of a  rigid body to an arbitrary point ''P'' of the body.  A rotation of this arbitrary vector around the unit vector <math>\hat{n}</math> over an angle &phi; can be written as
:<math>
\mathcal{R}(\varphi, \hat{n})(\vec{r}\,)\equiv \vec{r}\,' = \vec{r}\;\cos\varphi + \hat{n} (\hat{n}\cdot\vec{r}\,)\;  (1- \cos\varphi)
+ (\hat{n} \times \vec{r}\,) \sin\varphi .
</math>
where • indicates an [[inner product]] and the symbol × a [[cross product]].
It is easy to derive this result. Indeed, decompose the vector to be rotated into two components, one along the rotation axis and one perpendicular to it (see the figure on the right)
:<math>
\vec{r} = \vec{r}_\parallel + \vec{r}_\perp\quad\hbox{with}\quad
\vec{r}_\parallel = \hat{n} (\hat{n}\cdot\vec{r}\,), \quad \vec{r}_\perp = \vec{r}- \hat{n} (\hat{n}\cdot\vec{r}\,).
</math>
Upon rotation the component along the axis is invariant, only the component orthogonal to the axis changes. By virtue of the fact that
:<math>
|\vec{r}_\perp| = |\hat{n} \times \vec{r}\,| = \sqrt{|\vec{r}\,|^2 - (\hat{n}\cdot\vec{r}\,)^2},
</math>
the rotation property simply is
:<math>
\vec{r}_\perp \mapsto \vec{r}\,'_\perp = \cos\varphi\;\vec{r}_\perp + \sin\varphi\;(\hat{n}\times\vec{r}\,).
</math>
Hence
:<math>
\vec{r}\,' = \left[\vec{r}- (\hat{n}\cdot\vec{r}\,) \hat{n}\right]\cos\varphi+(\hat{n}\times\vec{r}\,)\sin\varphi + \hat{n} (\hat{n}\cdot\vec{r}\,).
</math>
Some reshuffling of the terms gives the required result.
==Explicit expression of rotation matrix==
It will be shown that
:<math>
\mathbf{R}(\varphi, \hat{n}) = \mathbf{E} + \sin\varphi \mathbf{N} +(1-\cos\varphi)\mathbf{N}^2,
</math>
where (see [[cross product]] for more details)
:<math>
\mathbf{N} \equiv
\begin{pmatrix}
0  & -n_z & n_y \\
n_z& 0    & -n_x \\
-n_y& n_x  & 0
\end{pmatrix}\quad\hbox{and}\quad
\hat{n} \equiv (\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\,)
\begin{pmatrix}
n_x \\
n_y \\
n_z  \\
\end{pmatrix} \equiv (\hat{e}_x,\;\hat{e}_y,\;\hat{e}_z\,) \; \hat{\mathbf{n}}
</math>
Note further  that the [[dyadic product]]  satisfies (as can be shown by squaring '''N'''),
:<math>
\hat{\mathbf{n}}\otimes\hat{\mathbf{n}} = \mathbf{N}^2 + \mathbf{E}, \quad\hbox{with}\quad |\hat{\mathbf{n}}| = 1
</math>
and that
:<math>
\hat{n} (\hat{n}\cdot\vec{r}\,) \leftrightarrow (\hat{\mathbf{n}}\otimes\hat{\mathbf{n}})\;\mathbf{r}
= \left(\mathbf{N}^2 + \mathbf{E}\right) \mathbf{r}.
</math>
Translating the result of the previous section to coordinate vectors and substituting these results
gives
:<math>
\begin{align}
\mathbf{r}' &= \left[\cos\varphi\; \mathbf{E} +(1-\cos\varphi)(\mathbf{N}^2 + \mathbf{E}) + \sin\varphi \mathbf{N} \right] \mathbf{r} \\
&= \left[\mathbf{E} + (1-\cos\varphi) \mathbf{N}^2 + \sin\varphi \mathbf{N}\right] \mathbf{r},
\qquad\qquad\qquad\qquad\qquad(1)
\end{align}
</math>
which gives the desired result for the rotation matrix.
This equation is identical to Eq. (2.6) of Biedenharn and Louck<ref>L. C. Biedenharn and J. D. Louck, ''Angular Momentum in Quantum Physics'', Addison-Wesley, Reading, Mass. (1981) ISBN 0-201-13507-8</ref>, who give credit to [[Leonhard Euler]] (ca. 1770) for this result.
For the special case &phi; = &pi; (rotation over 180°),  equation (1) can be simplified to
:<math>
\mathbf{R}(\pi, \hat{n}) = \mathbf{E} + 2 \mathbf{N}^2 = -\mathbf{E} +2\, \hat{\mathbf{n}}\otimes\hat{\mathbf{n}}
</math>
so that
:<math>
\mathbf{R}(\pi, \hat{n})\, \mathbf{r} = -\mathbf{r} +2\; \hat{\mathbf{n}}\;  (\hat{\mathbf{n}} \cdot\mathbf{r}),
</math>
which sometimes<ref>{{cite book|author=Mathematics Enhancement Programme|chapter=Matrices and Transformations|title=Further Pure Mathematics|url=http://www.cimt.plymouth.ac.uk/projects/mepres/alevel/fpure_ch9.pdf|publisher=Centre for Innovation in Mathematics Teaching|pages=235-272}}</ref> is referred to as ''reflection over a line'', although it is not a reflection.
Equation (1) is a special case of the transformation properties given on p. 7 of the classical work (first edition 1904) of Whittaker<ref>E. T. Whittaker, ''A Treatise on the Dynamics of Particles and Rigid Bodies, Cambridge University Press (1965)</ref>. To see the correspondence with Whittaker's formula, which includes also a translation over a displacement ''d'' and who rotates the vector (''x''&minus;''a'', ''y''&minus;''b'', ''z''&minus;''c''), we must put equal to zero: ''a'', ''b'', ''c'', and ''d'' in Whittaker's equation.  Furthermore Whittaker uses that the components of the unit vector '''n''' are the [[direction cosine]]s of the rotation axis:
:<math>
n_x \equiv \cos\alpha,\quad n_y \equiv\cos\beta,\quad n_z\equiv\cos\gamma.
</math>
Under these conditions the rotation becomes
:<math>
\begin{align}
x' &= x-(1-\cos\varphi)\left[x\;\sin^2\alpha - y\;\cos\alpha\cos\beta - z\;\cos\alpha\cos\gamma\right]
+\left[z\;\cos\beta- y\;\cos\gamma\right]\sin\varphi \\
y' &= y-(1-\cos\varphi)\left[y\;\sin^2\beta - z\;\cos\beta\cos\gamma - x\;\cos\beta\cos\alpha\right]
+\left[x\;\cos\gamma- z\;\cos\alpha\right]\sin\varphi \\
z' &= z-(1-\cos\varphi)\left[z\;\sin^2\gamma - x\;\cos\gamma\cos\alpha - y\;\cos\gamma\cos\beta\right]
+\left[y\;\cos\alpha- x\;\cos\beta\right]\sin\varphi \\
\end{align}
</math>
==Vector rotation==
Sometimes it is necessary to rotate a rigid body so that  a given vector in the body (for instance an oriented chemical bond in a molecule) is lined-up with an external vector (for instance a  vector along a coordinate axis).
Let the vector in the body be '''f''' (the "from" vector) and the vector to which '''f'''  must be rotated be '''t''' (the "to" vector). Let both vectors be unit vectors (have length 1).  From the definition of the [[inner product]] and the [[cross product]] follows that
:<math>
\mathbf{f} \cdot \mathbf{t} = \cos\varphi,\quad |\mathbf{f}\times\mathbf{t}| = \sin\varphi,
</math>
where &phi; is the  angle (&lt; 180°) between the two vectors. Since the cross product '''f''' &times; '''t''' is a vector perpendicular to the plane of both vectors, it is easily seen that a rotation around the cross product vector over an angle &phi; moves '''f''' to '''t'''.
Write
:<math>
\mathbf{u} = \mathbf{f}\times\mathbf{t}\quad \Longrightarrow\quad \mathbf{u} = \sin\varphi\hat{\mathbf{n}},
</math>
where <math>\hat{\mathbf{n}}</math> is a unit vector.
Define accordingly
:<math>
\mathbf{U} \; \stackrel{\mathrm{def}}{=} \; \sin\varphi \mathbf{N}=
\sin\varphi \begin{pmatrix}
0  & -n_z & n_y \\
n_z& 0    & -n_x \\
-n_y& n_x  & 0
\end{pmatrix}=
\begin{pmatrix}
0  & -u_z & u_y \\
u_z& 0    & -u_x \\
-u_y& u_x  & 0
\end{pmatrix} ,
</math>
so that
:<math>
\begin{align}
\mathbf{R}(\varphi, \hat{n})&= \mathbf{E} + \mathbf{U} + \frac{1-\cos\varphi}{\sin^2\varphi} \mathbf{U}^2 \\
&= \mathbf{E} + \mathbf{U} + \frac{1}{1+\cos\varphi} \mathbf{U}^2
\qquad\qquad\qquad\qquad\qquad\qquad\qquad(2)\\
&= \cos\varphi\,\mathbf{E}+ \mathbf{U} + \frac{1}{1+\cos\varphi} \mathbf{u}\otimes\mathbf{u}\\
\end{align}
</math>
The last equation, which follows from '''U'''<sup>2</sup> = '''u'''&otimes;'''u''' &minus; sin<sup>2</sup>&phi; '''E''',  is Eq. (3) of Ref. <ref name="MH">T. Möller and J. F. Hughes, J. Graphics Tools, '''4''' pp. 1&ndash;4 (1999).</ref> after substitution of
:<math>
\frac{1-\cos\varphi}{\sin^2\varphi} =\frac{1-\cos\varphi}{1-\cos^2\varphi} = \frac{1}{1+\cos\varphi} .
</math>
Indeed, write the rotation matrix in full,  using the short-hand notations ''c'' = cos &phi; and ''h'' = (1-''c'')/(1-''c''<sup>2</sup>)
:<math>
\mathbf{R}(\varphi, \hat{n}) =
\begin{pmatrix}
c+hu_x^2 & h u_xu_y - u_z & h u_x u_z + u_y  \\
h u_x u_y + u_z & c + h u_y^2 & h u_y u_z - u_x  \\
h u_x u_z -u_y & h u_y u_z + u_x  & c + h u_z^2 \\
\end{pmatrix},
</math>
which is the matrix in Eq. (3) of Ref. <ref name="MH"/>.
If the vectors are parallel, '''f''' = '''t''', then '''u''' = '''0''', '''U''' = '''0''' and '''f'''•'''t''' = cos&phi; = 1,
so that the equation is well-defined&mdash;it gives '''R'''(&phi;, ''n'') = '''E''', as expected.
Provided '''f''' and '''t''' are not anti-parallel, the matrix <math>\mathbf{R}(\varphi, \hat{n})</math>
can be computed easily and quickly. It requires not much more than the computation of the inner and cross product of '''f'''  and '''t'''.
===Case that "from" and "to" vectors are anti-parallel===
If the vectors '''f'''  and '''t''' are nearly anti-parallel, '''f''' &asymp; &minus; '''t''',  then  '''f'''•'''t''' = cos&phi; &asymp; &minus; 1, and the denominator in Eq. (2) becomes zero, so that Eq. (2) is not applicable.
The vector defining the rotation axis is nearly zero: '''u''' &equiv; '''f''' &times; '''t''' &asymp; '''f''' &times; (&minus;'''f''') &asymp; '''0'''.
Clearly, a two-fold rotation (angle 180°) around ''any'' rotation axis perpendicular to '''f''' will map '''f''' onto '''&minus;f'''. This freedom in choice of the two-fold axis is consistent with the indeterminacy in the equation that occurs for cos&phi; = &minus;1.
Since  &minus;'''E''' (inversion) sends '''f''' to &minus;'''f''', one could naively assume that all position vectors of the rigid body may be inverted by &minus;'''E'''. However, if the rigid body is not symmetric under inversion (does not have a symmetry center), inversion turns the body into a non-equivalent one. For instance, if the body is a right-hand glove, inversion  sends it into a left-hand glove;  it is well-known that a right-hand and a left-hand glove are different.
Recall that '''f''' is  a unit vector. If '''f''' is on the ''z''-axis, |''f''<sub>''z''</sub>| = 1, then the following rotation around the ''y''-axis turns '''f''' into &minus;'''f''':
:<math>
\mathbf{R}(\pi, \hat{e}_{y}) \mathbf{f} =
\begin{pmatrix}
-1 & 0 & 0 \\
0  & 1 & 0 \\
0  & 0 & -1 \\
\end{pmatrix}
\begin{pmatrix}
0 \\ 0 \\\pm 1
\end{pmatrix} =
\begin{pmatrix}
0 \\ 0 \\\mp 1
\end{pmatrix}
</math>
If '''f''' is not on the ''z''-axis, ''f''<sub>''z''</sub> &ne; 1, then the following orthogonal matrix sends '''f''' to &minus;'''f''' and hence gives a 180° rotation of the rigid body
:<math>
\mathbf{R}(\pi, \hat{e}_{y'}) \mathbf{f} =
\frac{1}{1-f^2_z} \begin{pmatrix}
-(f^2_x-f^2_y) & -2f_xf_y & 0 \\
-2f_xf_y  &(f^2_x-f^2_y)  & 0 \\
0  & 0 & -(1-f^2_z) \\
\end{pmatrix}
\begin{pmatrix}
f_x \\ f_y \\ f_z
\end{pmatrix} =
\begin{pmatrix}
-f_x \\ -f_y \\ -f_z
\end{pmatrix}
</math>
To show this we insert
:<math>
\hat{\mathbf{n}} = \frac{1}{1-f^2_z}
\begin{pmatrix}
f_y \\-f_x \\0
\end{pmatrix}
</math>
into the expression for rotation over 180°  introduced earlier:
:<math>
\mathbf{R}(\pi, \hat{e}_{y'}) = -\mathbf{E} +2 \hat{\mathbf{n}}\otimes \hat{\mathbf{n}} .
</math>
Note that the vector <math>\hat{\mathbf{n}}</math> is normalized, because '''f''' is normalized, and that it lies in the ''x-y'' plane  normal to the plane spanned by the ''z''-axis and '''f'''; it is in fact a unit vector along a rotated ''y''-axis obtained by rotation around the ''z''-axis.
Given '''f''' = (''f''<sub>''x''</sub>, ''f''<sub>''y''</sub>, ''f''<sub>''z''</sub>), the matrix <math>\mathbf{R}(\pi, \hat{e}_{y'})</math> is easily and quickly calculated. The matrix rotates the body over 180° sending '''f''' to &minus;'''f''' exactly.  When  '''&minus;f''' and '''t''' are close, but not exactly equal, the earlier rotation formula Eq. (2), may be used to perform the final (small) rotation of the body that lets '''&minus;f''' and '''t''' coincide exactly.
==Change of rotation axis==
[[Euler's theorem (rotation)|Euler's theorem]] states that a rotation is characterized by a unique axis (an eigenvector with unit eigenvalue) and a unique angle. As a corollary of the theorem follows that the [[trace (mathematics)|trace]] of a rotation matrix is equal to
:<math>
\mathrm{Tr}[\mathbf{R}(\varphi, \hat{n})] = 2\cos\varphi +1,
</math>
and hence the trace depends only on the rotation angle and is independent of the axis.
Let '''A''' be an orthogonal 3&times;3  matrix (not equal to '''E'''), then, because cyclic permutation of matrices under the trace is allowed (i.e., leaves the trace invariant),
:<math>
\mathrm{Tr}[\mathbf{A} \mathbf{R}(\varphi, \hat{n}) \mathbf{A}^\mathrm{T}] =
\mathrm{Tr}[ \mathbf{R}(\varphi, \hat{n}) \mathbf{A}^\mathrm{T}\mathbf{A}] = \mathrm{Tr}[\mathbf{R}(\varphi, \hat{n})] .
</math>
As a consequence it follows that the two matrices
:<math>
\mathbf{R}(\varphi, \hat{n})\quad \hbox{and}\quad  \mathbf{A} \mathbf{R}(\varphi, \hat{n}) \mathbf{A}^\mathrm{T}
</math>
describe a rotation over the ''same'' angle &phi; but around ''different'' axes.
The eigenvalue equation can be transformed
:<math>
\mathbf{R}(\varphi, \hat{n})\;\hat{n} = \hat{n} \;\Longrightarrow\;
\left(\mathbf{A}\,\mathbf{R}(\varphi, \hat{n})\,\mathbf{A}^\mathrm{T}\right) \;\mathbf{A}\hat{n} = \mathbf{A}\hat{n}
</math>
which shows that the transformed eigenvector is the rotation axis of the transformed matrix, or
:<math>
\mathbf{R}(\varphi, \mathbf{A}\hat{n})= \mathbf{A}\,\mathbf{R}(\varphi, \hat{n})\,\mathbf{A}^\mathrm{T} .
</math>
==References==
{{reflist}}[[Category:Suggestion Bot Tag]]

Latest revision as of 16:00, 13 October 2024

This article is developing and not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.

In mathematics and physics a rotation matrix is synonymous with a 3×3 orthogonal matrix, which is a matrix R satisfying

where T stands for the transposed matrix and R−1 is the inverse of R.

Connection of an orthogonal matrix to a rotation

In general a motion of a rigid body (which is equivalent to an angle and distance preserving transformation of affine space) can be described as a translation of the body followed by a rotation. By a translation all points of the space are displaced, while under a rotation at least one point stays in place. Let the the fixed point be O. By Euler's theorem follows that then not only the point is fixed but also an axis—the rotation axis— through the fixed point. Write for the unit vector along the rotation axis and φ for the angle over which the body is rotated, then the rotation operator on is written as

Erect three Cartesian coordinate axes with the origin in the fixed point O and take unit vectors along the axes, then the 3×3 rotation matrix is defined by its elements  :

In a more condensed notation this equation can be written as

Given a basis of a linear space, the association between a linear map and its matrix is one-to-one.

Since a rotation (for convenience sake the rotation axis and angle are suppressed in the notation) leaves all angles and distances invariant, for any pair of vectors and in the inner product is invariant, that is,

A linear map with this property is called orthogonal. It is easily shown that a similar vector-matrix relation holds. First we define column vectors (stacked triplets of real numbers given in bold face):

and observe that the inner product becomes by virtue of the orthonormality of the basis vectors

The invariance of the inner product under the rotation operator leads to

since this holds for any pair a and b it follows that a rotation matrix satisfies

where E is the 3×3 identity matrix. For finite-dimensional matrices one shows easily

A matrix with this property is called orthogonal. So, a rotation gives rise to a unique orthogonal matrix.

Conversely, consider an arbitrary point P in the body and let the vector connect the fixed point O with P. Expressing this vector with respect to a Cartesian frame in O gives the column vector p (three stacked real numbers). Multiply p by the orthogonal matrix R, then p′ = Rp represents the rotated point P′ (or, more precisely, the vector is represented by column vector p′ with respect to the same Cartesian frame). If we map all points P of the body by the same matrix R in this manner, we have rotated the body. Thus, an orthogonal matrix leads to a unique rotation. Note that the Cartesian frame is fixed here and that points of the body are rotated, this is known as an active rotation. Instead, the rigid body could have been left invariant and the Cartesian frame could have been rotated, this also leads to new column vectors of the form p′ ≡ Rp, such rotations are called passive.

Properties of an orthogonal matrix

Writing out matrix products it follows that both the rows and the columns of the matrix are orthonormal (normalized and orthogonal). Indeed,

where δij is the Kronecker delta.

Orthogonal matrices come in two flavors: proper (det = 1) and improper (det = −1) rotations. Indeed, invoking some properties of determinants, one can prove

Compact notation

A compact way of presenting the same results is the following. Designate the columns of R by r1, r2, r3, i.e.,

.

The matrix R is orthogonal if

The matrix R is a proper rotation matrix, if it is orthogonal and if r1, r2, r3 form a right-handed set, i.e.,

Here the symbol × indicates a cross product and is the antisymmetric Levi-Civita symbol,

and if two or more indices are equal.

The matrix R is an improper rotation matrix if its column vectors form a left-handed set, i.e.,

The last two equations can be condensed into one equation

by virtue of the the fact that the determinant of a proper rotation matrix is 1 and of an improper rotation −1. This was proved above, an alternative proof is the following: The determinant of a 3×3 matrix with column vectors a, b, and c can be written as scalar triple product

.

It was just shown that for a proper rotation the columns of R are orthonormal and satisfy,

Likewise the determinant is −1 for an improper rotation.

Explicit expression of rotation operator

CC Image
Rotation of vector around axis over an angle φ. The red vectors are in the plane of drawing spanned by and . The blue vectors are rotated, the green cross product points away from the reader and is perpendicular to the plane of drawing.

Let be a vector pointing from the fixed point O of a rigid body to an arbitrary point P of the body. A rotation of this arbitrary vector around the unit vector over an angle φ can be written as

where • indicates an inner product and the symbol × a cross product.

It is easy to derive this result. Indeed, decompose the vector to be rotated into two components, one along the rotation axis and one perpendicular to it (see the figure on the right)

Upon rotation the component along the axis is invariant, only the component orthogonal to the axis changes. By virtue of the fact that

the rotation property simply is

Hence

Some reshuffling of the terms gives the required result.

Explicit expression of rotation matrix

It will be shown that

where (see cross product for more details)

Note further that the dyadic product satisfies (as can be shown by squaring N),

and that

Translating the result of the previous section to coordinate vectors and substituting these results gives

which gives the desired result for the rotation matrix. This equation is identical to Eq. (2.6) of Biedenharn and Louck[1], who give credit to Leonhard Euler (ca. 1770) for this result.

For the special case φ = π (rotation over 180°), equation (1) can be simplified to

so that

which sometimes[2] is referred to as reflection over a line, although it is not a reflection.

Equation (1) is a special case of the transformation properties given on p. 7 of the classical work (first edition 1904) of Whittaker[3]. To see the correspondence with Whittaker's formula, which includes also a translation over a displacement d and who rotates the vector (xa, yb, zc), we must put equal to zero: a, b, c, and d in Whittaker's equation. Furthermore Whittaker uses that the components of the unit vector n are the direction cosines of the rotation axis:

Under these conditions the rotation becomes

Vector rotation

Sometimes it is necessary to rotate a rigid body so that a given vector in the body (for instance an oriented chemical bond in a molecule) is lined-up with an external vector (for instance a vector along a coordinate axis).

Let the vector in the body be f (the "from" vector) and the vector to which f must be rotated be t (the "to" vector). Let both vectors be unit vectors (have length 1). From the definition of the inner product and the cross product follows that

where φ is the angle (< 180°) between the two vectors. Since the cross product f × t is a vector perpendicular to the plane of both vectors, it is easily seen that a rotation around the cross product vector over an angle φ moves f to t.

Write

where is a unit vector. Define accordingly

so that

The last equation, which follows from U2 = uu − sin2φ E, is Eq. (3) of Ref. [4] after substitution of

Indeed, write the rotation matrix in full, using the short-hand notations c = cos φ and h = (1-c)/(1-c2)

which is the matrix in Eq. (3) of Ref. [4]. If the vectors are parallel, f = t, then u = 0, U = 0 and ft = cosφ = 1, so that the equation is well-defined—it gives R(φ, n) = E, as expected. Provided f and t are not anti-parallel, the matrix can be computed easily and quickly. It requires not much more than the computation of the inner and cross product of f and t.

Case that "from" and "to" vectors are anti-parallel

If the vectors f and t are nearly anti-parallel, f ≈ − t, then ft = cosφ ≈ − 1, and the denominator in Eq. (2) becomes zero, so that Eq. (2) is not applicable. The vector defining the rotation axis is nearly zero: uf × tf × (−f) ≈ 0.

Clearly, a two-fold rotation (angle 180°) around any rotation axis perpendicular to f will map f onto −f. This freedom in choice of the two-fold axis is consistent with the indeterminacy in the equation that occurs for cosφ = −1.

Since −E (inversion) sends f to −f, one could naively assume that all position vectors of the rigid body may be inverted by −E. However, if the rigid body is not symmetric under inversion (does not have a symmetry center), inversion turns the body into a non-equivalent one. For instance, if the body is a right-hand glove, inversion sends it into a left-hand glove; it is well-known that a right-hand and a left-hand glove are different.

Recall that f is a unit vector. If f is on the z-axis, |fz| = 1, then the following rotation around the y-axis turns f into −f:

If f is not on the z-axis, fz ≠ 1, then the following orthogonal matrix sends f to −f and hence gives a 180° rotation of the rigid body

To show this we insert

into the expression for rotation over 180° introduced earlier:

Note that the vector is normalized, because f is normalized, and that it lies in the x-y plane normal to the plane spanned by the z-axis and f; it is in fact a unit vector along a rotated y-axis obtained by rotation around the z-axis.

Given f = (fx, fy, fz), the matrix is easily and quickly calculated. The matrix rotates the body over 180° sending f to −f exactly. When −f and t are close, but not exactly equal, the earlier rotation formula Eq. (2), may be used to perform the final (small) rotation of the body that lets −f and t coincide exactly.

Change of rotation axis

Euler's theorem states that a rotation is characterized by a unique axis (an eigenvector with unit eigenvalue) and a unique angle. As a corollary of the theorem follows that the trace of a rotation matrix is equal to

and hence the trace depends only on the rotation angle and is independent of the axis. Let A be an orthogonal 3×3 matrix (not equal to E), then, because cyclic permutation of matrices under the trace is allowed (i.e., leaves the trace invariant),

As a consequence it follows that the two matrices

describe a rotation over the same angle φ but around different axes. The eigenvalue equation can be transformed

which shows that the transformed eigenvector is the rotation axis of the transformed matrix, or

References

  1. L. C. Biedenharn and J. D. Louck, Angular Momentum in Quantum Physics, Addison-Wesley, Reading, Mass. (1981) ISBN 0-201-13507-8
  2. Mathematics Enhancement Programme. “Matrices and Transformations”, Further Pure Mathematics. Centre for Innovation in Mathematics Teaching, 235-272. 
  3. E. T. Whittaker, A Treatise on the Dynamics of Particles and Rigid Bodies, Cambridge University Press (1965)
  4. 4.0 4.1 T. Möller and J. F. Hughes, J. Graphics Tools, 4 pp. 1–4 (1999).