# 7-dimensional cross product

How to define a 7-dimensional cross product?

\begin{aligned}\mathbf {x} \times \mathbf {y} =(x_{2}y_{4}-x_{4}y_{2}+x_{3}y_{7}-x_{7}y_{3}+x_{5}y_{6}-x_{6}y_{5})\,&\mathbf {e} _{1}\\{}+(x_{3}y_{5}-x_{5}y_{3}+x_{4}y_{1}-x_{1}y_{4}+x_{6}y_{7}-x_{7}y_{6})\,&\mathbf {e} _{2}\\{}+(x_{4}y_{6}-x_{6}y_{4}+x_{5}y_{2}-x_{2}y_{5}+x_{7}y_{1}-x_{1}y_{7})\,&\mathbf {e} _{3}\\{}+(x_{5}y_{7}-x_{7}y_{5}+x_{6}y_{3}-x_{3}y_{6}+x_{1}y_{2}-x_{2}y_{1})\,&\mathbf {e} _{4}\\{}+(x_{6}y_{1}-x_{1}y_{6}+x_{7}y_{4}-x_{4}y_{7}+x_{2}y_{3}-x_{3}y_{2})\,&\mathbf {e} _{5}\\{}+(x_{7}y_{2}-x_{2}y_{7}+x_{1}y_{5}-x_{5}y_{1}+x_{3}y_{4}-x_{4}y_{3})\,&\mathbf {e} _{6}\\{}+(x_{1}y_{3}-x_{3}y_{1}+x_{2}y_{6}-x_{6}y_{2}+x_{4}y_{5}-x_{5}y_{4})\,&\mathbf {e} _{7}\end{aligned}

The above can be coded directly, but I'm looking for something more elegant (and readable if possible).

As much I understand, the crucial part is to define a multiplication table which is not unique. Here I choose a trial example

$e_i \times e_j = \varepsilon_{i',j',k'} e_k$ where $i'=Mod[i,n]$ for $n$ dimension.

prod[n_, i_, j_] := Sum[LeviCivitaTensor[3][[Mod[i, 3, 1], Mod[j, 3, 1], Mod[k, 3, 1]]]
e[k], {k, n}]


I am going to show the example for 3 dimensions which can be verified.

dim = 3
Table[prod[dim, i, j], {i, dim}, {j, dim}] // MatrixForm


$\left( \begin{array}{ccc} 0 & e(3) & -e(2) \\ -e(3) & 0 & e(1) \\ e(2) & -e(1) & 0 \\ \end{array} \right)$

vecprod = Sum[prod[dim, i, j] xx[[i]] yy[[j]], {i, dim}, {j, dim}];
Grid[Table[{e[i], Coefficient[vecprod, e[i]]}, {i, dim}], Frame -> All]


$\begin{array}{cc} e(1) & x(2) y(3)-x(3) y(2) \\ e(2) & x(3) y(1)-x(1) y(3) \\ e(3) & x(1) y(2)-x(2) y(1) \\ \end{array}$

Once you construct your multiplication table you can use use the same method for any dimensions.

Now let's say you don't know the generator of the multiplication table (like me), but you know the table itself.

mtable = {
{0, e[3], -e[2], e[5], -e[4], -e[7], e[6]}, {-e[3], 0, e[1], e[6], e[7], -e[4], -e[5]},
{e[2], -e[1], 0, e[7], -e[6], e[5], -e[4]}, {-e[5], -e[6], -e[7], 0, e[1], e[2], e[3]},
{e[4], -e[7], e[6], -e[1], 0, -e[3], e[2]}, {e[7], e[4], -e[5], -e[2], -e[3], 0, -e[1]},
{-e[6], e[5], e[4], -e[3], -e[2], e[1], 0}};


$\left( \begin{array}{ccccccc} 0 & e(3) & -e(2) & e(5) & -e(4) & -e(7) & e(6) \\ -e(3) & 0 & e(1) & e(6) & e(7) & -e(4) & -e(5) \\ e(2) & -e(1) & 0 & e(7) & -e(6) & e(5) & -e(4) \\ -e(5) & -e(6) & -e(7) & 0 & e(1) & e(2) & e(3) \\ e(4) & -e(7) & e(6) & -e(1) & 0 & -e(3) & e(2) \\ e(7) & e(4) & -e(5) & -e(2) & -e(3) & 0 & -e(1) \\ -e(6) & e(5) & e(4) & -e(3) & -e(2) & e(1) & 0 \\ \end{array} \right)$

prod[n_, i_, j_] := mtable[[i, j]]
vecprod = Sum[prod[dim, i, j] xx[[i]] yy[[j]], {i, dim}, {j, dim}];
Grid[Table[{e[i], Coefficient[vecprod, e[i]]}, {i, dim}], Frame -> All]


\begin{array}{cc} e(1) & -x(3) y(2)+x(2) y(3)-x(5) y(4)+x(4) y(5)+x(7) y(6)-x(6) y(7) \\ e(2) & x(3) y(1)-x(1) y(3)-x(6) y(4)-x(7) y(5)+x(4) y(6)+x(5) y(7) \\ e(3) & -x(2) y(1)+x(1) y(2)-x(7) y(4)-x(6) y(5)-x(5) y(6)+x(4) y(7) \\ e(4) & x(5) y(1)+x(6) y(2)+x(7) y(3)-x(1) y(5)-x(2) y(6)-x(3) y(7) \\ e(5) & -x(4) y(1)+x(7) y(2)-x(6) y(3)+x(1) y(4)+x(3) y(6)-x(2) y(7) \\ e(6) & -x(7) y(1)-x(4) y(2)+x(5) y(3)+x(2) y(4)-x(3) y(5)+x(1) y(7) \\ e(7) & x(6) y(1)-x(5) y(2)-x(4) y(3)+x(3) y(4)+x(2) y(5)-x(1) y(6) \\ \end{array}

The multiplication table for $e_i\times e_j=\varepsilon_{ijk}e_k$ can be constructed from the indices $ijk$ for which $\varepsilon_{ijk}=+1$:

rules = {{1, 2, 3} -> 1, {1, 4, 5} -> 1, {1, 7, 6} -> 1, {2, 4, 6} -> 1,
{2, 5, 7} -> 1, {3, 4, 7} -> 1, {3, 6, 5} -> 1};


by creating a completely antisymmetric tensor:

dim = 7;
ε = SymmetrizedArray[rules, {dim, dim, dim}, Antisymmetric[All]]


Then the table is (the rest of the reasoning is as in Sumit's answer)

c[dim_, i_, j_] := Sum[ε[[i, j, k]] e[k], {k, dim}]
Table[c[dim, i, j], {i, 1, dim}, {j, 1, dim}]


and the cross product of vectors a and b is

cross[a_, b_] := Sum[c[dim, i, j] a[[i]] b[[j]], {i, dim}, {j, dim}]


giving

Grid[Table[{e[i], Coefficient[cross[xx, yy], e[i]]}, {i, dim}], Frame -> All]