# Find the rotation axis and angle of a matrix

$$A=\frac{1}{9} \begin{pmatrix} -7 & 4 & 4\\ 4 & -1 & 8\\ 4 & 8 & -1 \end{pmatrix}$$

How do I prove that A is a rotation ? How do I find the rotation axis and the rotation angle ?

• As a start, find the eigenvector with eigenvalue 1. Commented Dec 18, 2012 at 18:41
• Can I prove that this is a rotation, because $det(A)=1$ ? Commented Dec 18, 2012 at 19:24
• No. Lots of matrices have $\det A = 1$ without being rotations. See the answers below. Basically you need to check $A^T A = I$. Commented Dec 18, 2012 at 19:27

You have $A^T A = I$. Hence $A$ is a rotation. Since $\det A = 1$, it is proper.

By inspection, $A \begin{bmatrix} 1 \\ 2 \\ 2\end{bmatrix} = \begin{bmatrix} 1 \\ 2 \\2\end{bmatrix}$, which gives the axis of rotation.

Inspection also shows that $\begin{bmatrix} 2 \\ -1 \\ 0 \end{bmatrix}$ and $\begin{bmatrix} 2 \\ 4 \\ -5 \end{bmatrix}$ are orthogonal eigenvectors corresponding to the (repeated) eigenvalue $-1$. Hence we see that the rotation angle is $\pi$.

Explicitly, if we let $R = \begin{bmatrix} 1 & 2 & 2 \\ 2 & -1 & 4 \\ 2 & 0 & -5 \end{bmatrix}$, then $R^{-1} = \frac{1}{405} \begin{bmatrix} 45 & 90 & 90 \\ 162 & -81 & 0 \\ 18 & 36 & -45\end{bmatrix}$, and $R^{-1} A R = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & -1 \end{bmatrix}$, from which we see that the rotation angle is $\pi$.

• Could you explain how you get the eigenvector [2 4 -5] on the third line for repeated eigenvalue -1 as this is not a multiple of the original eigenvector [1 -1/2 0]? You then create a matrix of all 3 eigenvectors. What is the significance of this matrix? Commented May 3, 2020 at 10:38
• @twa14: The axis of rotation was a lazy guess, when you look at $9(A-I)$ the first row is $(-16,4,4)$, I just tried the combo. $(1,2,2)$ and was lucky. The trace is $-1$ and so the sum of the two 'non one' eigenvalues is $-2$ and since both are part of a rotation both must be $-1$. Now look at $9(A+I)$. There are many possibilities, I chose $(2,-1,0)$ and the third must be orthogonal to the first two so after a little work I got the third. Commented May 3, 2020 at 18:14
• The significance of the matrix of eigenvectors is that $A$ is diagonal with respect to that basis. Commented May 3, 2020 at 18:15
• Many thanks for clearing that up. Commented May 5, 2020 at 13:02

The simplest way to find the rotation angle is to take the trace of the matrix, the sum of the diagonal elements. By Cameron Buie's answer this equals $$1 + 2\cos(\theta)$$ where $$\theta$$ is the angle of rotation. $$\theta$$ can then be determined up to sign which will depend on the orientation of the axis of rotation chosen.

For non-symmetric matrices, the axis of rotation can be obtained from the skew-symmetric part of the rotation matrix, $$S = .5(R-R^\mathrm{T})$$;

Then if $$S=(a_{ij})$$, the rotation axis with magnitude $$\sin\theta$$ is $$(a_{21},a_{02},a_{10})$$.

• +1, the only original answer, which after a computational verification turns out to be true. Write the matrix associated to an arbitrary rotation given by a vector (axis, length the angle) and identify. Commented May 18, 2017 at 22:18
• Does this method extend to n by n matrices? Commented Dec 18, 2018 at 18:19
• Hi I want to take a look at the proof for Trace = 1+2 cos($\theta$), but it looks like difficult to find a well written proof. Do you have any book or link that you can post here? Commented Jun 7, 2019 at 7:13
• Basically it follows from Cameron Buie's answer since Tr(AB)=Tr(BA) and therefore taking the trace of both sides of $$(\hat w\: v_2\: v_3)^TA(\hat w\: v_2\: v_3)=\left(\begin{array}{ccc}1 & 0 & 0\\0 & \cos\theta & -\sin\theta\\0 & \sin\theta & \cos\theta\end{array}\right),$$ we see that $$Tr((\hat w\: v_2\: v_3)^TA(\hat w\: v_2\: v_3)) = Tr((\hat w\: v_2\: v_3)^T(\hat w\: v_2\: v_3)A) = Tr(A)= 1+2\cos(\theta).$$
– Ivan
Commented Jul 1, 2019 at 15:06
• How does this prove that the matrix is a rotation? Commented Jan 17, 2020 at 14:18

