<<

Quaternion Equations and Matrices

by

Liji Huang

A Thesis submitted to the Faculty of Graduate Studies of

The University of Manitoba

in partial fulfilment of the requirements of the degree of

MASTER OF SCIENCE

Department of

University of Manitoba

Winnipeg

Copyright © 2012 by Liji Huang Contents

Abstract i

Acknowledgments iii

1. Introduction 1 1.1. History of ...... 1 1.2. Background for Quaternion Equations ...... 5 1.3. Background for Quaternion Polynomial Matrices ...... 8

2. Quaternion Equations 9 2.1. Quaternions and Equivalence Classes ...... 9 2.2. General Quaternion Quadratic Equations ...... 15 2.3. Special Quaternion Equations and problems ...... 20 2.3.1. A quadratic equation ...... 20 2.3.2. Another quadratic equation ...... 36 2.3.3. A homogeneous quadratic equation ...... 40 2.3.4. A pair of quaternion equations ...... 48 2.3.5. Another pair of quaternion equations ...... 52 2.3.6. A least norm problem ...... 55 2.3.7. Another least norm problem ...... 58 3. Quaternion Polynomial Matrices 61 3.1. Generalized Inverse ...... 61 3.2. Leverrier-Faddeev Method ...... 74 3.3. Generalized Inversion by Interpolation ...... 82

A. Maple Codes 89 A.1. Overview ...... 89 A.2. The Codes ...... 90

Bibliography 119 Abstract

In this thesis, we mainly consider finding formula solutions to quaternion equations and calculating the generalized inverses of quaternion polynomial matrices.

In the first chapter, we give a condensed review of the history of quaternions.

The topic of the second chapter is solving quadratic and other quaternion equations. Many mathematicians have worked on solving various quaternion equations. How- ever, due to the complex nature of quaternions, the current "best" non-numerical result is a special case of quadratic quaternion equation presented in (Au-Yeung, 2003), which pales in comparison to what is known about equations in complex numbers. In this chapter, we present a new way to solve not only almost all of the quaternion equations that have been solved so far, including Au-Yeung’s result, but also several more complicated ones. This method can also be easily implemented into computer algebra systems such as Maple. Examples will be included.

The topic of the third chapter is calculating the generalized inverses of quaternion polynomial matrices. It has been shown that a real (Karampetakis, 1997) or complex (Stanimirović et al., 2007) polynomial matrix has the generalized inverse that can be calculated using the Leverrier-Faddeev algorithm (Faddeeva, 1959). It is natural to ask whether a quaternion polynomial matrix has a generalized inverse, and if yes, how it can be calculated. In this chapter, we first give conditions that a quaternion polynomial matrix must satisfy in order to have the generalized inverse. We then

i Contents present an interpolation method that can be used to calculate the generalized inverse of a given quaternion polynomial matrix.

In the appendix, we include our quaternion polynomial matrix Maple module as well as some examples.

ii Acknowledgments

First and foremost, I would like to express my most sincere gratitude to my thesis advisor, Dr. Zhang Yang. I greatly appreciate his encouragement and dedicated support. Countless hours of discussion with Dr. Zhang helped me overcome many obstacles during the writing up of this thesis. Without his wisdom and motivation this thesis would not have been possible.

I greatly appreciate the faculty and staff in the Department of Mathematics for their teaching and support during my two years of being a graduate student in mathematics.

I greatly thank my thesis committee members, Dr. Guenter Krause, Dr. Xikui Wang and Dr. Joe Williams, for reading my thesis and giving me feedback.

On behalf of myself and my wife, I would like to thank Dr. Zhang, the Faculty of Graduate Studies, the Faculty of Science, and the Department of Mathematics, for financially supporting me through my graduate studies.

I would like to thank the University of Manitoba library system for providing a rich supply of online and offline publications. I would also like to thank mapleprimes.com and latex-community.org for all of the excellent technical support I received from

iii Acknowledgments them, and their continued voluntary service to current and future graduate students and academics all over the world.

Finally, I would like to express my appreciation to my family and friends, for all of their support and love.

iv Dedicated to my wife Zifang. 1. Introduction

1.1. History of Quaternions

Quaternions were first discovered by Sir of Ireland on October 16th, 1843, in a "flash of genius", on the Brougham Bridge. It is uncommon that both the date and location of a major mathematical discovery are known, but we precisely know these because at the end of Hamilton’s life, in a letter to his second son, Archibald Henry, he wrote:

Every morning in the early part of [October 1843], on my coming down to breakfast, your (then) little brother, William Edwin, and yourself, used to ask me, “Well, papa, can you multiply triplets?” Whereto I was always obliged to reply, with a sad shake of the head: “No, I can only add and subtract them”.

But on the 16th day of the same month—which happened to be Monday, and a Council day of the Royal Irish Academy—I was walking in to attend and preside, and your mother was walking with me along the Royal Canal, to which she had perhaps driven; and although she talked with me now and then, yet an undercurrent of thought was going on in my mind which gave at last a result, whereof it is not too much to say that I felt at once the importance. An electric circuit seemed to close; and a spark flashed forth the herald (as I foresaw immediately) of many long years to come of definitely directed thought and work by myself, if spared, and, at all

1 1.1 History of Quaternions events, on the part of others if I should even be allowed to live long enough distinctly to communicate the discovery. Nor could I resist the impulse—unphilosophical as it may have been—to cut with a knife on a stone of Brougham Bridge, as we passed it, the fundamental formula with the symbols i, j, k:

i2 = j2 = k2 = ijk = −1 which contains the Solution of the Problem, but, of course, the inscription has long since mouldered away (Derbyshire, 2006).

It was a breakthrough discovery in the sense that after the step from one-dimensional real numbers to two-dimensional complex numbers, the next step was not the natural one to three-dimensional super-complex numbers but to four-dimensional ones, i.e., quaternions. Hamilton embarked on an eight-year journey to develop an algebra for bracketed triplets but ended up discovering quaternions in a moment of euphoria. The Dutch mathematician Van der Waerden called Hamilton’s inspiration "the leap into the fourth dimension" (van der Waerden, 1985). The Scottish mathematical physicist Peter Guthrie Tait, the leading quaternions exponent of his time, claimed "...no figure, nor even model, can be more expressive or intelligible than a quaternion equation" (Tait, 1890). However, Tait’s lifetime friend, William Thomson, 1st Baron Kelvin, disliked quaternions and would have nothing to do with them (Smith and Wise, 1989). Tait’s other great friend, the Scottish mathematical physicist James Clerk Maxwell, remained unconvinced of quaternion’s value in actual calculation, as he put it "...quaternions...is a mathematical method, but it is a method of thinking, and not, at least for the present generation, a method of saving thought" (Maxwell, 1873).

Furthermore, the American scientist Josiah Willard Gibbs did not find quaternions suited to his needs and rejected the quaternionic analysis in favor of his own in-

2 1.1 History of Quaternions vention: vector analysis (Hastings, 2010; Gibbs et al., 1902). The English electrical engineer Oliver Heaviside, who independently formulated vector analysis similar to Gibbs’s system, wrote "...it is impossible to think in quaternions, you can only pre- tend to do it" (Nahin, 2002). The British mathematician gave a poetic illustration on the matter "...I compare a quaternion formula to a pocket- map, a capital thing to put in one’s pocket, but which for use must be unfolded; the formula, to be understood, must be translated into coordinates" (Cayley, 1894). Even the English mathematician Alexander McAulay, a quaternion advocate, stated that "...not much advance in physics has been made by the aid of quaternions" (McAulay, 1892). Indeed, in the century that has passed since McAulay wrote, it can be argued that quaternions faded away to a minor role in mathematics and physics while the Gibbs-Heaviside vector algebra became the everyday work tool of all modern engi- neers and scientists. In 1892, Heaviside, hinting subtly that quaternions are what he called "a positive evil of no inconsiderable magnitude", summarized the matter in this way, and probably the best way "...the invention of quaternions must be re- garded as a most remarkable feat of human ingenuity...but to find out quaternions required a genius" (Nahin).

Today, quaternions still play a role in quantum physics (Adler, 1995; Finkelstein et al., 1962) and other branches of physics (Churchill, 1990). Quaternions are now used throughout the aerospace industry for attitude control of aircraft and space- craft (Kuipers, 2002). Some people claim that quaternions are an important aspect in modern computer graphics for calculations involving three-dimensional rotations because quaternions use less memory, compose faster, and are naturally suited for ef- ficient interpolation (Hanson, 2005). Although, like in the academic circle of physics over a century ago, there are controversies regarding the advantages of quaternion orientation representations in today’s computer graphics and modeling community

3 1.1 History of Quaternions

(Hanson, 2005). Quaternions are also attracting more and more attention in math- ematics. There has been a new surge of interest in quaternions in the mathemat- ics world—a quick search in the American Mathematical Society’s database shows that more than half of the 3232 publications containing the word “quaternion” or “quaternionic” in the title have been published after the year of 1996.

4 1.2 Background for Quaternion Equations

1.2. Background for Quaternion Equations

This section attempts to give a general and brief review on what has been done on quaternion equations, §2.1 offers a more detailed introduction to quaternions themselves.

Let x be a quaternion indeterminate and let ai be quaternions. In 1941, Niven looked into the equation:

m m−1 m−2 x + a1x + a2x + ··· + am = 0, (1.1)

where am 6= 0. He showed that 1.1 has at least one quaternion root.

In the following year, Niven completely solved the equation

m x − am = 0.

In 1944, Eilenberg and Niven showed that even the most general equation with a unique highest term,

a1xa2x ··· xam + φ (x) = 0,

where φ (x) is a sum of finite number of monomials of the form b1xb2x ··· xbk, k < m, has at least one quaternion root. This is also known as the "fundamental theorem of algebra" for quaternions.

In 1944, Johnson gave necessary and sufficient conditions for the equation

xa1 + a2x + a3 = 0 to have a quaternion solution. His result was extended by Tian to include

xa1 + a2x + a3 = 0

5 1.2 Background for Quaternion Equations and

xa1x + a2 = 0, where x denotes the quaternion conjugate of x.

Very little was done to obtain formula solutions of quaternion equations after John- son’s result, until, in 2002, Huang and So solved the special quadratic equation:

2 x + a1x + a2 = 0. (1.2)

Then in the following year, Au-Yeung solved another special quadratic equation, which included both Johnson’s and Huang and So’s results as special cases:

2 x + a1x + xa2 + a3 = 0. (1.3)

Au-Yeung’s paper was the latest non-numerical attempt to find the exact roots of a non-linear quaternion equation.

In 2010, Tian studied and solved two pairs of linear quaternion equations   xa1y = a2, (1.4)  ya2x = a1, and   xa1y = a2, (1.5)  ya2x = a1, where y is also a quaternion indeterminate. In §2.3, we present a new method to finding the solutions to 1.3, 1.4 and 1.5. In addition, we give solutions to several previously unsolved equations and least norm problems, including, for example, the "two-sided" quadratic homogeneous equation:

2 x + a1xa2 = 0,

6 1.2 Background for Quaternion Equations and the least norm problem:

min |a1x − xa2 − a3| . x∈H

In §A.2, we present some maple codes to solve these quaternion equations and problems.

7 1.3 Background for Quaternion Polynomial Matrices

1.3. Background for Quaternion Polynomial Matrices

In 1955, Penrose introduced the term generalized inverse that exists for any matrix with complex elements. In 1965, Decell gave a method for computing the general- ized inverse of a constant complex matrix based on Leverrier-Faddeev’s algorithm (Faddeeva, 1959), which recursively computes coefficients of the characteristic poly- nomial of the matrix. This method was later extended by Karampetakis to real polynomial matrices. In 2006, Stanimirović and Petković applied an interpolation method to the result of Karampetakis. Then in the following year, Stanimirović et al. extended Stanimirović and Petković’s result to include complex polynomial matrices with interpolations at data points.

In Chapter 3, we first give conditions that a quaternion polynomial matrix must satisfy in order to have a generalized inverse. Then we present an interpolation method that can be used to calculate the generalized inverse of a given quaternion polynomial matrix.

In §A.2, we include our Maple codes for calculating the generalized inverse of a given quaternion matrix or quaternion polynomial matrix. We also include our Maple codes that can be used to do Newton and Lagrange quaternionic interpolation, which are closely related to the interpolation of the generalized inverse of a quaternion polynomial matrix.

8 2. Quaternion Equations

2.1. Quaternions and Equivalence Classes

In this section, we will outline some definitions and properties of quaternions. First, recall the definition of quaternions:

Definition 2.1.1. Let R denote the field of the real numbers. Let H be a four- dimensional vector space over R with 1, i, j and k. A quaternion is a vector

x = x0 · 1 + x1i + x2j + x3k ∈ H

with real coefficients x0, x1, x2 and x3. Throughout this thesis, for convenience, if h ∈ H, then we will assume that h = h0 + h1i + h2j + h3k where hi ∈ R, 0 ≤ i ≤ 3.

We denote the real part, h0, by Re h and the imaginary part, h1i + h2j + h3k, by Im h.

Addition and multiplication in H can be defined as follows:

Definition 2.1.2. Let x, y ∈ H. Then quaternion addition is defined as:

x + y = (x0 + y0) + (x1 + y1) i + (x2 + y2) j + (x3 + y3) k.

9 2.1 Quaternions and Equivalence Classes

Quaternion multiplication is defined as:

xy =x0y0 − x1y1 − x2y2 − x3y3

+ (x0y1 + x1y0 + x2y3 − x3y2) i

+ (x0y2 − x1y3 + x2y0 + x3y1) j

+ (x0y3 + x1y2 − x2y1 + x3y0) k.

Remark 2.1.3. By direct calculation, we obtain:

ii = jj = kk = −1,

ij = −ji = k, jk = −kj = i, ki = −ik = j.

It is also worth noting that with the above equations, the multiplication defined in Definition 2.1.2 follows.

Lemma 2.1.4. Quaternion multiplication is not commutative in general. H is a division ring with center R.

Proof. By direct calculation.

Next, conjugate and norm for quaternions are defined as follows:

Definition 2.1.5. Let h ∈ H. Then h denotes the conjugate of h, h = h0 − h1i − √ q 2 2 2 2 h2j − h3k, and |h| denotes the norm of h, |h| = hh = h0 + h1 + h2 + h3.

Lemma 2.1.6. Let x, y ∈ H. Then |x| is non-negative and |·| is a norm on H, i.e.,

|x| = 0 ⇔ x = 0,

|x + y| ≤ |x| + |y| ,

|xy| = |yx| = |x| |y| .

10 2.1 Quaternions and Equivalence Classes

Proof. We will only show that |x + y| ≤ |x| + |y|. The rest of the lemma is true by direct calculation. Since

2 2 |x + y| = |(x0 + y0) + i (x1 + y1) + j (x2 + y2) + k (x3 + y3)|  2 q 2 2 2 2 = (x0 + y0) + (x1 + y1) + (x2 + y2) + (x3 + y3)

2 2 2 2 = (x0 + y0) + (x1 + y1) + (x2 + y2) + (x3 + y3)

2 2 2 2 2 2 2 2 =x0 + x1 + x2 + x3 + y0 + y1 + y2 + y3 + 2x0y0 + 2x1y1 + 2x2y2 + 2x3y3

2 2 = |x| + |y| + 2x0y0 + 2x1y1 + 2x2y2 + 2x3y3, it suffices to show that

|2x0y0 + 2x1y1 + 2x2y2 + 2x3y3| ≤ 2 |x| |y|

|x0y0 + x1y1 + x2y2 + x3y3| ≤ |x| |y|

2 2 2 (x0y0 + x1y1 + x2y2 + x3y3) ≤ |x| |y|

2  2 2 2 2  2 2 2 2 (x0y0 + x1y1 + x2y2 + x3y3) ≤ x0 + x1 + x2 + x3 y0 + y1 + y2 + y3 , which is true by the Cauchy-Schwartz inequality.

Next, inverse and conjugacy class for quaternions are defined as follows:

Lemma 2.1.7. For 0 6= h ∈ H, h−1, the inverse of h, is uniquely determined by h−1 = h . Furthermore, we have |h−1| = 1 . |h|2 |h|

Proof. By direct calculation.

Definition 2.1.8. Two quaternions x and y are said to be similar, or in the same

11 2.1 Quaternions and Equivalence Classes conjugacy class, if these exists a quaternion v 6= 0 such that v−1xv = y, and we write x v y.

Lemma 2.1.9. x v y implies |x| = |y|.

Proof. By Lemma 2.1.7,

1 x y ⇒ v−1xv = y ⇒ |y| = v−1xv = |x| |v| = |x| . v |v|

Next, we state and prove an important result regarding similar quaternions.

Theorem 2.1.10. x v y if and only if Re x = Re y and |Im x| = |Im y|.

Proof. We only prove the forward direction of the theorem. The backward direction is straightforward.

If x = 0 or y = 0, then the claim is true trivially. Assuming x 6= 0 and y 6= 0, we will first show that x0 = y0. Let xv = vy where v 6= 0. That is,

(x0 + x1i + x2j + x3k)(v0 + v1i + v2j + v3k) (2.1)

= (v0 + v1i + v2j + v3k)(y0 + y1i + y2j + y3k) .

After expanding 2.1 and comparing coefficients, we get:   x0v0 − x1v1 − x2v2 − x3v3 = y0v0 − y1v1 − y2v2 − y3v3 = A,     x0v1 + x1v0 + x2v3 − x3v2 = y1v0 + y0v1 + y3v2 − y2v3 = B, (2.2)  x2v0 + x0v2 + x3v1 − x1v3 = y2v0 + y0v2 + y1v3 − y3v1 = C,     x0v3 + x3v0 + x1v2 − x2v1 = y0v3 + y3v0 + y2v1 − y1v2 = D,

12 2.1 Quaternions and Equivalence Classes which is equivalent to:   v0 (x0 − y0) = v1 (x1 − y1) + v2 (x2 − y2) + v3 (x3 − y3) ,     v0 (x1 − y1) = −v1 (x0 − y0) + v2 (x3 + y3) − v3 (x2 + y2) , (2.3)  v0 (x2 − y2) = −v1 (x3 + y3) − v2 (x0 − y0) + v3 (x1 + y1) ,     v0 (x3 − y3) = v1 (x2 + y2) − v2 (x1 + y1) − v3 (x0 − y0) .

Multiplying the four equations of 2.3 by (x0 + y0), (x1 + y1), (x2 + y2) and (x3 + y3) respectively, then adding them, we get

x0 (v1y1 + v2y2 + v3y3) = y0 (v1x1 + v2x2 + v3x3)

x0 (y0v0 − A) = y0 (x0v0 − A)

Ax0 = Ay0.

If x0 = y0, we are done. Assume x0 6= y0. Then A = 0.

Next, multiplying the four equations of 2.3 by (x1 + y1), − (x0 + y0), − (x3 − y3) and (x2 − y2) respectively, then adding them, we get

x0 (y1v0 − y2v3 + y3v2) = y0 (x2v3 − x3v2 + x1v0)

x0 (B − y0v1) = y0 (B − x0v1)

Bx0 = By0.

Since x0 6= y0, B = 0.

Next, multiplying the four equations of 2.3 by (x2 + y2), (x3 − y3), − (x0 + y0) and

13 2.1 Quaternions and Equivalence Classes

− (x1 − y1) respectively, then adding them, we get

x0 (y2v0 + y1v3 − y3v1) = y0 (x2v0 + x3v1 − x1v3)

x0 (C − y0v2) = y0 (C − x0v2)

Cx0 = Cy0.

Since x0 6= y0, C = 0.

Lastly, multiplying the four equations of 2.3 by (x3 + y3), − (x2 − y2), (x1 − y1) and

− (x0 + y0) respectively, then adding them, we get

x0 (y3v0 + y2v1 − y1v2) = y0 (x3v0 + x1v2 − x2v1)

x0 (D − y0v3) = y0 (D − x0v3)

Dx0 = Dy0.

Since x0 6= y0, D = 0. That is, A = B = C = D = 0 ⇒ v = 0 or x = y = 0.

2 2 2 2 2 2 Contradiction. Therefore, x0 = y0. Then by Lemma 2.1.9, x1+x2+x3 = y1 +y2 +y3, that is, |Im x| = |Im y|.

14 2.2 General Quaternion Quadratic Equations

