Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Every rotation in 3D space can be defined by a rotation axis and an angle. Now let's say we have two rotations $R_1 (\text{(axis)}_1, \text{(angle)}_1)$, $R_2 (\text{(axis)}_2, \text{(angle)}_2)$.

I remember that Rotation operator is closed under composition, so $R_1 (R_2(\text{object}))$ will be a rotation again.

Does anybody know how to find the new axis and angle for $R_1R_2$?

share|cite|improve this question
depending on what on context of the problem, you might compute the eigenspace of eigenvalue 1 (i.e. the rotation axis whose vectors are fixed under that rotation). – shuhalo Feb 17 '11 at 2:15
nice point of view :) – Nima Feb 19 '11 at 14:34
up vote 12 down vote accepted

Once again, the easiest way of doing this (IMHO, at least) turns out to be quaternions: a rotation of $\theta$ about the (normalized) vector $\hat{v} = (v_0, v_1, v_2)$ is represented by the quaternion ${\bf q}=\mathrm{cos}(\theta/2) + \mathrm{sin}(\theta/2)*(v_0{\bf i}+v_1{\bf j}+v_2{\bf k})$; and quaternion multiplication is easy to compute (all you need are the base axioms ${\bf i}^2 = {\bf j}^2 = {\bf k}^2 = {\bf i}{\bf j}{\bf k} = -1$ - note that the latter implies for instance that ${\bf i}{\bf j} = {\bf k}$ by simply multiplying both sides by ${\bf k}$); once you have your resultant quaternion, the axis can be extracted as the (normalized) imaginary part of the result and the angle can be found by taking the arc-cosine of the scalar part. See the Wikipedia page on quaternions and rotations for more details on just how this works.

share|cite|improve this answer
Why once again? – t.b. Feb 17 '11 at 3:08
This just feels like the third or fourth question in the last few days where my answer has been 'quaternions'. They're a favorite topic of mine, mind, so I certainly don't mind another chance to extol their virtues! – Steven Stadnicki Feb 17 '11 at 8:08
Thanks, elegant and neat! :-) – Nima Feb 19 '11 at 14:28
Thanks for the link to Wikipedia . Although I knew the mathematics of that page beforehand, I am awed by its quality and the effectiveness of the illustrations (not to mention their sheer beauty). And I agree with you 100% on the virtues of quaternions: they are definitely the best tool for composing rotations. So, +1. – Georges Elencwajg Aug 7 '12 at 8:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.