Please note that I am not referring to Euler angles of the form (α,β,γ). I am referring to the axis-angle representation, in which a unit vector indicates the direction axis of a rotation and a scalar the magnitude of the rotation.

Let $(\hat{n_1},\theta_1)$ refer to the first rotation and $(\hat{n_2},\theta_2)$ refer to the second rotation. What is the value of the first rotation followed by the second rotation, in axis-angle representation?

I understand that the composition of two rotations represented by quaternions $q_1$ and $q_2$ is equal to their product $q_2q_1$. Is there a way to find the composition of axis-angle rotations (without having to convert them to quaternions, multiply them, and convert them back to axis-angle) in a similar manner? Is there a simplified formula for this operation?


5 Answers 5


The formula is given in this excerpt from a journal paper. It was discovered by the French mathematician Olinde Rodrigues in 1840, which was before the invention of vectors or even quaternions (which were invented before vectors).

The composition of $\alpha\hat{l}$ and $\beta\hat{m}$ (where the second rotation is applied and then the first is applied) is given by $\gamma\hat{n}$, where $\cos\frac{\gamma}{2} = \cos\frac{\alpha}{2}\cos\frac{\beta}{2} - \sin\frac{\alpha}{2}\sin\frac{\beta}{2}\hat{l}\cdot\hat{m}$ and $\sin\frac{\gamma}{2}\hat{n}=\sin\frac{\alpha}{2}\cos\frac{\beta}{2}\hat{l}+\cos\frac{\alpha}{2}\sin\frac{\beta}{2}\hat{m}+\sin\frac{\alpha}{2}\sin\frac{\beta}{2}\hat{l}\times\hat{m}$.

As a sanity check, it's easy to see that when $\hat{l}=\hat{m}$, then it's easy to see that $\gamma=\alpha+\beta$ and $\hat{n}= \hat{l}=\hat{m}$.

In any case, these formulas are proven in detail in Chapter 9 Sections 2-4 of Simon Altmann's book "Rotations, Quaternions, and Double Groups", but it basically boils down to this spherical triangle:

enter image description here

See also this related result proven by William Rowan Hamilton after he invented quaternions.

  • $\begingroup$ Yep, that is about as monstrous as I expected. $\endgroup$
    – rschwieb
    Commented Oct 22, 2016 at 1:59
  • 1
    $\begingroup$ @rschwieb Haha, at least there's some logic to it in terms of geometry, rather than just a random equation that comes out of nowhere. $\endgroup$ Commented Oct 22, 2016 at 2:19
  • $\begingroup$ @KeshavSrinivasan Can you disclose the title and author of that mysterious journal paper? $\endgroup$ Commented Nov 6, 2016 at 14:30
  • 1
    $\begingroup$ @BarbaraKwarc Sure, it's "Hamilton, Rodrigues, and the Quaternion Scandal" by Simon L. Altmann: jstor.org/stable/2689481 $\endgroup$ Commented Nov 6, 2016 at 14:52
  • 3
    $\begingroup$ Link is now dead $\endgroup$ Commented Apr 12, 2021 at 0:25

I did some original research using Mathematica, and this was the simplest form I could find.

Given two axis angles $\vec{a}$ and $\vec{b}$, with $a = \|\vec{a}\|$ and $b = \|\vec{b}\|$

The resulting vector has the length

$c = \cos^{-1}\left(\cos a \cos b - (\hat{a} \sin a) \cdot (\hat{b} \sin b)\right)$

and is in the direction

$d = (\cos a) (\hat{b} \sin b) + (\cos b) (\hat{a} \sin a) + (\hat{a} \sin a) \times (\hat{b} \sin b)$


$C = c \hat{d}$