2.2. General Quaternion Quadratic Equations

Let ai, bi, c ∈ H where i ∈ N. We write ai = ai0 + ai1i + ai2j + ai3k and bi = bi0 + bi1i + bi2j + bi3k for easier notation. In this section, we focus on the general quadratic equation:

k 2 X x + aixbi + c = 0, (2.4) i=1 where k ∈ N.

2.4 is equivalent to the real non-linear system:   (2x0 + m11) x1 + m12x2 + m13x3 = −c1 + x0n1, (1)     m21x1 + (2x0 + m22) x2 + m23x3 = −c2 + x0n2, (2) (2.5)  m31x1 + m32x2 + (2x0 + m33) x3 = −c3 + x0n3, (3)     2 2 2 2 x0 − x1 − x2 − x3 + d1x0 + d2x1 + d3x2 + d4x3 + c0 = 0, (4) where mij, ni and di are given by:

M = (mij )3×3   k ai0bi0 − ai1bi1 + ai2bi2 + ai3bi3 ai0bi3 − ai1bi2 − ai2bi1 − ai3bi0 −ai0bi2 − ai1bi3 + ai2bi0 − ai3bi1 X   = −ai0bi3 − ai1bi2 − ai2bi1 + ai3bi0 ai0bi0 + ai1bi1 − ai2bi2 + ai3bi3 ai0bi1 − ai1bi0 − ai2bi3 − ai3bi2  , i=1   ai0bi2 − ai1bi3 − ai2bi0 − ai3bi1 −ai0bi1 + ai1bi0 − ai2bi3 − ai3bi2 ai0bi0 + ai1bi1 + ai2bi2 − ai3bi3

 k  X  (−ai0bi1 − ai1bi0 − ai2bi3 + ai3bi2)   i=1   k  X  N = (n ) =  (−a b + a b − a b − a b ) , i 3×1  i0 i2 i1 i3 i2 i0 i3 i1  i=1   k  X   (−ai0bi3 − ai1bi2 + ai2bi1 − ai3bi0) i=1

15 2.2 General Quaternion Quadratic Equations and

 k  X  (ai0bi0 − ai1bi1 − ai2bi2 − ai3bi3)     i=1   k  X   (−ai0bi1 − ai1bi0 + ai2bi3 − ai3bi2)   i=1  D = (di)4×1 =  k  . X   (−a b − a b − a b + a b )  i0 i2 i1 i3 i2 i0 i3 i1    i=1   k  X  (−ai0bi3 + ai1bi2 − ai2bi1 − ai3bi0) i=1 ˇ Treating x0 as a constant, let M be the coefficient matrix of (1), (2) and (3) of 2.5:   2x0 + m11 m12 m13        .  m21 2x0 + m22 m23      m31 m32 2x0 + m33

Direct calculation yields:

ˇ σ (x0) = det M

3 2 =8x0 + 4(m11 + m22 + m33)x0

+ 2 (m11m22 + m11m33 − m12m21 − m13m31 − m23m32 + m22m33) x0

+ m11m22m33 − m11m23m32 − m12m21m33

+ m13m21m32 + m12m23m31 − m13m22m31.

We continue the discussion by cases:

Case 1. We assume that det Mˇ 6= 0.

Applying Cramer’s rule to (1), (2) and (3) of 2.5, we obtain x1, x2 and

x3 as rational of x0 as follows:

p1 (x0) x1 = , (2.6) σ (x0)

p2 (x0) x2 = (2.7) σ (x0)

16 2.2 General Quaternion Quadratic Equations

and

p3 (x0) x3 = , (2.8) σ (x0)

where

3 2 p1 (x0) =4n1x0 + 2 (n1 (m22 + m33) − n2m12 − n3m13 − 2c1) x0

+ 2 (m12c2 + m13c3 − c1 (m22 + m33)) x0

+ n1 (m22m33 − m23m32) x0 + n2 (m13m32 − m12m33) x0

+ n3 (m12m23 − m13m22) x0 + c1 (m23m32 − m33m22)

+ c2 (m12m33 − m13m32) + c3 (m13m22 − m12m23) ,

3 2 p2 (x0) =4n2x0 + 2 (n2 (m11 + m33) − n1m21 − n3m23 − 2c2) x0

+ 2 (m21c1 + m23c3 − c2 (m11 + m33)) x0

+ n1 (m23m31 − m21m33) x0 + n2 (m11m33 − m13m31) x0

+ n3 (m13m21 − m11m23) x0 + c1 (m21m33 − m23m31)

+ c2 (m13m31 − m11m33) + c3 (m11m23 − m13m21)

and

3 2 p3 (x0) =4n3x0 + 2 (n3 (m11 + m22) − n1m31 − n2m32 − 2c3) x0

+ 2 (m31c1 + m32c2 − c3 (m11 + m22)) x0

+ n1 (m21m32 − m22m31) x0 + n2 (m12m31 − m11m32) x0

+ n3 (m11m22 − m12m21) x0 + c1 (m22m31 − m21m32)

+ c2 (m11m32 − m12m31) + c3 (m12m21 − m11m22) .

17 2.2 General Quaternion Quadratic Equations

Substituting 2.6, 2.7 and 2.8 back into (4) of 2.5, we obtain:

2 2 2 2 p1 (x0) + p2 (x0) + p3 (x0) 0 =x0 + d1x0 + c0 − 2 σ (x0) d p (x ) + d p (x ) + d p (x ) + 2 1 0 3 2 0 4 3 0 . σ (x0)

2 Multiplication of the above equation by σ (x0) yields:

2  2  2 2 2 0 =σ (x0) x0 + d1x0 + c0 − p1 (x0) − p2 (x0) − p3 (x0) (2.9)

+ σ (x0)(d2p1 (x0) + d3p2 (x0) + d4p3 (x0)) .

th 2.9 is an 8 order equation of x0. After solving 2.9 for a real solution

x0, we substitute its value back into 2.6, 2.7 and 2.8 to get x1, x2 and

x3 respectively to obtain a solution to 2.4. The prime difficulty here is that, by Galois theory, there is no formula solution for general eighth degree equations (Morandi, 1996). Furthermore, there does not seem to be a general formula to factor 2.9. However, as we will show in the next section, under certain conditions, 2.9 can be solved.

Case 2. We assume that det Mˇ = 0.

Then x0 is known: it is equal to a (fixed) real root (which always exists) ˇ of the cubic polynomial σ (x0). Let N be the 3 × 1 vector:   −c1 + x0n1       . −c2 + x0n2     −c3 + x0n3

It is clear that 2.5 has a solution only if the last row of the reduced row   echelon form of the augmented matrix Mˇ | Nˇ is a zero row. Under these conditions, (1), (2) and (3) of 2.5, now viewed as a linear system

18 2.2 General Quaternion Quadratic Equations

with unknowns x1, x2 and x3, has infinitely many solutions of the form:   x = s y + t z + w ,  1 1 1 1   x = s y + t z + w , (2.10)  2 2 2 2    x3 = s3y + t3z + w3,

where si, ti and wi ∈ R, 1 ≤ i ≤ 3, and y, z ∈ R are parameters. We plug 2.10 into (4) of 2.5 and obtain:

2 2 2 0 = − (s1y + t1z + w1) − (s2y + t2z + w2) − (s3y + t3z + w3)

+ d2 (s1y + t1z + w1) + d3 (s2y + t2z + w2) + d4 (s3y + t3z + w3) (2.11)

2 + x0 + d1x0 + c0.

The parameters y and z must satisfy 2.11, therefore 2.11 can be seen as a quadratic equation of, WLOG, y:

y2 + f (z) y + g (z) = 0, (2.12)

where f (z) is a linear polynomial of z and g (z) is a quadratic polynomial

2 of z. We can take any z ∈ R such that the discriminant of 2.12, f (z) − 4g (z), a quadratic polynomial of z, is non-negative. We then solve for √ −f(z)± f(z)2−4g(z) y = 2 . Finally, we substitute the value of y and z back

into to 2.10 to get x1, x2 and x3 to obtain a solution to 2.4.

19 2.3 Special Quaternion Equations and problems

2.3. Special Quaternion Equations and problems

In this section, we give solutions to some specific quaternion equations and least norm problems.

2.3.1. A quadratic equation

In this subsection, we consider the quadratic equation that was studied and solved in (Au-Yeung, 2003):

t2 + αt + tβ + γ = 0, (2.13) where α, β and γ ∈ H and t is a quaternion indeterminate. Here I present a somewhat simpler solution.

α0+β0 Let x = t + 2 . Then 2.13 becomes: α + β !2 α + β ! α + β ! 0 = x − 0 0 + α x − 0 0 + x − 0 0 β + γ 2 2 2 = x2 + ax + xb + c, (2.14)

2  α0+β0  α0+β0 where a = Im α, b = Im β and c = 2 − (α + β) 2 + γ. The advantage of 2.14 over 2.13 is that the left and right coefficients of the indeterminate are both pure imaginary.

2.14 is equivalent to the real non-linear system:   2x0x1 + (−a3 + b3) x2 + (a2 − b2) x3 = (−a1 − b1) x0 − c1, (1)     (a3 − b3) x1 + 2x0x2 + (−a1 + b1) x3 = (−a2 − b2) x0 − c2, (2) (2.15)  (−a2 + b2) x1 + (a1 − b1) x2 + 2x0x3 = (−a3 − b3) x0 − c3, (3)     2 2 2 2 x1 + x2 + x3 + (a1 + b1) x1 + (a2 + b2) x2 + (a3 + b3) x3 = x0 + c0. (4)

20 2.3 Special Quaternion Equations and problems

We first show how to solve 2.15 if a = b. When a = b, 2.15 becomes:   2x0 (x1 + a1) = −c1, (1)     2x0 (x2 + a2) = −c2, (2) (2.16)  2x0 (x3 + a3) = −c3, (3)     2 2 2 2 x1 + x2 + x3 + 2a1x1 + 2a2x2 + 2a3x3 = x0 + c0. (4)

  x1 = −a1,   Case 1. If c = c0 ∈ R, then 2.16 can have solutions only if x0 = 0 or x2 = −a2,    x3 = −a3, is part of the solution.

1. When x0 = 0 is part of the solution, (4) of 2.16 becomes:

2 2 2 x1 + x2 + x3 + 2a1x1 + 2a2x2 + 2a3x3 = c

3 3 X 2 X 2 2 (xi + ai) = c + ai = c − a . (2.17) i=1 i=1

2 2.17 can only hold if c − a ≥ 0. In which case, x1, x2 and x3 can be any real numbers that satisfies 2.17.   x1 = −a1,   2. When x2 = −a2, is part of the solution, (4) of 2.16 becomes:    x3 = −a3,

2 2 2 2 −a1 − a2 − a3 = x0 + c

2 2 a − c = x0.

21 2.3 Special Quaternion Equations and problems

The above equation can only hold if and a2 − c ≥ 0. In which case, √ 2 x0 = ± a − c.

Case 2. If c 6= R, then x0 = 0 can never be part of the solution. We obtain, using

the method demonstrated in §2.2, a quartic equation for x0:

  1   x4 + c + a2 + a2 + a2 x2 − c2 + c2 + c2 = 0. 0 0 1 2 3 0 4 1 2 3

2 Replacing x0 by y, we obtain a quadratic equation for y:

  1   f (y) = y2 + c + a2 + a2 + a2 y − c2 + c2 + c2 = 0. 0 1 2 3 4 1 2 3

The solutions of f are: q ± (c + a2 + a2 + a2)2 + (c2 + c2 + c2) − (c + a2 + a2 + a2) y = 0 1 2 3 1 2 3 0 1 2 3 . 2

2 2 2 Since c 6= R, c1 + c2 + c3 > 0, and therefore q (c + a2 + a2 + a2)2 + (c2 + c2 + c2) − (c + a2 + a2 + a2) 0 1 2 3 1 2 3 0 1 2 3 > 0 2

and q − (c + a2 + a2 + a2)2 + (c2 + c2 + c2) − (c + a2 + a2 + a2) 0 1 2 3 1 2 3 0 1 2 3 < 0. 2

So

vq u 2 2 22 2 2 2 2 2 2 u c0 + a + a + a + c + c + c − c0 + a + a + a x = ±t 1 2 3 1 2 3 1 2 3 0 2 vq u 2 2 2 2 u (c0 − a ) − (Im c) − (c0 − a ) = t , 2

22 2.3 Special Quaternion Equations and problems

and   −c1 x1 = − a1,  2x0   −c2 x2 = − a2,  2x0    −c3 x3 = − a3.  2x0 From now on, we can and we will assume that a 6= b. The deter- minant of the coefficient matrix of (1), (2) and (3) of 2.15, Mˇ =   2x −a + b a − b  0 3 3 2 2       a3 − b3 2x0 −a1 + b1, is:     −a2 + b2 a1 − b1 2x0

ˇ σ (x0) = det M

3  2 2 2 =8x0 + 2 (a1 − b1) + (a2 − b2) + (a3 − b3) x0

 2 2 2 2 =2x0 4x0 + (a1 − b1) + (a2 − b2) + (a3 − b3) .

2.15 can have infinitely many solutions only if σ (x0) = 0, this would

mean that x0 = 0.

First, when x0 = 0, (4) of 2.16 becomes

2 2 2 x1 + x2 + x3 + 2a1x1 + 2a2x2 + 2a3x3 = c

3 3 X 2 X 2 2 (xi + ai) = c + ai = c − a . i=1 i=1 The above equation can only hold if c − a2 ≥ 0.

Next, when x0 = 0, the augmented matrix of (1), (2) and (3) of 2.15 is    0 −a3 + b3 a2 − b2 −c1     A =   .  a3 − b3 0 −a1 + b1 −c2     −a2 + b2 a1 − b1 0 −c3

23 2.3 Special Quaternion Equations and problems

We will show that A is the augmented matrix of a consistent linear system if and only if

3 X ci (ai − bi) = 0. i=1 We will show the forward direction first.

Case 1. If ai − bi 6= 0 for 1 ≤ i ≤ 3. We apply Gaussian elimination to A and . obtain (= means row equivalent) :   a3 − b3 0 −a1 + b1 −c2    .   A =   .  0 −a3 + b3 a2 − b2 −c1   P3   ci(ai−bi)  0 0 0 − i=1 a3−b3 Since A is the augmented matrix of a consistent linear system,

P3 i=1 ci (ai − bi) = 0.

Case 2. If a1 − b1 = 0, ai − bi 6= 0 for i = 2, 3, then    0 −a3 + b3 a2 − b2 −c1     A =   .  a3 − b3 0 0 −c2     −a2 + b2 0 0 −c3

Since A is the augmented matrix of a consistent linear system, the last two rows give:   (a3 − b3) x1 = −c2

 (−a2 + b2) x1 = −c3

(a2 − b2) c2 + (a3 − b3) c3 = 0

3 X ci (ai − bi) = 0. i=1

24 2.3 Special Quaternion Equations and problems

Similarly, we can show the same result when a2 − b2 = 0, ai − bi 6= 0 for

i = 1, 3 and a3 − b3 = 0, ai − bi 6= 0 for i = 1, 2.

Case 3. If a1 − b1 6= 0, ai − bi = 0 for i = 2, 3, then   0 0 0 −c1     A =   . 0 0 −a1 + b1 −c2     0 a1 − b1 0 −c3

Since A is the augmented matrix of a consistent linear system, the first

P3 row gives c1 = 0, and therefore i=1 ci (ai − bi) = 0. Similarly, we can

show the same result when a2 − b2 6= 0, ai − bi = 0 for i = 1, 3 and

a3 − b3 6= 0, ai − bi = 0 for i = 1, 2.

P3 For the converse, we assume that i=1 ci (ai − bi) = 0.

Case 1. If a3 − b3 6= 0, then we apply Gaussian elimination to A to obtain:   a3 − b3 0 −a1 + b1 −c2    .   A =    0 −a3 + b3 a2 − b2 −c1   P3   ci(ai−bi)  0 0 0 − i=1 a3−b3   a3 − b3 0 −a1 + b1 −c2     =   .  0 −a3 + b3 a2 − b2 −c1    0 0 0 0 

A is always the augmented matrix of a consistent linear system as it has the solution set   −c2+(a1−b1)s x1 = ,  a3−b3   c1+(a2−b2)s x2 = ,  a3−b3    x3 = s,

where s is a parameter. In order for 2.15 to have a solution, we must

25 2.3 Special Quaternion Equations and problems

have c − a2 ≥ 0 and s must be a solution of

 2  2 −c2 + (a1 − b1) s c1 + (a2 − b2) s 2 0 = + + s − c0 a3 − b3 a3 − b3     −c2 + (a1 − b1) s c1 + (a2 − b2) s + (a1 + b1) + (a2 + b2) + (a3 + b3) s a3 − b3 a3 − b3 ⇔

3 ! X 2 2 0 = (ai − bi) s + O (s) , (2.18) i=1

where O (s) is a complicated linear polynomial of s. The right hand side of 2.18 is not identically equal to zero as the coefficient of s2 is nonzero, and thus it can have at most 2 solutions and therefore 2.15 can have at most 2 solutions.

Case 2. If a3 − b3 = 0 and a2 − b2 = 0, then a1 − b1 6= 0 because a 6= b.

P3 i=1 ci (ai − bi) = 0 implies that c1 = 0 and we have:   0 0 0 0      A =   . 0 0 −a1 + b1 −c2     0 a1 − b1 0 −c3

This system is always consistent as it has the solution set   x = s,  1   c2 x2 = ,  a1−b1    −c3 x3 = ,  a1−b1 where s is a parameter. In order for 2.15 to have a solution, we must

26 2.3 Special Quaternion Equations and problems

have c − a2 ≥ 0 and s must be a solution of

 2  2 2 c2 −c3 0 =s + + − c0 a1 − b1 a1 − b1  c2   −c3  + (a1 + b1) s + (a2 + b2) + (a3 + b3) a1 − b1 a1 − b1 ⇔

2 2 0 = (a1 − b1) s + O (s) , (2.19)

where O (s) is a complicated linear polynomial of s. The right hand side of 2.19 is not identically equal to zero as the coefficient of s2 is nonzero, and therefore it can have at most 2 solutions and therefore 2.15 can have at most 2 solutions.

Case 3. If a3 − b3 = 0 and a2 − b2 6= 0, then    0 0 a2 − b2 −c1     A =   .  0 0 −a1 + b1 −c2     −a2 + b2 a1 − b1 0 −c3

P3 i=1 ci (ai − bi) = 0 implies that c2 (a2 − b2) = −c1 (a1 − b1) and there- fore the first two rows are consistent. Furthermore, this system is always consistent as it has the solution set   c3+(a1−b1)s x1 = ,  a2−b2   x = s,  2    −c1 x3 = ,  a2−b2 where s is a parameter. In order for 2.15 to have a solution, we must

27 2.3 Special Quaternion Equations and problems

have c − a2 ≥ 0 and s must be a solution of

 2  2 c3 + (a1 − b1) s 2 −c1 0 = + s + − c0 a2 − b2 a2 − b2     c3 + (a1 − b1) s −c1 + (a1 + b1) + (a2 + b2) s + (a3 + b3) a2 − b2 a2 − b2 ⇔

 2 2 2 0 = (a1 − b1) + (a2 − b2) s + O (s) , (2.20)

where O (s) is a complicated linear polynomial of s. The right hand side of 2.20 is not identically equal to zero as the coefficient of s2 is nonzero, and therefore it can have at most 2 solutions and therefore 2.15 can have at most 2 solutions.

This concludes our discussion for possible scenarios where 2.15 can have infinitely many solutions.

When x0 6= 0, we have σ (x0) 6= 0. Applying Cramer’s rule to (1), (2) and (3) of

2.15, we obtain x1, x2 and x3 as rational polynomials of x0 as follows:

p1 (x0) x1 = , (2.21) σ (x0)

p2 (x0) x2 = (2.22) σ (x0) and

p3 (x0) x3 = , (2.23) σ (x0)

28 2.3 Special Quaternion Equations and problems where

3 2 p1 (x0) = − 4 (a1 + b1) x0 + 4 (a2b3 − a3b2 − c1) x0

 2 2 2 2 2 2 + (b1 − a1) a1 + a2 + a3 − b1 − b2 − b3 x0

+ 2 (c2 (b3 − a3) + c3 (a2 − b2)) x0

