Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Determining axis of rotation

  1. Sep 24, 2011 #1
    Given the matrix of rotation, what is the procedure to determine the axis of rotation ?

    Is there a set mathematical way to do it (like a formula), or is it something that you need to
    think about logically ?
  2. jcsd
  3. Sep 24, 2011 #2


    User Avatar
    Science Advisor
    Homework Helper

    If A is a rotation matrix and v is along the axis of rotation, then what should Av be?
    What is the mathematical name for this property?
  4. Sep 24, 2011 #3
    Okay, from a non-mathematical reasoning, would Av be the rotation of v ?

    The name of this property is mapping/transformation ?

    Im guessing that we can use eigenvalues and eigenvectors to be able to determine v
  5. Sep 24, 2011 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    I assume you are talking about a 3x3 matrix rather than some arbitrary NxN matrix. The three dimensional space R3 is the only space in which you can legitimately talk about an "axis of rotation". For R2, the "axis of rotation" isn't in the space, rotation is rather weird for R4, weirder yet for R5 and higher.

    To start, look at the reverse situation. Given a rotation by an angle [itex]\phi[/itex] about an axis [itex]\hat{\mathbf u}[/itex], the [j] element of the transformation matrix is given by

    T_{ij} =
    \cos\phi\,\delta_{ij} +
    (1-\cos\phi)\,\hat u_i \hat u_j +
    \epsilon_{ijk}\sin\phi\,\hat u_k
    where [itex]\delta_{ij}[/itex] is the Kronecker delta, [itex]k \equiv i+j \bmod 3[/itex], and [itex]\epsilon_{ijk}[/itex] is the Levi-Civita symbol.

    The problem is to find the inverse of this: Given a transformation matrix [itex]\boldsymbol T[/itex], solve for [itex]\phi[/itex] and [itex]\hat{\mathbf u}[/itex] given a transformation matrix [itex]\boldsymbol T[/itex]. I'll call this phi and uhat the eigen rotation.

    There are several alternate expressions for computing the eigen rotation from a transformation matrix, all of which are equivalent in infinite precision arithmetic. The use of finite precision arithmetic means that care must be taken in choosing the algorithm to be used. The starting point is the above equation that takes us from phi and uhat to a transformation matrix.

    From this, the trace of the matrix and the difference between and sum of pairs of off-diagonal elements are

    \mathrm{tr}(T) &= 2\cos\phi + 1 \\
    T_{ij}-T_{ji} &= 2\epsilon_{ijk}\sin\phi\,\hat u_k \\
    T_{ij}+T_{ji} &= 2(1-\cos\phi)\,\hat u_i \hat u_j

    Method 1
    One approach to determining the eigen rotation involves the construction of a vector of differences between pairs of off-diagonal elements of the transformation matrix,

    [tex]d_k \equiv T_{ij}-T_{ji} = 2 \sin\phi\,\hat u_k[/tex]

    where (i,j,k) is an even permutation of (0,1,2). With this,

    \sin\phi &= \frac{||\mathbf d||} 2 \\ \\
    \hat{\mathbf u} &= \frac{\mathbf d}{||\mathbf d||}

    Note that in the above, the use of the inverse sine will restrict the rotation angle to be between 0 and 90 degrees. Special processing is needed when the rotation angle is between 90 and 180 degrees. Note also that the symmetric difference vector will be identically zero if the rotation angle is 0 or 180 degrees and will be very small for rotation angles close to 0 or 180 degrees.

    The precision loss for rotation angles near 0 and 180 degrees means the individual components of the eigen axis will not be as precise with this approach compared to alternatives.

    Method 2
    The diagonal elements of the matrix yields another method for determining the eigen angle and eigen axis:

    \phi &=\arccos\left(\frac{\mathrm{tr}(T)-1} 2\right) \\
    |\hat u_i| &= \sqrt{\frac{T_{ii} - \cos \phi}{1-\cos\phi}}

    Note that this approach determines the magnitudes but not the signs of the components of the eigen axis vector. Because this method is based on the inverse cosine, the calculated phi angle will be less precise than that obtained by method 1 for angles near 0 or 180 degrees. The component of the unit vector however will be more accurate than that obtained from method 1 in the case of large [itex]T_{ii}[/itex].

    Method 3
    Yet another alternative for computing components of the eigen axis is to use the sum of pairs of off-diagonal elements of the transformation matrix,

    T_{ij}+T_{ji} &=2(1-\cos\phi)\,\hat u_i \hat u_j \\
    T_{ik}+T_{ki} &=2(1-\cos\phi)\,\hat u_i \hat u_k

    This enables the calculation of two components of the unit vector. One component needs to be computed by one of the two previous methods.

    How to apply these techniques?
    The above techniques provide two ways to compute the rotation angle, three to compute the rotation axis. Which is best depends on the angle. There are four cases.

    Case 1: The trivial rotation, rotation angle = 0.
    The rotation axis is ill-defined in the the case of an identity matrix. This case is evidenced by [itex]\sin\phi = 0, \cos\phi > 0[/itex]. Set the rotation angle to zero and pick an arbitrary axis.

    Case 2: Rotation angle between 0 and 45 degrees (exclusive).
    This case is evidenced by [itex]-\cos\phi < \sin\phi < \cos\phi[/itex]. Here method #1 provides the best accuracy for both the rotation angle and the rotation axis.

    Case 3: Rotation angle between 45 and 135 degrees (inclusive).
    This case is evidenced by [itex]\sin\phi \ge |\cos\phi|[/itex]. Here method #2 provides the best accuracy for the rotation angle but method #1 is still the best (most accurate) approach for determining the rotation axis.

    Case 4: Rotation angle greater than 135 degrees.
    Here the sine will once again provide better accuracy than does cosine, but you can't just use inverse sine. Instead use [itex]\phi = \pi - \arcsin(\sin\phi)[/itex]. The rotation axis is a bit of a bear in this case. A combination of all three methods is needed. Method #2 provides the best accuracy for the component corresponding to the largest diagonal element, but method #2 is ambiguous regarding sign. Method #1, while inaccurate, is good enough to indicate the sign of this component. (Note: If method #1 says the component is zero we're at a 180 degree rotation. Pick any sign. The direction is arbitrary here.) Now use method #3 to determine the other two components.
    Last edited: Sep 24, 2011
  6. Sep 24, 2011 #5


    User Avatar
    Science Advisor
    Homework Helper

    Yep, that's what I meant by the notation Av, but that's not really what I tried to ask :)
    What I meant is: what do you get when you apply the rotation to a vector along the rotation axis?

    Is that guess based on anything rational? :)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook