### The Polar Form of a Quaternion

In order to deal with rotations in , it will be convenient to represent quaternions in polar form. The reader is no doubt familiar with the polar form of a complex number a + bI = r(cos(t) + I sin(t)) where r = , cos(t) = , sin (t) = , and . There is an analogous representation of a quaternion. Let q = (a, b, c, d). Then q = ah + sn where s = and n = (0, ,,). Let r = |q| = = . Then q = r(h + n). But += 1, so (, ) lies on the unit circle of . Hence there is an angle t, 0 ≤ t < 2π with cos(t) = and sin(t) = . Thus q = r(cos (t)h + sin(t)n). We can easily compute the polar form of a nonzero quaternion. Three functions to accomplish this, `PolarQ`, `angle`, and `PolarQtrig`, are defined below. Each function takes a quaternion as its argument.

Let us compute the polar form of (-13.46, 1.89, -3, -6). We see the axis n and a numerical as well as symbolic polar form of the quaternion showing the associated angle.

One nice application of the polar form is extracting roots of a quaternion. Since and , De Moivre's Theorem works for quaternions and gives that = (cos(mt)h + sin(mt)n). If = y = (cos()h + sin()n) where , then = , cos(mt) = cos(), sin(mt) = sin(). Hence the mth roots of y are given by r = , t = + k() for k = 0, 1 ,2,..., m-1. If y is real, = mt is an integer multiple of so that n is arbitrary (with the exception that |n| = s = 0 for y > 0 and m = 2). Thus we have the interesting result that (a) a nonreal quaternion has exactly quaternionic mth roots; (b) a positive real quaternion has two square roots, but infinitely many mth roots when ; and (c) a negative real quaternion has infinitely many mth roots for all . Let us find all cube roots of the quaternion (1, 1, 1, 1) = 2(cos(60°)h + sin(60°)n).

We can check our answers by cubing each of these quaternions.