+ (b1 − a1)(c1 (a1 − b1) + c2 (a2 − b2) + c3 (a3 − b3)) ,

3 2 p2 (x0) = − 4 (a2 + b2) x0 + 4 (a3b1 − a1b3 − c2) x0

 2 2 2 2 2 2 + (b2 − a2) a1 + a2 + a3 − b1 − b2 − b3 x0

+ 2 (c1 (a3 − b3) + c3 (b1 − a1)) x0

+ (b2 − a2)(c1 (a1 − b1) + c2 (a2 − b2) + c3 (a3 − b3)) and

3 2 p3 (x0) = − 4 (a3 + b3) x0 + 4 (a1b2 − a2b1 − c3) x0

 2 2 2 2 2 2 + (b3 − a3) a1 + a2 + a3 − b1 − b2 − b3 x0

+ 2 (c1 (b2 − a2) + c2 (a1 − b1)) x0

+ (b3 − a3)(c1 (a1 − b1) + c2 (a2 − b2) + c3 (a3 − b3)) .

Substituting 2.21, 2.23 and 2.23 back into (4) of 2.15, we obtain:

2 2 2 2 p1 (x0) + p2 (x0) + p3 (x0) 0 = − x0 − c0 + 2 σ (x0) (a + b ) p (x ) + (a + b ) p (x ) + (a + b ) p (x ) + 1 1 1 0 2 2 2 0 3 3 3 0 . σ (x0)

29 2.3 Special Quaternion Equations and problems

2 th Multiplication of the above equation by σ (x0) yields a 6 degree equation of x0:

6  2 2 2 2 2 2  4 0 =16x0 + 8 a1 + a2 + a3 + b1 + b2 + b3 + 2c0 x0

 2 2 2 2 + 4c0 (a1 − b1) + (a2 − b2) + (a3 − b3) x0

 2 2 2 2 2 22 2 + a1 + a2 + a3 − b1 − b2 − b3 x0

2 + (8a2b3 − 8a3b2 − 4c1) c1x0

2 + (8a3b1 − 8a1b3 − 4c2) c2x0

2 + (8a1b2 − 8a2b1 − 4c3) c3x0

3 !2 X − ci (ai − bi) . i=1

2 Replacing x0 by y, we obtain a cubic equation of y:

0 =f (y)

3  2 2 2 2 2 2  2 =16y + 8 a1 + a2 + a3 + b1 + b2 + b3 + 2c0 y

 2 2 2 + 4c0 (a1 − b1) + (a2 − b2) + (a3 − b3) y

 2 2 2 2 2 22 + a1 + a2 + a3 − b1 − b2 − b3 y

 2 + (8a2b3 − 8a3b2) c1 − 4c1 y

 2 + (8a3b1 − 8a1b3) c2 − 4c2 y

 2 + (8a1b2 − 8a2b1) c3 − 4c3 y

3 !2 X − ci (ai − bi) i=1

3 2 =16y + D2y + D1y + D0. (2.24)

We next show that f has exactly one strictly positive solution.

P3 2 Since x0 6= 0, D0 = − i=1 ci (ai − bi) < 0. By Descartes’ rule of signs, f has at least one strictly positive solution. Furthermore, f can have multiple positive solutions only if D2 < 0 and D1 > 0. We show that this is impossible.

30 2.3 Special Quaternion Equations and problems

2 2 2 2 2 2 a1+a2+a3+b1+b2+b3 If D2 < 0, then c0 < − 2 . Therefore,

 2 2 2  2 2 2 2 2 22 4c0 (a1 − b1) + (a2 − b2) + (a3 − b3) + a1 + a2 + a3 − b1 − b2 − b3

2 2 2 + (2a2b3 − 2a3b2) + (2a3b1 − 2a1b3) + (2a1b2 − 2a2b1)

 2 2 2 2 2 2  2 2 2 < − 2 a1 + a2 + a3 + b1 + b2 + b3 (a1 − b1) + (a2 − b2) + (a3 − b3)

 2 2 2 2 2 22 + a1 + a2 + a3 − b1 − b2 − b3

2 2 2 + (2a2b3 − 2a3b2) + (2a3b1 − 2a1b3) + (2a1b2 − 2a2b1)

 2 2 22 = − (a1 − b1) + (a2 − b2) + (a3 − b3) < 0.

This gives:

2  2 2 2  2 2 2 2 2 2 4c0 (a1 − b1) + (a2 − b2) + (a3 − b3) + a1 + a2 + a3 − b1 − b2 − b3

2 2 2 < − (2a2b3 − 2a3b2) − (2a3b1 − 2a1b3) − (2a1b2 − 2a2b1) .

Then D1 can be simplified as follows:

2  2 2 2  2 2 2 2 2 2 D1 =4c0 (a1 − b1) + (a2 − b2) + (a3 − b3) + a1 + a2 + a3 − b1 − b2 − b3

2 2 2 + (8a2b3 − 8a3b2) c1 − 4c1 + (8a3b1 − 8a1b3) c2 − 4c2 + (8a1b2 − 8a2b1) c3 − 4c3

2 2 2 < − (2a2b3 − 2a3b2) − (2a3b1 − 2a1b3) − (2a1b2 − 2a2b1)

2 2 2 + (8a2b3 − 8a3b2) c1 − 4c1 + (8a3b1 − 8a1b3) c2 − 4c2 + (8a1b2 − 8a2b1) c3 − 4c3

2 2 2 = − (2a2b3 − 2a3b2 − 2c1) − (2a3b1 − 2a1b3 − 2c2) − (2a1b2 − 2a2b1 − 2c3)

≤0.

√ Therefore, f has exactly one strictly positive solution z. We can plug x0 = ± z into 2.21, 2.23 and 2.23 to get x1, x2 and x3 respectively.

In all of the above discussion, solutions to 2.13 can be obtained by calculating

31 2.3 Special Quaternion Equations and problems

  t = x − α0+β0 ,  0 0 2    t1 = x1, α0+β0  α0+β0  t = x − 2 = x0 − 2 + x1i + x2j + x3k, that is, for each  t = x ,  2 2    t3 = x3, x.

We are now able to give a theorem that sums up our result so far in this subsection.

Theorem 2.3.1. The solutions of the quadratic equation

t2 + αt + tβ + γ = 0, (2.25) where α, β and γ ∈ H and t is a quaternion indeterminate, can be obtained by 2  α0+β0  formulas according to the following cases, let a = Im α, b = Im β and c = 2 −

α0+β0 (α + β) 2 + γ. In the following, we call    √ α +β  √ α +β t = s − 0 0 , t = − s − 0 0 ,  0 2  0 2    √  √  p1( s)  p1(− s) t = √ , t = √ ,  1 σ( s)  1 σ(− s) √ and √  p2( s)  p2(− s) t = √ , t = √ ,  2 σ s  2 σ − s  ( )  ( )  √  √  p3( s)  p3(− s) t = √ , t = √ ,  3 σ( s)  3 σ(− s) where s is the unique positive root of 2.24, the standard solutions.

1. a = b.

a) c ∈ R.

2 α0+β0 i. c − a > 0. t0 = − 2 and (t1, t2, t3) can be any real number triple P3 2 2 that satisfies the equation i=1 (ti + ai) = c − a . This is the only case where 2.25 has infinitely many solutions.

32 2.3 Special Quaternion Equations and problems

ii. a2 − c ≥ 0.  √  2 α0+β0 t0 = ± a − c − ,  2    t1 = −a1,

 t2 = −a2,     t3 = −a3.

b) c∈ / R.   α0+β0 t0 = s − ,  2    c1 t1 = −a1 − 2s ,

 c2 t2 = −a2 − ,  2s    c2 t3 = −a2 − 2s , or   α0+β0 t0 = −s − ,  2    c1 t1 = −a1 + 2s ,

 c2 t2 = −a2 + ,  2s    c2 t3 = −a2 + 2s ,

r√ 2 2 2 2 (c0−a ) −(Im c) −(c0−a ) where = 2 .

2. a 6= b. Standard solutions always exist. Furthermore,

P3 2 a) i=1 ci (ai − bi) = 0 and c − a ≥ 0.

33 2.3 Special Quaternion Equations and problems

i. a3 6= b3. Possible solutions must be of the form   α0+β0 t0 = − ,  2    −c2+(a1−b1)s t1 = ,  a3−b3

 c1+(a2−b2)s t2 = ,  a3−b3    t3 = s,

where s is a real number that satisfies the quadratic equation 2.18

ii. a3 = b3 and a2 = b2. Possible solutions must be of the form   α0+β0 t0 = − ,  2    t1 = s,

 c2 t2 = ,  a1−b1    −c3 t3 = ,  a1−b1 where s is a real number that satisfies the quadratic equation 2.19

iii. a3 = b3 and a2 6= b2. Possible solutions must be of the form   α0+β0 t0 = − ,  2    c3+(a1−b1)s t1 = ,  a2−b2

 t2 = s,     −c1 t3 = ,  a2−b2 where s is a real number that satisfies the quadratic equation 2.20

b) Otherwise. No additional solutions exist.

Example 2.3.2. Find all the solutions of

t2 + (1 − 2i − 2j − 2k) t + t (1 + i − 3j + k) + (−1 − 3i + j − 2k) = 0. (2.26)

34 2.3 Special Quaternion Equations and problems

The following steps have been implemented into a single procedure in Maple. For details, see the “AY” procedure of §A.2.

Let x = t + 1. Then 2.26 becomes

x2 + (−2i − 2j − 2k) x + x (i − 3j + k) + (−2 − 2i + 6j − k) = 0. (2.27)

We have

3 X ci (ai − bi) = (−2) · (−2 − 1) + 6 · (−2 + 3) + (−1) · (−2 − 1) = 15 6= 0. i=1 By Theorem 2.3.1, there are only standard solutions and we obtain a cubic poly-

2 nomial of y = x0:

f (y) = 16y3 + 152y2 − 251y − 225. f (y) has one positive root

13√ 1  18 √  1  19 y = 13 sin arctan 10091901 + π − = s. 6 3 85634 6 6

The two solutions to 2.26 are √ √ √ √  p ( s) p ( s) p ( s) s − 1 + 1 √ i + 2 √ j + 3 √ k ≈ 0.41 + 0.8i + 1.14k σ ( s) σ ( s) σ ( s) and √ √ √  √  p (− s) p (− s) p (− s) − s − 1 + 1 √ i + 2 √ j + 3 √ k ≈ −2.41 + 0.87i + 1.65j − 1.93k σ (− s) σ (− s) σ (− s)

These answers are verified to be correct by direct claculation.

35 2.3 Special Quaternion Equations and problems

2.3.2. Another quadratic equation

In this subsection, we consider another quadratic equation:

x2 + axb + c = 0, (2.28) where a and b ∈ H with a0 = b0 = 0, c ∈ R and x is a quaternion indeterminate. We assume that ab 6= 0. Otherwise, 2.28 is reduced to x2 + c = 0, which was studied and solved in (Niven, 1942). We also assume that c 6= 0. Otherwise, 2.28 is reduced to x2 + axb = 0, which we will discuss in §2.3.3.

2.28 is equivalent to the real non-linear system:   (2x0 + m11) x1 + m12x2 + m13x3 = (−a2b3 + a3b2) x0, (1)     m21x1 + (2x0 + m22) x2 + m23x3 = (a1b3 − a3b1) x0, (2) (2.29)  m31x1 + m32x2 + (2x0 + m33) x3 = (−a1b2 + a2b1) x0, (3)     2 2 2 2 x0 − x1 − x2 − x3 + d1x0 + d2x1 + d3x2 + d4x3 + c = 0, (4) where mij and di are given by:

M = (mij)3×3   −a1b1 + a2b2 + a3b3 −a1b2 − a2b1 −a1b3 − a3b1      =   ,  −a1b2 − a2b1 a1b1 − a2b2 + a3b3 −a2b3 − a3b2      −a1b3 − a3b1 −a2b3 − a3b2 a1b1 + a2b2 − a3b3 and   −a1b1 − a2b2 − a3b3        a2b3 − a3b2  D = (d ) =   . i 4×1      −a1b3 + a3b1      a1b2 − a2b1

We already discussed in §2.2 how to solve 2.28 if the determinant of the coefficient

36 2.3 Special Quaternion Equations and problems

  2x + m m m  0 11 12 13    ˇ   matrix, M =  m21 2x0 + m22 m23 , is zero. We can and will assume     m31 m32 2x0 + m33 that det Mˇ 6= 0.

ˇ σ (x0) = det M

 2  2 2 2  2 2 2 = (b1a1 + a2b2 + a3b3 + 2x0) 4x0 − a1 + a2 + a3 b1 + b2 + b3 6= 0,

2 2 2 2 2 2 2 therefore, 4x0 − (a1 + a2 + a3)(b1 + b2 + b3) 6= 0. Applying Cramer’s rule to (1), (2) and (3) of 2.29, we obtain x1 as a rational polynomial of x0,

2 2 2 2 2 2 2 [x0 (a3b2 − a2b3)] (4x0 − (a1 + a2 + a3)(b1 + b2 + b3)) x1 = 2 2 2 2 2 2 2 (b1a1 + a2b2 + a3b3 + 2x0) (4x0 − (a1 + a2 + a3)(b1 + b2 + b3)) x0 (a3b2 − a2b3) = = p1 (x0) . (2.30) b1a1 + a2b2 + a3b3 + 2x0

Similarly,

x0 (a1b3 − a3b1) x2 = = p2 (x0) (2.31) b1a1 + a2b2 + a3b3 + 2x0 and

x0 (a2b1 − a1b2) x3 = = p3 (x0) . (2.32) b1a1 + a2b2 + a3b3 + 2x0

Substituting 2.30, 2.31 and 2.32 back into (4) of 2.29, then multiplying through by

2 (b1a1 + a2b2 + a3b3 + 2x0) , we obtain a quartic equation of x0,

 3  1 1 f (x ) = x4 + c − α x2 + β (4c − α) x + cβ2 = 0, (2.33) 0 0 4 0 4 0 4 where

 2 2 2  2 2 2 α = a1 + a2 + a3 b1 + b2 + b3 and

β = a1b1 + a2b2 + a3b3.

37 2.3 Special Quaternion Equations and problems

1 2 2  3 3 2 The discriminant of f is 4f = 256 β (α − β ) (α + 4c) (3α − 4c) − 1024c β . 2 Since α − β ≥ 0 by the Cauchy–Schwartz inequality, 4f < 0 if an only if (α + 4c) (3α − 4c)3 − 1024c3β2 < 0.

Once we solve f for x0, we substitute its value back into 2.30, 2.31 and 2.32 to get x1, x2 and x3 respectively to obtain a solution to 2.28.

Example 2.3.3. Find all the solutions of

x2 + (−i − 3j + 2k) x (−2i + j − k) + 21 = 0. (2.34)

The following steps have been implemented into a single procedure in Maple. For details, see the “AXBc” procedure of §A.2.

2.34 is equivalent to   (2x0 − 7) x1 − 5x2 + 3x3 = −x0, (1)     −5x1 + (2x0 + 3) x2 − 5x3 = 5x0, (2) (2.35)  3x1 − 5x2 + (2x0 + 1) x3 = 7x0, (3)     2 2 2 2 x1 + x2 + x3 − x1 + 5x2 + 7x3 = x0 + 21. (4)

  2x − 7 −5 3  0      When the determinant of the coefficient matrix,  −5 2x0 + 3 −5 , is 0,     3 −5 2x0 + 1 3 2 that is, when σ (x0) = 8x0 − 12x0 − 168x0 + 252 = 0, 2.35 has no solutions because   2x − 7 −5 3 −x  0 0     the last row of the reduced row echelon form of  −5 2x0 + 3 −5 5x0      3 −5 2x0 + 1 7x0 is not a zero row. Otherwise, by 2.33, we obtain a quartic polynomial of x0,

189 f (x ) = x4 − 42x2 + 0 0 0 4 q √ 1 f (x0) has four positive roots x0 = ± 2 84 ± 30 7. Therefore, by 2.30, 2.31 and

38 2.3 Special Quaternion Equations and problems

2.32, the four solutions to 2.34 are

q √ q √  q √  q √  84 + 30 7 84 + 30 7 84 + 30 7 84 + 30 7 + p1   i + p2   j + p3   k 2 2 2 2

≈6.39 − 0.65i + 3.27j + 4.57k,

q √ q √  q √  q √  84 − 30 7 84 − 30 7 84 − 30 7 84 − 30 7 + p1   i + p2   j + p3   k 2 2 2 2

≈1.08 + 1.27i − 6.34j − 8.87k,

q √  q √   q √   q √  − 84 + 30 7 − 84 + 30 7 − 84 + 30 7 − 84 + 30 7 + p1   i + p2   j + p3   k 2 2 2 2

≈ − 6.39 − 0.40i + 2.02j + 2.83k, and

q √  q √   q √   q √  − 84 − 30 7 − 84 − 30 7 − 84 − 30 7 − 84 − 30 7 + p1   i + p2   j + p3   k 2 2 2 2

≈ − 1.08 − 0.21i + 1.04j + 1.46k

These answers are verified to be correct by direct claculation.

39 2.3 Special Quaternion Equations and problems

2.3.3. A homogeneous quadratic equation

In this subsection, we consider the currently unsolved homogeneous quadratic equa- tion:

x2 + axb = 0, (2.36) where a and b ∈ H and x is the quaternion unknown. We assume that a∈ / R and b∈ / R. Otherwise, 2.36 is reduced to x (x + ab) = 0 or (x + ab) x = 0.

2.36 is equivalent to the real non-linear system:   (2x0 + m11) x1 + m12x2 + m13x3 = x0n1, (1)     m21x1 + (2x0 + m22) x2 + m23x3 = x0n2, (2) (2.37)  m31x1 + m32x2 + (2x0 + m33) x3 = x0n3, (3)     2 2 2 2 x0 − x1 − x2 − x3 + d1x0 + d2x1 + d3x2 + d4x3 + c0 = 0, (4) where mij, ni and di are given by:

M = (mij)3×3    a0b0 − a1b1 + a2b2 + a3b3 a0b3 − a1b2 − a2b1 − a3b0 −a0b2 − a1b3 + a2b0 − a3b1     =   , −a0b3 − a1b2 − a2b1 + a3b0 a0b0 + a1b1 − a2b2 + a3b3 a0b1 − a1b0 − a2b3 − a3b2      a0b2 − a1b3 − a2b0 − a3b1 −a0b1 + a1b0 − a2b3 − a3b2 a0b0 + a1b1 + a2b2 − a3b3

  −a0b1 − a1b0 − a2b3 + a3b2     N = (n ) =   , i 3×1 −a0b2 + a1b3 − a2b0 − a3b1     −a0b3 − a1b2 + a2b1 − a3b0

40 2.3 Special Quaternion Equations and problems and    a0b0 − a1b1 − a2b2 − a3b3        −a0b1 − a1b0 + a2b3 − a3b2 D = (d ) =   . i 4×1     −a0b2 − a1b3 − a2b0 + a3b1     −a0b3 + a1b2 − a2b1 − a3b0

We already showed in §2.2 how to solve such an equation when the determinant of    2x0 + m11 m12 m13      the coefficient matrix, Mˇ =  , is zero. We can  m21 2x0 + m22 m23      m31 m32 2x0 + m33 and will assume that det Mˇ 6= 0. Direct calculation yields:

ˇ σ (x0) = det M

3 2 =8x0 + 4(m11 + m22 + m33)x0

+ 2 (m11m22 + m11m33 − m12m21 − m13m31 − m23m32 + m22m33) x0

+ m11m22m33 − m11m23m32 − m12m21m33

+ m13m21m32 + m12m23m31 − m13m22m31.

Applying Cramer’s rule to (1), (2) and (3) of 2.37, we obtain x1, x2 and x3 as rational polynomials of x0 as follows:

p1 (x0) x1 = , (2.38) σ (x0)

p2 (x0) x2 = (2.39) σ (x0) and

p3 (x0) x3 = , (2.40) σ (x0)

41 2.3 Special Quaternion Equations and problems where

3 2 p1 (x0) =4n1x0 + 2 (n1 (m22 + m33) − n2m12 − n3m13) x0

+ n1 (m22m33 − m23m32) x0

+ n2 (m13m32 − m12m33) x0

+ n3 (m12m23 − m13m22) x0,

