3

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}$.

  • Did you try octonions? Perhaps this will push it to dim 8? – markvs Nov 29 '21 at 06:18
  • @markvs: I know dimension 8 and 16 work too, but the properties of the product are less and less interesting as the dimension increases. First you lose commutativity with quaternions, I am not sure octonions still enjoy associativity for the product, or uniqueness for inverses. – Vincent Granville Nov 29 '21 at 06:43
  • How about coordinatewise product? Given $A, B \in \mathbb{R}^{n \times n \times \dots \times n}$, define $C \in \mathbb{R}^{n \times n \times \dots \times n}$ as $C_{i_1, \dots, i_d} = A_{i_1, \dots, i_d} B_{i_1, \dots, i_d}$. – CrabMan Nov 29 '21 at 06:47
  • @CrabMan: That is the trivial case I wanted to avoid. – Vincent Granville Nov 29 '21 at 06:49
  • Alright, then how about all bilinear functions of the required type signature (i.e. taking in two cubes and returning a cube)? – CrabMan Nov 29 '21 at 06:50
  • @CrabMan: can you elaborate a bit? Or maybe you have an answer in mind. – Vincent Granville Nov 29 '21 at 06:51
  • 1
    Suppose $f: \mathbb{R}^{n^d} \times \mathbb{R}^{n^d} \to \mathbb{R}^{n^d}$ is a bilinear function. That is, it takes two tensors (cubes) as arguments and it's linear in each of the two arguments. Call $f$ the product. The coordinatewise product is a function of this form. AFAIK your suggested product is also bilinear and is thus a function of this form. The vector space of such bilinear functions is naturally isomorphic to the vector space of real tensors with $3d$ axes, each of length $n$. – CrabMan Nov 29 '21 at 07:00
  • 1
    Not every such bilinear function will give rise to an associative product. And commutativity will be even more rare. Perhaps looking at tensor network diagrams or just writing out some formulas one can figure out conditions for associativity and commutativity. – CrabMan Nov 29 '21 at 07:05
  • But wait, most such bilinear functions wouldn't respect the fact that a cube is a cube rather than just a long vector with $n^d$ coordinates. So perhaps only bilinear functions of specific form should be considered? Perhaps only bilinear functions which which are naturally isomorphic to a tensor which can be represented as the outer product of $d$ tensors of shape $n \times n \times n$? Idk. The coordinatewise product sure has this form. Not sure about your suggested product. – CrabMan Nov 29 '21 at 07:13
  • @CrabMan: I am more familiar with quaternions and higher order complex-like numbers than tensors; indeed that's why I asked my question, knowing it is related to tensors and that many mathematicians know a lot more about tensors, than I do. – Vincent Granville Nov 29 '21 at 07:15
  • 1
    Also, I want to say that looking at tensor networks and tensor formats might be of interest to you (but ignore the algorithms for calculating tensor decompositions). The best introductory article is Hans G Ehrbar. Graph notation for arrays. ACM SIGAPL APL Quote Quad, 2000. It doesn't call them tensor networks, but they are. Some more sources are chapter 1 of Jacob C Bridgeman and Christopher T Chubb. Hand-waving and interpretive dance: an intro-ductory course on tensor networks. and chapter 2 of https://arxiv.org/abs/1609.00893 – CrabMan Nov 29 '21 at 07:21

0 Answers0