# Rotation matrix about an axis from the origin to (1,1,1)

## Homework Statement

Find the transformation matrix R that describes a rotation by 120 about an axis from the origin through the point (1,1,1). The rotation is clockwise as you look down the axis toward the origin.

## Homework Equations

Rotations about the z-axis are given by

$$R_{z}(\alpha) = \left( \begin{array}{ccc} cos(\alpha) & sin(\alpha) & 0 \\ -sin(\alpha) & cos(\alpha) & 0 \\ 0 & 0 & 1 \end{array} \right)$$

whereas rotations about the x-axis are given by

$$R_{x}(x) = \left( \begin{array}{ccc} 1 & 0 & 0 \\ 0 & cos(x) & sin(x) \\ 0 & -sin(x) & cos(x) \end{array} \right)$$.

## The Attempt at a Solution

My strategy in solving this problem was to rotate the coordinate system in such a way as to align the z-axis along the axis extending from the origin to (1,1,1). Once this was done, I was to rotate the system as a regular rotation in a two-dimensional x-y system.

The first rotation should be such that the x-axis is aligned perpendicular to the x-y projection of $$\hat{x} + \hat{y} + \hat{z}$$, or perpendicular to $$\hat{x} + \hat{y}$$. This was done with a rotation about the z-axis, more specifically $$R_{z}(\frac{3 \pi}{4})$$.

I intended the second rotation to be about the x-axis to orient the z-axis as desired. Working now with primed coordinates after the previous rotation the desired axis lied in the y'-z plane. The coordinates of the original vector <1, 1, 1> in the primed system was $$\sqrt{2} \hat{y} + \hat{z}$$. Therefore, I wanted to rotate the x-axis clockwise by $$Cos^{-1}(\frac{1}{\sqrt{3}})$$ degress. However, the way my matrices in section 2 were set up should have all rotations going counterclockwise, so I wanted my rotation matrix to be $$R_{x}(2 \pi - Cos^{-1}(\frac{1}{\sqrt{3}}))$$.

Now that the z-axis was properly aligned, I could rotate about it, so my final rotation matrix should be $$R_{z}(\frac{2 \pi}{3})$$.

If my logic is correct then the final rotation should be

$$R = R_{z}(\frac{2 \pi}{3}) * R_{x}(2 \pi - Cos^{-1}(\frac{1}{\sqrt{3}})) * R_{z}(\frac{3 \pi}{4})$$.

That said, I know my answer should be

$$R = \left( \begin{array}{ccc} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{array} \right)$$

however this is not what I am getting. I am getting something very messy. Where have I gone wrong?

## Answers and Replies

vela
Staff Emeritus
Homework Helper
I didn't closely check the logic of your other rotations, but I didn't see anything obviously wrong when I skimmed over your post. After the 120-degree rotation about the z'' axis, I think you still need to undo the first two rotations to get back to the original coordinates.

I'm not sure I understand why I need to undo the first rotations. If I'm looking for the rotation matrix which represents a series of rotations shouldn't I just multiply the individual matrices?

vela
Staff Emeritus
Homework Helper
Think about this. The point (1,1,1) lies on the axis of rotation, so it should map to itself. Your scheme, however, would map it to the z-axis.

