Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. **There will be no changes to other Yahoo properties or services, or your Yahoo account.** You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

# Derive the rotation matrix R that represents the rotation about a line by an angle A?

Assume that the line L is given in parametric form as (x,y,z) = r0 + t d, where r0 = (x0, y0, z0), and

d = (dx, dy, dz) is the direction vector of the line. The rotation affects any point in space (x, y, z)

and rotates it about the line L by an angle A, in a right hand sense i.e. if the thumb points along the direction vector d, then the fingers indicate the direction of rotation. You may assume that the vector d is a unit vector.

### 1 Answer

- IndicaLv 77 years agoFavorite Answer
*edited after reflection

This can be tackled by by calculating the product of 5 separate rotation matrices based on angles. Two to align one axis with L, one to effect a plane rotation about L and then two inverses to restore original axes. However, calculating the elements of the overall rotation matrix is not exciting and result seems without form. This way uses vectors and gives an explicit expression for R.

WLOG we can set r₀=0 and do translation at end. Let n be a unit vector such that d•n=0

Establish orthonormal axes OX,OY,OZ where OZ=d, OX=n and OY=dXn=m

Set n=k(d₂,−d₁,0), m=k( d₁d₃, d₂d₃,−k⁻² ) with k=1/√(1−d₃²) but use later … (i)

The vector coords of P(=(x,y,z)=r) in XYZ system are ( n•r, m•r, d•r )

After a RH rotation A of P in the XY plane, these become

( (n•r)cosA−(m•r)sinA, (n•r)sinA+(m•r)cosA, d•r )

In original coords this rotated point is r’ where

r’ = (x’,y’,z’) = {(n•r)cosA−(m•r)sinA}n + {(n•r)sinA+(m•r)cosA}m + {d•r}d

To transform to matrix form Rr use (p•r)q = (pᵀr)q = q(pᵀr) = (qpᵀ)r on each term

This gives R = (nnᵀ+mmᵀ)cosA + (−nmᵀ+mnᵀ)sinA + ddᵀ

Using (i) the last row of R is {−d₃d₁−d₃d₂,1−d₃² }cosA + {−d₂,d₁,0}sinA + d₃dᵀ

Because R is unique and X or Y axis could have been aligned with L instead, R should be independent of n like the row above and I claim that because d•n=0 so then

nnᵀ+mmᵀ = { {1−d₁²,−d₁d₂,−d₁d₃}, {−d₂d₁,1−d₂²,−d₂d₃}, {−d₃d₁,−d₃d₂,1−d₃²} } = I−ddᵀ

Likewise −nmᵀ+mnᵀ = { {0,−d₃,d₂}, {d₃,0,−d₁}, {−d₂,d₁,0} } and call this matrix K

So R = (I−ddᵀ)cosA + KsinA + ddᵀ

This result gives the right answers for d=i,j or k.

With this matrix the coordinates of the rotated point are r₀ + R(r−r₀)