I am trying to figure out a way to calculate the angle that a vector gets rotated around itself if a rotation matrix is applied to it.

For example if we take a vector $\vec{k} = (0, 0, 1)$ and rotate it $45^{\circ}$ around the Z axis (in this case the vector itself), well end up with the same vector $\vec{k'} = (0, 0, 1)$ but it essentially rotated around Z axis by $45^{\circ}$. What I am interested in calculating is that $45^{\circ}$ angle for more complex rotations around multiple axes and vectors that are not on any particular axis.

If we find a vector that is orthogonal to $\vec{k}$, for example, $\vec{i} = (1, 0, 0)$, and we apply that same rotation to it we'll end up with a rotated vector $\vec{i'} = (0.707, -0.707, 0)$. In this particular case I could just calculate the angle between $\vec{i}$ and $\vec{i'}$ and get my answer, but if the rotation was around multiple axes and not just Z that would not work.

Is there a way to calculate this rotation matrix "component" (there might be a more appropriate term for this?)? Would it be possible to split the original rotation matrix into 2 parts - rotation matrix that only has elements which directly affect the output vector, and an angle that the vector gets rotated around its own axis?

Edit 1: An example of a more complicated rotation matrix

If we have a vector $\vec{v} = (0, 0, 1)$, an orthogonal vector $\vec{x} = (0.707, 0.707, 0)$ and a rotation matrix:

M = 
 0.500   0.707  -0.500
-0.500   0.707   0.500
 0.707   0.000   0.707

If we apply the rotation matrix to $\vec{x}$ we get $\vec{Mx} = (0.854, 0.146, 0.5)$.

If we then plot those vectors and view directly into a plane that $\vec{v}$ is normal of (in this case XY plane but can be any 2D plane), what I would like to know is the angle that I need to rotate $\vec{x}$ around $\vec{v}$ by to have it overlap with $\vec{Mx}$ in that view.

In this case the answer is around $35.2^\circ$ (manual try and error)

Note: $\vec{v}$ is usually not on one of the coordinate axes, this is just easier explain with (I think). Another example could be $\vec{v} = (0.424, 0.566, 0.707)$

Visual example


1 Answer 1


Say non-zero $v \in \mathbb{R}^{3}$ defines the line we rotate around by matrix $M$. Pick arbitrary non-zero $x \in \mathbb{R}^{3}$ with $\| x \| = 1$ and $\langle x, v \rangle = 0$. Now $Mx$ is the rotated vector and $\| Mx \| = 1$ as well, also $\langle Mx, v \rangle = 0$. Now compute $\| x - Mx \|$.

So you have a triangle with two sides equal to 1 and one side equal to $\| x - Mx \|$. That should be enough info to calculate the angle.

You are allowed to skip the condition $\| x \| = 1$ btw. Note $Mv = v$.

  • $\begingroup$ Hi, thanks for this. It would work fine for the case when rotation happens around v (or as you note Mv = v), which is like the example in the question. However I am trying to solve for when rotation happens around any axis that is not necessarily v, for which case this does not work anymore $\endgroup$ Jun 29, 2021 at 20:20
  • $\begingroup$ What you mean by ‘any axis’? $\endgroup$
    – Elmex80s
    Jun 29, 2021 at 20:39
  • $\begingroup$ This works for any non-zero $v$. $\endgroup$
    – Elmex80s
    Jun 29, 2021 at 20:55
  • $\begingroup$ Hi @Elmex80s, I have added a more complex example and a visualisation of vectors and which angle I am trying to find. Also, by 'any axis', I mean that rotation matrix could contain rotations around a combination of individual rotations around X, Y and Z axes and the overall rotation is not happening around v but some arbitrary axis. $\endgroup$ Jun 29, 2021 at 22:21
  • $\begingroup$ $v$ doesn’t seem to play any role here. It only is about $M$, am I right? $\endgroup$
    – Elmex80s
    Jun 30, 2021 at 6:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .