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

Rotating vectors and matrices

  1. Jul 9, 2008 #1
    I want to find the rotations needed to rotate one unit vector into another unit vector and then use these rotations to rotate a 3x3 matrix.

    For example: I want to determine the rotations needed to rotate [1 0 0] into [-0.342, -0.938, 0.0566] and apply the same rotation to the matrix [tex]M[/tex] =

    (1 0 0)
    (0 2 0)
    (0 0 3)

    The way I've thought of doing this is to:

    1. Rotate [1 0 0] about the z-axis by the angle arctan( [tex]\frac{0.938}{0.342}[/tex] ) to get [-0.3425 -0.9395 0]. Apply the same rotation to [tex]M[/tex].
    2. Take the cross product between [-0.3425 -0.9395 0] and [-0.342 -0.938 0.0566] to get a new axis of rotation [tex]\hat{r}[/tex].
    3. The new angle of rotation should be [tex]\hat{\theta}[/tex] = arctan([tex]\frac{0.0566}{\sqrt{0.3425^{2} + 0.9395^{2}}}[/tex]).
    4. Apply Rodriguez's rotation formula by [tex]\hat{\theta}[/tex] about [tex]\hat{r}[/tex] to [tex]M[/tex]

    I hope it's clear what I'm trying to do. If anyone can confirm that I'm doing this correctly, or come up with a better way of doing this, I'd very much appreciate it.

  2. jcsd
  3. Jul 12, 2008 #2
    Hello and welcome to PF!
    To rotate one vector into another one, you
    need only a single rotation in the plane containing the two vectors.
    Here is a general method of finding such a single rotation.

    The angle of rotation is a
    bivector whose direction specifies the plane of rotation and whose
    magnitude specifies how much to rotate.

    Let [tex] a [/tex] and [tex] b [/tex] be two unit vectors in 3D space.
    Since any unit vector multiplied by itself is just equal to the
    square of its magnitude, [tex] a^2=b^2=1 [/tex] , so it follows that
    a = ab^2 = (ab) b = (a \cdot b + a \wedge b) b.
    i.e. the geometric product [tex] ab [/tex] rotates the vector [tex] b [/tex]
    into the vector [tex] a [/tex] . The product may be written in terms of the
    angle of rotation, the bivector [tex] \mathbf A [/tex] .
    Write [tex] {\mathbf A} = \mid {\mathbf A} \mid \widehat{\mathbf A} [/tex] , where
    [tex] \mid {\mathbf A}\mid [/tex] is the magnitude of the
    rotation angle and [tex] \widehat{\mathbf A} [/tex] is the unit
    bivector specifying the plane of rotation. Using the fact that
    [tex] \widehat{\mathbf A}^2 = -1 [/tex] , the product can be expressed as
    ab = e^{\mathbf A}= \cos{\mathbf A} + \sin{\mathbf A}.
    ab = \cos{\theta} + \widehat{\mathbf A } \sin{\theta}.
    It only remains to identify the scalar and bivector parts of this with
    [tex] a\cdot b [/tex] and [tex] a\wedge b [/tex] (which you know) in order
    to get the sine and cosine of the rotation angle and the plane of

    Any vector in the rotation plane, [tex] \widehat{\mathbf A} [/tex],
    may therefore be rotated through the angle [tex] \theta [/tex] by
    pre-multiplying it with the geometric product [tex] ab [/tex] . Any
    vector perpendicular to this plane remains unaltered by this
    multiplication; hence, to rotate some arbitrary vector [tex] x [/tex] in the same
    way that you rotated the vector [tex] b [/tex] , you must first find
    its components parallel and perpendicular to the plane of rotation:
    [tex] x = x_\parallel + x_\perp
    The rotated vector is then
    [tex] x' = x_\perp + ab x_\parallel [/tex] .
    You can get the two components from
    [tex] x_\parallel = (x\cdot \widehat{\mathbf A})\widehat{\mathbf A}^{-1}
    [tex] x_\perp = (x\wedge \widehat{\mathbf A})\widehat{\mathbf A}^{-1}
    [/tex] .

    There is an alternative way to rotate an arbitrary vector. Let
    R = \cos{\theta/2} + \widehat{\mathbf A} \sin{\theta/2}
    R^\dagger = \cos{\theta/2} - \widehat{\mathbf A } \sin{\theta/2}
    The rotated vector is then
    [tex] x' = R^\dagger x R
    [/tex] .

    That's it, but it may be useful to spell this out somewhat. Let
    [tex] {e_1,e_2,e_3} [/tex] be a set of orthonormal vectors spanning the
    space. These have the properties [tex] e_i^2=1 [/tex]
    and [tex] e_i e_j = -e_j e_i [/tex] . The unit vectors defining the rotation
    are then
    a = a_1e_1 + a_2e_2 + a_3e_3
    b = b_1e_1 + b_2e_2 + b_3e_3
    The dot product and wedge products are
    a\cdot b = a_1b_1 + a_2b_2 + a_3b_3 = \cos{\theta}
    a\wedge b = {\mathbf A} = A_3 e_1e_2 + A_1 e_2e_3 + A_2 e_3e_1
    where [tex] A_3=a_1b_2 - a_2b_1 [/tex] , with similar expressions for
    [tex] A_1 [/tex] and [tex] A_2 [/tex] . The magnitude of the bivector
    [tex] \mathbf A [/tex] is
    [tex] \mid {\mathbf A} \mid = \sqrt{A_1^2+A_2^2 + A_3^2}=\sin{\theta} [/tex]
    and the unit plane of rotation is
    \widehat{\mathbf A}= {\mathbf A} / \sin{\theta}.
    This should be enough to get you started.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook