# A real example of an Octonion product

Goal: find the general Octonion multiplication product like the Quaternion formula given here:

https://en.wikipedia.org/wiki/Quaternion#Multiplication_of_basis_elements

* question modified for clarity

I am having trouble with Octonion multiplications. Can you help?

The equations needed to achieve your goal are provided below. As well as the steps I took for my attempt. BUT my solution does not match secondary online sources.

my solution is incorrect

Let me know if you see the mistake or have a better solution.

I expect the solution to be a set of 8 sums and differences of pairs of products of different combinations of 8 input variables. ie: your solution will look similar to this attempt.

# Define:

Doubling Product (Pt3): $$(A,B)×(C,D) = (AC − D^\star B, DA + BC^\star)$$

Conjugate: $$(A,B)^\star = (A^\star,-B)$$

Octonion notation: $$(A,B,C,D,E,F,G,H)$$ $$= A·e0 + B·e1 + C·e2 + D·e3 + E·e4 + F·e5 + G·e6 + H·e7$$

where :

$$e0 = 1$$

$$e1,e2,e3,e4,e5,e6,e7 ∈ Imaginary Units$$

* imaginary values are implied based on their order within the set and will not be displayed further.

Paired variables are products: $$ab = a×b$$

Variables are Real numbers: a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p ∈ ℝ

To be clear... all variables used (a to p) represent Real number and no imaginary units are shown. The coefficient of imaginary numbers are not shown, because the ordering of the variables in the bracket notation matches the ordering of our imaginary numbers. ex: (1,2) = 1+2e1, (0,5,6,1,0,0,3,0) = 5e1 + 6e2 + 1e3 + 3e6

# Known Quaternion Multiplication

Following the Quaterion equation given here:

https://en.wikipedia.org/wiki/Quaternion#Multiplication_of_basis_elements

...substitute variable names like this:

a1 = A, b1 = B, c1 = C, d1 = D
a2 = E, b2 = F, c2 = G, d2 = H


To obtain {equation 1} as:

(A,B,C,D)×(E,F,G,H) = (
AE - BF - CG - DH,
AF + BE + CH - DG,
AG - BH + CE + DF,
AH + BG - CF + DE,
)


# Octonion Multiplication:

$$(a,b,c,d,e,f,g,h) × (i,j,k,l,m,n,o,p)$$

$$= ((a,b,c,d),(e,f,g,h)) × ((i,j,k,l),(m,n,o,p))$$

using: $$(A,B)×(C,D) = (AC − D^\star B, DA + BC^\star)$$

with: $$A = (a,b,c,d), B = (e,f,g,h), C = (i,j,k,l), D = (m,n,o,p)$$

then:

$$((a,b,c,d),(e,f,g,h)) × ((i,j,k,l),(m,n,o,p))$$

$$=( (a,b,c,d) × (i,j,k,l) - (m, n, o, p) ^\star × (e,f,g,h),$$ $$(m,n,o,p) × (a,b,c,d) + (e,f,g,h) × (i, j, k, l) ^\star )$$

$$= ( (a,b,c,d) × (i,j,k,l) - (m,-n,-o,-p) × (e,f,g,h),$$ $$(m,n,o,p) × (a,b,c,d) + (e,f,g,h) × (i,-j,-k,-l) )$$

Above equation is composed of 4 quaternion products:

 Q1 = ( a, b, c, d) × ( i, j, k, l)

Q2 = ( m,-n,-o,-p) × ( e, f, g, h)

Q3 = ( m, n, o, p) × ( a, b, c, d)

Q4 = ( e, f, g, h) × ( i,-j,-k,-l)


... and our solution will be the ordered set of their difference and sum:

$$(a,b,c,d,e,f,g,h) × (i,j,k,l,m,n,o,p) = ( Q1-Q2, Q3+Q4 )$$

In words the equation says:

"Our solution is the difference and sum of quaternion product pairs which in order produce our Octonion solution."

# Calculate a general Octonion Multiplication equation:

First, calculate the 4 quaternion products...

$$Q1 = ( a, b, c, d) × ( i, j, k, l)$$

