# Intuition behind rotation matrices?

• Inertigratus
In summary, the conversation discussed methods and intuition for computing rotation matrices in three dimensions. It was explained that a straightforward way is to transform the basis vectors, and examples were given for rotations around the x-axis and z-axis. The conversation also touched on rotating around a general vector and the use of inverse matrices for rotations. There was some confusion about the sign of the x-component in the rotation matrix for rotations around the y-axis, but it was clarified that it should be positive based on the right-hand rule. Overall, the conversation provided a comprehensive understanding of how to compute rotation matrices.
Inertigratus
I probably can remember the matrices by just trying to, but I hate having to "remember" things without actually understanding them.
Is there no intuition behind these matrices so that I can remember it (the intuition) and then from it produce the wanted matrix?
To me the matrices look like some kind of cross product between a position vector and the derivative of that position vector but in polar coordinates.
But in 3 dimensions the row with the zeros and the single 1 changes depending on which axis the rotation is about and the order matters...

I hope you understand the way I wrote this, not sure how to type the matrices on here.

Once again, the reason I'm asking is because I don't want to just remember a couple of trigonometric matrices but rather a method or intuition from which I can produce the desired matrix depending on the kind of rotation I'm looking for.

Thanks!

One of the most straightforward ways to compute a matrix from a linear transformation is to simply transform the basis vectors.

And how do you do that? how about rotations in 3 dimensions?

Well let's do an example in 3D then. Consider the rotation around the x-axis of 90°.

We only need to figure out where (1,0,0), (0,1,0) and (0,0,1) end up. Obviously (1,0,0) remains fixed. (0,1,0) is being sent to (0,0,-1) (or (,0,0,1) depending on how you rotate). And (0,0,1) is being sent to (0,1,0) (or (0,-1,0)). So our rototation matrix has the form

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

That's how you solve these things in general...

If you rotate the vector i= <1, 0> through angle $\theta$ around the origin. You will get a vector of length 1 which is the hypotenuse of a right triangle. It follows that the "near side", which is the i component of the vector, is $cos(\theta)$ and the "far side", which is the j component of the vector, is $sin(\theta)$. That is, <1, 0> is rotated into $<cos(\theta), sin(\theta)>$.

Similarly if you rotate the vector j= <0, 1> through angle $\theta$ around the origin. You will get a vector of length 1 which is the hypotenuse of right triangle. This time, the "near side" is along the y-axis while the "opposite side" points in the direction of the negative x axis. The i component is $-sin(\theta)$ and the j component if $cos(\theta)$. <0, 1> is rotated to $<-sin(\theta), cos(\theta)>$.

As Hurkyl said, you can construct a matrix by using, as columns, the vectors the basis vectors are mapped into. Since <1, 0> is mapped into $<cos(\theta), sin(\theta)>$ and <0, 1> is mapped into $<-sin(\theta), cos(\theta)>$, the rotation matrix is
$$\begin{bmatrix}cos(\theta) & -sin(\theta) \\ sin(\theta) & cos(\theta)\end{bmatrix}$$.

As for three dimensions, it is easy to see that a rotation around the z-axis does not change the z component of any point so rotation around the z axis through angle $\theta$ is given by
$$\begin{bmatrix}cos(\theta) & -sin(\theta) & 0 \\ sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 1\end{bmatrix}$$
and it should be clear that a rotation about the y-axis through angle $\theta$ is
$$\begin{bmatrix}cos(\theta) & 0 & -sin(\theta) \\ 0 & 1 & 0 \\ sin(\theta) & 0 & cos(\theta)\end{bmatrix}$$
and a rotation about the x-axis through angle $\theta$ is
$$\begin{bmatrix}1 & 0 & 0 \\ 0 & cos(\theta) & -sin(\theta) \\ 0 & sin(\theta) & cos(\theta)\end{bmatrix}$$

Finally, to rotate around a general vector, <a, b, c>, through an angle $\theta$, find a matrix, A, that rotates the axis, <a, b, c>, around the z-axis into the yz-plane so that the i component is 0. It is easy to see, with a little work, that the matrix that does that is
$$\begin{bmatrix}\frac{b}{r} & -\frac{a}{r} & 0 \\ \frac{a}{r} & \frac{b}{r} & 0 \\ 0 & 0 & 1\end{bmatrix}$$
where $r= \sqrt{a^2+ b^2}$.

