# Deriving the Matrix for a 3 dimensional rotation

• ForceBoy
In summary: It will make more sense if you start with the vector in Cartesian coordinates and convert it to polar coordinates.
ForceBoy

## Homework Statement

[/B]
The problem consists of deriving the matrix for a 3 dimensional rotation.

My approach consisted of constructing an arbitrary vector and rewriting this vector in terms of its magnitude and the angles which define it. Then I increased the angles by some amount each. I would expand the equations then simplify.

My problem comes towards the end of the derivation where I encounter an expression which I don't know how to simplify in a way that will make everything come out nicely and in a way that is useful.

## Homework Equations

The arbitrary vector is as follows:

## \vec v = \begin{pmatrix}x \\ y \\ z \end{pmatrix} = r \begin{pmatrix} \cos \theta \cos \alpha \\ \cos \theta \sin \alpha \\ \sin \theta \end{pmatrix}##

where ## r ## is the magnitude of the vector, ## \theta## the angle the vector forms with the ##\text{xy-plane}## and ## \alpha## the angle the xy projection of the vector forms with the x axis.

The angle addition identities will also be used

## The Attempt at a Solution

[/B]
Before the rotation transformation the vector is:

## \vec v = \begin{pmatrix}x \\ y \\ z \end{pmatrix} = r \begin{pmatrix} \cos \theta \cos \alpha \\ \cos \theta \sin \alpha \\ \sin \theta \end{pmatrix}##

After the transformation has been applied:

## \vec v' = \begin{pmatrix}x' \\ y' \\ z' \end{pmatrix} = r \begin{pmatrix} \cos (\theta+ \phi) \cos (\alpha + \beta) \\ \cos (\theta + \phi) \sin (\alpha + \beta) \\ \sin (\theta+\phi) \end{pmatrix}##

Expanding the trig functions:

## \vec v' = r \begin{pmatrix} (\cos \theta \cos \phi - \sin \theta \sin \phi)(\cos \alpha \cos \beta - \sin \alpha \sin\beta) \\ (\cos \theta \cos \phi - \sin \theta \sin \phi)(\sin \alpha \cos \beta + \sin \beta \cos \alpha) \\ \sin \theta \cos \phi +\sin \phi \cos \theta \end{pmatrix} ##

Foiling out the binomials:

##\vec v' = r \begin{pmatrix} \cos \theta \cos \phi \cos \alpha \cos \beta - \cos \theta \cos \phi \sin \alpha \sin \beta - \sin \theta \sin \phi \cos \alpha \cos \beta + \sin \theta \sin \phi \sin \alpha \sin\beta \\ \cos \theta \cos \phi \sin \alpha \cos \beta + \cos \theta \cos \phi \sin \beta \cos \alpha - \sin \theta \sin \phi \sin \alpha \cos \beta - \sin \theta \sin \phi \sin \beta \cos \alpha \\ \sin \theta \cos \phi + \sin \phi \cos \theta \end{pmatrix} ##

Distributing the ## r ## and simplifying:

##\vec v' = \begin{pmatrix} x \cos \phi \cos \beta - y \cos \phi \sin\beta - z \sin \phi (cos \alpha cos \beta + \sin \alpha \sin\beta) \\ y \cos \phi \cos \beta + x \cos \phi \sin \beta - z \sin \phi (\sin \alpha \cos \beta - \sin \beta \cos \alpha) \\ z \cos \phi +r \sin \phi \cos \theta \end{pmatrix} ##

##\vec v' = \begin{pmatrix} x \cos \phi \cos \beta - y \cos \phi \sin\beta - z \sin \phi \cos(\alpha-\beta) \\ x \cos \phi \sin \beta + y \cos \phi \cos \beta + - z \sin \phi \sin(\alpha-\beta) \\ z \cos \phi +r \sin \phi \cos \theta \end{pmatrix} ##

Things would work out nicely here and I could represent ## \vec v'## as a product of ##\vec v## and a matrix. My problem is getting rid of the ugly ## r\sin\phi \cos\theta##. Could you provide a hint as to how I would proceed? Also please point out any errors I might've made with the simplifications. Thanks!

Last edited:
ForceBoy said:

## Homework Statement

[/B]
The problem consists of deriving the matrix for a 3 dimensional rotation.

My approach consisted of constructing an arbitrary vector and rewriting this vector in terms of its magnitude and the angles which define it. Then I increased the angles by some amount each. I would expand the equations then simplify.

*********************************************************

My problem comes towards the end of the derivation where I encounter an expression which I don't know how to simplify in a way that will make everything come out nicely and in a way that is useful.

***********************************************************

Things would work out nicely here and I could represent ## \vec v'## as a product of ##\vec v## and a matrix. My problem is getting rid of the ugly ## r\sin\phi \cos\theta##. Could you provide a hint as to how I would proceed? Also please point out any errors I might've made with the simplifications. Thanks!

