There are many MO or MSE questions, some very popular, about the product of 3-D matrices (cubes) and 4-D matrices, and more. Of course they are considered as tensor operations, but so far, I haven't seen a non-trivial product of "cubes" ($n \times n \times n$ matrices) resulting in a cube. I propose examples here, indeed in any dimension, generalizing the standard 2-D case, and I am wondering if these examples exhaust all the nice possibilities. The objects investigated here have $n^d$ elements, all real numbers, and $d$ is called the dimension ($n$ is not called the dimension).
To cut it short, it seems to work quite nicely only if $n=2$ or $n=4$. First, define a product $A\cdot B = C$ of cubes (there are many possible definitions) by reducing it to 2-D, as follows:
- An $n\times n\times n$ cube $A$ consists of $n$ (say horizontal) slices $A_1,\cdots,A_n$, each slice being a $n\times n$ matrix.
- Let $\sigma_k$ be a permutation of $(1,\dots,n)$, and $A\cdot B=C$. Then $C_k = \sum_{j=1}^n \epsilon_{k,j} A_j B_{\sigma_k(j)}$, with $\epsilon_{k,j}\in\{-1,1\}$.
The choice for the $\sigma_k$'s and $\epsilon_{k,j}$'s is very important and discussed below. Note that the generic definition of $A\cdot B$ generalizes easily to any dimension $d>2$, that is to hypercubes and so on. In that case $A_k$ is an hyper-slice of dimension $d-1$, of $A$, and $A$ has $n$ such hyper-slices. The product is computed iteratively by going to lower and lower dimensions until we reach standard $n\times n$ matrices (dimension $=$ 2). It is a combinatorial problem.
Examples
I see only two cases that are interesting and non-trivial: the case $n=2$ and $n=4$, regardless of the dimension (cube, hypercube and so on). Are there any other? The case $n=2$ is related to complex numbers, and $n=4$ to quaternions.
For $n=2$, the $2\times 2 \times 2$ cube $A$ is equivalent to $A_1 + A_2i$, where $i$ is the imaginary unit. Since $$(A_1 + A_2i)\cdot(B_1+B_2i)=A_1 B_1 - A_2 B_2 + (A_1 B_2 + A_2 B_1) i,$$ we have
- $C_1 = A_1 B_1 - A_2 B_2$
- $C_2 = A_1 B_2 + A_2 B_1$
that is: $\sigma_1(1,2)=(1,2)$, $\sigma_2(1,2)=(2,1)$, $\epsilon_{1,1}=1,\epsilon_{1,2} = -1, \epsilon_{2,1}=1, \epsilon_{2,2}=1$.
So the case $n=2$ (for cubes) essentially corresponds to complex matrices, despite the elements being real numbers. The inverse, exponential function, or determinant of a $2\times 2\times 2$ cube can be computed easily. In particular, the identity cube has $A_1 = I$ and $A_2=0$ (respectively, the identity and the zero $2\times 2$ matrices).
The case $n=4$ can be handled in the same way if we replace complex numbers by quaternions. For other values of $n$ there is no great complex-like extension of real numbers in $n$ dimension, thus my chagrin. See however an attempt with $n=3$, here.
Do you know of other products, possibly even better than those mentioned here, for cubes, hypercubes and so on, especially if $n=3$ or $n>4$?
Update
I was able to find a $n \times n \times n$ product satisfying all the desirable properties (associativity, existence and uniqueness of the inverse, distributivity and so on) for $n=1+\nu(1+\nu)/2$ with $\nu>0$. Of course it can not be commutative, like the product of standard matrices. However, the elements of the cube $A$ must be quadratic rather than real numbers. It works as follows.
Choose a field $F$, say rationals or quadratic irrationals. We are going to extend $F$ to $G$ as follows. Pick up $\nu$ numbers $\rho_1,\dots, \rho_\nu \in G$ such that:
- $\rho_i\in G \setminus F$ for all $1\leq i\leq \nu,$
- $\rho_i\rho_j \in G$ for all $1\leq i,j\leq \nu,$
- $\sum_{i=1}^\nu a_i \rho_i \neq 0$ if $a_1,\dots, a_\nu \in F.$
The last condition is the linear independence of the $\rho_i's$, in $F$. We then define $G$ as an extension of $F$, making sure $G$ is closed under the product operation. The way to do this is illustrated in the following example, with $\nu=2$, resulting in $n=4$ and an alternative to quaternions.
Let $\rho_1=\sqrt{2},\rho_2=\sqrt{3}$, and $F=\mathbb{Q}$ be the field of rational numbers. The field $G$ is defined as $$G=\{ a_1 + a_2\sqrt{2}+a_3\sqrt{3}+a_4\sqrt{6}, \mbox{ with } a_1,\dots,a_4\in F\}.$$
The base product is the standard product on $G$. Note that $G$ is closed under this product ($a,b\in G\Rightarrow ab\in G$). Also the product is associative, commutative, distributive, and each element of $G$ except $0$ admits a unique inverse. The resulting product $A \cdot B=C$ for $4\times 4 \times 4$ cubes $A, B$ is defined as follows, based on the homomorphism as those cubes are equivalent to elements of $G$:
$$\begin{align} C_1 = & A_1 B_1 + 2 A_2 B_2 + 3 A_3 B_3 + 6 A_4 B_4\\ C_2 = & A_2 B_1 + A_1 B_2 + 3 A_4 B_3 + 3 A_3 B_4\\ C_3 = & A_3 B_1 + 2 A_4 B_2 + A_1 B_3 + 2 A_2 B_4\\ C_4 = & A_4 B_1 + A_3 B_2 + A_2 B_3 + A_1 B_4 \end{align}$$
This allows you to easily find $A^{-1}=A_1 b_1 +\cdots A_4 b_4$ with $b_1,\dots b_4 \in F$, assuming $A$ is represented as $A_1 a_1+\cdots A_4 a_4$ with $a_1,\dots a_4 \in F$, by solving the following linear system to find $b_1,\cdots,b_4$:
$$\begin{align} a_1 b_1 + 2 a_2 b_2 + 3 a_3 b_3 + 6 a_4 b_4 & = 1\\ a_2 b_1 + a_1 b_2 + 3 a_4 b_3 + 3 a_3 b_4 & = 0\\ a_3 b_1 + 2 a_4 b_2 + a_1 b_3 + 2 a_2 b_4 & = 0\\ a_4 b_1 + a_3 b_2 + a_2 b_3 + a_1 b_4 & = 0 \end{align}$$
Another example, with $\rho_1=\sqrt{2}, \rho_2=\sqrt{3}, \rho_3=\sqrt{5}$, still with $F=\mathbb{Q}$, results in $$G=\{ a_1 + a_2\sqrt{2}+a_3\sqrt{3}+a_4\sqrt{5}+a_5\sqrt{6}+a_6\sqrt{10}+a_7\sqrt{15}, \mbox{ with } a_1,\dots,a_7\in F\}.$$ In this case, $n=7$, but the computations are similar.
Yet I can't find a good candidate for (say) $n=3, 5, 6, 9$. Nor can I find a good candidate for (say) $n=7$, when $F=\mathbb{R}$.