Next, rotate around the x-axis so that axis is rotated into the z-axis. That requires matrix
$$B= \begin{bmatrix}1 & 0 & 0 \\ 0 & \frac{c}{\rho} & -\frac{r}{\rho} \\ 0 & \frac{r}{\rho} & \frac{c}{\rho}\end{bmatrix}$$

Once you have done that, use the matrix
$$\begin{bmatrix}cos(\theta) & -sin(\theta) & 0 \\ sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 1\end{bmatrix}$$

Finally, use the inverses of matrices B and A to rotate back to the original position. Of course, the inverse matrix just rotates through the negative angle- and since cosine (the diagonal elements) is an even function while sine (the off diagonal elements) is an odd function, that just requires changing the sign on the off diagonal elements.

That is, to rotate a vector through angle $\theta$, around axis <a, b, c> multiply by the matrix product:
$$\begin{bmatrix}\frac{b}{r} & \frac{a}{r} & 0 \\ -\frac{a}{r} & \frac{b}{r} & 0 \\ 0 & 0 & 1\end{bmatrix}$$$$\begin{bmatrix}1 & 0 & 0 \\ 0 & \frac{c}{\rho} & -\frac{r}{\rho} \\ 0 & \frac{r}{\rho} & \frac{c}{\rho}\end{bmatrix}$$$$\begin{bmatrix}cos(\theta) & -sin(\theta) & 0 \\ sin(\theta) & cos(\theta) & 0 \\ 0 & 0 & 1\end{bmatrix}$$$$\begin{bmatrix}1 & 0 & 0 \\ 0 & \frac{c}{\rho} & -\frac{r}{\rho} \\ 0 & \frac{r}{\rho} & \frac{c}{\rho}\end{bmatrix}$$$$\begin{bmatrix}\frac{b}{r} & -\frac{a}{r} & 0 \\ \frac{a}{r} & \frac{b}{r} & 0 \\ 0 & 0 & 1\end{bmatrix}$$

Last edited by a moderator:
Wow, thanks a great deal! That really made sense... now I can find the matrix by just doing a quick picture of how the basis vectors are transformed.

Ivy, I understood most of what you explained... except the general vector part, will re-read it a little bit later. However, when rotating about the y-axis... where did that minus sign appear from? On the x-component of the z-basis vector. I tried painting a picture but to me the minus seems wrong?
Both the x and z basis vectors rotate about the y-axis clockwise (right-hand rule?) and then the x-component should be positive?
(Clockwise if you look towards the direction of the y-axis)

Last edited:

## 1. What is a rotation matrix and how does it work?

A rotation matrix is a 2-dimensional array that represents a rotation transformation in a coordinate system. It is used to rotate points or objects in a 2D or 3D space. The matrix is composed of a combination of sine and cosine functions to determine the angle and direction of rotation.

## 2. How is a rotation matrix different from other transformation matrices?

A rotation matrix is different from other transformation matrices, such as translation or scaling matrices, because it only affects the orientation of an object without changing its size or position. It is also different from reflection matrices, which produce a mirror image of the original object.

## 3. What is the significance of the elements in a rotation matrix?

The elements in a rotation matrix represent the direction and magnitude of rotation around each axis. The values in the first column correspond to the rotation around the x-axis, the second column represents the rotation around the y-axis, and the third column represents the rotation around the z-axis.

## 4. How are rotation matrices used in computer graphics and animation?

Rotation matrices are essential in computer graphics and animation as they allow for smooth and accurate rotation of objects in a 2D or 3D space. They are used to create realistic movements and transformations of objects, such as rotating a 3D model or animating a character's movements.

## 5. Are there any limitations to using rotation matrices?

Rotation matrices have certain limitations, such as being limited to rotations in 2D or 3D space and not being able to handle transformations that involve scaling or shearing. Also, using multiple rotation matrices in succession can lead to a phenomenon known as gimbal lock, where one axis loses its degree of freedom and causes unexpected results. This can be avoided by using other transformation methods, such as quaternions.

• Linear and Abstract Algebra
Replies
2
Views
1K
• Linear and Abstract Algebra
Replies
8
Views
2K
• Linear and Abstract Algebra
Replies
4
Views
3K
• Linear and Abstract Algebra
Replies
7
Views
2K
• Linear and Abstract Algebra
Replies
4
Views
7K
• Linear and Abstract Algebra
Replies
48
Views
5K
• Linear and Abstract Algebra
Replies
4
Views
2K
• Mechanics
Replies
2
Views
943
• Linear and Abstract Algebra
Replies
14
Views
2K
• Linear and Abstract Algebra
Replies
6
Views
1K