3 2 p2 (x0) =4n2x0 + 2 (n2 (m11 + m33) − n1m21 − n3m23) x0

+ n1 (m23m31 − m21m33) x0

+ n2 (m11m33 − m13m31) x0

+ n3 (m13m21 − m11m23) x0 and

3 2 p3 (x0) =4n3x0 + 2 (n3 (m11 + m22) − n1m31 − n2m32) x0

+ n1 (m21m32 − m22m31) x0

+ n2 (m12m31 − m11m32) x0

+ n3 (m11m22 − m12m21) x0.

Substituting 2.38, 2.39 and 2.40 back into (4) of 2.37, we obtain:

2 0 =x0 + d1x0 2 2 2 p1 (x0) + p2 (x0) + p3 (x0) d2p1 (x0) + d3p2 (x0) + d4p3 (x0) − 2 + , σ (x0) σ (x0)

2 th Multiplication of the above equation by σ (x0) yields an 8 degree polynomial of

42 2.3 Special Quaternion Equations and problems

x0,

0 =f (x0) (2.41)

2  2  2 2 2 2 =σ (x0) x0 + d1x0 − d1x0 − p2 (x0) − p3 (x0)

+ σ (x0)(d2p1 (x0) + d3p2 (x0) + d4p3 (x0)) .

2.41 can be factored into the product of x0, a cubic and a quartic polynomial of x0,

f (x0) = x0h (x0) g (x0) , where the cubic polynomial is

3 2 h (x0) =x0 + 2a0b0x0 (2.42) 4 1     + a2b2 − a2 − 3a2 − 3a2 − 3a2 b2 − 3b2 − 3b2 − 3b2 x 3 0 0 12 0 1 2 3 0 1 2 3 0 1 + B (a b − a b − a b − a b ) , 4 0 0 1 1 2 2 3 3 and the quartic polynomial is

1 1 1 g (x ) = x4 + 2a b x3 + Ax2 + a b Bx + B2, (2.43) 0 0 0 0 0 2 0 2 0 0 0 16 with

2 2  2 2 2 2  2 2 2 2 A = 4a0b0 − a1 + a2 + a3 − a0 b1 + b2 + b3 − b0 and

 2 2 2 2  2 2 2 2 B = a0 + a1 + a2 + a3 b0 + b1 + b2 + b3 .

Furthermore, g (x0) can be factored in R as

g (x0) = g1 (x0) g2 (x0) ,

43 2.3 Special Quaternion Equations and problems where

1 g (x ) = x2 + sx + B 1 0 0 0 4 and

1 g (x ) = x2 + tx + B, 2 0 0 0 4 with

q 2 2 2 2 2 2 s = a0b0 + (b1 + b2 + b3)(a1 + a2 + a3) and

q 2 2 2 2 2 2 t = a0b0 − (b1 + b2 + b3)(a1 + a2 + a3).

The discriminants of g1 and g2 are

2 2 2 2 2 2 2 2 2 2 2 2 4g1 = − b3a0 − a1b0 − a2b0 − a3b0 − b2a0 − a0b1 q 2 2 2 2 2 2 + 2b0a0 (b1 + b2 + b3)(a1 + a2 + a3)  q q 2 2 2 2 2 2 2 = − a0 (b1 + b2 + b3) − b0 (a1 + a2 + a3) ≤ 0 and

2 2 2 2 2 2 2 2 2 2 2 2 4g2 = − b3a0 − a1b0 − a2b0 − a3b0 − b2a0 − a0b1 q 2 2 2 2 2 2 − 2b0a0 (b1 + b2 + b3)(a1 + a2 + a3)  q q 2 2 2 2 2 2 2 = − a0 (b1 + b2 + b3) + b0 (a1 + a2 + a3) ≤ 0.

We continue the discussion by cases:

Case 1. When a0 = b0 = 0.

44 2.3 Special Quaternion Equations and problems

Then h (x0), g (x0) and σ (x0) can be simplified to:

1     h (x ) =x3 − 3a2 + 3a2 + 3a2 3b2 + 3b2 + 3b2 x (2.44) 0 0 12 1 2 3 1 2 3 0 1     − a2 + a2 + a2 b2 + b2 + b2 (a b + a b + a b ) , 4 1 2 3 1 2 3 1 1 2 2 3 3

 1    2 g (x ) = x2 − a2 + a2 + a2 b2 + b2 + b2 (2.45) 0 0 4 1 2 3 1 2 3

and

 1     σ (x ) = 4 (2x + a b + a b + a b ) x2 − a2 + a2 + a2 b2 + b2 + b2 . 0 0 1 1 2 2 3 3 0 4 1 2 3 1 2 3 (2.46)

Note that we already assumed that σ (x0) 6= 0, and therefore 2.45 does not contribute any roots. We next show that 2.44 always has three real solutions. The discriminant of h is

27  2  2 4 = a2 + a2 + a2 b2 + b2 + b2 h 16 1 2 3 1 2 3  2 2 2 × (a1b2 − a2b1) + (a1b3 − a3b1) + (a2b3 − a3b2)

≥0.

So the solution to f (x0) are 0 and the 3 real roots of 2.44. q 2 2 2 (a1+a2+a3) a0 Case 2. Otherwise. 4g1 < 0 unless = q , that is, a0 = cb0 and b0 2 2 2 (b1+b2+b3) 2 2 2 2 2 2 2 a1 + a2 + a3 = c (b1 + b2 + b3) for some 0 < c. Under these conditions,

4g2 < 0 and therefore g2 does not contribute any solutions. However, g1 can be simplified to

  1  2 x2 + c b2 + b2 + b2 + b2 x + c2 b2 + b2 + b2 + b2 . (2.47) 0 0 1 2 3 0 4 0 1 2 3 q 2 2 2 (a1+a2+a3) a0 Similarly, 4g2 < 0 unless = − q = c for some c < 0. Under b0 2 2 2 (b1+b2+b3)

these conditions, 4g1 < 0 and therefore g1 does not contribute any solu-

45 2.3 Special Quaternion Equations and problems

tions. However g2 can also be simplified to 2.47. So the roots of f (x0) 2 2 2 2 a0(b +b +b +b ) are 0, the real root(s) of 2.42 and − 0 1 2 3 which has multiplicity 2b0 2 and is contributed by 2.47.

Once we obtain x0, we substitute its value back into 2.38, 2.39 and 2.40 to get x1, x2 and x3 respectively to obtain a solution to 2.36.

Example 2.3.4. Find all the solutions of

x2 + (−19 + 15i − j + 11k) x (9 + 10i − 4j + 10k) = 0. (2.48)

The following steps have been implemented into a single procedure in Maple. For details, see the “AXB” procedure of §A.2.

2.48 is equivalent to   (2x0 − 207) x1 − 219x2 − 345x3 = 21x0, (1)     359x1 + (2x0 + 85) x2 − 271x3 = −27x0, (2) (2.49)  −175x1 + 379x2 + (2x0 − 127) x3 = 141x0, (3)     2 2 2 2 x1 + x2 + x3 − 89x1 + 107x2 − 41x3 = x0 − 435x0. (4)

When the determinant of the coefficient matrix,   2x0 − 207 −219 −345         359 2x0 + 85 −271      −175 379 2x0 − 127

3 2 is 0, that is, when σ (x0) = 8x0 − 996x0 + 237708x0 − 91470060 = 0, 2.49 has no solutions because the last row of the reduced row echelon form of   2x0 − 207 −219 −345 21x0         359 2x0 + 85 −271 −27x0     −175 379 2x0 − 127 141x0

46 2.3 Special Quaternion Equations and problems

is not a zero row. Otherwise, by 2.42, we obtain a cubic polynomial of x0,

3 2 f (x0) = x − 342x + 6858x − 22867515

f (x0) has one real root:

√ 1 3   3 7140 x0 = 3710932 + 4 853947883289 + √ 1 + 114 2   3 3710932 + 4 853947883289

=δ.

Therefore, by 2.38, 2.39 and 2.40, the solutions to 2.48 are 0 and

p (δ) p (δ) p (δ) δ + 1 i + 2 j + 3 k σ (δ) σ (δ) σ (δ) ≈443.03 + 62.3i − 7.35j + 100.33k.

This answer is verified to be correct by direct claculation.

47 2.3 Special Quaternion Equations and problems

2.3.4. A pair of quaternion equations

Two nonzero quaternions a and b are said to be semisimilar if the following system has a solution:   yax = b, (2.50)  xby = a, where x and y are nonzero quaternion indeterminates. 2.50 was studied and solved in (Tian, 2010). In this subsection, we present a somewhat simpler solution.

2.50 can be written as   −1 −1 y = bx a ,

 −1 −1 y = b x a, this gives:

bx−1a−1 = b−1x−1a (2.51)

−1 −1 |b| a = b |a| ⇒ |a| = |b| .

Therefore, a and b must satisfy the following equation for 2.55 to have solutions,

2 2 2 2 2 2 2 2 a0 + a1 + a2 + a3 = b0 + b1 + b2 + b3. (2.52)

2.51 is equivalent to xb2 = a2x, which is equivalent to the real linear homogeneous system:   m11x1 + m12x2 + m13x3 + m14x0 = 0,     m21x1 + m22x2 + m23x3 + m24x0 = 0, (2.53)  m31x1 + m32x2 + m33x3 + m34x0 = 0,     m41x1 + m42x2 + m43x3 + m44x0 = 0.

48 2.3 Special Quaternion Equations and problems

where mij is given by the 4 × 4 skew-symmetric matrix:

M = (mij)4×4    d −2 (a0a3 + b0b3) 2 (a0a2 + b0b2) 2 (a0a1 − b0b1)        2 (a0a3 + b0b3) d −2 (a0a1 + b0b1) 2 (a0a2 − b0b2)   ,     −2 (a0a2 + b0b2) 2 (a0a1 + b0b1) d 2 (a0a3 − b0b3)     −2 (a0a1 − b0b1) −2 (a0a2 − b0b2) −2 (a0a3 − b0b3) d

2 2 2 2 2 2 2 2 where the diagonal entries are d = a0 − a1 − a2 − a3 − b0 + b1 + b2 + b3. By 2.52,

2 2 2 2 2 2 d = a0 − b0 + a0 − b0 = 2a0 − 2b0.

Therefore, M becomes:   2 2  a0 − b0 − (a0a3 + b0b3) a0a2 + b0b2 a0a1 − b0b1      2 2   a0a3 + b0b3 a0 − b0 − (a0a1 + b0b1) a0a2 − b0b2   .    2 2  − (a0a2 + b0b2) a0a1 + b0b1 a0 − b0 a0a3 − b0b3    2 2  − (a0a1 − b0b1) − (a0a2 − b0b2) − (a0a3 − b0b3) a0 − b0

We continue the discussion by cases.

Case 1. If a0 = b0 or a0 = −b0, then det M = 0. Therefore, the homoge- neous system 2.53 has a solution set with an infinite number of solutions

(x0, x1, x2, x3). Each such x gives a solution to 2.50,   x = x,

 −1 −1 y = bx a .

2 2 2 2 Case 2. Otherwise, we show that 2.50 has no solutions. Let A = a0 + a1 + a2 + a3

2 2 2 2 and B = b0 + b1 + b2 + b3. Direct calculation yields:

2 2  2 2 det M =a0b0 (A − B) A − B − 4a0 + 4b0

+ (a0 + b0)(a0 − b0)(a0A − b0B)(a0A + b0B) .

49 2.3 Special Quaternion Equations and problems

A = B by 2.52 and therefore,

det M =0 + (a0 + b0)(a0 − b0) A (a0 − b0) A (a0 + b0)

2 2 2 = (a0 + b0) (a0 − b0) A .

Since a 6= 0, A 6= 0 and therefore det M 6= 0. This implies that the

homogeneous system 2.53 has only trivial solutions (x0, x1, x2, x3) = (0, 0, 0, 0). A contradiction. Therefore, 2.50 has no solutions.

Example 2.3.5. Find all (x, y) such that the following system holds   y (2 + 5i + 12j − 5k) x = 2 + 4i − 3j + 13k, (2.54)  x (2 + 4i − 3j + 13k) y = 2 + 5i + 12j − 5k.

The following steps have been implemented into a single procedure in Maple. For details, see the “SemiSim” procedure of §A.2.

Since Re (2 + 4i − 3j + 13k) = 2 = Re (2 + 5i + 12j − 5k) and

|2 + 4i − 3j + 13k| =22 + 42 + (−3)2 + 132 = 198

=22 + 52 + 122 + (−5)2 = |2 + 5i + 12j − 5k| ,

2.54 has infinitely many solutions. First we solve the linear system   −16x2 + 18x3 − 2x0 = 0,     16x1 − 18x3 − 30x0 = 0,

 18x1 − 18x2 − 36x0 = 0,     2x1 + 30x2 − 36x3 = 0.

50 2.3 Special Quaternion Equations and problems

Direct calculation yields:   x0 = −8t2 + 9t3,     x1 = −15t2 + 18t3,

 x2 = t2,     x3 = t3, where t2 and t3 are arbitrary real numbers such that x = x0 + x1i + x2j + x3k 6= 0. Then we have a solution set with an infinite number of solutions of the form:   x = x,

 −1 −1 y = (2 + 5i + 12j − 5k) x (2 + 4i − 3j + 13k) .

For example, when t2 = 2 and t3 = 3, we have:   x = −11 + 24i + 2j + 3k,   11 12 1 3 y = − 710 − 355 i − 355 j − 710 k.

Direct calculation shows that (x, y) satisfies 2.54.

51 2.3 Special Quaternion Equations and problems

2.3.5. Another pair of quaternion equations

Two nonzero quaternions a and b are said to be consemisimilar if the following system has a solution:   yax = b, (2.55)  xby = a, where x and y are nonzero quaternion indeterminates. 2.55 was studied and solved in (Tian, 2010). In this subsection, we present a somewhat simpler solution.

Since st = ts and s−1 = s−1 for all s, t ∈ H, 2.55 can be written as   −1 −1 y = a x b,

 −1 −1 y = b x a, this gives:

a−1x−1b = b−1x−1a (2.56)

−1 −1 a b = b |a| ⇒ |a| = |b| .

Therefore a and b must satisfy the following equation in order for 2.55 to have solutions,

2 2 2 2 2 2 2 2 a0 + a1 + a2 + a3 = b0 + b1 + b2 + b3. (2.57)

2.56 is equivalent to x−1ba−1 = ab−1x−1. On the other hand, we have:

−1 a0 − a1i − a2j − a3k a a = 2 2 2 2 = 2 2 2 2 a0 + a1 + a2 + a3 a0 + a1 + a2 + a3 and

−1 b0 − b1i − b2j − b3k b b = 2 2 2 2 = 2 2 2 2 . b0 + b1 + b2 + b3 b0 + b1 + b2 + b3

52 2.3 Special Quaternion Equations and problems

By 2.57, 2.56 is equivalent to bax = xab ⇔ xab = bax, which is equivalent to the following system:   m11x1 + m12x2 + m13x3 + m14x0 = 0,     m21x1 + m22x2 + m23x3 + m24x0 = 0, (2.58)  m31x1 + m32x2 + m33x3 + m34x0 = 0,     m41x1 + m42x2 + m43x3 + m44x0 = 0, where mij is given by the 4 × 4 skew-symmetric matrix:

M = (mij)4×4    0 a0b3 + a3b0 − (a0b2 + a2b0) a2b3 − a3b2        − (a0b3 + a3b0) 0 a0b1 + a1b0 − (a1b3 − a3b1) =   .      a0b2 + a2b0 − (a0b1 + a1b0) 0 a1b2 − a2b1      − (a2b3 − a3b2) a1b3 − a3b1 − (a1b2 − a2b1) 0

Direct calculation yields det M = 0. Therefore, the homogeneous system 2.58 has a solution set with an infinite number of solutions (x0, x1, x2, x3). Each such x gives a solution to 2.55:   x = x,

 −1 −1 y = b x a.

Example 2.3.6. Find all (x, y) such that the following system holds:   y (1 − 25i + 8j + 15k) x = 17 + i − 24j − 7k, (2.59)  x (17 + i − 24j − 7k) y = 1 − 25i + 8j + 15k.

The following steps have been implemented into a single procedure in Maple. For details, see the “CSSim” procedure of §A.2.

53 2.3 Special Quaternion Equations and problems

Since

|17 + i − 24j − 7k| =172 + 12 + (−24)2 + (−7)2 = 915

=12 + (−25)2 + 82 + 152 = |1 − 25i + 8j + 15k| ,

2.59 has infinitely many solutions. First we solve the linear system:   248x2 − 112x3 − 304x0 = 0,     −248x1 − 424x3 + 160x0 = 0,

 112x1 + 424x2 − 592x0 = 0,     304x1 − 160x2 + 592x3 = 0, to obtain:   31 53 x0 = − t1 − t3,  20 20    x1 = t1,

 19 37 x2 = t1 + t3,  10 10    x3 = t3, where t1 and t3 are arbitrary real numbers such that x = x0 + x1i + x2j + x3k 6= 0. Then we have a solution set with an infinite number of solutions of the form:   x = x,

 −1 −1 y = (17 + i − 24j − 7k) x (1 − 25i + 8j + 15k) .

For example, when t1 = 1 and t3 = 3, we have:   19 x = − 2 + i + 13j + 3k,   2 56 4 32 y = 1077 + 1077 i − 359 j − 1077 k.

Direct calculation shows that (x, y) satisfies 2.59.

54 2.3 Special Quaternion Equations and problems

2.3.6. A least norm problem

The following least norm problem was proposed in (Tian, 2010),

min |ax − xb − c| , x∈H where a, b and c ∈ H and x is a quaternion indeterminate that minimizes the value of |ax − xb − c|. In this subsection, we present a solution.

We consider:

ax − xb = c. (2.60)

2.60 is equivalent to the real linear homogeneous system:   m11x1 + m12x2 + m13x3 + m14x0 = c1,     m21x1 + m22x2 + m23x3 + m24x0 = c2, (2.61)  m31x1 + m32x2 + m33x3 + m34x0 = c3,     m41x1 + m42x2 + m43x3 + m44x0 = c0, where mij is given by:    a0 − b0 −a3 − b3 a2 + b2 a1 − b1        a3 + b3 a0 − b0 −a1 − b1 a2 − b2 M = (m ) =   . ij 4×4     −a2 − b2 a1 + b1 a0 − b0 a3 − b3     −a1 + b1 −a2 + b2 −a3 + b3 a0 − b0

Direct calculation yields:

 2 2 2 2 2 22 det M = a1 + a2 + a3 − b1 − b2 − b3

2  2 2 2 2 2 2 2 + (a0 − b0) (a0 − b0) + 2a1 + 2a2 + 2a3 + 2b1 + 2b2 + 2b3 .

We continue the discussion by cases:

Case 1. a ∼ b. Then det M = 0. Therefore, we can find the least norm solution

55 2.3 Special Quaternion Equations and problems

  y  1       y2    † 0 † of 2.61 by calculating   = M c where M is the Moore-Penrose    y3      y0   c  1       c2  0   pseudoinverse of M and c =   (Bjõrck, 1996). This means that    c3      c0

x = y0 + y1i + y2j + y3k satisfies |ax − xb − c| ≤ |az − zb − c| for all

z ∈ H.

Case 2. Otherwise. Then det M 6= 0. Therefore, we can solve the linear system   y  1       y2    2.61 to obtain a unique solution   such that 2.61 holds. This means    y3      y0

that x = y0 + y1i + y2j + y3k satisfies |ax − xb − c| = 0.

Example 2.3.7. Solve the following least norm problem:

min |(5 − 10i − 5j + 2k) x − x (3 − 4i − 4j − 8k) − (−9 − 2i + 10j − 2k)| . (2.62) x∈H

The following steps have been implemented into a single procedure in Maple. For details, see the “LN1” procedure of §A.2.

Since 5 − 10i − 5j + 2k  3 − 4i − 4j − 8k, there exists an exact solution. We solve

56 2.3 Special Quaternion Equations and problems the linear system:   2x1 + 6x2 − 9x3 − 6x0 = −2,     −6x1 + 2x2 + 14x3 − x0 = 10,

 9x1 − 14x2 + 2x3 + 10x0 = −2,     6x1 + x2 − 10x3 + 2x0 = −9, to obtain:   3364 x0 = − ,  2905    128 x1 = 415 ,

 1073 x2 = − ,  2905    2372 x3 = 2905 .

