[math-fun] Trivial soln for AX=XB in quaternions
I assume that this solution is known, but I've not seen it before -- e.g., in Wikipedia, etc. I am mystified why not. Find quaternion X s.t. AX=XB, A,B unit vector quaternions. A,B are unit vector quaternions => AA = BB = -1. Consider X=(1-AB). A(1-AB)=(1-AB)B A-AAB = B-ABB A-(-1)B = B-A(-1) A+B = B+A (Check!) -X = AB-1 is also a solution: A(AB-1)=(AB-1)B AAB-A = ABB-B -B-A = -A-B (Check!) Example: A = J, B = (cos(2t) + I sin(2t)) J, X = 1-AB = 2*cos(t)*(cos(t) - I sin(t)). Note that X is actually a square root, as is typical for quaternion rotations. If we want to normalize X, simply divide by 2*cos(t). If X isn't normalized, then denote X' as the conjugate of X, and compute B = X'AX/(X'X); since X'X=|X|^2, we never need to compute |1-AB|. ----- The above is closely related to the following hack: To compute the square root of a complex number z = r*(cos(t)+i*sin(t)): Let sz = |z|+z = r*(1+cos(t)+i*sin(t)). Then sz^2 = 2*(1+cos(t))*r^2*(cos(t)+i*sin(t)) = 2*(1+cos(t))*r*z Thus sqrt(z) = sz/|sz| = sz/sqrt(2*r*(1+cos(t))). Note that we have utilized trig only to show that this hack works; we never have to calculate trig functions to compute the square root. This hack works because the points (0,|z|,z,|z|+z) form a rhombus, so |z|+z has 1/2 the angle of z. Computer graphics people also utilize this hack for quaternion square roots, so how come they don't compute (1-AB) for these rotations, as above?
Hi Henry, Just to clarify - in this context, does unit vector quaternion refer to a quaternion xi + yj + zk such that x^2 + y^2 + z^2 = 1 (i.e. a quaternion that is unit and only has a vector part?) I haven't been able to find this in the literature yet - my best guess so far is that because there are an infinite number of solutions (described below), robotics applications seem to focus on the problem of finding a value of X that minimizes a metric of error (e.g. least squares) in a system of equations A_1 X = X B_1, A_2 X = X B_2, ... It looks like many applications also consider the case where X, A, B, ... are general matrices, which could include translation (e.g. solutions involving dual quaternions), as well as rotations that aren't odd multiples of pi/2 (i.e. A, B not necessarily unit vector quaternions). For the infinite number of solutions, suppose X is a quaternion that satisfies AX = XB, where A and B are nonzero quaternions. Then for any real u, v, (defining the power of a quaternion in an appropriate way), Y = A^u X B^v is another solution to AY = YB, since A (A^u X B^v) B^-1 = A^u A X B^-1 B^v = A^u X B^v = Y so AY = YB. In other words, if a unit quaternion solution to AX=XB exists, and A and B are also unit quaternions (not necessarily unit vector quaternions) (and assuming I haven't made any mistakes!), then there can be up to a 2-dimensional space of unit quaternion solutions. Best regards, --Neil Bickford
On 02/10/2020 01:17, Henry Baker wrote:
To compute the square root of a complex number z = r*(cos(t)+i*sin(t)):
Let sz = |z|+z = r*(1+cos(t)+i*sin(t)).
Then sz^2 = 2*(1+cos(t))*r^2*(cos(t)+i*sin(t)) = 2*(1+cos(t))*r*z
Thus sqrt(z) = sz/|sz| = sz/sqrt(2*r*(1+cos(t))).
Surely the "= sz/|sz|" bit is wrong: z is an arbitrary complex number but you say sqrt(z) = sz/|sz| which is always of modulus 1. So if I've done my algebra right, a square root of z is (z + |z|) / sqrt(2(|z| + Re(z)). (Which it seems like you can find about equally easily by doing the naive thing: let the square root be a+ib, write down the equations for real and imaginary part, solve them, simplify.) -- g
Yes, Gareth, you are correct! Here's the correct derivation: To compute sqrt of z, z=r*(cos(2t)+i*sin(2t)): I claim that r+z = |z|+z is a real multiple of sqrt(z), i.e, |z|+z = r+z = m*sqrt(z), where m = 2*cos(t)*sqrt(r). Note that t here is the angle of the sqrt(z), not the angle of z itself, which is 2t. So m = sqrt(2 r (1+cos(2t)) = sqrt(2 (r + r*cos(2t))) = sqrt(2 Re(|z|+z)) Thus, as you correctly pointed out: sqrt(z) = (|z|+z) / sqrt(2*Re(|z|+z)) The reason for expressing the result like this is to better show the relationship with the quaternion case. At 05:13 AM 10/2/2020, Gareth McCaughan wrote:
On 02/10/2020 01:17, Henry Baker wrote:
To compute the square root of a complex number z = r*(cos(t)+i*sin(t)): Let sz = |z|+z = r*(1+cos(t)+i*sin(t)). Then sz^2 = 2*(1+cos(t))*r^2*(cos(t)+i*sin(t)) = 2*(1+cos(t))*r*z Thus sqrt(z) = sz/|sz| = sz/sqrt(2*r*(1+cos(t))).
Surely the "= sz/|sz|" bit is wrong: z is an arbitrary complex number but you say sqrt(z) = sz/|sz| which is always of modulus 1.
So if I've done my algebra right, a square root of z is (z + |z|) / sqrt(2(|z| + Re(z)).
(Which it seems like you can find about equally easily by doing the naive thing: let the square root be a+ib, write down the equations for real and imaginary part, solve them, simplify.)
-- g
participants (3)
-
Gareth McCaughan -
Henry Baker -
Neil Bickford