recall {equation 1} is:

(A,B,C,D)×(E,F,G,H) = (
AE - BF - CG - DH,
AF + BE + CH - DG,
AG - BH + CE + DF,
AH + BG - CF + DE,
)


using: {equation 1}

let: A=a, B=b, C=c, D=d, E=i, F=j, G=k, H=l

then:

(a,b,c,d)×(i,j,k,l) = (

ai-bj-ck-dl,

aj+bi+cl-dk,

ak-bl+ci+dj,

al+bk-cj+di,

)


$$Q2 = ( m,-n,-o,-p) × ( e, f, g, h)$$

using: {equation 1}

let: A=m, B=-n, C=-o, D=-p, E=e, F=f, G=g, H=h

then:

(m,-n,-o,-p)×(e,f,g,h) = (

me+nf+og+ph,

mf-ne-oh+pg,

mg+nh-oe-pf,

mh-ng+of-pe,

)


$$Q3 = ( m, n, o, p) × ( a, b, c, d)$$

using: {equation 1}

let: A=m, B=n, C=o, D=p, E=a, F=b, G=c, H=d

then:

( m,n,o,p) × (a,b,c,d) = (

ma-nb-oc-pd,

mb+na+od-pc,

mc-nd+oa+pb,

md+nc-ob+pa,

)


$$Q4 = ( e, f, g, h) × ( i,-j,-k,-l)$$

using: {equation 1}

let: A=e, B=f, C=g, D=h, E=i, F=-j, G=-k, H=-l

then:

(e,f,g,h) × (i,-j,-k,-l) = (

ei+fj+gk+hl,

-ej+fi-gl+hk,

-ek+fl+gi-hj,

-el-fk+gj+hi,

)


$$( Q1-Q2, Q3+Q4 )$$

( Q1-Q2, Q3+Q4 )

= (
( ai-bj-ck-dl, aj+bi+cl-dk, ak-bl+ci+dj, al+bk-cj+di )
- ( me+nf+og+ph, mf-ne-oh+pg, mg+nh-oe-pf, mh-ng+of-pe )
,
( ma-nb-oc-pd, mb+na+od-pc, mc-nd+oa+pb, md+nc-ob+pa )
+ ( ei+fj+gk+hl,-ej+fi-gl+hk,-ek+fl+gi-hj,-el-fk+gj+hi )
)


and recall:

(a,b,c,d,e,f,g,h) × (i,j,k,l,m,n,o,p) = ( Q1-Q2, Q3+Q4 )

# Octonion solution is calculated

$$(a,b,c,d,e,f,g,h) × (i,j,k,l,m,n,o,p)$$

(a,b,c,d,e,f,g,h) × (i,j,k,l,m,n,o,p)

= (

ai-bj-ck-dl-me-nf-og-ph,

aj+bi+cl-dk-mf+ne+oh-pg,

ak-bl+ci+dj-mg-nh+oe+pf,

al+bk-cj+di-mh+ng-of+pe,

ma-nb-oc-pd+ei+fj+gk+hl,

mb+na+od-pc-ej+fi-gl+hk,

mc-nd+oa+pb-ek+fl+gi-hj,

md+nc-ob+pa-el-fk+gj+hi,

)


and it has label { Octonion Product Equation }

# Test Octonion Equation

Calculate: $$(1,2,3,4,5,6,7,8) × (8,7,6,5,4,3,2,1)$$

using: { Octonion Product Equation }

let: a=1, b=2, c=3, d=4, e=5, f=6, g=7, h=8, i=8, j=7, k=6, l=5, m=4, n=3, o=2, p=1

then:

$$(1,2,3,4,5,6,7,8) × (8,7,6,5,4,3,2,1)$$