3364 128 1073 2372 Direct calculation shows that x = − 2905 + 415 i − 2905 j + 2905 k satisfies 2.62.

57 2.3 Special Quaternion Equations and problems

2.3.7. Another least norm problem

The following least norm problem was proposed in (Tian, 2010):

min |ax − xb¯ − c| , (2.63) x∈H where a, b and c ∈ H and x is a quaternion indeterminate that minimizes the value of |ax − xb¯ − c| . In this subsection, we present a solution.

We consider:

ax − xb¯ − c = 0. (2.64)

2.64 is equivalent to the real linear homogeneous system:   m11x1 + m12x2 + m13x3 + m14x0 = c1,     m21x1 + m22x2 + m23x3 + m24x0 = c2, (2.65)  m31x1 + m32x2 + m33x3 + m34x0 = c3,     m41x1 + m42x2 + m43x3 + m44x0 = c0, where mij is given by:    a0 + b0 −a3 + b3 a2 − b2 a1 − b1        a3 − b3 a0 + b0 −a1 + b1 a2 − b2 M = (m ) =   . ij 4×4     −a2 + b2 a1 − b1 a0 + b0 a3 − b3     −a1 − b1 −a2 − b2 −a3 − b3 a0 − b0

Direct calculation yields:

 2 2 2 2 det M = (a0 + b0) + (a1 − b1) + (a2 − b2) + (a3 − b3)

 2 2 2 2 2 2 2 2 × a0 + a1 + a2 + a3 − b0 − b1 − b2 − b3 .

We continue the discussion by cases:

Case 1. a ∼ b. Then det M = 0. Therefore, we can find the least norm solution

58 2.3 Special Quaternion Equations and problems

  y  1       y2    † 0 † of 2.65 by calculating   = M c where M is the Moore-Penrose    y3      y0   c  1       c2  0   pseudoinverse of M and c =   (Bjõrck, 1996). This means that    c3      c0

x = y0 + y1i + y2j + y3k satisfies |ax − xb¯ − c| ≤ |az − zb − c| for all

z ∈ H.

Case 2. Otherwise. Then det M 6= 0. Therefore, we can solve the linear system   y  1       y2    2.65 to obtain a unique solution   such that 2.65 holds. This means    y3      y0

that x = y0 + y1i + y2j + y3k satisfies |ax − xb¯ − c| = 0.

Example 2.3.8. Solve the following least norm problem:

min |(6 − 8i + j + 5k) x − x (6 + i + 5j − 8k) − (−3 + i + j − 5k)| . (2.66) x∈H

The following steps have been implemented into a single procedure in Maple. For details, see the “LN2” procedure of §A.2.

Since 6 − 8i + j + 5k ∼ 6 + i + 5j − 8k, we can only find a least square solution. We calculate M †c0 where M † is the Moore-Penrose pseudoinverse of

59 2.3 Special Quaternion Equations and problems

    12 −13 −4 −9 1             13 12 9 −4  1    0   M =   and c =   to obtain:      4 −9 12 13  −5         7 −6 3 0 −3

  39 x0 = − ,  205    119 x1 = − 7380 ,

 1133 x2 = ,  8610    2519 x3 = − 17220 .

39 119 1133 2519 Direct calculation shows that x = − 205 − 7380 i + 8610 j − 17220 k satisfies 2.66.

60 3. Quaternion Polynomial Matrices

3.1. Generalized Inverse

Definition 3.1.1. H [x] denotes the set of quaternion polynomials

( n ) X i aix | ai ∈ H, an 6= 0, n ∈ N , i=0

m×n where x commutes element-wise with H. H [x] denotes the space of m × n matrices with entries from H [x].

Remark 3.1.2. If no ambiguity arises, the indeterminate x will be omitted and we

m×n write p ∈ H [x] or A ∈ H [x] and so on. Im denotes the m × m identity matrix.

0m×n denotes the m × n zero matrix. When the dimension is unspecified, a matrix is of appropriate dimension.

m×n Pn i n Definition 3.1.3. Let A ∈ H [x] and i=0 pix = p0+p1x+···+pnx = p ∈ H [x] where pi ∈ H. We give a list of some notations as follows:

Pn i   • p = pix , A denotes the conjugate of A, A = (Aij). i=0 ij ! m×n PQ 2m×2n • If A = P + Qj where P , Q ∈ C [x] , then χA = ∈ C [x] −Q P denotes the complex adjoint of A.

T n×m  T  • A ∈ [x] denotes the transpose of A, A = Aji. H ij

61 3.1 Generalized Inverse

∗ n×m ∗ • A ∈ H [x] denotes the conjugate transpose of A, (A )ij = (Aji). In particular, for all p ∈ H [x], p∗ = p.

n×m • A† ∈ H [x] , a generalized inverse of A (Penrose, 1955), if it exists, denotes the solution of the following system of equations,

AXA = A (3.1)

XAX = X (3.2)

(AX)∗ = AX (3.3)

(XA)∗ = XA (3.4)

We first show some elementary properties that will be used often throughout this chapter.

m ×n n×m ∗ Lemma 3.1.4. Let A ∈ H [x] 1 and B ∈ H [x] 2 . Then (AB) = B∗A∗.

Proof. By direct calculation.

m×n Corollary 3.1.5. For A ∈ H [x] , let B = AA∗. Then B = B∗.

Proof. B∗ = (AA∗)∗ = (A∗)∗ A∗ = AA∗ = B.

m×n † Lemma 3.1.6. Let A ∈ H [x] have a generalized inverse A†. Then (A∗) =  ∗ A† .

 ∗ Proof. We show that A† satisfies the defining relations of a generalized inverse stated in Definition 3.1.3,

 ∗  ∗ A∗ A† A∗ = AA†A = A∗,  ∗  ∗  ∗  ∗ A† A∗ A† = A†AA† = A† , h  ∗i∗ h ∗i∗  ∗  ∗ A∗ A† = A†A = A†A = A†A = A∗ A† , h ∗ i∗ h ∗i∗  ∗  ∗ A† A∗ = AA† = AA† = AA† = A† A∗.

62 3.1 Generalized Inverse

 ∗ Therefore, (A∗)† = A† .

m×n Lemma 3.1.7. (Adaption of (Penrose, 1955)) Let A ∈ H [x] have a generalized  ∗  ∗ inverse A†. Then relations satisfied by A† include: A† A† A∗ = A† = A∗ A† A† and A†AA∗ = A∗ = A∗AA†.

Proof. First,

 ∗  ∗ A† A† A∗ =A† AA† = A†AA† = A†  ∗  ∗ =A†AA† = A†A A† = A∗ A† A†.

Next,

 ∗  ∗ A†AA∗ = A†A A∗ = AA†A = A∗  ∗  ∗  ∗ = AA†A = A∗ A† A∗ = A∗ AA† = A∗AA†.

We next show that A† is uniquely defined for quaternion polynomial matrices.

m×n Lemma 3.1.8. (Adaption of (Penrose, 1955)) Let A ∈ H [x] have a generalized inverse A†. Then A† is unique.

Proof. We first show that 3.2 and 3.3 are equivalent to

XX∗A∗ = X. (3.5)

Substituting 3.3 into 3.2, we obtain X = XAX = X (AX)∗ = XX∗A∗.

Conversely, 3.5 implies that:

AXX∗A∗ = AX ⇒ (AXX∗A∗)∗ = (AX)∗ ⇒ AXX∗A∗ = (AX)∗ .

63 3.1 Generalized Inverse

So AX = (AX)∗ and therefore X = XX∗A∗ = X (AX)∗ = XAX. Similarly 3.1 and 3.4 can be replaced by the equation:

XAA∗ = A∗. (3.6)

Therefore, 3.5 and 3.6 are equivalent to 3.1, 3.2, 3.3 and 3.4.

Likewise the following two equations are also equivalent to 3.1, 3.2, 3.3 and 3.4,

X∗A∗A = A (3.7)

A∗X∗X = X. (3.8)

Suppose A† satisfies 3.5 and 3.6, B satisfies 3.7 and 3.8. Then

 ∗  ∗ A† =A† A† A∗ = A† A† (B∗A∗A)∗  ∗ =A† A† A∗AB = A†AB = A†AA∗B∗B = A∗B∗B = B.

Therefore, if it exists, A† is uniquely defined.

Due to the non-commutativity of quaternions, there are two types of eigenvalues: right eigenvalues and left eigenvalues. Right eigenvalues have been studied exten- sively (Brenner, 1951; Lee, 1949; Baker, 1999). We will work with right eigenvalues towards our main result. For convenience, we will just use the term “eigenvalue” from now on.

Definition 3.1.9. A ∈ Hm×m is unitary if AA∗ = A∗A = I.

Lemma 3.1.10. (Zhang, 1997) A ∈ Hm×m is hermitian, that is, A = A∗, if and   d  1    m×m ∗  ..  only if there exists a unitary matrix U ∈ H such that U AU =  . ,     dm where di are the eigenvalues of A.

Proof. Corollary 6.2 of (Zhang, 1997).

64 3.1 Generalized Inverse

Adapting ideas from (Puystjens and de Smet, 1980), we will give conditions that quaternion polynomial matrices must satisfy to have generalized inverses. We need to prove some lemmas first.

m×n Lemma 3.1.11. (Adaption of (Puystjens and de Smet, 1980)) Let A ∈ H [x] † have the generalized inverse A†. If U ∈ Hm×m is a unitary matrix, then (UA) = A†U ∗.

Proof. We show that A†U ∗ satisfies the defining relations of the generalized inverse stated in Definition 3.1.3,

  UA A†U ∗ UA = UAA†A = UA,

A†U ∗ (UA) A†U ∗ = A†AA†U ∗ = A†U ∗,  ∗  ∗ UAA†U ∗ = U AA† U ∗ = UAA†U ∗,  ∗  ∗ A†U ∗UA = A†A = A†A = A†U ∗UA.

Therefore, (UA)† = A†U ∗.

n×1 m×1 Lemma 3.1.12. A ∈ Hm×n induces a homomorphism H [x] to H [x] , that is, n×1 m×1 for all P , Q ∈ H [x] , A (P + Q) = AP + AQ ∈ H [x] .

Proof. By direct calculation.

m×n Lemma 3.1.13. (Adaption of (Puystjens and de Smet, 1980)) Let A ∈ H [x] n×1 have the generalized inverse A†. Consider A as a homomorphism from H [x] to m×1 H [x] . Then ImageA = ImageAA∗ = ImageAA† and ImageA∗ = ImageA∗A = ImageA†A.

n×1 Proof. Let P ∈ H [x] . Then

 ∗ h ∗ i AP = AA†AP = A A†A P = AA∗ A† P ,

65 3.1 Generalized Inverse

m×1  ∗ m×1 where AP ∈ H [x] and A† P ∈ H [x] . Therefore, ImageA ⊆ ImageAA∗ and ImageA ⊆ ImageAA†.

m×1 n×1 For any Q ∈ H [x] , it is clear that AA∗Q = A (A∗Q) where A∗Q ∈ H [x] and   n×1 that AA†Q = A A†Q where A†Q ∈ H [x] . Thus, ImageAA∗ ⊆ ImageA and ImageAA† ⊆ ImageA.

Therefore, ImageA = ImageAA∗ and ImageA = ImageAA†, i.e., ImageA = ImageAA∗ = ImageAA†.

Similarly we can show that ImageA∗ = ImageA∗A = ImageA†A.

m×m Lemma 3.1.14. (Adaption of (Puystjens and de Smet, 1980)) If E ∈ H [x] is a symmetric projection, that is, E = E2 = E∗, then E ∈ Hm×m.

Proof. If f1, ··· , fm are the entries in the first row of E, with f1 = f1, then

m m X 2 X f1f1 + fifi = f1 ⇒ f1 + fifi = f1. i=2 i=2

2 Since f1 = f1, the leading coefficient of f1 is a positive real number. Note that the Pm leading coefficient of i=2 fifi is also a positive real number. Thus,

m ! ( m !)  2 2 X  2 X deg f1 ≥ deg f1 = deg f1 + fifi = max deg f1 , deg fifi i=2 i=2

 2 ≥ deg f1 .

Pm  This shows that f1 ∈ H. Furthermore, 0 = deg f1 = deg i=2 fifi and therefore fi ∈ H for all 1 ≤ i ≤ m.

The same can be done for the other rows of E. Therefore, E ∈ Hm×m.

Now we are ready to give conditions that quaternion polynomial matrices must satisfy in order to have generalized inverses.

66 3.1 Generalized Inverse

m×n Theorem 3.1.15. (Adaption of (Puystjens and de Smet, 1980)) Let A ∈ H [x] .   A1 A2 †   Then A has the generalized inverse A if and only if A = U   with U ∈ 0 0 m×m ∗ ∗ r×r H unitary and A1A1 + A2A2 a unit in H [x] with r ≤ min {m, n}. Moreover,   A∗ (A A∗ + A A∗)−1 0 †  1 1 1 2 2  ∗ A =   U .  ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0

Proof. If A has the generalized inverse A†, then

 2  ∗ AA† = AA†AA† = AA† = AA† .

By Lemma 3.1.14, AA† ∈ Hm×m. AA† is hermitian and hence, by Lemma 3.1.10, there exists a unitary matrix U ∈ Hm×m such that U ∗AA†U = D where D is diagonal. Since

D2 = U ∗AA†UU ∗AA†U = U ∗AA†AA†U = U ∗AA†U = D, the diagonal entries of D are either 1 or 0. Therefore, we can rearrange the rows of   Ir 0   U so that D =   with r ≤ min {m, n}. 0 0 Set A0 = U ∗A. By Lemma 3.1.11, A0 has its own generalized inverse A0† and     Ir 0 A1 A2 0 0†   0   A A =  . Set A =  , for arbitrary quaternion polynomial matrices 0 0 A3 A4 r×r r×(n−r) (m−r)×r (m−r)×(n−r) A1 ∈ H [x] , A2 ∈ H [x] , A3 ∈ H [x] and A4 ∈ H [x] . Since         Ir 0 A1 A2 A1 A2 A1 A2 0 0 0† 0       0   A = A A A =     =  , we must have A =   0 0 A3 A4 0 0 0 0     ∗ ∗ A1A + A2A 0 B1 0 0 0∗  1 2  0†   and therefore A A =  . Similarly, A =   for some B1 0 0 B2 0 and B2.

67 3.1 Generalized Inverse

By Lemma 3.1.13,   I 0 0 0∗ 0 0 0†  r  ImageA A = ImageA = ImageA A = Image   .  0 0

∗ ∗ r×1 ∗ ∗ This implies the surjectivity of A1A1 + A2A2 on H [x] . Therefore, A1A1 + A2A2 r×r is a unit in H [x] and   A A 0  1 2 A = UA = U   .  0 0 

Next, we have that:

 ∗ A0† =A0† A0† A0∗ = A0† (A0∗)† A0∗ = A0∗ (A0A0∗)†     ∗ ∗ ∗ −1 A1 0 (A1A1 + A2A2) 0 =      ∗    A2 0 0 0   ∗ ∗ ∗ −1 A1 (A1A1 + A2A2) 0 =   ,  ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0 which gives:   A∗ (A A∗ + A A∗)−1 0 †  1 1 1 2 2  ∗ A =   U .  ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0

We will show the converse by direct computation.   A1 A2   m×n m×m ∗ ∗ Let A = U   be in H [x] with U ∈ H unitary and A1A1 + A2A2 a 0 0 r×r unit in H [x] with r ≤ min {m, n}. Let   A∗ (A A∗ + A A∗)−1 0  1 1 1 2 2  ∗ B =   U .  ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0

We show that A†U ∗ satisfies the defining relations of the generalized inverse stated in Definition 3.1.3,

68 3.1 Generalized Inverse

• the first condition:

ABA       A A A∗ (A A∗ + A A∗)−1 0 A A  1 2  1 1 1 2 2  ∗  1 2 =U     U U      ∗ ∗ ∗ −1    0 0 A2 (A1A1 + A2A2) 0 0 0       ∗ ∗ ∗ −1 A1 A2 A1 (A1A1 + A2A2) 0 A1 A2 =U          ∗ ∗ ∗ −1    0 0 A2 (A1A1 + A2A2) 0 0 0   A1 A2 =U   = A,  0 0 

• the second condition:

BAB       A∗ (A A∗ + A A∗)−1 0 A A A∗ (A A∗ + A A∗)−1 0  1 1 1 2 2  ∗  1 2  1 1 1 2 2  ∗ =   U U     U  ∗ ∗ ∗ −1     ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0 0 0 A2 (A1A1 + A2A2) 0       A∗ (A A∗ + A A∗)−1 0 A A A∗ (A A∗ + A A∗)−1 0  1 1 1 2 2   1 2  1 1 1 2 2  ∗ =       U  ∗ ∗ ∗ −1     ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0 0 0 A2 (A1A1 + A2A2) 0   A∗ (A A∗ + A A∗)−1 0  1 1 1 2 2  ∗ =   U = B,  ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0

• the third condition:      ∗ A A A∗ (A A∗ + A A∗)−1 0 ∗   1 2  1 1 1 2 2  ∗ (AB) = U     U      ∗ ∗ ∗ −1   0 0 A2 (A1A1 + A2A2) 0  ∗   Ir 0 Ir 0 =   =   = AB,  0 0  0 0

69 3.1 Generalized Inverse

• the last condition:    ∗ A∗ (A A∗ + A A∗)−1 0 A A ∗  1 1 1 2 2  ∗  1 2 (BA) =   U U    ∗ ∗ ∗ −1    A2 (A1A1 + A2A2) 0 0 0  ∗   Ir 0 Ir 0 =   =   = BA.  0 0  0 0

  ∗ ∗ ∗ −1 A (A1A + A2A ) 0 Therefore, B =  1 1 2  U ∗ = A†. The uniqueness of A† is the  ∗ ∗ ∗ −1  A2 (A1A1 + A2A2) 0 result of Lemma 3.1.8.

Lemma 3.1.16. Let A ∈ Hm×m be hermitian. Then the eigenvalues of A are real.

Proof. Let λ ∈ H be an eigenvalue of A with corresponding eigenvector 0 6= X =   x  1     .  ∗ ∗ ∗ ∗ ∗  .  such that AX = Xλ. Then X AX = X Xλ. So X AX = λ X X and     xm therefore

X∗Xλ = λ∗X∗X = (X∗Xλ)∗

⇒    x1     .  X  X  ∗ (x , ··· x )  .  λ = x x λ = x x λ 1 m  .  i i i i     xm

∗ X ∗ ∗ X  = λ xixi = λ xixi .

P P Note that 0 6= xixi ∈ R [x]. Division of the above equation by xixi gives λ = λ∗ ⇒ λ ∈ R.

Theorem 3.1.17. (Zhang, 1997)(Cayley-Hamilton theorem for Quaternion Matri-

m×m ces) Let A ∈ H . fA (λ) = det (λI2m − χA) is called the characteristic polyno-

70 3.1 Generalized Inverse

mial of A, where λ is a complex indeterminate. Then fA (A) = 0. Furthermore, fA (λ0) = 0 if and only if λ0 is an eigenvalue of A.

Proof. Theorem 8.1 of (Zhang, 1997).

m×n Definition 3.1.18. Let A ∈ H [x] have the generalized inverse A†. For any

∗ x ∈ R, set B = AA . Then fB (λ) = det (λI2m − χB) is called the characteristic polynomial of B. By Lemma 3.1.16, λ can be assumed to be an indeterminate that enjoys the following: λ = λ and λ commutes element-wise with H [x].

m×n Lemma 3.1.19. Let A ∈ H [x] have the generalized inverse A†. For any x ∈ R,

∗ 2 set B = AA . Then fB (λ) = g (λ) where g (λ) ∈ (R [x]) [λ].

Proof. We first show that fB (λ) ∈ (R [x]) [λ]. Since

 T  ∗ det (λI2m − χB) = det (λI2m − χB) = det ((λI2m − χB) )

det (λI2m − χB) = det (λI2m − χB) = det (λI2m − χB), we have that:

det (λI2m − χB) = fB (λ) ∈ (R [x]) [λ] . (3.9)

