<s>
In	O
linear	B-Language
algebra	I-Language
,	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
is	O
a	O
transformation	B-Algorithm
matrix	I-Algorithm
that	O
is	O
used	O
to	O
perform	O
a	O
rotation	B-General_Concept
in	O
Euclidean	O
space	O
.	O
</s>
<s>
To	O
perform	O
the	O
rotation	B-General_Concept
on	O
a	O
plane	O
point	O
with	O
standard	O
coordinates	O
,	O
it	O
should	O
be	O
written	O
as	O
a	O
column	O
vector	O
,	O
and	O
multiplied	O
by	O
the	O
matrix	B-Architecture
:	O
</s>
<s>
Indeed	O
,	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
can	O
be	O
seen	O
as	O
the	O
trigonometric	O
summation	O
angle	O
formulae	O
in	O
matrix	B-Architecture
form	O
.	O
</s>
<s>
If	O
any	O
one	O
of	O
these	O
is	O
changed	O
(	O
such	O
as	O
rotating	O
axes	O
instead	O
of	O
vectors	O
,	O
a	O
passive	O
transformation	O
)	O
,	O
then	O
the	O
inverse	O
of	O
the	O
example	O
matrix	B-Architecture
should	O
be	O
used	O
,	O
which	O
coincides	O
with	O
its	O
transpose	O
.	O
</s>
<s>
Since	O
matrix	B-Architecture
multiplication	O
has	O
no	O
effect	O
on	O
the	O
zero	O
vector	O
(	O
the	O
coordinates	O
of	O
the	O
origin	O
)	O
,	O
rotation	B-Algorithm
matrices	I-Algorithm
describe	O
rotations	O
about	O
the	O
origin	O
.	O
</s>
<s>
Rotation	B-Algorithm
matrices	I-Algorithm
provide	O
an	O
algebraic	O
description	O
of	O
such	O
rotations	O
,	O
and	O
are	O
used	O
extensively	O
for	O
computations	O
in	O
geometry	O
,	O
physics	O
,	O
and	O
computer	O
graphics	O
.	O
</s>
<s>
In	O
some	O
literature	O
,	O
the	O
term	O
rotation	B-General_Concept
is	O
generalized	O
to	O
include	O
improper	B-Algorithm
rotations	I-Algorithm
,	O
characterized	O
by	O
orthogonal	B-Algorithm
matrices	I-Algorithm
with	O
a	O
determinant	O
of	O
−1	O
(	O
instead	O
of	O
+1	O
)	O
.	O
</s>
<s>
These	O
combine	O
proper	B-Algorithm
rotations	I-Algorithm
with	O
reflections	O
(	O
which	O
invert	O
orientation	O
)	O
.	O
</s>
<s>
Rotation	B-Algorithm
matrices	I-Algorithm
are	O
square	B-Algorithm
matrices	I-Algorithm
,	O
with	O
real	O
entries	O
.	O
</s>
<s>
More	O
specifically	O
,	O
they	O
can	O
be	O
characterized	O
as	O
orthogonal	B-Algorithm
matrices	I-Algorithm
with	O
determinant1	O
;	O
that	O
is	O
,	O
a	O
square	B-Algorithm
matrix	I-Algorithm
is	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
if	O
and	O
only	O
if	O
and	O
.	O
</s>
<s>
The	O
set	O
of	O
all	O
orthogonal	B-Algorithm
matrices	I-Algorithm
of	O
size	O
with	O
determinant	O
+1	O
is	O
a	O
representation	O
of	O
a	O
group	O
known	O
as	O
the	O
special	O
orthogonal	O
group	O
,	O
one	O
example	O
of	O
which	O
is	O
the	O
rotation	B-General_Concept
group	O
SO(3 )	O
.	O
</s>
<s>
The	O
set	O
of	O
all	O
orthogonal	B-Algorithm
matrices	I-Algorithm
of	O
size	O
with	O
determinant	O
+1	O
or	O
−1	O
is	O
a	O
representation	O
of	O
the	O
(	O
general	O
)	O
orthogonal	O
group	O
.	O
</s>
<s>
In	O
two	O
dimensions	O
,	O
the	O
standard	O
rotation	B-Algorithm
matrix	I-Algorithm
has	O
the	O
following	O
form	O
:	O
</s>
<s>
This	O
rotates	O
column	O
vectors	O
by	O
means	O
of	O
the	O
following	O
matrix	B-Architecture
multiplication	O
,	O
</s>
<s>
The	O
direction	O
of	O
vector	O
rotation	B-General_Concept
is	O
counterclockwise	O
if	O
is	O
positive	O
(	O
e.g.	O
</s>
<s>
not	O
one-dimensional	O
)	O
case	O
where	O
the	O
rotation	B-Algorithm
matrices	I-Algorithm
group	O
is	O
commutative	O
,	O
so	O
that	O
it	O
does	O
not	O
matter	O
in	O
which	O
order	O
multiple	O
rotations	O
are	O
performed	O
.	O
</s>
<s>
An	O
alternative	O
convention	O
uses	O
rotating	O
axes	O
,	O
and	O
the	O
above	O
matrices	O
also	O
represent	O
a	O
rotation	B-General_Concept
of	O
the	O
axes	O
clockwise	O
through	O
an	O
angle	O
.	O
</s>
<s>
If	O
a	O
standard	O
right-handed	O
Cartesian	O
coordinate	O
system	O
is	O
used	O
,	O
with	O
the	O
to	O
the	O
right	O
and	O
the	O
up	O
,	O
the	O
rotation	B-General_Concept
is	O
counterclockwise	O
.	O
</s>
<s>
See	O
below	O
for	O
other	O
alternative	O
conventions	O
which	O
may	O
change	O
the	O
sense	O
of	O
the	O
rotation	B-General_Concept
produced	O
by	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
Under	O
this	O
isomorphism	O
,	O
the	O
rotation	B-Algorithm
matrices	I-Algorithm
correspond	O
to	O
circle	O
of	O
the	O
unit	O
complex	O
numbers	O
,	O
the	O
complex	O
numbers	O
of	O
modulus	O
.	O
</s>
<s>
If	O
one	O
identifies	O
with	O
through	O
the	O
linear	B-Architecture
isomorphism	I-Architecture
the	O
action	O
of	O
a	O
matrix	B-Architecture
of	O
the	O
above	O
form	O
on	O
vectors	O
of	O
corresponds	O
to	O
the	O
multiplication	O
by	O
the	O
complex	O
number	O
,	O
and	O
rotations	O
correspond	O
to	O
multiplication	O
by	O
complex	O
numbers	O
of	O
modulus	O
.	O
</s>
<s>
A	O
basic	O
rotation	B-General_Concept
(	O
also	O
called	O
elemental	O
rotation	B-General_Concept
)	O
is	O
a	O
rotation	B-General_Concept
about	O
one	O
of	O
the	O
axes	O
of	O
a	O
coordinate	O
system	O
.	O
</s>
<s>
The	O
following	O
three	O
basic	O
rotation	B-Algorithm
matrices	I-Algorithm
rotate	O
vectors	O
by	O
an	O
angle	O
about	O
the	O
-	O
,	O
-	O
,	O
or	O
-axis	O
,	O
in	O
three	O
dimensions	O
,	O
using	O
the	O
right-hand	O
rule	O
—	O
which	O
codifies	O
their	O
alternating	O
signs	O
.	O
</s>
<s>
(	O
The	O
same	O
matrices	O
can	O
also	O
represent	O
a	O
clockwise	O
rotation	B-General_Concept
of	O
the	O
axes	O
.	O
)	O
</s>
<s>
This	O
is	O
similar	O
to	O
the	O
rotation	B-General_Concept
produced	O
by	O
the	O
above-mentioned	O
two-dimensional	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
See	O
below	O
for	O
alternative	O
conventions	O
which	O
may	O
apparently	O
or	O
actually	O
invert	O
the	O
sense	O
of	O
the	O
rotation	B-General_Concept
produced	O
by	O
these	O
matrices	O
.	O
</s>
<s>
Other	O
rotation	B-Algorithm
matrices	I-Algorithm
can	O
be	O
obtained	O
from	O
these	O
three	O
using	O
matrix	B-Architecture
multiplication	O
.	O
</s>
<s>
represents	O
a	O
rotation	B-General_Concept
whose	O
yaw	O
,	O
pitch	O
,	O
and	O
roll	O
angles	O
are	O
,	O
and	O
,	O
respectively	O
.	O
</s>
<s>
More	O
formally	O
,	O
it	O
is	O
an	O
intrinsic	O
rotation	B-General_Concept
whose	O
Tait	O
–	O
Bryan	O
angles	O
are	O
,	O
,	O
,	O
about	O
axes	O
,	O
,	O
,	O
respectively	O
.	O
</s>
<s>
represents	O
an	O
extrinsic	O
rotation	B-General_Concept
whose	O
(	O
improper	B-Algorithm
)	O
Euler	O
angles	O
are	O
,	O
,	O
,	O
about	O
axes	O
,	O
,	O
.	O
</s>
<s>
These	O
matrices	O
produce	O
the	O
desired	O
effect	O
only	O
if	O
they	O
are	O
used	O
to	O
premultiply	O
column	O
vectors	O
,	O
and	O
(	O
since	O
in	O
general	O
matrix	B-Architecture
multiplication	O
is	O
not	O
commutative	O
)	O
only	O
if	O
they	O
are	O
applied	O
in	O
the	O
specified	O
order	O
(	O
see	O
Ambiguities	O
for	O
more	O
details	O
)	O
.	O
</s>
<s>
The	O
order	O
of	O
rotation	B-General_Concept
operations	O
is	O
from	O
right	O
to	O
left	O
;	O
the	O
matrix	B-Architecture
adjacent	O
to	O
the	O
column	O
vector	O
is	O
the	O
first	O
to	O
be	O
applied	O
,	O
and	O
then	O
the	O
one	O
to	O
the	O
left	O
.	O
</s>
<s>
Every	O
rotation	B-General_Concept
in	O
three	O
dimensions	O
is	O
defined	O
by	O
its	O
axis	O
(	O
a	O
vector	O
along	O
this	O
axis	O
is	O
unchanged	O
by	O
the	O
rotation	B-General_Concept
)	O
,	O
and	O
its	O
angle	O
—	O
the	O
amount	O
of	O
rotation	B-General_Concept
about	O
that	O
axis	O
(	O
Euler	O
rotation	B-General_Concept
theorem	O
)	O
.	O
</s>
<s>
There	O
are	O
several	O
methods	O
to	O
compute	O
the	O
axis	O
and	O
angle	O
from	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
(	O
see	O
also	O
axis	O
–	O
angle	O
representation	O
)	O
.	O
</s>
<s>
Here	O
,	O
we	O
only	O
describe	O
the	O
method	O
based	O
on	O
the	O
computation	O
of	O
the	O
eigenvectors	O
and	O
eigenvalues	O
of	O
the	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
It	O
is	O
also	O
possible	O
to	O
use	O
the	O
trace	O
of	O
the	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
since	O
the	O
rotation	B-General_Concept
of	O
around	O
the	O
rotation	B-General_Concept
axis	O
must	O
result	O
in	O
.	O
</s>
<s>
which	O
shows	O
that	O
lies	O
in	O
the	O
null	B-Algorithm
space	I-Algorithm
of	O
.	O
</s>
<s>
Every	O
rotation	B-Algorithm
matrix	I-Algorithm
must	O
have	O
this	O
eigenvalue	O
,	O
the	O
other	O
two	O
eigenvalues	O
being	O
complex	O
conjugates	O
of	O
each	O
other	O
.	O
</s>
<s>
It	O
follows	O
that	O
a	O
general	O
rotation	B-Algorithm
matrix	I-Algorithm
in	O
three	O
dimensions	O
has	O
,	O
up	O
to	O
a	O
multiplicative	O
constant	O
,	O
only	O
one	O
real	O
eigenvector	O
.	O
</s>
<s>
One	O
way	O
to	O
determine	O
the	O
rotation	B-General_Concept
axis	O
is	O
by	O
showing	O
that	O
:	O
</s>
<s>
The	O
matrix	B-Architecture
–	O
vector	O
product	O
becomes	O
a	O
cross	O
product	O
of	O
a	O
vector	O
with	O
itself	O
,	O
ensuring	O
that	O
the	O
result	O
is	O
zero	O
:	O
</s>
<s>
The	O
magnitude	O
of	O
computed	O
this	O
way	O
is	O
,	O
where	O
is	O
the	O
angle	O
of	O
rotation	B-General_Concept
.	O
</s>
<s>
To	O
find	O
the	O
angle	O
of	O
a	O
rotation	B-General_Concept
,	O
once	O
the	O
axis	O
of	O
the	O
rotation	B-General_Concept
is	O
known	O
,	O
select	O
a	O
vector	O
perpendicular	O
to	O
the	O
axis	O
.	O
</s>
<s>
Then	O
the	O
angle	O
of	O
the	O
rotation	B-General_Concept
is	O
the	O
angle	O
between	O
and	O
.	O
</s>
<s>
A	O
more	O
direct	O
method	O
,	O
however	O
,	O
is	O
to	O
simply	O
calculate	O
the	O
trace	O
:	O
the	O
sum	O
of	O
the	O
diagonal	O
elements	O
of	O
the	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
matrix	B-Architecture
of	O
a	O
proper	B-Algorithm
rotation	I-Algorithm
by	O
angle	O
around	O
the	O
axis	O
,	O
a	O
unit	O
vector	O
with	O
,	O
is	O
given	O
by	O
:	O
</s>
<s>
A	O
derivation	O
of	O
this	O
matrix	B-Architecture
from	O
first	O
principles	O
can	O
be	O
found	O
in	O
section	O
9.2	O
here	O
.	O
</s>
<s>
The	O
basic	O
idea	O
to	O
derive	O
this	O
matrix	B-Architecture
is	O
dividing	O
the	O
problem	O
into	O
few	O
known	O
simple	O
steps	O
.	O
</s>
<s>
Use	O
one	O
of	O
the	O
fundamental	O
rotation	B-Algorithm
matrices	I-Algorithm
to	O
rotate	O
the	O
point	O
depending	O
on	O
the	O
coordinate	O
axis	O
with	O
which	O
the	O
rotation	B-General_Concept
axis	O
is	O
aligned	O
.	O
</s>
<s>
where	O
is	O
the	O
cross	O
product	O
matrix	B-Architecture
of	O
;	O
the	O
expression	O
is	O
the	O
outer	O
product	O
,	O
and	O
is	O
the	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
Alternatively	O
,	O
the	O
matrix	B-Architecture
entries	O
are	O
:	O
</s>
<s>
In	O
the	O
rotation	B-General_Concept
of	O
a	O
vector	O
around	O
the	O
axis	O
by	O
an	O
angle	O
can	O
be	O
written	O
as	O
:	O
</s>
<s>
If	O
the	O
3D	O
space	O
is	O
right-handed	O
and	O
,	O
this	O
rotation	B-General_Concept
will	O
be	O
counterclockwise	O
when	O
points	O
towards	O
the	O
observer	O
(	O
Right-hand	O
rule	O
)	O
.	O
</s>
<s>
A	O
rotation	B-General_Concept
is	O
termed	O
proper	O
if	O
,	O
and	O
improper	B-Algorithm
(	O
or	O
a	O
roto-reflection	O
)	O
if	O
.	O
</s>
<s>
For	O
even	O
dimensions	O
,	O
the	O
eigenvalues	O
of	O
a	O
proper	B-Algorithm
rotation	I-Algorithm
occur	O
as	O
pairs	O
of	O
complex	O
conjugates	O
which	O
are	O
roots	O
of	O
unity	O
:	O
for	O
,	O
which	O
is	O
real	O
only	O
for	O
.	O
</s>
<s>
Therefore	O
,	O
there	O
may	O
be	O
no	O
vectors	O
fixed	O
by	O
the	O
rotation	B-General_Concept
(	O
)	O
,	O
and	O
thus	O
no	O
axis	O
of	O
rotation	B-General_Concept
.	O
</s>
<s>
Any	O
fixed	O
eigenvectors	O
occur	O
in	O
pairs	O
,	O
and	O
the	O
axis	O
of	O
rotation	B-General_Concept
is	O
an	O
even-dimensional	O
subspace	O
.	O
</s>
<s>
For	O
odd	O
dimensions	O
,	O
a	O
proper	B-Algorithm
rotation	I-Algorithm
will	O
have	O
an	O
odd	O
number	O
of	O
eigenvalues	O
,	O
with	O
at	O
least	O
one	O
and	O
the	O
axis	O
of	O
rotation	B-General_Concept
will	O
be	O
an	O
odd	O
dimensional	O
subspace	O
.	O
</s>
<s>
Here	O
is	O
the	O
identity	B-Algorithm
matrix	I-Algorithm
,	O
and	O
we	O
use	O
,	O
as	O
well	O
as	O
since	O
is	O
odd	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
2-space	O
,	O
a	O
rotation	B-General_Concept
by	O
angle	O
has	O
eigenvalues	O
and	O
,	O
so	O
there	O
is	O
no	O
axis	O
of	O
rotation	B-General_Concept
except	O
when	O
,	O
the	O
case	O
of	O
the	O
null	O
rotation	B-General_Concept
.	O
</s>
<s>
In	O
3-space	O
,	O
the	O
axis	O
of	O
a	O
non-null	O
proper	B-Algorithm
rotation	I-Algorithm
is	O
always	O
a	O
unique	O
line	O
,	O
and	O
a	O
rotation	B-General_Concept
around	O
this	O
axis	O
by	O
angle	O
has	O
eigenvalues	O
.	O
</s>
<s>
The	O
null	O
rotation	B-General_Concept
has	O
.	O
</s>
<s>
The	O
case	O
of	O
is	O
called	O
a	O
simple	O
rotation	B-General_Concept
,	O
with	O
two	O
unit	O
eigenvalues	O
forming	O
an	O
axis	O
plane	O
,	O
and	O
a	O
two-dimensional	O
rotation	B-General_Concept
orthogonal	O
to	O
the	O
axis	O
plane	O
.	O
</s>
<s>
The	O
case	O
of	O
is	O
called	O
an	O
isoclinic	O
rotation	B-General_Concept
,	O
having	O
eigenvalues	O
repeated	O
twice	O
,	O
so	O
every	O
vector	O
is	O
rotated	O
through	O
an	O
angle	O
.	O
</s>
<s>
The	O
trace	O
of	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
is	O
equal	O
to	O
the	O
sum	O
of	O
its	O
eigenvalues	O
.	O
</s>
<s>
For	O
,	O
a	O
rotation	B-General_Concept
by	O
angle	O
has	O
trace	O
.	O
</s>
<s>
For	O
,	O
a	O
rotation	B-General_Concept
around	O
any	O
axis	O
by	O
angle	O
has	O
trace	O
.	O
</s>
<s>
For	O
,	O
and	O
the	O
trace	O
is	O
,	O
which	O
becomes	O
for	O
an	O
isoclinic	O
rotation	B-General_Concept
.	O
</s>
<s>
corresponds	O
to	O
a	O
90°	O
planar	O
rotation	B-General_Concept
clockwise	O
about	O
the	O
origin	O
.	O
</s>
<s>
is	O
its	O
inverse	O
,	O
but	O
since	O
its	O
determinant	O
is	O
−1	O
,	O
this	O
is	O
not	O
a	O
proper	B-Algorithm
rotation	I-Algorithm
matrix	B-Architecture
;	O
it	O
is	O
a	O
reflection	B-Algorithm
across	O
the	O
line	O
.	O
</s>
<s>
corresponds	O
to	O
a	O
−30°	O
rotation	B-General_Concept
around	O
the	O
-axis	O
in	O
three-dimensional	O
space	O
.	O
</s>
<s>
corresponds	O
to	O
a	O
rotation	B-General_Concept
of	O
approximately	O
−74°	O
around	O
the	O
axis	O
in	O
three-dimensional	O
space	O
.	O
</s>
<s>
is	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
as	O
is	O
the	O
matrix	B-Architecture
of	O
any	O
even	O
permutation	B-Algorithm
,	O
and	O
rotates	O
through	O
120°	O
about	O
the	O
axis	O
.	O
</s>
<s>
has	O
determinant	O
+1	O
,	O
but	O
is	O
not	O
orthogonal	O
(	O
its	O
transpose	O
is	O
not	O
its	O
inverse	O
)	O
,	O
so	O
it	O
is	O
not	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
is	O
not	O
square	O
,	O
and	O
so	O
cannot	O
be	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
;	O
yet	O
yields	O
a	O
identity	B-Algorithm
matrix	I-Algorithm
(	O
the	O
columns	O
are	O
orthonormal	O
)	O
.	O
</s>
<s>
describes	O
an	O
isoclinic	O
rotation	B-General_Concept
in	O
four	O
dimensions	O
,	O
a	O
rotation	B-General_Concept
through	O
equal	O
angles	O
(	O
180°	O
)	O
through	O
two	O
orthogonal	O
planes	O
.	O
</s>
<s>
In	O
Euclidean	O
geometry	O
,	O
a	O
rotation	B-General_Concept
is	O
an	O
example	O
of	O
an	O
isometry	O
,	O
a	O
transformation	O
that	O
moves	O
points	O
without	O
changing	O
the	O
distances	O
between	O
them	O
.	O
</s>
<s>
In	O
contrast	O
,	O
a	O
translation	B-Algorithm
moves	O
every	O
point	O
,	O
a	O
reflection	B-Algorithm
exchanges	O
left	O
-	O
and	O
right-handed	O
ordering	O
,	O
a	O
glide	B-Algorithm
reflection	I-Algorithm
does	O
both	O
,	O
and	O
an	O
improper	B-Algorithm
rotation	I-Algorithm
combines	O
a	O
change	O
in	O
handedness	O
with	O
a	O
normal	O
rotation	B-General_Concept
.	O
</s>
<s>
A	O
geometric	O
rotation	B-General_Concept
transforms	O
lines	O
to	O
lines	O
,	O
and	O
preserves	O
ratios	O
of	O
distances	O
between	O
points	O
.	O
</s>
<s>
From	O
these	O
properties	O
it	O
can	O
be	O
shown	O
that	O
a	O
rotation	B-General_Concept
is	O
a	O
linear	B-Architecture
transformation	I-Architecture
of	O
the	O
vectors	O
,	O
and	O
thus	O
can	O
be	O
written	O
in	O
matrix	B-Architecture
form	O
,	O
.	O
</s>
<s>
Because	O
this	O
equation	O
holds	O
for	O
all	O
vectors	O
,	O
,	O
one	O
concludes	O
that	O
every	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
,	O
satisfies	O
the	O
orthogonality	O
condition	O
,	O
</s>
<s>
Rotations	O
preserve	O
handedness	O
because	O
they	O
cannot	O
change	O
the	O
ordering	O
of	O
the	O
axes	O
,	O
which	O
implies	O
the	O
special	O
matrix	B-Architecture
condition	O
,	O
</s>
<s>
Equally	O
important	O
,	O
it	O
can	O
be	O
shown	O
that	O
any	O
matrix	B-Architecture
satisfying	O
these	O
two	O
conditions	O
acts	O
as	O
a	O
rotation	B-General_Concept
.	O
</s>
<s>
The	O
inverse	O
of	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
is	O
its	O
transpose	O
,	O
which	O
is	O
also	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
:	O
</s>
<s>
The	O
product	O
of	O
two	O
rotation	B-Algorithm
matrices	I-Algorithm
is	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
:	O
</s>
<s>
For	O
,	O
multiplication	O
of	O
rotation	B-Algorithm
matrices	I-Algorithm
is	O
generally	O
not	O
commutative	O
.	O
</s>
<s>
Noting	O
that	O
any	O
identity	B-Algorithm
matrix	I-Algorithm
is	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
and	O
that	O
matrix	B-Architecture
multiplication	O
is	O
associative	O
,	O
we	O
may	O
summarize	O
all	O
these	O
properties	O
by	O
saying	O
that	O
the	O
rotation	B-Algorithm
matrices	I-Algorithm
form	O
a	O
group	O
,	O
which	O
for	O
is	O
non-abelian	O
,	O
called	O
a	O
special	O
orthogonal	O
group	O
,	O
and	O
denoted	O
by	O
,	O
,	O
,	O
or	O
,	O
the	O
group	O
of	O
rotation	B-Algorithm
matrices	I-Algorithm
is	O
isomorphic	O
to	O
the	O
group	O
of	O
rotations	O
in	O
an	O
space	O
.	O
</s>
<s>
This	O
means	O
that	O
multiplication	O
of	O
rotation	B-Algorithm
matrices	I-Algorithm
corresponds	O
to	O
composition	O
of	O
rotations	O
,	O
applied	O
in	O
left-to-right	O
order	O
of	O
their	O
corresponding	O
matrices	O
.	O
</s>
<s>
The	O
interpretation	O
of	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
can	O
be	O
subject	O
to	O
many	O
ambiguities	O
.	O
</s>
<s>
In	O
most	O
cases	O
the	O
effect	O
of	O
the	O
ambiguity	O
is	O
equivalent	O
to	O
the	O
effect	O
of	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
inversion	O
(	O
for	O
these	O
orthogonal	B-Algorithm
matrices	I-Algorithm
equivalently	O
matrix	B-Architecture
transpose	O
)	O
.	O
</s>
<s>
The	O
coordinates	O
of	O
a	O
point	O
may	O
change	O
due	O
to	O
either	O
a	O
rotation	B-General_Concept
of	O
the	O
coordinate	O
system	O
(	O
alias	O
)	O
,	O
or	O
a	O
rotation	B-General_Concept
of	O
the	O
point	O
(	O
alibi	O
)	O
.	O
</s>
<s>
In	O
the	O
latter	O
case	O
,	O
the	O
rotation	B-General_Concept
of	O
also	O
produces	O
a	O
rotation	B-General_Concept
of	O
the	O
vector	O
representing	O
.	O
</s>
<s>
Any	O
given	O
rotation	B-General_Concept
can	O
be	O
legitimately	O
described	O
both	O
ways	O
,	O
as	O
vectors	O
and	O
coordinate	O
systems	O
actually	O
rotate	O
with	O
respect	O
to	O
each	O
other	O
,	O
about	O
the	O
same	O
axis	O
but	O
in	O
opposite	O
directions	O
.	O
</s>
<s>
represents	O
a	O
counterclockwise	O
rotation	B-General_Concept
of	O
a	O
vector	O
by	O
an	O
angle	O
,	O
or	O
a	O
rotation	B-General_Concept
of	O
by	O
the	O
same	O
angle	O
but	O
in	O
the	O
opposite	O
direction	O
(	O
i.e.	O
</s>
<s>
Rotation	B-Algorithm
matrices	I-Algorithm
can	O
either	O
pre-multiply	O
column	O
vectors	O
(	O
)	O
,	O
or	O
post-multiply	O
row	O
vectors	O
(	O
)	O
.	O
</s>
<s>
However	O
,	O
produces	O
a	O
rotation	B-General_Concept
in	O
the	O
opposite	O
direction	O
with	O
respect	O
to	O
.	O
</s>
<s>
To	O
obtain	O
exactly	O
the	O
same	O
rotation	B-General_Concept
(	O
i.e.	O
</s>
<s>
The	O
matrix	B-Architecture
and	O
the	O
vector	O
can	O
be	O
represented	O
with	O
respect	O
to	O
a	O
right-handed	O
or	O
left-handed	O
coordinate	O
system	O
.	O
</s>
<s>
The	O
vector	O
space	O
has	O
a	O
dual	O
space	O
of	O
linear	B-Algorithm
forms	I-Algorithm
,	O
and	O
the	O
matrix	B-Architecture
can	O
act	O
on	O
either	O
vectors	O
or	O
forms	O
.	O
</s>
<s>
First	O
,	O
one	O
of	O
the	O
roots	O
(	O
or	O
eigenvalues	O
)	O
is	O
1	O
,	O
which	O
tells	O
us	O
that	O
some	O
direction	O
is	O
unaffected	O
by	O
the	O
matrix	B-Architecture
.	O
</s>
<s>
For	O
rotations	O
in	O
three	O
dimensions	O
,	O
this	O
is	O
the	O
axis	O
of	O
the	O
rotation	B-General_Concept
(	O
a	O
concept	O
that	O
has	O
no	O
meaning	O
in	O
any	O
other	O
dimension	O
)	O
.	O
</s>
<s>
This	O
factorization	O
is	O
of	O
interest	O
for	O
rotation	B-Algorithm
matrices	I-Algorithm
because	O
the	O
same	O
thing	O
occurs	O
for	O
all	O
of	O
them	O
.	O
</s>
<s>
(	O
As	O
special	O
cases	O
,	O
for	O
a	O
null	O
rotation	B-General_Concept
the	O
"	O
complex	O
conjugates	O
"	O
are	O
both	O
1	O
,	O
and	O
for	O
a	O
180°	O
rotation	B-General_Concept
they	O
are	O
both	O
−1	O
.	O
)	O
</s>
<s>
Furthermore	O
,	O
a	O
similar	O
factorization	O
holds	O
for	O
any	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
And	O
since	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
commutes	O
with	O
its	O
transpose	O
,	O
it	O
is	O
a	O
normal	B-Algorithm
matrix	I-Algorithm
,	O
so	O
can	O
be	O
diagonalized	O
.	O
</s>
<s>
We	O
conclude	O
that	O
every	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
when	O
expressed	O
in	O
a	O
suitable	O
coordinate	O
system	O
,	O
partitions	O
into	O
independent	O
rotations	O
of	O
two-dimensional	O
subspaces	O
,	O
at	O
most	O
of	O
them	O
.	O
</s>
<s>
The	O
sum	O
of	O
the	O
entries	O
on	O
the	O
main	O
diagonal	O
of	O
a	O
matrix	B-Architecture
is	O
called	O
the	O
trace	O
;	O
it	O
does	O
not	O
change	O
if	O
we	O
reorient	O
the	O
coordinate	O
system	O
,	O
and	O
always	O
equals	O
the	O
sum	O
of	O
the	O
eigenvalues	O
.	O
</s>
<s>
This	O
has	O
the	O
convenient	O
implication	O
for	O
and	O
rotation	B-Algorithm
matrices	I-Algorithm
that	O
the	O
trace	O
reveals	O
the	O
angle	O
of	O
rotation	B-General_Concept
,	O
,	O
in	O
the	O
two-dimensional	O
space	O
(	O
or	O
subspace	O
)	O
.	O
</s>
<s>
For	O
a	O
matrix	B-Architecture
the	O
trace	O
is	O
,	O
and	O
for	O
a	O
matrix	B-Architecture
it	O
is	O
.	O
</s>
<s>
In	O
the	O
three-dimensional	O
case	O
,	O
the	O
subspace	O
consists	O
of	O
all	O
vectors	O
perpendicular	O
to	O
the	O
rotation	B-General_Concept
axis	O
(	O
the	O
invariant	O
direction	O
,	O
with	O
eigenvalue	O
1	O
)	O
.	O
</s>
<s>
Thus	O
we	O
can	O
extract	O
from	O
any	O
rotation	B-Algorithm
matrix	I-Algorithm
a	O
rotation	B-General_Concept
axis	O
and	O
an	O
angle	O
,	O
and	O
these	O
completely	O
determine	O
the	O
rotation	B-General_Concept
.	O
</s>
<s>
Now	O
consider	O
the	O
first	O
column	O
of	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
</s>
<s>
Shifting	O
attention	O
to	O
the	O
second	O
column	O
,	O
a	O
Givens	O
rotation	B-General_Concept
of	O
the	O
-subspace	O
can	O
now	O
zero	O
the	O
value	O
.	O
</s>
<s>
which	O
is	O
an	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
We	O
conclude	O
that	O
the	O
set	O
of	O
rotation	B-Algorithm
matrices	I-Algorithm
,	O
each	O
of	O
which	O
has	O
entries	O
,	O
can	O
be	O
parameterized	O
by	O
angles	O
.	O
</s>
<s>
In	O
three	O
dimensions	O
this	O
restates	O
in	O
matrix	B-Architecture
form	O
an	O
observation	O
made	O
by	O
Euler	O
,	O
so	O
mathematicians	O
call	O
the	O
ordered	O
sequence	O
of	O
three	O
angles	O
Euler	O
angles	O
.	O
</s>
<s>
suggests	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
</s>
<s>
Each	O
embedding	O
leaves	O
one	O
direction	O
fixed	O
,	O
which	O
in	O
the	O
case	O
of	O
matrices	O
is	O
the	O
rotation	B-General_Concept
axis	O
.	O
</s>
<s>
where	O
,	O
,	O
is	O
a	O
rotation	B-General_Concept
by	O
angle	O
leaving	O
axis	O
fixed	O
.	O
</s>
<s>
Thus	O
it	O
is	O
natural	O
to	O
describe	O
the	O
rotation	B-General_Concept
group	O
as	O
combining	O
and	O
.	O
</s>
<s>
Thus	O
we	O
can	O
build	O
an	O
rotation	B-Algorithm
matrix	I-Algorithm
by	O
starting	O
with	O
a	O
matrix	B-Architecture
,	O
aiming	O
its	O
fixed	O
axis	O
on	O
(	O
the	O
ordinary	O
sphere	O
in	O
three-dimensional	O
space	O
)	O
,	O
aiming	O
the	O
resulting	O
rotation	B-General_Concept
on	O
,	O
and	O
so	O
on	O
up	O
through	O
.	O
</s>
<s>
A	O
point	O
on	O
can	O
be	O
selected	O
using	O
numbers	O
,	O
so	O
we	O
again	O
have	O
numbers	O
to	O
describe	O
any	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
composition	O
of	O
Givens	O
rotations	O
brings	O
the	O
first	O
column	O
(	O
and	O
row	O
)	O
to	O
,	O
so	O
that	O
the	O
remainder	O
of	O
the	O
matrix	B-Architecture
is	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
of	O
dimension	O
one	O
less	O
,	O
embedded	O
so	O
as	O
to	O
leave	O
fixed	O
.	O
</s>
<s>
When	O
an	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
does	O
not	O
include	O
a	O
−1	O
eigenvalue	O
,	O
thus	O
none	O
of	O
the	O
planar	O
rotations	O
which	O
it	O
comprises	O
are	O
180°	O
rotations	O
,	O
then	O
is	O
an	O
invertible	O
matrix	B-Architecture
.	O
</s>
<s>
Most	O
rotation	B-Algorithm
matrices	I-Algorithm
fit	O
this	O
description	O
,	O
and	O
for	O
them	O
it	O
can	O
be	O
shown	O
that	O
is	O
a	O
skew-symmetric	B-Algorithm
matrix	I-Algorithm
,	O
.	O
</s>
<s>
Conveniently	O
,	O
is	O
invertible	O
whenever	O
is	O
skew-symmetric	O
;	O
thus	O
we	O
can	O
recover	O
the	O
original	O
matrix	B-Architecture
using	O
the	O
Cayley	B-Algorithm
transform	I-Algorithm
,	O
</s>
<s>
which	O
maps	O
any	O
skew-symmetric	B-Algorithm
matrix	I-Algorithm
to	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
In	O
fact	O
,	O
aside	O
from	O
the	O
noted	O
exceptions	O
,	O
we	O
can	O
produce	O
any	O
rotation	B-Algorithm
matrix	I-Algorithm
in	O
this	O
way	O
.	O
</s>
<s>
Although	O
in	O
practical	O
applications	O
we	O
can	O
hardly	O
afford	O
to	O
ignore	O
180°	O
rotations	O
,	O
the	O
Cayley	B-Algorithm
transform	I-Algorithm
is	O
still	O
a	O
potentially	O
useful	O
tool	O
,	O
giving	O
a	O
parameterization	O
of	O
most	O
rotation	B-Algorithm
matrices	I-Algorithm
without	O
trigonometric	O
functions	O
.	O
</s>
<s>
If	O
we	O
condense	O
the	O
skew	O
entries	O
into	O
a	O
vector	O
,	O
,	O
then	O
we	O
produce	O
a	O
90°	O
rotation	B-General_Concept
around	O
the	O
-axis	O
for	O
(	O
1	O
,	O
0	O
,	O
0	O
)	O
,	O
around	O
the	O
-axis	O
for	O
(	O
0	O
,	O
1	O
,	O
0	O
)	O
,	O
and	O
around	O
the	O
-axis	O
for	O
(	O
0	O
,	O
0	O
,	O
1	O
)	O
.	O
</s>
<s>
The	O
180°	O
rotations	O
are	O
just	O
out	O
of	O
reach	O
;	O
for	O
,	O
in	O
the	O
limit	O
as	O
,	O
does	O
approach	O
a	O
180°	O
rotation	B-General_Concept
around	O
the	O
axis	O
,	O
and	O
similarly	O
for	O
other	O
directions	O
.	O
</s>
<s>
For	O
the	O
2D	O
case	O
,	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
can	O
be	O
decomposed	O
into	O
three	O
shear	B-Algorithm
matrices	I-Algorithm
(	O
)	O
:	O
</s>
<s>
A	O
rotation	B-General_Concept
can	O
also	O
be	O
written	O
as	O
two	O
shears	O
and	O
scaling	B-Algorithm
(	O
)	O
:	O
</s>
<s>
Below	O
follow	O
some	O
basic	O
facts	O
about	O
the	O
role	O
of	O
the	O
collection	O
of	O
all	O
rotation	B-Algorithm
matrices	I-Algorithm
of	O
a	O
fixed	O
dimension	O
(	O
here	O
mostly	O
3	O
)	O
in	O
mathematics	O
and	O
particularly	O
in	O
physics	O
where	O
rotational	O
symmetry	O
is	O
a	O
requirement	O
of	O
every	O
truly	O
fundamental	O
law	O
(	O
due	O
to	O
the	O
assumption	O
of	O
isotropy	O
of	O
space	O
)	O
,	O
and	O
where	O
the	O
same	O
symmetry	O
,	O
when	O
present	O
,	O
is	O
a	O
simplifying	O
property	O
of	O
many	O
problems	O
of	O
less	O
fundamental	O
nature	O
.	O
</s>
<s>
Their	O
role	O
in	O
the	O
group	O
theory	O
of	O
the	O
rotation	B-General_Concept
groups	O
is	O
that	O
of	O
being	O
a	O
representation	O
space	O
for	O
the	O
entire	O
set	O
of	O
finite-dimensional	O
irreducible	O
representations	O
of	O
the	O
rotation	B-General_Concept
group	O
SO(3 )	O
.	O
</s>
<s>
For	O
this	O
topic	O
,	O
see	O
Rotation	B-General_Concept
group	O
SO(3 )	O
§	O
Spherical	O
harmonics	O
.	O
</s>
<s>
The	O
rotation	B-Algorithm
matrices	I-Algorithm
for	O
each	O
form	O
a	O
group	O
,	O
the	O
special	O
orthogonal	O
group	O
,	O
.	O
</s>
<s>
This	O
algebraic	O
structure	O
is	O
coupled	O
with	O
a	O
topological	O
structure	O
inherited	O
from	O
in	O
such	O
a	O
way	O
that	O
the	O
operations	O
of	O
multiplication	O
and	O
taking	O
the	O
inverse	O
are	O
analytic	B-Language
functions	I-Language
of	O
the	O
matrix	B-Architecture
entries	O
.	O
</s>
<s>
and	O
is	O
the	O
space	O
of	O
skew-symmetric	B-Algorithm
matrices	I-Algorithm
of	O
dimension	O
,	O
see	O
classical	O
group	O
,	O
where	O
is	O
the	O
Lie	O
algebra	O
of	O
,	O
the	O
orthogonal	O
group	O
.	O
</s>
<s>
Connecting	O
the	O
Lie	O
algebra	O
to	O
the	O
Lie	O
group	O
is	O
the	O
exponential	O
map	O
,	O
which	O
is	O
defined	O
using	O
the	O
standard	O
matrix	B-Architecture
exponential	O
series	O
for	O
For	O
any	O
skew-symmetric	B-Algorithm
matrix	I-Algorithm
,	O
is	O
always	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
In	O
rotation	B-General_Concept
group	O
SO(3 )	O
,	O
it	O
is	O
shown	O
that	O
one	O
can	O
identify	O
every	O
with	O
an	O
Euler	O
vector	O
,	O
where	O
is	O
a	O
unit	O
magnitude	O
vector	O
.	O
</s>
<s>
By	O
the	O
properties	O
of	O
the	O
identification	O
,	O
is	O
in	O
the	O
null	B-Algorithm
space	I-Algorithm
of	O
.	O
</s>
<s>
Thus	O
,	O
is	O
left	O
invariant	O
by	O
and	O
is	O
hence	O
a	O
rotation	B-General_Concept
axis	O
.	O
</s>
<s>
According	O
to	O
Rodrigues	O
 '	O
rotation	B-General_Concept
formula	O
on	O
matrix	B-Architecture
form	O
,	O
one	O
obtains	O
,	O
</s>
<s>
This	O
is	O
the	O
matrix	B-Architecture
for	O
a	O
rotation	B-General_Concept
around	O
axis	O
by	O
the	O
angle	O
.	O
</s>
<s>
The	O
Lie	O
group	O
of	O
rotation	B-Algorithm
matrices	I-Algorithm
,	O
,	O
is	O
not	O
simply	O
connected	O
,	O
so	O
Lie	O
theory	O
tells	O
us	O
it	O
is	O
a	O
homomorphic	O
image	O
of	O
a	O
universal	O
covering	O
group	O
.	O
</s>
<s>
Every	O
rotation	B-Algorithm
matrix	I-Algorithm
is	O
produced	O
by	O
a	O
countable	O
infinity	O
of	O
angles	O
,	O
separated	O
by	O
integer	O
multiples	O
of	O
2	O
.	O
</s>
<s>
Every	O
rotation	B-Algorithm
matrix	I-Algorithm
is	O
produced	O
by	O
two	O
opposite	O
points	O
on	O
the	O
sphere	O
.	O
</s>
<s>
We	O
can	O
also	O
describe	O
Spin(3 )	O
as	O
isomorphic	O
to	O
quaternions	O
of	O
unit	O
norm	O
under	O
multiplication	O
,	O
or	O
to	O
certain	O
real	B-Architecture
matrices	I-Architecture
,	O
or	O
to	O
complex	O
special	O
unitary	O
matrices	O
,	O
namely	O
SU(2 )	O
.	O
</s>
<s>
It	O
can	O
be	O
exponentiated	O
in	O
the	O
usual	O
way	O
to	O
give	O
rise	O
to	O
a	O
representation	O
,	O
also	O
known	O
as	O
projective	O
representation	O
of	O
the	O
rotation	B-General_Concept
group	O
.	O
</s>
<s>
The	O
matrices	O
in	O
the	O
Lie	O
algebra	O
are	O
not	O
themselves	O
rotations	O
;	O
the	O
skew-symmetric	B-Algorithm
matrices	I-Algorithm
are	O
derivatives	O
,	O
proportional	O
differences	O
of	O
rotations	O
.	O
</s>
<s>
With	O
these	O
rules	O
,	O
these	O
matrices	O
do	O
not	O
satisfy	O
all	O
the	O
same	O
properties	O
as	O
ordinary	O
finite	O
rotation	B-Algorithm
matrices	I-Algorithm
under	O
the	O
usual	O
treatment	O
of	O
infinitesimals	O
.	O
</s>
<s>
In	O
all	O
these	O
cases	O
we	O
can	O
either	O
decompose	O
a	O
matrix	B-Architecture
or	O
construct	O
one	O
.	O
</s>
<s>
We	O
have	O
also	O
given	O
special	O
attention	O
to	O
rotation	B-Algorithm
matrices	I-Algorithm
,	O
and	O
these	O
warrant	O
further	O
attention	O
,	O
in	O
both	O
directions	O
.	O
</s>
<s>
Now	O
every	O
quaternion	O
component	O
appears	O
multiplied	O
by	O
two	O
in	O
a	O
term	O
of	O
degree	O
two	O
,	O
and	O
if	O
all	O
such	O
terms	O
are	O
zero	O
what	O
is	O
left	O
is	O
an	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
This	O
leads	O
to	O
an	O
efficient	O
,	O
robust	O
conversion	O
from	O
any	O
quaternion	O
–	O
whether	O
unit	O
or	O
non-unit	O
–	O
to	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
Freed	O
from	O
the	O
demand	O
for	O
a	O
unit	O
quaternion	O
,	O
we	O
find	O
that	O
nonzero	O
quaternions	O
act	O
as	O
homogeneous	O
coordinates	O
for	O
rotation	B-Algorithm
matrices	I-Algorithm
.	O
</s>
<s>
The	O
Cayley	B-Algorithm
transform	I-Algorithm
,	O
discussed	O
earlier	O
,	O
is	O
obtained	O
by	O
scaling	B-Algorithm
the	O
quaternion	O
so	O
that	O
its	O
component	O
is	O
1	O
.	O
</s>
<s>
For	O
a	O
180°	O
rotation	B-General_Concept
around	O
any	O
axis	O
,	O
will	O
be	O
zero	O
,	O
which	O
explains	O
the	O
Cayley	O
limitation	O
.	O
</s>
<s>
Thus	O
we	O
can	O
write	O
the	O
trace	O
itself	O
as	O
;	O
and	O
from	O
the	O
previous	O
version	O
of	O
the	O
matrix	B-Architecture
we	O
see	O
that	O
the	O
diagonal	O
entries	O
themselves	O
have	O
the	O
same	O
form	O
:	O
,	O
,	O
and	O
.	O
</s>
<s>
So	O
we	O
can	O
easily	O
compare	O
the	O
magnitudes	O
of	O
all	O
four	O
quaternion	O
components	O
using	O
the	O
matrix	B-Architecture
diagonal	O
.	O
</s>
<s>
In	O
that	O
case	O
,	O
suppose	O
is	O
the	O
largest	O
diagonal	O
entry	O
,	O
so	O
will	O
have	O
the	O
largest	O
magnitude	O
(	O
the	O
other	O
cases	O
are	O
derived	O
by	O
cyclic	O
permutation	B-Algorithm
)	O
;	O
then	O
the	O
following	O
is	O
safe	O
.	O
</s>
<s>
If	O
the	O
matrix	B-Architecture
contains	O
significant	O
error	O
,	O
such	O
as	O
accumulated	O
numerical	O
error	O
,	O
we	O
may	O
construct	O
a	O
symmetric	O
matrix	B-Architecture
,	O
</s>
<s>
(	O
If	O
is	O
truly	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
that	O
value	O
will	O
be	O
1	O
.	O
)	O
</s>
<s>
The	O
quaternion	O
so	O
obtained	O
will	O
correspond	O
to	O
the	O
rotation	B-Algorithm
matrix	I-Algorithm
closest	O
to	O
the	O
given	O
matrix	B-Architecture
(	O
Note	O
:	O
formulation	O
of	O
the	O
cited	O
article	O
is	O
post-multiplied	O
,	O
works	O
with	O
row	O
vectors	O
)	O
.	O
</s>
<s>
If	O
the	O
matrix	B-Architecture
is	O
nonsingular	O
,	O
its	O
columns	O
are	O
linearly	O
independent	O
vectors	O
;	O
thus	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
can	O
adjust	O
them	O
to	O
be	O
an	O
orthonormal	O
basis	O
.	O
</s>
<s>
Stated	O
in	O
terms	O
of	O
numerical	O
linear	B-Language
algebra	I-Language
,	O
we	O
convert	O
to	O
an	O
orthogonal	B-Algorithm
matrix	I-Algorithm
,	O
,	O
using	O
QR	O
decomposition	O
.	O
</s>
<s>
To	O
measure	O
closeness	O
,	O
we	O
may	O
use	O
any	O
matrix	B-Architecture
norm	O
invariant	O
under	O
orthogonal	O
transformations	O
.	O
</s>
<s>
Though	O
written	O
in	O
matrix	B-Architecture
terms	O
,	O
the	O
objective	O
function	O
is	O
just	O
a	O
quadratic	O
polynomial	O
.	O
</s>
<s>
For	O
a	O
matrix	B-Architecture
,	O
the	O
orthogonality	O
constraint	O
implies	O
six	O
scalar	O
equalities	O
that	O
the	O
entries	O
of	O
must	O
satisfy	O
.	O
</s>
<s>
To	O
incorporate	O
the	O
constraint(s )	O
,	O
we	O
may	O
employ	O
a	O
standard	O
technique	O
,	O
Lagrange	O
multipliers	O
,	O
assembled	O
as	O
a	O
symmetric	O
matrix	B-Architecture
,	O
.	O
</s>
<s>
Taking	O
the	O
derivative	O
with	O
respect	O
to	O
,	O
,	O
,	O
in	O
turn	O
,	O
we	O
assemble	O
a	O
matrix	B-Architecture
.	O
</s>
<s>
To	O
ensure	O
a	O
minimum	O
,	O
the	O
matrix	B-Architecture
(	O
and	O
hence	O
)	O
must	O
be	O
positive	O
definite	O
.	O
</s>
<s>
Linear	B-Language
algebra	I-Language
calls	O
the	O
polar	O
decomposition	O
of	O
,	O
with	O
the	O
positive	O
square	O
root	O
of	O
.	O
</s>
<s>
That	O
is	O
,	O
is	O
only	O
guaranteed	O
to	O
be	O
orthogonal	O
,	O
not	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
This	O
is	O
unavoidable	O
;	O
an	O
with	O
negative	O
determinant	O
has	O
no	O
uniquely	O
defined	O
closest	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
To	O
efficiently	O
construct	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
from	O
an	O
angle	O
and	O
a	O
unit	O
axis	O
,	O
we	O
can	O
take	O
advantage	O
of	O
symmetry	O
and	O
skew-symmetry	B-Algorithm
within	O
the	O
entries	O
.	O
</s>
<s>
Determining	O
an	O
axis	O
and	O
angle	O
,	O
like	O
determining	O
a	O
quaternion	O
,	O
is	O
only	O
possible	O
up	O
to	O
the	O
sign	O
;	O
that	O
is	O
,	O
and	O
correspond	O
to	O
the	O
same	O
rotation	B-Algorithm
matrix	I-Algorithm
,	O
just	O
like	O
and	O
.	O
</s>
<s>
When	O
the	O
angle	O
is	O
180°	O
,	O
the	O
matrix	B-Architecture
becomes	O
symmetric	O
,	O
which	O
has	O
implications	O
in	O
extracting	O
the	O
axis	O
.	O
</s>
<s>
A	O
fully	O
robust	O
approach	O
will	O
use	O
a	O
different	O
algorithm	O
when	O
,	O
the	O
trace	O
of	O
the	O
matrix	B-Architecture
,	O
is	O
negative	O
,	O
as	O
with	O
quaternion	O
extraction	O
.	O
</s>
<s>
When	O
is	O
zero	O
because	O
the	O
angle	O
is	O
zero	O
,	O
an	O
axis	O
must	O
be	O
provided	O
from	O
some	O
source	O
other	O
than	O
the	O
matrix	B-Architecture
.	O
</s>
<s>
Among	O
all	O
permutations	B-Algorithm
of	O
,	O
only	O
two	O
place	O
that	O
axis	O
first	O
;	O
one	O
is	O
an	O
even	O
permutation	B-Algorithm
and	O
the	O
other	O
odd	O
.	O
</s>
<s>
This	O
is	O
enough	O
to	O
construct	O
a	O
matrix	B-Architecture
from	O
angles	O
,	O
but	O
triples	O
differing	O
in	O
many	O
ways	O
can	O
give	O
the	O
same	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
problem	O
of	O
singular	O
alignment	O
,	O
the	O
mathematical	O
analog	O
of	O
physical	O
gimbal	O
lock	O
,	O
occurs	O
when	O
the	O
middle	O
rotation	B-General_Concept
aligns	O
the	O
axes	O
of	O
the	O
first	O
and	O
last	O
rotations	O
.	O
</s>
<s>
These	O
singularities	O
are	O
not	O
characteristic	O
of	O
the	O
rotation	B-Algorithm
matrix	I-Algorithm
as	O
such	O
,	O
and	O
only	O
occur	O
with	O
the	O
usage	O
of	O
Euler	O
angles	O
.	O
</s>
<s>
The	O
singularities	O
are	O
avoided	O
when	O
considering	O
and	O
manipulating	O
the	O
rotation	B-Algorithm
matrix	I-Algorithm
as	O
orthonormal	O
row	O
vectors	O
(	O
in	O
3D	O
applications	O
often	O
named	O
the	O
right-vector	O
,	O
up-vector	O
and	O
out-vector	O
)	O
instead	O
of	O
as	O
angles	O
.	O
</s>
<s>
In	O
some	O
instances	O
it	O
is	O
interesting	O
to	O
describe	O
a	O
rotation	B-General_Concept
by	O
specifying	O
how	O
a	O
vector	O
is	O
mapped	O
into	O
another	O
through	O
the	O
shortest	O
path	O
(	O
smallest	O
angle	O
)	O
.	O
</s>
<s>
In	O
this	O
completely	O
describes	O
the	O
associated	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
We	O
sometimes	O
need	O
to	O
generate	O
a	O
uniformly	O
distributed	O
random	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
It	O
seems	O
intuitively	O
clear	O
in	O
two	O
dimensions	O
that	O
this	O
means	O
the	O
rotation	B-General_Concept
angle	O
is	O
uniformly	O
distributed	O
between	O
0	O
and	O
2	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
we	O
decompose	O
rotation	B-Algorithm
matrices	I-Algorithm
in	O
axis	O
–	O
angle	O
form	O
,	O
the	O
angle	O
should	O
not	O
be	O
uniformly	O
distributed	O
;	O
the	O
probability	O
that	O
(	O
the	O
magnitude	O
of	O
)	O
the	O
angle	O
is	O
at	O
most	O
should	O
be	O
,	O
for	O
.	O
</s>
<s>
Since	O
is	O
a	O
connected	O
and	O
locally	O
compact	O
Lie	O
group	O
,	O
we	O
have	O
a	O
simple	O
standard	O
criterion	O
for	O
uniformity	O
,	O
namely	O
that	O
the	O
distribution	O
be	O
unchanged	O
when	O
composed	O
with	O
any	O
arbitrary	O
rotation	B-General_Concept
(	O
a	O
Lie	O
group	O
"	O
translation	B-Algorithm
"	O
)	O
.	O
</s>
<s>
show	O
how	O
to	O
use	O
the	O
Cayley	B-Algorithm
transform	I-Algorithm
to	O
generate	O
and	O
test	O
matrices	O
according	O
to	O
this	O
criterion	O
.	O
</s>
<s>
Generate	O
a	O
uniform	O
angle	O
and	O
construct	O
a	O
rotation	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
To	O
step	O
from	O
to	O
,	O
generate	O
a	O
vector	O
uniformly	O
distributed	O
on	O
the	O
-sphere	O
,	O
embed	O
the	O
matrix	B-Architecture
in	O
the	O
next	O
larger	O
size	O
with	O
last	O
column	O
,	O
and	O
rotate	O
the	O
larger	O
matrix	B-Architecture
so	O
the	O
last	O
column	O
becomes	O
.	O
</s>
<s>
takes	O
advantage	O
of	O
the	O
odd	O
dimension	O
to	O
change	O
a	O
Householder	B-Algorithm
reflection	I-Algorithm
to	O
a	O
rotation	B-General_Concept
by	O
negation	O
,	O
and	O
uses	O
that	O
to	O
aim	O
the	O
axis	O
of	O
a	O
uniform	O
planar	O
rotation	B-General_Concept
.	O
</s>
<s>
Multiplication	O
of	O
rotation	B-Algorithm
matrices	I-Algorithm
is	O
homomorphic	O
to	O
multiplication	O
of	O
quaternions	O
,	O
and	O
multiplication	O
by	O
a	O
unit	O
quaternion	O
rotates	O
the	O
unit	O
sphere	O
.	O
</s>
<s>
Normalize	O
its	O
length	O
and	O
you	O
have	O
a	O
uniformly	O
sampled	O
random	O
unit	O
quaternion	O
which	O
represents	O
a	O
uniformly	O
sampled	O
random	O
rotation	B-General_Concept
.	O
</s>