= (

1×8-2×7-3×6-4×5-4×5-3×6-2×7-1×8,

1×7+2×8+3×5-4×6-4×6+3×5+2×8-1×7,

1×6-2×5+3×8+4×7-4×7-3×8+2×5+1×6,

1×5+2×6-3×7+4×8-4×8+3×7-2×6+1×5,

4×1-3×2-2×3-1×4+5×8+6×7+7×6+8×5,

4×2+3×1+2×4-1×3-5×7+6×8-7×5+8×6,

4×3-3×4+2×1+1×2-5×6+6×5+7×8-8×7,

4×4+3×3-2×2+1×1-5×5-6×6+7×7+8×8,

)


= (-104, 14, 12, 10, 152, 42, 4, 74)

Comparing with: http://jwbales.us/rpnSedenion.html (using Pt3 setting)

= ( -104, -4, 48, 64, 80, -48, 112, 56 )

WARNING: the list of 8 numbers above DO NOT MATCH. They should. Can you solve the puzzle?

The formula I show must be incorrect. What am I missing?

# Update:

I think this calculator is broken? http://jwbales.us/rpnSedenion.html

Because I modified code found here: https://www.johndcook.com/blog/2018/07/10/cayley-dickson/

And found: (1,2,3,4,5,6,7,8) × (8,7,6,5,4,3,2,1) = [-104. 14. 12. 10. 152. 42. 4. 74.]

... which match previous results, results mentioned by J.G and the result of the calculated Octonion equation above.

perhaps the generic Octonion equation above is correct

If so... I don't know how these calculators are operating:

http://jwbales.us/rpnSedenion.html

http://jwbales.us/rpnOctonion.html

http://jwbales.us/sedenion.html

I am unsure what is true. Do you think the formula I provided is correct?

modified python code for reference:

#!/usr/bin/python
# reference: https://www.johndcook.com/blog/2018/07/10/cayley-dickson/
import numpy as np
from numpy.linalg import norm

def conj(x):
xstar = -x
xstar[0] *= -1
return xstar

def CayleyDickson(x, y):
n = len(x)

if n == 1:
return x*y

m = n // 2

a, b = x[:m], x[m:]
c, d = y[:m], y[m:]
z = np.zeros(n)
z[:m] = CayleyDickson(a, c) - CayleyDickson(conj(d), b)
z[m:] = CayleyDickson(d, a) + CayleyDickson(b, conj(c))
return z

a = np.array([1,2,3,4,5,6,7,8])
b = np.array([8,7,6,5,4,3,2,1])
c = CayleyDickson(a, b)
print "{} * {} = {}".format(a, b, c)



beginner tip: I needed to "pip install numpy" before it would run.

• I'm not sure which stack exchange can best help with this, but wherever this question ends up, it'll be easiest to help you if we can also see your code. In the mean time, double-check whether you correctly used$$(p,\,q)^\ast=(p^\ast,\,-q),\,(p,\,q)(r,\,s)=(pr-s^\ast q,\,sp+qr^\ast).$$A mnemonic based on this is left as an exercise to the reader. – J.G. Oct 15 at 10:21
• Code location: github.com/peawormsworth/Tangle/blob/master/Tangle-0.04/lib/… But I don't want code review. I want someone to show the long form steps of multiplying a pair of simple integer quaternions, so I may observe the steps described. Because I know my code is doing what I want. So obviously I don't understand the steps. I am searching the Internet for one written example of someone showing Octonion multiplication but there is no more than algebra. There should be an example. Please do it or point where it is done. – peawormsworth Oct 15 at 11:54
• Wikipedia gives $(ac-d^\ast b,\,da+bc^\ast)$, but you use $(ac-db^\ast,\,a^\ast d+cb)$, as does that site. Worse still, some Python I wrote gives $-104+14i+12j+10k+152l+42m+4n+74o$. – J.G. Oct 15 at 12:31
• I have modified the question to show the steps to obtain the formula of last post. The question has been modified from a specific example into a generic solution... which should be useful to solve. I hope this inspires answers. – peawormsworth Oct 16 at 4:34
• Any chance you could improve the formatting too? I also strongly recommend you write octonions as $a_0e_0+\cdots+a_7e_7$ with $e_0=1$ etc., since multiplying two octonions otherwise requires $24$ letters. As it stands, your question repeats letters in a confusing way. – J.G. Oct 16 at 5:58