2 Next, we show that fB (λ) = g (λ) where g (λ) ∈ (C [x]) [λ]. Let B = P + Qi. For any fixed 1 ≤ i, j ≤ m, we have Bij = a + bi + cj + dk where a, b, c and d ∈ R [x].

Since B is hermitian, Bji = a − bi − cj − dk and therefore Pij = a + bi, Pji = a − bi

T T and Qij = c + di, Qji = −c − di. So P = P and Q = −Q . Therefore,      PQ  PQ  χB =   =   −Q P  −QP T 

71 3.1 Generalized Inverse

  λIm − PQ  λI2m − χB =   .  T  −Q λIm − P

Next, we have:         Im −Im Im 0  Im −Im λIm − PQ                 T  0 Im Im Im 0 Im −Q λIm − P   T  QP − λIm =     λIm − PQ and     Im −Im Im 0  det   = det   = 1.     0 Im Im Im

Therefore,     T λIm − PQ   QP − λIm fB (λ) = det   = det   .  T    −Q λIm − P λIm − PQ

Note that:  T   T T  QP − λIm  QP − λIm −   =   ,     λIm − PQ λIm − PQ

  T QP − λIm   which implies that   is skew-symmetric. By (Muir, 2003), the λIm − PQ   T QP − λIm   determinant of  , also called its Pfaffian, can be written as λIm − PQ 2 the square of a polynomial in its entries. Therefore, fB (λ) = g (λ) where g (λ) ∈

(C [x]) [λ].

Finally we show that g (λ) ∈ (R [x]) [λ]. Suppose otherwise. Then g (λ) = 2 a (λ) + b (λ) i where a and b ∈ (R [x]) [λ] with b (λ) 6= 0. By 3.9, g (λ) ∈ 2 2 2 (R [x]) [λ]. So a (λ) = 0 and therefore fB (λ) = g (λ) = (b (λ) i) = −b (λ)

72 3.1 Generalized Inverse where b (λ) ∈ (R [x]) [λ]. For a fixed x ∈ R, let λ0 ∈ R be large enough such that

0 2m×2m λ I2m − χB ∈ C is diagonally dominant with non-negative diagonal entries

0 0 0 and that (b (x)) (λ ) 6= 0. Since λ I2m − χB is also hermitian, λ I2m − χB is positive

0 0 2 definite (Horn and Johnson, 1990). But det (λ I2m − χB) = − ((b (x)) (λ )) < 0.

2 Contradiction. So, b = 0 and therefore fB (λ) = g (λ) where g (λ) ∈ (R [x]) [λ].

m×n Corollary 3.1.20. Let A ∈ H [x] have the generalized inverse A†. For any

∗ 2 x ∈ R, set B = AA and fB (λ) = g (λ) . Then g (B) = 0. We will call g (λ) the generalized characteristic polynomial of A.

Proof. g (λ) ∈ (R [α]) [λ] by Lemma 3.1.19, so χg(B) = g (χB). Next, fB (χB) = 0 by the Cayley-Hamilton theorem for complex polynomial matrices (Horn and Johnson,

1990), so g (χB) = 0. Therefore 0 = g (χB) = χg(B), that is, g (B) = 0.

73 3.2 Leverrier-Faddeev Method

3.2. Leverrier-Faddeev Method

m×n Lemma 3.2.1. Let A ∈ H [x] have the generalized inverse A†. Set B = AA∗. Then B† = (A∗)† A† and B†B = BB†.

Proof. First we show that (A∗)† A† satisfies the defining relations of the generalized inverse stated in Definition 3.1.3,

• the first condition:

h i B (A∗)† A† B =AA∗ (A∗)† A†AA∗

=AA∗ (A∗)† A∗ = AA∗ = B,

• the second condition:

h i h i (A∗)† A† B (A∗)† A† = (A∗)† A†AA∗ (A∗)† A†

= (A∗)† A∗ (A∗)† A† = (A∗)† A†,

• the third condition:

 h i∗  ∗  ∗ B (A∗)† A† = AA∗ (A∗)† A† = AA† h i =AA† = AA∗ (A∗)† A† = B (A∗)† A† ,

• the last condition:

h i ∗  ∗  ∗ (A∗)† A† B = (A∗)† A†AA∗ = (A∗)† A∗ h i = (A∗)† A∗ = (A∗)† A†AA∗ = (A∗)† A† B.

Therefore, (A∗)† A† = (AA∗)† = B†. Next,

(AA∗)† AA∗ = (A∗)† A†AA∗ = (A∗)† A∗  ∗  ∗ = (A∗)† A∗ = AA† = AA∗ A† A† = AA∗ (AA∗)† ,

74 3.2 Leverrier-Faddeev Method which is, B†B = BB†.

m×n Lemma 3.2.2. Let A ∈ H [x] have the generalized inverse A†. Set B = AA∗.  k  † Then B† = Bk where k ∈ N.

 k Proof. We show that B† satisfies the defining relations of the generalized inverse stated in Definition 3.1.3,

• the first condition:

 k  k−1   Bk B† Bk =Bk B† BB† Bk−1  k−1 =Bk B† Bk−1 = ··· = Bk,

• the second condition:

 k  k  k−1    k B† Bk B† = B† BB† Bk−1 B†  k−1  k  k = B† Bk−1 B† = ··· = B† ,

• the third condition:

  k∗ h ik  k  k Bk B† = (B∗)† (B∗)k = B† Bk = Bk B† ,

• the last condition:

 k ∗    k  k  k B† Bk = (B∗)k (B∗)† = Bk B† = B† Bk.

 k  † Therefore, B† = Bk where k ∈ N.

m×n p×q Lemma 3.2.3. (Adaption of (Penrose, 1955)) Let A ∈ H [x] , B ∈ H [x] m×q and C ∈ H [x] . If A† and B† both exist, then the quaternion polynomial matrix n×p equation AXB = C has a solution in H [x] if and only if AA†CB†B = C, in which case the general solution is

X = A†CB† + Y − A†AY BB†,

75 3.2 Leverrier-Faddeev Method

n×p where Y ∈ H [x] is arbitrary.

Proof. Suppose X satisfies AXB = C, then

C = AXB = AA†AXBB†B = AA†CB†B.

Conversely, if C = AA†CB†B then A†CB† is a particular solution of AXB = C.

For the general solution, we must solve AXB = 0. Any expression of the form X = Y − A†AY BB† satisfies AXB = 0, and conversely if AXB = 0 then X = A†CB† + Y − A†AY BB†.

m×n Theorem 3.2.4. (Adaption of (Penrose, 1955)) Let A ∈ H [x] have the general- ized inverse A†. For any x ∈ R, set B = AA∗. Suppose the generalized characteristic polynomial of A is

m m−1 m−k g (λ) = λ + a1λ + ··· + akλ + ··· + am−1λ + am, where ai ∈ R [x]. If k is the largest integer such that ak 6= 0, then the generalized inverse of A is given by

† 1 ∗ h k−1 k−2 i A = − A B + a1B + ··· + ak−1I . ak

† If ai = 0 for all 1 ≤ i ≤ m, then A = 0.

Proof. By Corollary 3.1.20, we have:

m m−1 m−k 0 = B + a1B + ··· + akB + ··· + am−1B + amIm.

0 If k is the largest integer such that ak 6= 0 and define B = I, we may write:

m−k  k k−1  B B + a1B + ··· + ak−1B + akI = 0.

This equation guarantees a solution of the matrix equation Bm−kX = 0 and hence,

76 3.2 Leverrier-Faddeev Method by Lemma 3.2.1 and 3.2.3, all solutions are given by:

 † X = Y − Bm−k Bm−kY = Y − B†BY,

m×m where Y ∈ H is arbitrary. In particular, there exists Y1 such that:

k k−1 † † B + a1B + ··· + ak−1B + akI = Y1 − B BY1 = Y1 − AA Y1

Left multiplication of the latter equation by A† gives:

† k † k−1 † † A B + a1A B + ··· + ak−1A B + akA = 0.

By Lemma 3.1.7, this can be simplified to:

∗ k−1 ∗ k−2 ∗ † A B + a1A B + ··· + ak−1A = −akA , which gives:

† 1 ∗ h k−1 k−2 i A = − A B + a1B + ··· + ak−1I . ak

† If ai = 0 for all 1 ≤ i ≤ m, then A = 0 and therefore A = 0.

m×n Lemma 3.2.5. (Adaption of (Kalman, 1978)) Let A ∈ H [x] have the generalized

† ∗ 0 inverse A . For any real x ∈ R, set B = AA . Let λ1, ··· , λm0 , where m ≤ m, be all the non-zero eigenvalues of B. Then for 1 ≤ k ≤ m,

h k k−1 i tr B + a1B + ··· + ak−1B = −kak,

where the ai arise from the generalized characteristic polynomial of A:

m m−1 m−k g (λ) = λ + a1λ + ··· + akλ + ··· + am−1λ + am.

77 3.2 Leverrier-Faddeev Method

Proof. Let Y = yI where y ∈ R. We can write g (Y ) as:

g (Y ) = (Y − B)

 m−1 m−2  2  m−3 × Y + (B + a1I) Y + B + a1B + a2I Y + ···

 m−1 m−2  + B + a1B + ··· + amI .

As long as y is not an eigenvalue of B, (yI − B) = Y − B is non-singular, so we can write:

−1 m−1 m−2  2  m−3 (Y − B) g (Y ) =Y + (B + a1I) Y + B + a1B + a2I Y + ···

 m−1 m−2  + B + a1B + ··· + amI .

Taking the traces gives:

h −1 i m−1 m−2 tr (Y − B) g (Y ) =my + tr [(B + a1I)] y

h 2 i m−3 + tr B + a1B + a2I y + ···

 m−1 m−2  + tr B + a1B + ··· + amI .

Let C = (Y − B)−1 g (Y ). Since g (Y ) = g (yI) = g (y) I, C = g (y)(Y − B)−1. Therefore,

h i trC = g (y) tr (Y − B)−1 .

h i tr (Y − B)−1 is the sum of the eigenvalue of (Y − B)−1. We will show these eigen- values are the fractions 1 , ··· , 1 . y−λ1 y−λm0

Let ζ be an eigenvalue of (Y − B)−1 with corresponding eigenvector Z such that:

(Y − B)−1 Z = Zζ.

78 3.2 Leverrier-Faddeev Method

ζ is real by Lemma 3.1.16, and hence

1 (Y − B) Z = Z ζ ⇒ 1! BZ = Z y − . ζ

1 1 0 Therefore, y − = λi ⇒ ζ = for some 1 ≤ i ≤ m . ζ y−λi

0 Since g (y) = (y − λ1)(y − λ2) ··· (y − λm0 ), we have that g (y) =   g (y) 1 + ··· + 1 and y−λ1 y−λm0

trC = g0 (y)

The of g is also equal to:

0 m−1 m−2 g (y) = my + a1 (m − 1) y + ··· + am−1.

Therefore,

m−1 m−2 m−1 m−2 my + a1 (m − 1) y + ··· + am−1 =my + tr [(B + a1I)] y + ···

 m−1 m−2  + tr B + a1B + ··· + amI

Comparing the coefficient of ym−k−1 on both sides, we obtain

h k k−1 i ak (m − k) = tr B + a1B + ··· + ak−1B + akI

h k k−1 i ak (m − k) = tr B + a1B + ··· + ak−1B + trakI

h k k−1 i −kak = tr B + a1B + ··· + ak−1B

m×n Lemma 3.2.6. (Adaption of (Decell, 1965; Faddeeva, 1959)) Let A ∈ H [x] have

79 3.2 Leverrier-Faddeev Method the generalized inverse A†. For any x ∈ R, set B = AA∗. Suppose the generalized characteristic polynomial of A is

m m−1 m−k g (λ) = λ + a1λ + ··· + akλ + ··· + am−1λ + am, where ai ∈ R [x]. Define a0 = 1. If p is the largest integer such that ap 6= 0 and we construct the sequence A0, ··· , Ap as follows:

A0 = 0 −1 = q0 B0 = I ...... trA A = AA∗B p−1 = q B = A − q I p−1 p−2 p − 1 p−1 p−1 p−1 p−1 trA A = AA∗B p = q B = A − q I p p−1 p p p p p then qi (x) = −ai (x) , i = 0, ··· , p.

Proof. We will show the desired result by mathematical induction.

For p ≥ i ≥ 0, let Pi be the statement:

qi (x) = −ai (x) .

P0 is the statement:

q0 = −a0, which is true by definition.

80 3.2 Leverrier-Faddeev Method

Suppose Pi holds for all 0 ≤ i ≤ k − 1, it remains to show that Pk holds. We have

Ak =BBk−1

=B (Ak−1 − qk−1I)

=B (B (Ak−2 − qk−2I) − qk−1I)

= ···

k k−1 k−2 =B − q1B − q2B − · · · − qk−1B

k k−1 =B + a1B + ··· + ak−1B.

Therefore,

h k k−1 i tr Ak = tr B + a1B + ··· + ak−1B ,

tr Ak which by Lemma 3.2.5 is equal to −kak. So qk = k = −ak.

Thus, Pk holds.

Therefore, by the principle of mathematical induction, Pi holds for all p ≥ i ≥ 0.

That is, qi = −ai, i = 0, ··· , p.

81 3.3 Generalized Inversion by Interpolation

3.3. Generalized Inversion by Interpolation

In this section we present a method to obtain the generalized inverse of a quaternion polynomial matrix by interpolation at real number data points.

Lemma 3.3.1. (See (Lam, 2001) for more details) An element r ∈ H is a root of a nonzero polynomial f ∈ H [x] iff x − r is a right divisor of f. The set of polynomials in H [x] having r as a root is the left ideal H [x] · (x − r).

Proof. By direct calculation.

Lemma 3.3.2. (See (Lam, 2001) for more details) Let f, g and h ∈ H [x], f = gh and r ∈ H be such that β = h (r) 6= 0. Then

  f (r) = g βrβ−1 h (r) .

In particular, if r is a root of f but not of h, then βrβ−1 is a root of g.

Pn i Pn i Pn i Proof. Let g = i=0 aix . Then f = ( i=0 aix ) h = i=0 aihx . Therefore,

n n X i X i f (r) = aih (r) r = aiβr i=0 i=0 n n X i −1 X  −1i = aiβr β β = ai βrβ β i=0 i=0 n ! X  −1i  −1 = ai βrβ β = g βrβ h (r) . i=0

The last conclusion follows since H has no zero-divisors.

Theorem 3.3.3. (Adaption of (Gordon and Motzkin, 1965)) Let f ∈ H [x] be of degree n. Then the roots of f lie in at most n conjugacy classes of H.

Proof. We will show the desired result by mathematical induction.

For n ≥ 1, let Pn be the statement:

82 3.3 Generalized Inversion by Interpolation

Let f ∈ H [x] be of degree n. Then the roots of f lie in at most n conjugacy classes.

P1 is the statement:

Let f ∈ H [x] be of degree 1. Then the root of f lies in at most 1 conjugacy class.

P1 is trivially true.

Suppose Pn holds for all 1 ≤ n ≤ k − 1, it remains to show that Pk holds. Let f ∈ H [x] be of degree k with roots c 6= d. By Lemma 3.3.1, we can write

f = g · (x − c) , where g has a root that is, by Lemma 3.3.2, conjugate to d. Invoking the inductive hypothesis, d lies in at most k −1 conjugacy classes. So, the roots of f lie in at most k conjugacy classes. Thus, Pk holds. Therefore, by the principle of mathematical induction, Pn holds for all n ≥ 1.

Theorem 3.3.4. (Adaption of (Bray and Whaples, 1983)) Let c1, ··· , cn be n pairwise non-conjugate elements of H. Then there is a unique polynomial gn ∈ H [x], monic of degree n, such that gn (c1) = ··· = gn (cn) = 0. Moreover, c1, ··· , cn are the only roots of gn in H.

Proof. We first show the existence of gn for all n ≥ 1 by mathematical induction.

For n ≥ 1, let Pn be the statement:

Let c1, ··· , cn ∈ H be pairwise non-conjugate. Then there is a polynomial gn ∈

H [x], monic of degree n, such that gn (c1) = ··· = gn (cn) = 0. Moreover, c1, ··· , cn are the only roots of g in H.

P1 is the statement:

Let c1 ∈ H. Then there is a polynomial g1 ∈ H [x], monic of degree 1, such that g1 (c1) = 0. Moreover, c1 is the only root of g in H.

83 3.3 Generalized Inversion by Interpolation

P1 is trivially true as g = x − c1.

Suppose Pn holds for all 1 ≤ n ≤ k − 1, it remains to show that Pk holds. Let c1, ··· , ck ∈ H be pairwise non-conjugate. Invoking the inductive hypothesis, there exists a monic polynomial gk−1 of degree k −1 with c2, ··· , ck as its only roots, that is, gk−1 (c1) 6= 0. Construct gk as follows,

 −1 gk = x − gk−1 (c1) c1gk−1 (c1) · gk−1.

By Lemma 3.3.2, gk (c1) = 0. Thus, Pk holds.

Therefore, by the principle of mathematical induction, for all n ≥ 1, Pn holds.

0 We next show that gn is unique for all n ≥ 1. For some fixed n, let g 6= gn be monic

0 0 0 of degree n, such that g (c1) = ··· = g (cn) = 0 too. Then deg (gn − g ) ≤ n − 1 but

0 gn − g has roots c1, ··· , cn which lie in n conjugacy classes of H. This contradicts

Theorem 3.3.3. Therefore, gn is unique for all n ≥ 1.

Lemma 3.3.5. Let c1, ··· , cn+1 ∈ H be pairwise non-conjugate and let d1, ··· , dn+1 ∈ H. Then there is a unique lowest degree polynomial f ∈ H [x], of degree p ≤ n, such that f (ci) = di for all 1 ≤ i ≤ n + 1.

Proof. For any 1 ≤ s0 ≤ n+1, let S = {1, ··· , n + 1}\{s0}. By Theorem 3.3.4, for any s ∈ S, we can find unique hS ∈ H [x], monic of degree n, such that hS (cs) = 0 and that {cs | s ∈ S} are the only roots of hS in H. So, hS (cs0 ) 6= 0 and therefore   0 α ∈ S, we can construct a polynomial gS of degree n such that gS (cα) = as  0 1 α = s , below:

−1 gS = hS (cs0 ) hS.

We can then construct the polynomial f, of degree at most n, such that f (ci) = di

84 3.3 Generalized Inversion by Interpolation for all 1 ≤ i ≤ n + 1 as below:

n+1 X f = ds0 gS. s0=1

We next show that f is unique. Suppose we have f 0 ∈ H [x] of degree p0 ≤ p ≤ n,

0 0 0 such that f 6= f and that f (ci) = di for all 1 ≤ i ≤ n + 1 too. Then f − f 6= 0 is of

0 degree at most p ≤ n. But f −f has roots c1, ··· , cn+1 which lie in n+1 conjugacy classes of H. This contradicts Theorem 3.3.3. Therefore, f is unique.

Definition 3.3.6. The degree of a given quaternion polynomial matrix A ∈

m×n H [x] is deg A = max {deg (Aij) | 1 ≤ i ≤ m, 1 ≤ j ≤ n}.

m×n Lemma 3.3.7. Let A ∈ H [x] have the generalized inverse A†. Then deg A† ≤ (2m − 1) deg A.

  Proof. By Theorem 3.2.4, deg A† ≤ deg A∗ (AA∗)m−2 ≤ deg (A2m−1) ≤ (2m − 1) deg A.

Remark 3.3.8. The upper bound mentioned in Lemma 3.3.7 is rarely achieved in practice, because some elements of AA∗ (and other matrices) do not have maximal degree.

Lemma 3.3.9. Let c1, ··· , ck+1 ∈ H be pairwise non-conjugate and let

n×m n×m A1, ··· , Ak+1 ∈ H . Then there is a unique lowest degree matrix A ∈ H [x] of degree p ≤ k, such that A (ci) = Ai for all 1 ≤ i ≤ k + 1.

Proof. For any 1 ≤ n1 ≤ n and 1 ≤ m1 ≤ m, by Lemma 3.3.5, there is

a lowest degree polynomial An1m1 determined by the values c1, ··· , ck+1 and (A ) , ··· , (A ) . In fact, for any 1 ≤ s0 ≤ k + 1, let S = {1, ··· , k + 1}\ 1 n1m1 k+1 n1m1 {s0}. Then