I believe your scheme is doomed to failure in the form you are attempting. In three dimensions, any rotation can be represented as a rotation through some angle ##\omega## about some axis defined by some unit vector ##{\mathbf n}##. In such rotations the polar angle may increase for some vectors, decrease for others, etc; certainly, you will not have the same polar-angle increment for all vectors simultaneously. Likewise for the azimuthal angles.

So, whatever your transformation does, it will nonlinear, not representable as a multiplication by some constant matrix.

I don't think that you should start with the vector in polar coordinates at all. That seems to complicate everything. Why not leave it in cartesian coordinates and only use angles for the desired rotations? Has your class done anything already with rotation matrices?

FactChecker said:

Before this thread grows any longer I would like to state that this question was not on homework. I had seen a derivation of the rotation matrix for 2 dimensional space and decided this would be a good exercise. I am sorry for wasting your time. For future reference, where would these types of questions go? They do not seem advanced enough to go on any of the mathematics threads which is why I put them here. Again sorry for wasting your time. Please feel no obligation to continue with this thread. If you want to, great!

Ray Vickson said:
So, whatever your transformation does, it will nonlinear, not representable as a multiplication by some constant matrix

Now, I do not understand what is meant by this transformation being nonlinear. As we know a transformation is linear if ## T(c\vec v) = cT(\vec u) ## and ##T(\vec u + \vec w) = T(\vec w) +T(\vec u)## where ##T## is a transformation. As I understand it, the first of these statements is saying that the resulting vector from scaling a vector before a transformation and after the transformation must be the same. This is satisfied because the scalar would have no effect on the angles of the vector, just the size. As I understand it, the second of these statements states that the sum of two vectors transformed must be the same as the sum of each vector transformed. Again, I don't see how this is not true for this proposed rotation. If it help, the rotation I am trying to express is similar to rotating a box containing a 3 dimensional vector space inside. If I have a box with vectors inside and then I rotate the box, the vectors inside the box will just change direction. It doesn't matter if I scaled a vector before rotating the box or after. It doesn't matter if I add two vectors before or after I rotate the box. Am I overlooking something?

FactChecker said:
Why not leave it in cartesian coordinates and only use angles for the desired rotations?

The reason I converted the vector to polar coordinates is because each coordinate would be affected by the transformation. By this I mean that it doesn't matter if the vector isn't being rotated about the z axis, all three coordinates will change. I don't see how I could express these changes in another way.

ForceBoy said:
Before this thread grows any longer I would like to state that this question was not on homework. I had seen a derivation of the rotation matrix for 2 dimensional space and decided this would be a good exercise. I am sorry for wasting your time. For future reference, where would these types of questions go? They do not seem advanced enough to go on any of the mathematics threads which is why I put them here. Again sorry for wasting your time. Please feel no obligation to continue with this thread. If you want to, great!
Now, I do not understand what is meant by this transformation being nonlinear. As we know a transformation is linear if ## T(c\vec v) = cT(\vec u) ## and ##T(\vec u + \vec w) = T(\vec w) +T(\vec u)## where ##T## is a transformation. As I understand it, the first of these statements is saying that the resulting vector from scaling a vector before a transformation and after the transformation must be the same. This is satisfied because the scalar would have no effect on the angles of the vector, just the size. As I understand it, the second of these statements states that the sum of two vectors transformed must be the same as the sum of each vector transformed. Again, I don't see how this is not true for this proposed rotation. If it help, the rotation I am trying to express is similar to rotating a box containing a 3 dimensional vector space inside. If I have a box with vectors inside and then I rotate the box, the vectors inside the box will just change direction. It doesn't matter if I scaled a vector before rotating the box or after. It doesn't matter if I add two vectors before or after I rotate the box. Am I overlooking something?
The reason I converted the vector to polar coordinates is because each coordinate would be affected by the transformation. By this I mean that it doesn't matter if the vector isn't being rotated about the z axis, all three coordinates will change. I don't see how I could express these changes in another way.

If you stick with your original formulation, but use the polar-coordinate equations ##x = r \cos \theta \cos \alpha,## etc., to get rid of ##\cos \alpha, \sin \alpha## and ##\cos \theta## in your third form for ##\vec{v}'## (leaving expressions involving only ##x,y,z, \beta## and ##\phi##) you will be able to write
$$\vec{v}' = M \vec{v},$$
but with the matrix ##M = M(x,y,z)## being non-constant, with some of its elements containing functions of ##x,y,z##---and these will not go away. That is why I claim it is nonlinear.