where $\hat{x} = \vec{x} / |x|$. Not very monstrous, but it took several hours of simplifying and prodding.

  • 1
    $\begingroup$ Use MathJax please. It's hard to read. $\endgroup$ Commented Nov 14, 2015 at 12:08
  • $\begingroup$ Schrodinger's cat is right $\endgroup$ Commented Jun 28, 2018 at 19:26
  • $\begingroup$ So $a$ and $b$ are the length of the vector? (aka the angle). And, $\hat{a}$ and $\hat{b}$ are the unit vector? (those symbols are new to me but I did some googling). If $c$ is the supposed to be the new angle/length how does that formula give a scalar and not a vector? Isn't $(\hat{a} \sin a)$ a vector? ($\hat{a} * \sin(a)$) $\endgroup$ Commented Nov 21, 2019 at 17:41
  • $\begingroup$ Oh, oh, duh. Dot products return a scalar (from vectors) not another vector. $\endgroup$ Commented Nov 22, 2019 at 2:17
  • $\begingroup$ Are the vector lengths $a$ and $b$ maybe half angles? As in, rotation is around $\hat x$ by $x/2$ degrees? Because then this answer would be compatible with the accepted one. $\endgroup$ Commented Dec 20, 2022 at 15:47

I do not believe there is without passing through some alternate representation (quaternion, matrix, ...). This is one of the known disadvantages of axis-angle compared to the others, while an advantage is the triviality of inversion (simply negate the angle or the axis).

  • 2
    $\begingroup$ There is such a formula, and it was discovered in 1840; see my answer. $\endgroup$ Commented Oct 21, 2016 at 3:38

The quaternion procedure is probably the simplest, easiest to implement, and most computationally economical way to go.

In practice you would likely be doing all of this in a computer anyhow, and computing the product of two quaternions (in the big scheme of things) is not much harder than two real numbers, or two complex numbers. I think the multiplication is more computatationally efficient than multiplying two $3\times 3$ matrices, at least.

Actually, if you sit down and work the quaternion solution, you can probably work out a formula completely in terms of the coordinates of the $n_i$ and the angles $\theta_i$. It would be monstrous, but it would be totally in terms of your data (and maybe inverse trigonometric functions.)

  • 3
    $\begingroup$ It's not as monstrous as you might think, and it actually makes some geometric sense; see my answer. $\endgroup$ Commented Oct 21, 2016 at 3:37

I'm not sure if this is simpler or more complex. This reworks the formulae to combine the angles before taking the sin/cos. I had started with this... https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#The_composition_of_spatial_rotations and ended up feeding the partials to wolfram alpha, and getting equivalent functions.

https://github.com/d3x0r/stfrphysics#live-demos implement this method; it is equivalent.


  • ${Q} = [n,\theta]$ n is a normal vector/axis of rotation

  • ${P} = [n,\theta]$ $\theta$ is the angle of rotation - often positive.

  • composite result, of Q rotated around P.

    • $ R_{\theta} = 2 cos^{-1}(\frac { {\cos (\frac {{ Q_\theta} - P_{\theta}} 2)}( 1 - (Q_n \cdot P_n) ) + {\cos (\frac {{ Q_\theta} + P_{\theta}} 2) }(1+(Q_n \cdot P_n)) } 2 ) $

    • $ R_n = ( Q_n \times P_n ) ({\cos (\frac {{ Q_\theta} - P_{\theta}} 2)}-{ \cos (\frac {{ Q_\theta} + P_{\theta}} 2) }) + P_n ({\sin (\frac {{ Q_\theta} + P_{\theta}} 2)}+{\sin (\frac {{ Q_\theta} - P_{\theta}} 2)}) + Q_n ({\sin (\frac {{ Q_\theta} + P_{\theta}} 2)}-{\sin (\frac {{ Q_\theta} - P_{\theta}} 2)}) $


  • $ A = Q_n \cdot P_n $

  • $ B = \cos \frac {{ Q_\theta} + P_{\theta}} 2 $

  • $ C = \cos \frac {{ Q_\theta} - P_{\theta}} 2 $

  • $ D = \frac { C( 1 - A ) + B(1+A) } 2 $

  • $ {Result}_{\theta} = 2 \arccos( D ) $

if $ {Result}_{\theta} = 0 $

  • then the two rotations are co-incidental the axis is left unmodified.


  • $ E = \sin \frac {{ Q_\theta} + P_{\theta}} 2 $
  • $ F = \sin \frac {{ Q_\theta} - P_{\theta}} 2 $
  • $ G = ( Q_n \times P_n ) (C-B) + P_n (E+F) + Q_n (E-F) $
  • $ {Result}_n = \frac G {||G||} $

$ {Result} = Result_{\theta} {Result}_n $


You must log in to answer this question.

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