# RotationMatrix

gives the 2D rotation matrix that rotates 2D vectors counterclockwise by θ radians.

RotationMatrix[θ,w]

gives the 3D rotation matrix for a counterclockwise rotation around the 3D vector w.

RotationMatrix[{u,v}]

gives the matrix that rotates the vector u to the direction of the vector v in any dimension.

RotationMatrix[θ,{u,v}]

gives the matrix that rotates by θ radians in the plane spanned by u and v.

# Details • RotationMatrix gives matrices for rotations of vectors around the origin.
• Two different conventions for rotation matrices are in common use.
• RotationMatrix is set up to use the vector-oriented convention and to give a matrix m so that m.r yields the rotated version of a vector r.
• Transpose[RotationMatrix[]] gives rotation matrices with the alternative coordinate-system-oriented convention for which r.m yields the rotated version of a vector r.
• Angles in RotationMatrix are in radians. or θ° specifies an angle in degrees.
• Positive θ in RotationMatrix[θ,{u,v}] corresponds to going from the direction of u towards the direction of v.
• is equivalent to RotationMatrix[θ,{{1,0},{0,1}}].
• RotationMatrix[θ,w] is equivalent to RotationMatrix[θ,{u,v}], where uw, vw, and u,v,w form a right-handed coordinate system.
• RotationMatrix gives an orthogonal matrix of determinant 1, that in dimensions can be considered an element of the group .

# Examples

open all close all

## Basic Examples(4)

General 2D rotation matrix for rotating a vector about the origin:

 In:= Out//MatrixForm= Apply rotation by to a unit vector in the direction:

 In:= Out= Counterclockwise rotation by 30°:

 In:= Out= Rotation that transforms the direction of {1,1} into the direction of {0,1}:

 In:= Out= 3D rotation around the axis:

 In:= Out//MatrixForm= ## Neat Examples(1)

Introduced in 2007
(6.0)