Quaternion square roots
If y is a quaternion, how many solutions does x^2 = y have? That is, does every quaternion have a square root, and if so, how many square roots does it have?
A quaternion can have more than two roots. There is a example right in the definition of quaternions:
i^2 = j^2 = k^2 = -1
and so -1 has at least three square roots. It follows that every negative real number has at least three square roots.
Negative realsIn fact, every square root of -1 corresponds to a square root of any other negative number. To see this, let p be a positive real number and let r = p > 0. If x is a square root of -1, then rx is a square root of -p. Conversely, if x is a square root of -p, then x/r is a square root of -1.
So all negative real numbers have the same number of square roots in the quaternions, and that number is at least 3. In fact, it turns out that all negative real numbers have infinitely many quaterion roots. A calculation shows that
(a + bi + cj + dk)^2 = -1
if and only if b^2 + c^2 + d^2 = 1. So there are as many square roots of -1 as there are points on a sphere.
Not negative realsIf a quaternion is not a negative real number, then the story is much more familiar: the equation x^2 = y has one solution if y = 0 and two solutions otherwise.
To summarize, x^2 = y has
- one solution if y = 0,
- infinitely many solutions if y is negative and real, and
- two solutions otherwise.
It's easy to show that 0 has only one root: |x^2| = |x|^2, and so if x^2 = 0, then |x| = 0 and so x = 0. Here the norm of a quaternion is defined by
|a + bi + cj + dk| = (a^2 + b^2 + c^2 + d^2).
If p > 0, the solutions to x^2 = -p are bi + cj + dk where b^2 + c^2 + d^2 = p.
What's left is to show that if y is not zero and not a negative real, then x^2 = y has two solutions.
Polar form and calculating rootsQuaternions have a polar form analogous to the polar form for complex numbers. That is, we can write a quaternion y in the form
y = r(cos + u sin )
where r is real and positive, is real, and u is a unit quaternion with zero real part. We can find r, , and u as follows. Write y as
a + bi + cj + dk = a + q
so that a is the real part and q is the pure quaternion part. Then we can find r, , and u by
r = |y|
cos = a/|y|
u = q / |q|
Then the two roots are
x = r (cos /2 + u sin /2).
Python codeFirst we'll implement the algorithm above, then show that it produces the same results as the Python package quaternionic.
First, our code to compute x satisfying x^2 = y.
import numpy as np np.random.seed(20210106) def norm(q): return sum(t*t for t in q)**0.5 y = np.random.random(size=4) r = norm(y) theta = np.arccos(y[0]/r) u = y + 0 # make a copy u[0] = 0 u /= norm(u) x = np.sin(theta/2)*u x[0] = np.cos(theta/2) x *= r**0.5
And now we check our results using quaternionic.
import quaternionic qx = quaternionic.array(x) qy = quaternionic.array(y) print(f"y = {y}") print(f"x*x = {qx*qx}") # should equal y print(f"x = {x}") # our root print(f"x = {np.sqrt(qy)}") # root via package
This produces
y = [0.61615367 0.07612092 0.09606777 0.11150865] x*x = [0.61615367 0.07612092 0.09606777 0.11150865] x = [0.79189641 0.04806243 0.06065678 0.07040609] x = [0.79189641 0.04806243 0.06065678 0.07040609]More quaternion posts
- Finnegans Wake and quaternions
- How far is xy from yx on average for quaternions?
- Probability of commuting
For an exploration of the roots of general polynomial equations over polynomials, see Equations in Quaternions by Ivan Niven. The American Mathematical Monthly, Dec., 1941, Vol. 48, pp. 654-661.
The post Quaternion square roots first appeared on John D. Cook.