If a linear transformation $$T:\Bbb R^3\to\Bbb R^3$$ is a non-trivial rotation, then the set $$\{x\in\Bbb R^3:T(x)=x\}$$ will be the axis of rotation, since non-trivial rotation about an axis moves every point except the points on the axis. Also, if the determinant of $$T$$ isn't $$1,$$ then it isn't a rotation (why?), though you've already seen that $$\det(A)=1$$ in this case.

Here, we're working with the transformation $$T(x)=Ax$$, so the set $$\{x\in\Bbb R^3:T(x)=x\}$$ is just the eigenspace of $$A$$ corresponding to the eigenvalue $$1$$. If $$A$$ didn't have $$1$$ as an eigenvalue, we'd know it wasn't a rotation at all (in this case, it does have $$1$$ as an eigenvalue). If the eigenspace's dimension were greater than $$1$$, then either it'd be a reflection matrix (if dimension $$2$$), or the identity matrix (if dimension $$3$$). The latter is clearly not the case, so it's either a rotation matrix or a reflection matrix. However, if it were a reflection matrix, its determinant would be $$-1,$$ instead (why?), and so it is a rotation matrix.

Side Note: Given any two non-zero vectors $$x,y$$ in $$\Bbb R^3$$ with the angle from $$x$$ to $$y$$ being $$\theta$$, we may assume without loss of generality that $$\theta$$ is no less than $$0$$ radians and no more than $$\pi$$ radians. (Why?) Then we have the following formula (where $$\cdot$$ is the dot product): $$x\cdot y=\lVert x\rVert\lVert y\rVert\cos\theta\tag{1}$$

To see where $$(1)$$ comes from, see here.

In general, let's suppose we've been given some matrix $$A$$ corresponding to a rotation in $$\Bbb R^3$$, and that we want to find its angle of rotation. First, find a basis $$\{w\}$$ for the axis of rotation (found as above), let $$x$$ be any non-zero unit vector orthogonal (perpendicular) to $$w$$, let $$y=Ax$$. Then both $$x$$ and $$y=Ax$$ will be unit vectors. (Do you see why $$y$$ is a unit vector?), so formula $$(1)$$ yields the following alternate formula for our particular $$x,y$$: $$x\cdot y=\cos\theta\tag{1'}$$ Here, $$\theta$$ is the angle of rotation of $$A$$. (Do you see why?) From there, we can determine $$\theta$$. (Do you see why and how?)

Alternatively, start with $$w$$ (as above), normalize it to $$\hat w$$, and then determine an orthonormal basis $$B=\{\hat w,v_2,v_3\}$$ for $$\Bbb R^3$$ with the Gram-Schmidt process. Then $$(\hat w\: v_2\: v_3)^TA(\hat w\: v_2\: v_3)=\left(\begin{array}{ccc}1 & 0 & 0\\0 & \cos\theta & -\sin\theta\\0 & \sin\theta & \cos\theta\end{array}\right),$$ which gives us another way to find $$\theta$$.

Wolfram Alpha tells me there is an eigenspace with eigenvalue $-1$ generated by $(-2, 0, 1)$ and $(-2, 1, 0)$ and an eigenspace with eigenvalue $1$ generated by $(1, 2, 2)$. (You could do this by hand). The eigenspaces are orthogonal, so this is a rotation by 180 degrees about the axis $(1, 2, 2)$.

The problem is a little atypical, since if you rotate by any angle that's not an integer multiple of $\pi$ you will have complex eigenvalues.

• (This answer should have said explicitly: if you just want to prove it's a rotation, then checking that it has orthonormal columns and determinant one is enough.)
– user29743
Commented Dec 18, 2012 at 19:05
• okay thanks for the clear answer ! Commented Dec 18, 2012 at 19:27
• I believe the rotation is by a multiple of $\pi$? Commented Dec 18, 2012 at 19:42

A rotation matrix has unit determinant. Such a matrix that has all non-zero entries may be decomposed into three rotation matrices, each representing a rotation about an orthogonal coordinate axis.

The document: orthogonal matrices is an excellence reference for this problem.

The steps are as follows.

1. Show that the determinant is 1. Matrices with determinant -1 are reflections no rotations.

2. Find the eigenvalues. The three eigenvalues of the matrix are $$1, \text{e}^{-i \theta}$$, where $$\theta$$ is the angle of rotation.

3. find the eigenvector for the eigenvalue 1. This is the axis of rotation.

Solution: That the determinant is 1 can be directly checked.

The eigenvalues are $$\lambda=1, \pm 1$$. So the angle of rotation is $$0$$.

The eigenvector for the eigenvalue $$1$$ is $$(1/2,1,1)$$. This is the axis of rotation.

• You've miscalculated the eigenvalues, I'm afraid. If $1$ were a repeated eigenvalue, then the determinant would be $-1,$ instead. Commented Jan 23, 2017 at 13:38