Let me repeat: a general rotation can be reduced to a rotation by a fixed angle ##\omega## about some fixed axial direction ##\vec{n}##, and that will give you a transformation in which your angles ##\theta## and ##\alpha## do NOT change by constant amounts everywhere. Different vectors ##\vec{v}## will have their values of ##\theta## and/or ##\alpha## change by different amounts. So, whatever your transformation may be, it is not a rotation in the normal sense of that term.

Your proposed really is nonlinear: you will not have ##T(\vec{u}+\vec{v}) = T(\vec{u}) + T(\vec{v})##, because ##T(\vec{u})## gives you polar rotation of ##\theta## and ##T(\vec{v})## gives you a polar rotation of ##\theta##; their sum gives a polar rotation of ##2 \theta##. On the other hand, ##T(\vec{u}+\vec{v})## gives a polar rotation of just ##\theta.##

Last edited:
ForceBoy said:
Before this thread grows any longer I would like to state that this question was not on homework. I had seen a derivation of the rotation matrix for 2 dimensional space and decided this would be a good exercise. I am sorry for wasting your time. For future reference, where would these types of questions go? They do not seem advanced enough to go on any of the mathematics threads which is why I put them here. Again sorry for wasting your time.
No need to apologize. This is a very interesting and respectable effort. Even if it doesn't work out, it will make you understand and appreciate the Euler angles and rotation matrices much more.

I never like it when people suggest a completely different approach rather than helping to answer the original question, but I can't resist this time. The two-dimensional rotation is a rotation in three dimensions where one dimension is left untouched (the rotation is around it). That can be easily put into a matrix form. A general rotation in three dimensions can be represented as a sequence of three rotations (by Euler angles, yaw, pitch, roll) where each rotation is like a two-dimensional rotation which leaves one of the current intermediate dimensions untouched. That works out to be a linear transformation which can be represented by a single matrix which is the product of the three simple rotation matrices. That single matrix can be applied to any vector in its original cartesian coordinates.

Last edited:
Though this has nothing to do with the question, but the verb form of deriative is differentiate, not derive.

ForceBoy said:
Before this thread grows any longer I would like to state that this question was not on homework. I had seen a derivation of the rotation matrix for 2 dimensional space and decided this would be a good exercise. I am sorry for wasting your time. For future reference, where would these types of questions go? They do not seem advanced enough to go on any of the mathematics threads which is why I put them here. Again sorry for wasting your time. Please feel no obligation to continue with this thread. If you want to, great!

...

Here is a link to a Wikipedia page on this topic. The link takes you directly to the 3 dim. case, but the page includes 2 dim. as well:

For the 3D case, a rotation matrix should be 3×3 square matrix.

FactChecker
Thank you all. I now understand better. You all have been very helpful. I will check out the links and look into non linear matrix transformations as well as try an approach to a rotation matrix with the product of two other matrices. Again, thank you all.

## 1. How do you define a 3 dimensional rotation matrix?

A 3 dimensional rotation matrix is a mathematical representation of the transformation of a 3 dimensional object in space. It is a 3x3 matrix that contains the cosine and sine values of the rotation angle about each axis, and can be used to rotate objects in 3D space.

## 2. What is the formula for deriving a 3 dimensional rotation matrix?

The formula for deriving a 3 dimensional rotation matrix involves using trigonometric functions such as cosine and sine to represent the rotation angles about each axis. The resulting matrix will have 9 elements, with the diagonal elements being the cosine values and the off-diagonal elements being the sine values.

## 3. How do you apply a 3 dimensional rotation matrix to a vector?

To apply a 3 dimensional rotation matrix to a vector, the vector must first be represented as a column matrix with 3 rows. Then, the rotation matrix is multiplied by the vector matrix, resulting in a new vector matrix with rotated coordinates.

## 4. What are the properties of a 3 dimensional rotation matrix?

A 3 dimensional rotation matrix has several properties, including orthogonality (its inverse is equal to its transpose), determinant of 1, and preserving length and angles of vectors. It also follows the associative and distributive properties of matrix multiplication.

## 5. Can a 3 dimensional rotation matrix be used for non-orthogonal rotations?

Yes, a 3 dimensional rotation matrix can be used for non-orthogonal rotations, as long as the resulting matrix is still orthogonal. This means that the columns and rows of the matrix must be perpendicular to each other and have a magnitude of 1. Non-orthogonal rotations can be achieved by combining multiple rotations about different axes.

• Precalculus Mathematics Homework Help
Replies
31
Views
2K
• Precalculus Mathematics Homework Help
Replies
2
Views
1K
• Linear and Abstract Algebra
Replies
1
Views
822
• Calculus and Beyond Homework Help
Replies
3
Views
609
• Special and General Relativity
Replies
8
Views
1K
Replies
6
Views
999
• Topology and Analysis
Replies
16
Views
580
• Introductory Physics Homework Help
Replies
8
Views
737
• Calculus
Replies
3
Views
750