(I tried calculating your matrices in Mathematica, and it doesn't seem to map (1,1,1) correctly. It seems your middle matrix rotates in the wrong direction.)

Last edited:
I see that my second rotation did go the wrong way. After correction, however, my answer is still bogus. Forgive me if I'm wrong, it's very possible that I've completely misunderstood/forgotten the concept, but shouldn't the ultimate rotation matrix be frame independent? Shouldn't the axis of rotation be z" since in the double-primed frame the goal was to have z" be the axis of rotation?

vela
Staff Emeritus
Homework Helper
The rotation itself is coordinate-independent, but the particular matrix which represents the rotation depends on the basis/coordinates you've chosen.

Let's take the vector (1,1,1). The rotation should leave it unchanged. This is what you get when you apply the first two rotations:

$$R_{x'}(\theta_2)R_z(\theta_1)\begin{pmatrix} 1 \\ 1 \\ 1\end{pmatrix} = \begin{pmatrix}0 \\ 0 \\ \sqrt{3}\end{pmatrix}$$

So that's what you wanted. It's lined up with the z''-axis. Now you apply the final rotation

$$R_{z''}(\theta_3)\begin{pmatrix}0 \\ 0 \\ \sqrt{3}\end{pmatrix} = \begin{pmatrix}0 \\ 0 \\ \sqrt{3}\end{pmatrix}$$

As expected, the vector is unchanged since it lies along the axis of rotation. The thing is, you want the final answer to be (1,1,1), right? You need to transform the vector's coordinates back to be in terms of the original set of axes.

Last edited:
Thank you very much, I appreciate your help. I feel as though I am very close to solving this, however the answer seems to be eluding me for some reason. On Mathematica, I have defined the following

Code:
z[a_] := {{Cos[a], Sin[a], 0}, {-Sin[a], Cos[a], 0}, {0, 0, 1}}

which is the rotation matrix function about the z-axis, and

Code:
x[a_] := {{1, 0, 0}, {0, Cos[a], Sin[a]}, {0, -Sin[a], Cos[a]}}

which is the rotation matrix function about the x-axis.

I have defined a third matrix as the dot product x.z with the desired angles plugged into the matrix functions for convenience:

Code:
a = x[ArcCos[1/Sqrt[3]]].z[3*Pi/4].

The angle of rotation about the x-axis has been corrected from above. Multiplying this with the vector (1,1,1) we arrive at the expected result:

Code:
In[16]:= a.{1, 1, 1}

Out[16]= {0,0,Sqrt[3]}

The final rotation about the z" axis also acts as it's supposed to:

Code:
In[18]:= z[2*Pi/3].(a.{1, 1, 1})

Out[18]= {0,0,Sqrt[3]}
.

I assumed, therefore, my answer was correct. However, after attempting to revert back to my original coordinate system the rotation matrix was once again bogus. The line

Code:
answer = Inverse[a].z[2*Pi/3].a

produced the following matrix:

[Tex]
\left(
\begin{array}{ccc}
-\frac{\frac{1}{2 \sqrt{6}}-\frac{\sqrt{\frac{3}{2}}}{2}}{\sqrt{6}}-\frac{1}{6} & \frac{5}{6}-\frac{\frac{1}{2 \sqrt{6}}-\frac{\sqrt{\frac{3}{2}}}{2}}{\sqrt{6}} & \sqrt{\frac{2}{3}} \left(\frac{1}{2 \sqrt{6}}-\frac{\sqrt{\frac{3}{2}}}{2}\right)+\frac{1}{3} \\
\frac{1}{3}-\frac{\frac{\sqrt{\frac{3}{2}}}{2}+\frac{1}{2 \sqrt{6}}}{\sqrt{6}} & \frac{1}{3}-\frac{\frac{\sqrt{\frac{3}{2}}}{2}+\frac{1}{2 \sqrt{6}}}{\sqrt{6}} & \sqrt{\frac{2}{3}} \left(\frac{\sqrt{\frac{3}{2}}}{2}+\frac{1}{2 \sqrt{6}}\right)+\frac{1}{3} \\
1 & 0 & 0
\end{array}
\right)[/Tex].

Attempting to undo the coordinate change through flipping the signs of the angles initially rotated and rerotating through gave me the same matrix:

Code:
z[-3*Pi/4].x[-ArcCos[1/Sqrt[3]]].z[2*Pi/3].a

[Tex]\left(
\begin{array}{ccc}
-\frac{\frac{1}{2 \sqrt{6}}-\frac{\sqrt{\frac{3}{2}}}{2}}{\sqrt{6}}-\frac{1}{6} & \frac{5}{6}-\frac{\frac{1}{2 \sqrt{6}}-\frac{\sqrt{\frac{3}{2}}}{2}}{\sqrt{6}} & \sqrt{\frac{2}{3}} \left(\frac{1}{2 \sqrt{6}}-\frac{\sqrt{\frac{3}{2}}}{2}\right)+\frac{1}{3} \\
\frac{1}{3}-\frac{\frac{\sqrt{\frac{3}{2}}}{2}+\frac{1}{2 \sqrt{6}}}{\sqrt{6}} & \frac{1}{3}-\frac{\frac{\sqrt{\frac{3}{2}}}{2}+\frac{1}{2 \sqrt{6}}}{\sqrt{6}} & \sqrt{\frac{2}{3}} \left(\frac{\sqrt{\frac{3}{2}}}{2}+\frac{1}{2 \sqrt{6}}\right)+\frac{1}{3} \\
1 & 0 & 0
\end{array}
\right)[/Tex]

Even stranger, this matrix rotated (1,1,1) as it should:

Code:
In[29]:= answer.{1, 1, 1}

Out[29]= {1, 1, 1}

I'm not sure how to proceed from here. Thanks again for your help.

Last edited:
For some reason in the previous post the image of the matrices is not rendering. I do not know how to fix this. Sorry.

The following is tests.

$$\left( \begin{array}{ccc} 1 & 1 & 0 \\ 0 & 1 & 2 \\ 1 & 1 & 1 \end{array} \right)$$

Hmm... mathematica seems to generate compatible Latex, don't know what went wrong up there. Perhaps the latex code was simply too complex.

vela
Staff Emeritus
Homework Helper
You got the right answer. Try

Code:
Simplify[answer]

in Mathematica.

Wow, that's a powerful little statement there. Thank you very much for your help.

I have found a way to rotate the coordinate system about any axis through the origin (given it's direction cosines or a point on it) by any angle. I had to make five rotations (had to multiply five matrices using wxMaxima) in order to get that final matrix. All five rotation were about either x, y or z axis. Checked and worked for the example mentioned above.

To find the transformation matrix for rotation by an angle 'theta' around an axis 'I' passing through the origin and a point (a, b, c), do the following steps (you can use the final result directly of course!).
Denote the coordinate column vector by X and the rotational matrix by R.

1st Rotation: Rotate about z-axis so that x, I and z are coplanar. X1 = R1 . X
2nd Rotation: Rotate about the y1-axis so that z1 coincides with I. X2 = R2 . X1
3rd Rotation: Rotate about the z2-axis by an angle theta. X3 = R3 . X2
4th Rotation: Reverse step 2. X4 = R4 . X3
5th Rotation: Reverse step 1. X5 = R5 . X4

The desired NEW coordinate system X' is itself X5. The desired total rotational matrix is R.
X' = R . X
R = R5 . R4 . R3 . R2 . R1

The matrices are attached to this comment. Make sure you extract the zip file first then click the html file.

The derivation of the final total rotational matrix is kind of complicated. I feel that there could be a more elegant way of finding it.

NOTE: I have found this result on my own without consulting any reference. I checked it and it worked. Any comment is welcomed.

#### Attachments

• Rotational Matrix.zip
99 KB · Views: 320