k+1 X A = (A 0 ) g , n1m1 s n1m1 S s0=1

85 3.3 Generalized Inversion by Interpolation

  0 α ∈ S, where gS (cα) = . Since n1 and m1 are chosen randomly, a lowest degree  0 1 α = s matrix A that satisfies A (ci) = Ai for all 1 ≤ i ≤ k + 1 is determined by A = Pk+1 s0=1 As0 gS.

Next we show that A is unique. Suppose A0 6= A of degree p0 ≤ p also satisfies

0 A (ci) = Ai for all 1 ≤ i ≤ k + 1. Then for some 1 ≤ n2 ≤ n and 1 ≤ m2 ≤ m, (A − A0) 6= 0. But (A − A0) , of degree at most p ≤ k, has roots c , ··· , c n2m2 n2m2 1 k+1 which lie in k+1 conjugacy classes of H. This contradicts Theorem 3.3.3. Therefore, A is unique.

m×n Let A ∈ H [x] satisfy conditions of Theorem 3.1.15. For any x ∈ R, set B =

∗ AA . Let p be the largest integer such that ap 6= 0. We construct the sequence

A0, ··· , Ap as follows:

A0 = 0 −1 = q0 B0 = I ...... trA A = AA∗B p−1 = q B = A − q I p−1 p−2 p − 1 p−1 p−1 p−1 p−1 trA A = AA∗B p = q B = A − q I p p−1 p p p p p

Theorem 3.3.10. In the above setting, let k = (2m − 1) deg A and c1, ··· , ck+1 ∈

0 R be k + 1 distinct real numbers such that qp (cs0 ) 6= 0 for any 1 ≤ s ≤ k + 1. Let S = {1, ··· , k + 1}\{s0}. Then

k+1 † X † A = A (cs0 ) gS s0=1 where

† 1 ∗ h p−1 p−2 i A (cs0 ) = A (cs0 ) B (cs0 ) − q1 (cs0 ) B (cs0 ) − · · · − qp−1 (cs0 ) I qp (cs0 )

86 3.3 Generalized Inversion by Interpolation and   0 α ∈ S, gS (cα) =  0 1 α = s .

Proof. By Theorem 3.2.4, Lemma 3.2.6 and Lemma 3.3.9.

Example 3.3.11. Find, by interpolation, the generalized inverse of the quaternion polynomial matrix   14x + 14 + 76i + 70j + 56k 56 − 28i − 70j + 70k 28j − 56k 14x − 56 − 8i − 14j − 56k    −2x − 2 − 43i − 10j − 8k −8 + 4i + 10j − 10k −4j + 8k −2x + 8 − 31i + 2j + 8k  A =      −3x − 3 + 3i − 15j − 12k −12 + 6i + 15j − 15k −6j + 12k −3x + 12 + 21i + 3j + 12k −4x − 4 + 4i − 20j − 16k −16 + 8i + 20j − 20k −8j + 16k −4x + 16 + 28i + 4j + 16k

The following steps have been implemented into a single procedure in Maple. For details, see the “LFI” procedure of §A.2. As mentioned in Remark 3.3.8, here we only need two data points because direct † calculation shows that deg A = 2. Let c1 = 0 and c2 = 1. We have:   14 + 76i + 70j + 56k 56 − 28i − 70j + 70k 28j − 56k −56 − 8i − 14j − 56k   −2 − 43i − 10j − 8k −8 + 4i + 10j − 10k −4j + 8k 8 − 31i + 2j + 8k  A (c1) =     −3 + 3i − 15j − 12k −12 + 6i + 15j − 15k −6j + 12k 12 + 21i + 3j + 12k  −4 + 4i − 20j − 16k −16 + 8i + 20j − 20k −8j + 16k 16 + 28i + 4j + 16k and   28 + 76i + 70j + 56k 56 − 28i − 70j + 70k 28j − 56k −42 − 8i − 14j − 56k   −4 − 43i − 10j − 8k −8 + 4i + 10j − 10k −4j + 8k 6 − 31i + 2j + 8k  A (c2) =   .   −6 + 3i − 15j − 12k −12 + 6i + 15j − 15k −6j + 12k 9 + 21i + 3j + 12k  −8 + 4i − 20j − 16k −16 + 8i + 20j − 20k −8j + 16k 12 + 28i + 4j + 16k

By the algorithm stated in Lemma 3.2.6, we calculate and obtain:

† † 1 A (c1) = A (0) = × 230175   140 − 560i − 228j − 342k 355 + 1730i − 96j + 81k −255 − 870i + 126j + 54k −340 − 1160i + 168j + 72k    276 + 88i + 426j − 382k 282 + 416i − 93j − 149k −252 − 276i − 72j + 204k −336 − 368i − 96j + 272k       32 + 16i − 176j + 292k −176 − 88i + 68j + 194k 96 + 48i + 12j − 204k 128 + 64i + 16j − 272k  −140 − 122i + 228j + 342k −355 + 2021i + 96j − 81k 255 − 1176i − 126j − 54k 340 − 1568i − 168j − 72k

87 3.3 Generalized Inversion by Interpolation and

† † 1 A (c2) = A (1) = × 230175   152 − 550i − 244j − 330k 289 + 1675i − 8j + 15k −219 − 840i + 78j + 90k −292 − 1120i + 104j + 120k    268 + 104i + 406j − 402k 326 + 328i + 17j − 39k −276 − 228i − 132j + 144k −368 − 304i − 176j + 192k    .    32 + 16i − 160j + 300k −176 − 88i − 20j + 150k 96 + 48i + 60j − 180k 128 + 64i + 80j − 240k  −152 − 132i + 244j + 330k −289 + 2076i + 8j − 15k 219 − 1206i − 78j − 90k 292 − 1608i − 104j − 120k

By Theorem 3.3.10, we have:

2 † X † † † A = A (cs0 ) gS = A (0) (1 − x) + A (1) x s0=1 1 = × 230175  (12 + 10i − 16j + 12k) x + 140 − 560i − 228j − 342k (−66 − 55i + 88j − 66k) x + 355 + 1730i − 96j + 81k   (−8 + 16i − 20j − 20k) x + 276 + 88i + 426j − 382k (44 − 88i + 110j + 110k) x + 282 + 416i − 93j − 149k    (16j + 8k) x + 32 + 16i − 176j + 292k (−88j − 44k) x − 176 − 88i + 68j + 194k (−12 − 10i + 16j − 12k) x − 140 − 122i + 228j − 342k (66 + 55i − 88j + 66k) x − 355 + 2021i + 96j − 81k  (36 + 30i − 48j + 36k) x − 255 − 870i + 126j + 54k (48 + 40i − 64j + 48k) x − 340 − 1160i + 168j + 72k  (−24 + 48i − 60j − 60k) x − 252 − 276i − 72j + 204k (−32 + 64i − 80j + 80k) x − 366 − 368i − 96j + 272k   .  (48j + 24k) x + 96 + 48i + 12j − 204k (64j + 32k) x + 128 + 64i + 16j − 272k  (−36 − 30i + 48j − 36k) x + 255 − 1176i − 126j − 54k (−48 − 40i + 64j − 48k) x + 340 − 1568i − 168j − 72k

Direct calculation shows that A† satisfies the defining relations of the generalized inverse stated in Definition 3.1.3.

88 A. Maple Codes

A.1. Overview

At the early stage of my graduate studies, I realized the need of utilizing Maple when trying to solve quaternion quadratic equations. There are existing Maple packages dedicated to quaternions (Carter, 2007; Harder, 2010), but not quaternion polynomials or quaternion polynomial matrices. Therefore, I started writing my own Maple module. During my two years of graduate studies, I gradually extended this module to have over thirty procedures. These procedures enable the user to do basic quaternion and quaternion polynomial matrix operations such as additions and multiplications; to do Lagrange and Newton interpolations of a list of quaternion pairs; to obtain the generalized inverse of a quaternion polynomial matrix; to solve multiple quaternion equations and quaternion least norm problems; and so on. In §A2 the codes of the procedures are provided with descriptions and examples.

89 A.2 The Codes

A.2. The Codes

Q := module() option package; export M, ‘*‘, ‘^‘, eval, Qdef, Qrand, QPrand, Mrand,

PMrand, Qreal, Qimag, Qconj, Mconj, Qnorm, Qinv, AXXB, sortcollect, ZeroP, QMFNorm, PRotate, LagrangeP, AXBc,

NewtonP, QAdjointMatrix, LFI, NoSim1, NoSim2, Meval, AXB,

SemiSim, CSSim, LN1, LN2; local QMultiplyScalar, QMatrixMultiply, QScalarMultiply;

M := proc(a,b)

#M is the multiplication operator for quaternions and quaternion polynomials. local a1 := Qreal(a), b1 := coeff(a, I), c1 := coeff(a, J), d1 := coeff(a, K), a2 := Qreal(b), b2 := coeff(b, I), c2 := coeff(b, J), d2 := coeff(b, K); return sortcollect (a1*a2 - b1*b2 - c1*c2 - d1*d2

+ (a1*b2 + b1*a2 + c1*d2 - d1*c2)*I

+ (a1*c2 - b1*d2 + c1*a2 + d1*b2)*J

+ (a1*d2 + b1*c2 - c1*b2 + d1*a2)*K, x); end proc;

90 A.2 The Codes

QMatrixMultiply := proc(A::Matrix, B::Matrix)

#Local procedure for quaternion matrix multiplication. local nrowsA := LinearAlgebra:-RowDimension(A), ncolsA := LinearAlgebra:-ColumnDimension(A), ncolsB := LinearAlgebra:-ColumnDimension(B),

AB := Matrix(1..nrowsA, 1..ncolsB), i, j; for i from 1 to nrowsA do for j from 1 to ncolsB do

AB(i, j) := simplify(add(M(A(i, k), B(k, j)), k = 1 .. ncolsA)); end do; end do; end proc;

QMultiplyScalar := proc(A::Matrix, B)

#Local procedure to multiply a quaternion matrix by a quaternion scalar. local nrowsA := LinearAlgebra:-RowDimension(A), ncolsA := LinearAlgebra:-ColumnDimension(A),

AB := Matrix(1..nrowsA, 1..ncolsA), i, j; for i from 1 to nrowsA do for j from 1 to ncolsA do

AB(i, j) := simplify(M(A(i, j), B)); end do; end do;

91 A.2 The Codes end proc;

QScalarMultiply := proc(A, B::Matrix)

#Local procedure to multiply a quaternion scalar by a quaternion matrix. local nrowsB := LinearAlgebra:-RowDimension(B), ncolsB := LinearAlgebra:-ColumnDimension(B),

AB := Matrix(1..nrowsB, 1..ncolsB), i, j; for i from 1 to nrowsB do for j from 1 to ncolsB do

AB(i, j) := simplify(M(A, B(i, j))); end do; end do; end proc;

‘*‘ := proc(m, n)

#Newly defined multiplication operator for quaternions related elements. options remember; if type(m, Matrix) and type(n, Matrix) then

QMatrixMultiply(m, n); elif type(m, Matrix) then

QMultiplyScalar(m, n); elif type(n, Matrix) then

QScalarMultiply(m, n); else M(m, n);

92 A.2 The Codes end if; end proc;

‘^‘ := proc(m, n::integer)

#Newly defined exponential operator to include quaternion raised to positive integer powers. options remember; local i, p := 1; if type(m, freeof({I, J, K})) = false and n > 1 then for i from 1 to n do p := M(p, m); end do; return p; else m^n; end if; end proc;

Qdef := proc(a, b, c, d)

#Defines a quaternion a + bi + cj + dk. a + b*I + c*J + d*K; end proc:

Qrand := proc(m::integer, n::integer)

#Generates a random quaternion with all integer coordinates between m and n.

Qdef(rand(m..n)(), rand(m..n)(), rand(m..n)(), rand(m..n)());

93 A.2 The Codes end proc:

QPrand := proc (m,n,k)

#Generates a random quaternion polynomial of degee k, with coefficients Qrand (m, n). local j := k; return convert([seq(Qrand(m, n)*x^(j - i), i = 0 .. k)], ‘+‘) end proc;

Mrand := proc(m, n, p, q)

#Generates a random p × q Matrix with quaternion entries Qrand (m, n). local M := Matrix(1 .. p, 1 .. q), i, j; for i from 1 to p do for j from 1 to q do

M(i, j) := Qrand(m, n); end do; end do; end proc:

PMrand := proc(m, n, k1, k2, p, q)

#Generates a random p × q Matrix with random quaternion polynomial entries. local M := Matrix(1 .. p, 1 .. q), i, j; for i from 1 to p do for j from 1 to q do

M(i, j) := QPrand(m, n, rand(k1..k2)());

94 A.2 The Codes end do; end do; end proc:

Qreal := proc(a)

#Calculates the real part of a quaternion. subs(I = 0, J = 0, K = 0, a); end proc:

Qimag := proc(a)

#Calculates the imaginary part of a quaternion. a - Qreal(a); end proc:

Qconj := proc(f)

#Calculates the conjugate of a quaternion or a quaternion polynomial. sortcollect(Qreal(f) - Qimag(f), x); end proc:

Mconj := proc(A)

#Calculates the conjugate of a quaternion or quaternion polynomial matrix. local nrowsA:=LinearAlgebra:-RowDimension(A), ncolsA:=LinearAlgebra:-ColumnDimension(A),

AC := Matrix(1..nrowsA, 1..ncolsA), i, j; for i from 1 to nrowsA do for j from 1 to ncolsA do

95 A.2 The Codes

AC(i, j) := Qconj(A(i, j)) end do; end do; end proc: sortcollect := proc (A, a)

#Returns A as a polynomial in standard form of variable a. return sort(collect(A, a), a) end proc; eval := proc(N, n)

#Calculates N (n) where N (x) is a polynomial of x. options remember; local i, f := 1, m := N; if has(N, x) = false then expand(N); elif is(expand(N),‘+‘) = true then map(eval,expand(N),n); else for i from 1 to degree(N, x) do f := M(f, n); end do;

M(coeff(N, x, degree(N, x)), f); end if; end proc;

96 A.2 The Codes

Meval := proc(N, n)

#Calculates N (n) where N (x) is a quaternion polynomial matrix of x. options remember; local i, j, m := Matrix(LinearAlgebra:-RowDimension(N),

LinearAlgebra:-ColumnDimension(N)); for i from 1 to LinearAlgebra:-RowDimension(m) do for j from 1 to LinearAlgebra:-ColumnDimension(m) do m(i, j) := eval(N(i, j), n); end do; end do; end proc;

PRotate := proc(m::integer)

#Generates a block matrix. local M := Matrix(1 .. 2*m, 1 .. 2*m), i; for i from 1 to m do

M(i, i + m) := -1; end do; for i from m + 1 to 2*m do

M(i, i - m) := 1; end do; end proc;

97 A.2 The Codes

Qnorm := proc(a)

#Calculates the 2 norm of a quaternion.

(Qreal(a)^2 + coeff(a, I)^2 + coeff(a, J)^2 + coeff(a, K)^2)^(1/2); end proc:

Qinv := proc(a)

#Calculates the inverse of a quaternion or a quaternion polynomial. sortcollect(Qreal(a) - Qimag(a), x)/sortcollect

((Qreal(a)^2 + coeff(a,I)^2 + coeff(a, J)^2 + coeff(a, K)^2), x) end proc:

NoSim1 := proc(A::list)

#Ensures that a list of quaternion is ready for zero polynomial interpolation. options remember; local i, j, k, B := A, n := nops(B); for i from 2 to n do for j from 1 to i - 1 do if Qreal(B[j]) = Qreal(B[i]) and Qnorm(B[j]) = Qnorm(B[i]) then for k from j + 1 to i - 1 do if Qreal(B[k]) = Qreal(B[i]) and Qnorm(B[k]) = Qnorm(B[i]) then

B := subsop(i = z, B); next; end if; end do; end if;

98 A.2 The Codes end do; end do; return remove(t -> t = z, B); end proc;

ZeroP := proc(B::list)

#Calculates an zero polynomial for a list of quaternions. options remember; local A := [op({op(NoSim1(B))})], i, n := nops(A), f; f[1] := x - op(1, A); for i from 2 to n do f[i] := M((x - M(M(eval((f[i - 1]), op(i, A)), op(i, A)),

Qinv(eval((f[i - 1]), op(i, A))))), f[i - 1]); end do; return sortcollect(f[n], x); end proc;

NoSim2 := proc(A::listlist)

#Ensures that a list of quaternion pairs is ready for Lagrange Interpolation. options remember; local i, j, k, B := A, C, n1 := nops(B), n2; for i from 2 to n1 do for j from 1 to i - 1 do if A[j][1] = A[i][1] then

99 A.2 The Codes

B := subsop([i,1] = z, B); end if; end do; end do;

C := remove(t -> t[1] = z, B); n2 := nops(C); for i from 3 to n2 do for j from 1 to i-2 do if Qreal(C[j][1]) = Qreal(C[i][1]) and Qnorm(C[j][1]) = Qnorm(C[i][1]) then for k from j + 1 to i - 1 do if Qreal(C[k][1]) = Qreal(C[i][1]) and Qnorm(C[k][1]) = Qnorm(C[i][1]) then

C := subsop([i, 1] = z, C); next; end if; end do; end if; end do; end do; return remove(t -> t[1] = z, C); end proc;

LagrangeP := proc(B::listlist)

#Calculates the Lagrange polynomial for a list of quaternion pairs. local A := NoSim2(B), n := nops(A), b, c, i, j, f, g; options remember;

100 A.2 The Codes for i from 1 to n do b[i] := op(1, op(i, A)); c[i] := op(2, op(i, A)); end do; for i from 1 to n do f[i] := ZeroP([seq(b[j], j in {seq(1..n)} minus {i})]); end do; for i from 1 to n do g[i] := M(Qinv(eval(f[i], b[i])), f[i]); end do; return sortcollect(add(M(c[i], g[i]), i = 1..n), x); end proc:

QAdjointMatrix := proc(A::Matrix)

#Calculates the adjoint matrix of a quaternion matrix. local nrowsA := LinearAlgebra:-RowDimension(A), ncolsA := LinearAlgebra:-ColumnDimension(A),

A1 := Matrix(1..nrowsA, 1..ncolsA), A1C := Matrix(1..nrowsA, 1..ncolsA),

A2 := Matrix(1..nrowsA, 1..ncolsA), A2C := Matrix(1..nrowsA, 1..ncolsA),

AM := Matrix(1..2*nrowsA, 1..2*ncolsA), i, j; for i from 1 to nrowsA do for j from 1 to ncolsA do

A1(i, j) := A(i, j) - coeff(A(i, j), J)*J - coeff(A(i, j), K)*K;

101 A.2 The Codes

A1C(i, j) := Qconj(A1(i, j));

A2(i, j) := coeff(A(i, j), J) + coeff(A(i, j), K)*I;

A2C(i,j) := Qconj(A2(i, j));

AM(i, j) := A1(i, j); end do; end do; for i from 1 to nrowsA do for j from ncolsA + 1 to 2*ncolsA do

AM(i, j) := A2(i, j - ncolsA); end do; end do; for i from nrowsA + 1 to 2*nrowsA do for j from 1 to ncolsA do

AM(i, j) := -A2C(i - nrowsA, j); end do; end do; for i from nrowsA + 1 to 2*nrowsA do for j from ncolsA + 1 to 2*ncolsA do

AM(i, j) := A1C(i - nrowsA, j - ncolsA); end do; end do; for i from 1 to 2*nrowsA do

102 A.2 The Codes for j from 1 to 2*ncolsA do

AM(i, j) := subs(I = ii, AM(i, j)); end do; end do; return AM; end proc;

QMFNorm := proc(A::Matrix)

#Calculates the frobinius norm of a quaternion matrix. local nrowsA := LinearAlgebra:-RowDimension(A), ncolsA := LinearAlgebra:-ColumnDimension(A), i, j, N := 0; for i from 1 to nrowsA do for j from 1 to ncolsA do

N := N + coeff(A[i, j], I)^2 + coeff(A[i, j], J)^2

+ coeff(A[i, j], K)^2 + (Qreal(A[i, j]))^2; end do; end do; return (expand(N))^(1/2); end proc;

NewtonP := proc(B::listlist)

#Calculates the Newton polynomials and the divided difference for a list of quater- nion pairs. local g, i, j, d, b, c, A := NoSim2(B), n := nops(A); options remember;

