half sine and half cosine quaternions

Something is a little bit unclear to me. In the image below you see that you need to divide the angle by a half. Acccording to wikipedia they say that this is so that I could rotate clockwise or counter clockwise. The sine function returns a value between 1 and -1. So I don't understand it. Could somebody explain why I need to divide my angle by a half?

Quaternion rotation


Solution 1:

In one sense, there is no "reason" as such. Sometimes you just need a constant factor. In this case, however, there is one way of thinking about it which helps: The quaternion represents a directed area, and you're rotating by that area.

Here's why it's the correct area: Consider a sector of a unit circle, where the angle of the sector is $\theta$. (Note that we're all grown-ups here, so we're working in radians.) Then the area of the sector is $\frac{\theta}{2}$. There's that division by two.

What's not obvious, though, is why a quaternion represents an area, or what that even means. That's a little bit too involved for this box, but I'll try to explain how things in 2D, then give an outline of how to fill in the gaps.

Consider a 2D plane with vectors. We'll add two basis vectors, called $\hat{e_1}$ and $\hat{e_2}$ (you may know them as $i$ and $j$ in some notation). We know that vectors have an inner product (a.k.a. dot product) which returns a scalar, commutes and so on. (I won't formally define a vector space or inner product space here; look it up.) The basis vectors are orthonormal:

$$e_1 \cdot e_1 = e_2 \cdot e_2 = 1$$ $$e_1 \cdot e_2 = 0$$

We also know that in 3D, there is another product, the outer product (a.k.a. cross product, Gibbs product), which obeys the laws of a Lie bracket. The outer product anticommutes (i.e. $x \times y = - y \times x$). We could, therefore, think of there being a more general product, where the inner product is the bit that commutes and the outer product is the bit that anticommutes.

So we will assume a geometric product $xy$, which in general neither commutes nor anticommutes. If $x$ and $y$ are vectors, we will define:

$$x \cdot y = \frac{1}{2}(xy + yx)$$ $$x \times y = \frac{1}{2}(xy - yx)$$

You can see that by construction, the inner product commutes and the outer product anticommutes. Moreover, if $x$ and $y$ are vectors:

$$xy = x \cdot y + x \times y$$

The first term is a scalar and the second term would, in 3D, be a vector. This is looking a bit like quaternions already, but let's not get ahead of ourselves. In 2D, there is no cross product, so we need to find out exactly what the outer product means.

Whatever it means, if $x$ is a vector, $xx$ must be a scalar, because the outer product part must be zero (after all, $x \times x = - x \times x$). In particular, ${\hat e_1}{\hat e_1} = {\hat e_2}{\hat e_2} = 1$.

So let's expand $x$ and $y$ in terms of the basis vectors and see what happens.

$$(x_1 \hat e_1 + x_2 \hat e_2)(y_1 \hat e_1 + y_2 \hat e_2) = (x_1 x_2 + y_1 y_2) + (x_1 y_2 + x_2 y_1) {\hat e_1}{\hat e_2}$$

The first part is the inner product; we already know that. The second part is the outer product of two vectors. We don't know what ${\hat e_1}{\hat e_2}$ is, but the thing it's multiplied by is the area of a parallelogram with adjacent sides $x$ and $y$. So it has something to do with area.

To save typing, we will call this quantity (known as a pseudoscalar) $I = {\hat e_1}{\hat e_2}$. Why $I$? Let's multiply it by itself using the geometric product and see what happens. Note that the expansion into inner and outer product is only defined for vectors, and this isn't a vector. But we do know what it does to basis vectors, and in particular that ${\hat e_2}{\hat e_1} = - {\hat e_1}{\hat e_2}$, and so:

$$I^2 = {\hat e_1}{\hat e_2}{\hat e_1}{\hat e_2} = -{\hat e_1}{\hat e_1}{\hat e_2}{\hat e_2} = -1$$

So the geometric product of two vectors can be thought of as a complex number. Again, this is looking a lot like quaternions.

To complete the connection, we need to work out what exponentiation does. We can use the well-known identity that if $I\theta = \theta I$ and $I^2=-1$ then $e^{I\theta} = \cos \theta + I \sin \theta$.

(Incidentally, if $J\theta = \theta J$ and $J^2 = 1$ then $e^{J\theta} = \cosh \theta + J \sinh \theta$. This turns out to be important when you extend this idea to 4D, which you need to do to analyse relativistic space-time.)

You can probably see immediately from this what $e^{I\theta}$ does to vectors in 2D, but I encourage you to work out the theory of it. Then you can impress your physicist friends by telling them you independently invented 2D spinors.

The final piece of the puzzle which connects this to quaternions is that if $v$ is a 3D unit vector represented as a quaternion with no real component, then $v^2 = -1$. The proof is left as an exercise.

You should be able to work the rest out for yourself if you want to. If you don't, I would suggest asking Google about "geometric algebra" or "Clifford algebra". There are some excellent tutorials around on the net.

Solution 2:

My understanding of the reason half angles are generally used with quaternions is that when you have a point in 3-D space, $p=(x,y,z)$ which you want to rotate $\theta$ degrees about an axis given by a vector $\vec{v}$:

Write $p$ as a 4-D quaternion that will have real part $0$, just like a point on the $xy$-plane written in 3-D coordinates will have a $z$-coordinate of $0$. Therefore $p=0+xi+yj+zk$

Make a quaternion $q$ to represent the rotaion. You can consider a quaternion to be a 4-D vector that is the axis of rotation vector $\vec{v}$ rotated $\pi-\frac{\theta}{2}$ out of our 3-D space, which means it forms an angle of $\frac{\theta}{2}$ with the $w$-axis. Assuming $\vec{v}$ lies on the unit sphere (if it doesn't, divide by its length), then right now it also lies on the unit hypersphere, since the unit sphere is the "equator" of a unit hypersphere. To rotate it out of 3-D space but keeping it on the hypersphere is very similar to having a vector lying on the $xy$-plane and rotating it upward keeping it on the unit sphere to from angle $\alpha$ with the $z$-axis:

rotate on unit sphere

As you can see, we scale the $xy$-coordinates of the original point $A$ by $\sin{\alpha}$, and the new $z$-coordinate will be just $\cos{\alpha}$. We can do the same to rotate a point on the unit sphere like $\vec{v}$ so it forms an angle $\frac{\theta}{2}$ with the $w$-axis, scaling $\vec{v}$ by $\sin{\frac{\theta}{2}}$ and making the new $w$-coordinate, the real part, $\cos{\frac{\theta}{2}}$so the quaternion will be $\cos{\frac{\theta}{2}} + \sin{\frac{\theta}{2}}\vec{v}$.

It is $\frac{\theta}{2}$ because...

$p'=qpq^{-1}$ will be the a quaternion with real part $0$ (in 3-D space) that corresponds to the point that is the result of the specified rotation. The reason you multiply on one side by $q$ and on the the other by $q^{-1}$ is that a multiplication by just $q$ would produce a $p'$ with real part $\ne 0$, that lies outside of our 3-D space and doesn't make sense because a rotation in 3-D space should produce a point in 3-D space. Essentially by multiplying on the left by $q$ takes you out of our 3-D space and multiplying by the right by $q^{-1}$ brings you back, but with the same real part or angle of rotation each time, kind of like this diagram but 3-D rotation in 4-D space instead of 2-D rotation 3-D space:

2to3

THE ANSWER As you can see this keeps us in the plane/space we started in, but ends up doubling $\theta$ as you rotate once by $\theta$ on your way out and once by $\theta$ on your way back. So we use $\frac{\theta}{2}$ so you end up with $\theta$