While toying around with some bits-n-bobs for my next quaternion quantization post I made a joke twitter post:

Pointless 3D fact of the day: Given uniform random rotations, then their average is $\pi/2$ + $2/\pi$ radians (~126.476 degrees)


I was probably type parts of this up anyway, so I’ll just do it now…sorry it’s kinda brain-dump like.


Prelim


Rehashing the same old stuff. The set of all quaternions $\mathbb{H}$, excluding zero, can represent 3D rotations by the similarity transform. The subset of quaternions representing the same rotation form a line through the origin (excluded). Limiting ourselves to unit quaternions this line intersects the 4D sphere (3-sphere or $\mathbb{S}^3$) at two points $Q$ and $-Q$. By further limiting ourselves to unit quaternions with positive (or zero) scalars then each point in this subset represents a unique 3D rotation. So unit quaternions lie on $\mathbb{S}^3$ and we can represent all rotations by half of this sphere. By a web-search or hitting up a math reference site we can finding the surface volume (or 3-dimensional cubic hyperarea if that’s your thing) of the sphere which is $2\pi^2$, so the volume of our half sphere is $\pi^2$. Gotta run through the math of this since we need the volume element.

EDIT:



Volume of $SO\left(3\right)$


Define a unit quaternion with the bivector part in azimuth $\left(\alpha\right)$ / inclination $\left(\beta\right)$ spherical coordinates:


with angle ranges of:


Now we have this 3D spherical coordinate thing that’s be converted into a 4D Euclidean space thing and I want to compute the Jacobian determinant. To get a square Jacobian (so we can compute the determinate) I’ll just extend the quaternion to 4D by allowing non-unit magnitude (or a radius if you want) and multply the components by $r$:


Then we have the Jacobian:


Setting $r=1$ then the volume element is:


The volume is then:


Great it agrees with what we could have looked up on Wikipedia.



Volume of $SO\left(3\right)$ take 2


I don’t need it but since I’m typing we could have done this a second way. Without adding an extra dimension the Jacobian is:


then the Euclidean metric:


and it’s determinate:


The volume element is then:

Same as before.



Average rotation angle of uniform random rotations


Not explictly mentioned so far is that $\theta$ is the measure in quaternion space which translates into a $2\theta$ rotation. I want to find the average rotation angle $\phi$ of a uniform distribution of random rotations. We have $q_w = \cos\left(\frac{\phi}{2}\right) = \cos\left(\theta\right)$ and the expected value is:

There’s surely an easier way to do this and I’m shaky on the math here, so an empirical validation: CLICK