103 A.2 The Codes for i from 1 to n do b[i] := op(1, op(i, A)); c[i] := op(2, op(i, A)); end do; d[0] := c[1]; g[0] := 1; for i from 1 to n - 1 do g[i] := ZeroP([seq(b[j], j = 1..i)]); d[i] := M(c[i + 1] - c[1] - add(M(d[j], eval(g[j], b[i + 1])), j = 1..i - 1),

Qinv(eval(g[i], b[i + 1]))); end do; return [seq(g[i], i = 0..n - 1)], [seq(d[i], i = 0..n - 1)]; end proc;

LFI := proc (A::Matrix)

#Calculates the generalized inverse of a quaternion polynomial matrix. local nrowsA := LinearAlgebra:-RowDimension(A),

H := LinearAlgebra:-Transpose(Mconj(A)),

P := QMatrixMultiply(A, H), a, B, AA, i, j, k := 0, LFI; a[0] := 1;

B[0] := LinearAlgebra:-IdentityMatrix(nrowsA); for i from 1 to nrowsA do

AA[i] := QMatrixMultiply(P, B[i - 1]); a[i] := -LinearAlgebra:-Trace(AA[i])/i;

B[i] := AA[i] + QScalarMultiply(a[i], B[0]);

104 A.2 The Codes end do; for j from 1 to nrowsA do if a[j] <> 0 then k := j; end if; end do; if k = 0 then

LFI := 0; else

LFI := [(-1/a[k]), QMatrixMultiply(H, B[k - 1])]; end if; end proc:

AXXB:= proc (A, B, C)

#Calculates the solutions of x2 + Ax + xB + C = 0. local a0 := Qreal(A), a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b0 := Qreal(B), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), c := ((a0 + b0)/2)^2 - M((A + B), ((a0 + b0)/2)) + C, c0 := Qreal(c), c1 := coeff(c, I), c2 := coeff(c, J),c3 := coeff(c, K), one := -4*(a1 + b1)*x^3 + 4*(a2*b3 - a3*b2 - c1)*x^2

+ (b1 - a1)*(a1^2 + a2^2 + a3^2 - b1^2 - b2^2 - b3^2)*x

105 A.2 The Codes

+ 2*(c2*(b3 - a3) + c3*(a2 - b2))*x

+ (b1 - a1)*(c1*(a1 - b1) + c2*(a2 - b2) + c3*(a3 - b3)), two := -4*(a2 + b2)*x^3 + 4*(a3*b1 - a1*b3 - c2)*x^2

+ (b2 - a2)*(a1^2 + a2^2 + a3^2 - b1^2 - b2^2 - b3^2)*x

+ 2*(c1*(a3 - b3) + c3*(b1 - a1))*x

+ (b2 - a2)*(c1*(a1 - b1) + c2*(a2 - b2) + c3*(a3 - b3)), three := -4*(a3 + b3)*x^3 + 4*(a1*b2 - a2*b1 - c3)*x^2

+ (b3 - a3)*(a1^2 + a2^2 + a3^2 - b1^2 - b2^2 - b3^2)*x

+ 2*(c1*(b2 - a2) + c2*(a1 - b1))*x

+ (b3 - a3)*(c1*(a1 - b1) + c2*(a2 - b2) + c3*(a3 - b3)), d := 8*x^3 + 2*((a1 - b1)^2 + (a2 - b2)^2 + (a3 - b3)^2)*x, f := 16*x^3

+ 8*(a1^2 + a2^2 + a3^2 + b1^2 + b2^2 + b3^2 + 2*c0)*x^2

+ 4*c0*((a1 - b1)^2 + (a2 - b2)^2 + (a3 - b3)^2)*x

+ (a1^2 + a2^2 + a3^2 - b1^2 - b2^2 - b3^2)^2*x

+ (8*(a2*b3 - a3*b2)*c1 - 4*c1^2)*x

+ (8*(a3*b1 - a1*b3)*c2 - 4*c2^2)*x

+ (8*(a1*b2 - a2*b1)*c3 - 4*c3^2)*x

- (a1*c1 + a2*c2 + a3*c3 - b1*c1 - b2*c2 - b3*c3)^2,

Z := evalf(op(select(t -> evalf(t) > 0, map(Re + Im*ii, simplify(evalc([solve(f,x)])))))); return map(t ->

106 A.2 The Codes

(t + subs(x = t,one/d)*I

+ subs(x = t,two/d)*J + subs(x = t,three/d)*K - (a0 + b0)/2),

{sqrt(Z), -sqrt(Z)}); end proc:

AXBc:= proc (A, B, c)

#Calculates the solutions of x2 + AxB + c = 0. local a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), one := x*(a3*b2 - a2*b3), two := x*(a1*b3 - a3*b1), three := x*(a2*b1 - a1*b2), a := (a1^2 + a2^2 + a3^2)*(b1^2 + b2^2 + b3^2), b := a1*b1 + a2*b2 + a3*b3, d := 2*x + b, f := x^4 + (c - (3/4)*a)*x^2

+ (1/4)*b*(4*c - a)*x + (1/4)*c*b^2, sol := fsolve(f, x, real); return map(t -> (t

+ subs(x = t,one/d)*I + subs(x = t,two/d)*J + subs(x = t,three/d)*K),

{sol}); end proc:

AXB:= proc (A, B)

107 A.2 The Codes

#Calculates the solutions of x2 + AxB = 0. local a0 := Qreal(A), a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b0 := Qreal(B), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), m11 := a0*b0 - a1*b1 + a2*b2 + a3*b3, m12 := a0*b3 - a1*b2 - a2*b1 - a3*b0, m13 := -a0*b2 - a1*b3 + a2*b0 - a3*b1, m21 := -a0*b3 - a1*b2 - a2*b1 + a3*b0, m22 := a0*b0 + a1*b1 - a2*b2 + a3*b3, m23 := a0*b1 - a1*b0 - a2*b3 - a3*b2, m31 := a0*b2 - a1*b3 - a2*b0 - a3*b1, m32 := -a0*b1 + a1*b0 - a2*b3 - a3*b2, m33 := a0*b0 + a1*b1 + a2*b2 - a3*b3, d := 8*x^3 + 4*(m11 + m22 + m33)*x^2

+ 2*(m11*m22 + m11*m33 - m12*m21 - m13*m31 - m23*m32 + m22*m33)*x

+ m11*m22*m33 - m11*m23*m32 - m12*m21*m33

+ m13*m21*m32 + m12*m23*m31 - m13*m22*m31, n1 := -a0*b1 - a1*b0 - a2*b3 + a3*b2, n2 := -a0*b2 + a1*b3 - a2*b0 - a3*b1, n3 := -a0*b3 - a1*b2 + a2*b1 - a3*b0, one := 4*n1*x^3 + 2*(n1*(m22 + m33) - n2*m12 - n3*m13)*x^2

108 A.2 The Codes

+ n1*(m22*m33 - m23*m32)*x

+ n2*(m13*m32 - m12*m33)*x

+ n3*(m12*m23 - m13*m22)*x, two := 4*n2*x^3 + 2*(n2*(m11 + m33) - n1*m21 - n3*m23)*x^2

+ n1*(m23*m31 - m21*m33)*x

+ n2*(m11*m33 - m13*m31)*x

+ n3*(m13*m21 - m11*m23)*x, three := 4*n3*x^3 + 2*(n3*(m11 + m22) - n1*m31 - n2*m32)*x^2

+ n1*(m21*m32 - m22*m31)*x

+ n2*(m12*m31 - m11*m32)*x

+ n3*(m11*m22 - m12*m21)*x, ab := (a0^2 + a1^2 + a2^2 + a3^2)*(b0^2 + b1^2 + b2^2 + b3^2), h := x^3 + 2*a0*b0*x^2 + ((4/3)*a0^2*b0^2

- (1/12)*(a0^2 - 3*a1^2 - 3*a2^2 - 3*a3^2)

*(b0^2 - 3*b1^2 - 3*b2^2 - 3*b3^2))*x

+ (1/4)*ab*(a0*b0 - a1*b1 - a2*b2 - a3*b3), g := x^4 + 2*a0*b0*x^3

+ (1/2)*(4*a0^2*b0^2

- (a1^2 + a2^2 + a3^2 - a0^2)*(b1^2 + b2^2 + b3^2 - b0^2))*x^2

+ (1/2)*a0*b0*ab*x + (1/16)*ab^2, solg := fsolve(g, x, real), solh := fsolve(h, x, real);

109 A.2 The Codes if a0 = 0 and b0 = 0 then return map(t -> (t

+ subs(x = t,one/d)*I + subs(x = t,two/d)*J + subs(x = t,three/d)*K),

{solh}); else return map(t -> (t

+ subs(x = t, one/d)*I + subs(x = t, two/d)*J + subs(x = t, three/d)*K),

{solg, solh}); end if; end proc:

SemiSim:= proc (B, A)   yAx = B #Calculates (x, y) such that .  xBy = A local a0 := Qreal(A), a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b0 := Qreal(B), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), Z; if Qnorm(A) <> Qnorm(B) then return "No Solution" elif abs(a0) <> abs(b0) then return "No Solution" else Z := LinearAlgebra:-LinearSolve(

Matrix([[a0^2 - b0^2, -a0*a3 - b0*b3, a0*a2 + b0*b2, a0*a1 - b0*b1, 0],

110 A.2 The Codes

[a0*a3 + b0*b3, a0^2 - b0^2, -a0*a1 - b0*b1, a0*a2 - b0*b2, 0],

[-a0*a2 - b0*b2, a0*a1 + b0*b1, a0^2 - b0^2, a0*a3 - b0*b3, 0],

[-a0*a1 + b0*b1, -a0*a2 + b0*b2, -a0*a3 + b0*b3, a0^2 - b0^2, 0]]), free = ’t’); end if; return sort(Z[4] + Z[1]*I + Z[2]*J + Z[3]*K, [I, J, K]) and simplify(M(B, M(Qinv(Z[4] + Z[1]*I + Z[2]*J + Z[3]*K),Qinv(A)))); end proc:

CSSim:= proc (B, A)   yAx = B #Calculates (x, y) such that .  xBy = A #Calculates x,y such that local a0 := Qreal(A), a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b0 := Qreal(B), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), Z; if Qnorm(A) <> Qnorm(B) then return "No Solution" else Z := LinearAlgebra:-LinearSolve(

Matrix([[0, a0*b3 + a3*b0, -a0*b2 - b0*a2, a2*b3 - a3*b2, 0],

[-a0*b3 - a3*b0, 0, a0*b1 + a1*b0, -a1*b3 + a3*b1, 0],

[a0*b2 + a2*b0, -a0*b1 - a1*b0, 0, a1*b2 - a2*b1, 0],

[-a2*b3 + a3*b2, a1*b3 - a3*b1, -a1*b2 + a2*b1, 0, 0]]),

111 A.2 The Codes free = ’t’); end if; return simplify(Z[4] + Z[1]*I + Z[2]*J + Z[3]*K) and simplify(M(M(Qinv(B),Qinv(Qconj(Z[4] + Z[1]*I + Z[2]*J + Z[3]*K))),A)) end proc:

LN1:= proc (A, B, C)

#Calculates the solution of min |ax − xb − c|. x∈H local a0 := Qreal(A), a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b0 := Qreal(B), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), c0 := Qreal(C), c1 := coeff(C, I), c2 := coeff(C, J), c3 := coeff(C, K), Z; if Qnorm(A) = Qnorm(B) and Qreal(A) = Qreal(B) then

Z := LinearAlgebra:-MatrixMatrixMultiply(LinearAlgebra:-MatrixInverse(

Matrix([[a0 - b0, -a3 - b3, a2 + b2, a1 - b1],

[a3 + b3, a0 - b0, -a1 - b1, a2 - b2],

[-a2 - b2, a1 + b1, a0 - b0, a3 - b3],

[-a1 + b1, -a2 + b2, -a3 + b3, a0 - b0]]), method = pseudo),

Matrix(4, 1, {(1, 1) = c1, (2, 1) = c2, (3, 1) = c3, (4, 1) = c0})); else

Z := LinearAlgebra:-LinearSolve(

Matrix([[a0 - b0, -a3 - b3, a2 + b2, a1 - b1, c1],

[a3 + b3, a0 - b0, -a1 - b1, a2 - b2, c2],

112 A.2 The Codes

[-a2 - b2, a1 + b1, a0 - b0, a3 - b3, c3],

[-a1 + b1, -a2 + b2, -a3 + b3, a0 - b0, c0]]), free = ’t’); end if; return simplify(Z[4] + Z[1]*I + Z[2]*J + Z[3]*K); end proc:

LN2:= proc (A,B,C)

#Calculates the solution of min |ax − xb¯ − c|. x∈H local a0 := Qreal(A), a1 := coeff(A, I), a2 := coeff(A, J), a3 := coeff(A, K), b0 := Qreal(B), b1 := coeff(B, I), b2 := coeff(B, J), b3 := coeff(B, K), c0 := Qreal(C), c1 := coeff(C, I), c2 := coeff(C, J), c3 := coeff(C, K), Z; if Qnorm(A) = Qnorm(B) and Qreal(A) = Qreal(B) then

Z := LinearAlgebra:-MatrixMatrixMultiply(LinearAlgebra:-MatrixInverse(

Matrix([[a0 + b0, -a3 + b3, a2 - b2, a1 - b1],

[a3 - b3, a0 + b0, -a1 + b1, a2 - b2],

[-a2 + b2, a1 - b1, a0 + b0, a3 - b3],

[-a1 - b1, -a2 - b2, -a3 - b3, a0 - b0]]), method = pseudo),

Matrix(4, 1, {(1, 1) = c1, (2, 1) = c2, (3, 1) = c3, (4, 1) = c0})); else

Z := LinearAlgebra:-LinearSolve(

Matrix([[a0 + b0, -a3 + b3, a2 - b2, a1 - b1, c1],

[a3 - b3, a0 + b0, -a1 + b1, a2 - b2, c2],

113 A.2 The Codes

[-a2 + b2, a1 - b1, a0 + b0, a3 - b3, c3],

[-a1 - b1, -a2 - b2, -a3 - b3, a0 - b0, c0]]), free = ’t’); end if; return simplify(Z[4] + Z[1]*I + Z[2]*J + Z[3]*K); end proc: end module:

114 A.2 The Codes

115 A.2 The Codes

116 A.2 The Codes

117 A.2 The Codes

118 Bibliography

Adler, S., 1995. Quaternionic quantum mechanics and quantum fields. International Series of Monographs on Physics. Oxford University Press, USA.

Au-Yeung, Y., 2003. An explicit solution for the quaternionic equation x2 + bx + xc + d = 0. Southeast Asian Bull. Math. 26 (5), 717–724.

Baker, A., 1999. Right eigenvalues for quaternionic matrices: a topological approach. Linear Algebra Appl. 286 (1-3), 303–309.

Bjõrck, A., 1996. Numerical methods for least squares problems. Society for Indus- trial and Applied Mathematics.

Bray, U., Whaples, G., 1983. Polynomials with coefficients from a division ring. Canad. J. Math. 35 (3), 509–515.

Brenner, J. L., 1951. Matrices of quaternions. Pacific J. Math. 1, 329–335.

Carter, M., March 2007. Quaternions. Maple package. Maplesoft.

URL http://www.maplesoft.com/applications/view.aspx?SID=4886

Cayley, A., 1894. On coordinates versus quaternions. Proc. Roy. Soc. Edinburgh 20, 271–275.

Churchill, L., 1990. Quaternion analysis in physics. East Carolina University.

Decell, H., 1965. An application of the Cayley-Hamilton theorem to generalized matrix inversion. SIAM Rev. 7, 526–528.

119 Bibliography

Derbyshire, J., 2006. Unknown quantity: a real and imaginary history of algebra. Joseph Henry Press.

Eilenberg, S., Niven, I., 1944. The “fundamental theorem of algebra” for quaternions. Bull. Amer. Math. Soc. 50, 246–248.

Faddeeva, V., 1959. Computational methods of linear algebra. Dover books on ad- vanced mathematics. Dover Publications.

Finkelstein, D., Jauch, J., Schiminovich, S., Speiser, D., 1962. Foundations of quater- nion quantum mechanics. Journal of Mathematical Physics 3 (2), 207–220.

Gibbs, J., Bumstead, H., Van Name, R., Longley, W., 1902. The collected works of J. Willard Gibbs. No. v. 2 in The Collected Works of J. Willard Gibbs. Longman, Green and Co.

Gordon, B., Motzkin, T. S., 1965. On the zeros of polynomials over division rings. Trans. Amer. Math. Soc. 116, 218–226.

Hanson, A., 2005. Visualizing quaternions. The Morgan Kaufmann Series In Inter- active 3D Technology. Morgan Kaufmann.

Harder, D., September 2010. Quaternions. Maple package. Maplesoft.

URL http://www.maplesoft.com/applications/view.aspx?SID=96897

Hastings, C., 2010. Biographical Memoir of Josiah Willard Gibbs, 1839-1903: By Charles S. Hastings. BiblioBazaar.

Horn, R., Johnson, C., 1990. Matrix analysis. Cambridge University Press.

Huang, L., So, W., 2002. Quadratic formulas for quaternions. Appl. Math. Lett. 15 (5), 533–540.

Johnson, R. E., 1944. On the equation χα = γχ + β over an algebraic division ring. Bull. Amer. Math. Soc. 50, 202–207.

120 Bibliography

Kalman, D., 1978. An extension of the remainder theorem. Delta 8, 77–80.

Karampetakis, N. P., 1997. Computation of the generalized inverse of a polynomial matrix and applications. Linear Algebra Appl. 252, 35–60.

Kuipers, J., 2002. Quaternions and rotation sequences: a primer with applications to orbits, aerospace and virtual reality. Princeton University Press.

Lam, T., 2001. A first course in noncommutative rings. Graduate Texts in Mathe- matics (131). Springer.

Lee, H. C., 1949. Eigenvalues and canonical forms of matrices with quaternion co- efficients. Proc. Roy. Irish Acad. Sect. A. 52, 253–260.

Maxwell, J., 1873. Quaternions. Nature 9, 137–138.

McAulay, A., 1892. Quaternions as a practical instrument of physical research. Philo- sophical Magazine 33, 477–495.

Morandi, P., 1996. Field and Galois theory. Graduate Texts in Mathematics. Springer.

Muir, T., 2003. A treatise on the theory of determinants. Dover Phoenix Editions. Dover Publications.

Nahin, P., 2002. Oliver Heaviside: the life, work, and times of an electrical genius of the Victorian age. Oliver Heaviside. Johns Hopkins University Press.

Niven, I., 1941. Equations in quaternions. Amer. Math. Monthly 48, 654–661.

Niven, I., 1942. The roots of a quaternion. Amer. Math. Monthly 49, 386–388.

Penrose, R., 1955. A generalized inverse for matrices. Proc. Cambridge Philos. Soc. 51, 406–413.

Puystjens, R., de Smet, H., 1980. The Moore-Penrose inverse for matrices over skew

121 Bibliography

polynomial rings. Antwerp, Lecture Notes in Mathematics 825, 94– 103.

Smith, C., Wise, N., 1989. Energy and empire: a biographical study of Lord Kelvin. Cambridge University Press.

Stanimirović, P., Petković, M., 2006. Computing generalized inverse of polynomial matrices by interpolation. Appl. Math. Comput. 172 (1), 508–523.

Stanimirović, P., Tasić, M., Krtolica, P., Karampetakis, N., 2007. Generalized in- version by interpolation. Filomat 21 (1), 67–86.

Tait, P., 1890. Vii. On the importance of quaternions in physics. Philosophical Mag- azine Series 5 29 (176), 84–97.

Tian, Y., 2004. The equations ax − xb = c, ax − xb = c and xax = b in quaternions. Southeast Asian Bull. Math. 28 (2), 343–362.

Tian, Y., 2010. Solving two pairs of quadratic equations in quaternions. Adv. Appl. Clifford Algebr. 20 (1), 185–193. van der Waerden, B., 1985. A history of algebra: from al-Khw¯arizm¯ı to Emmy Noether. Springer.

Zhang, F., 1997. Quaternions and matrices of quaternions. Linear Algebra and its Applications 251 (0), 21–57.

122