I have to prove an equality between matrices $R=OTDO$ where

  • $R$ is a $M\times M$ matrix
  • $O$ is a $2\times M$ matrix
  • $T$ is a $M\times M\times M$ tensor
  • $D$ is a diagonal $2\times 2$ matrix

The entries of the matrices and the tensor are probabilities so the result should somehow be the consequence of Bayes formula. The problem is that I have no idea how to compute that because I don't know how to use tensors. I had an algebra course about tensor products of vector spaces a long time ago but it was very abstract so I don't know how to multiply tensors in practice.

I'm surprised because the first matrix of the product has $2$ rows, the last one has $M$ columns and yet the result is a $M\times M$ matrix.

Could you explain how to do this? For example, what's the dimension of $OT$? I am familiar with the Kronecker product of matrices, is it useful here?


Stupid me... I've spent hours trying to understand this product and... this was a typo. It was $O^TDO$ and the equality was straightforward... I've been confused by the fact that the tensor $T$ did exist and there could be and equality involving it. At least I've learnt a few things about tensors, thank you again for the answers!

  • $\begingroup$ it seems that the following link may help math.stackexchange.com/questions/1133497/…. $\endgroup$ – Ignat Domanov Oct 4 '16 at 12:27
  • $\begingroup$ If you use the n-mode product as in the link above, then: 1) $OT$ can have dimensions $2\times M\times M$ or $M\times 2\times M$ or $M\times M\times 2$; 2) $R=OTDO$ cannot be a matrix (i.e., to be an $M\times M\times 1$ or $M\times 1\times M$ or $1\times M\times M$) tensor. $\endgroup$ – Ignat Domanov Oct 4 '16 at 12:30
  • $\begingroup$ So this product is not well defined because there is not a unique way to interpret it, and because the dimensions do not match, right? $\endgroup$ – Augustin Oct 4 '16 at 12:41
  • $\begingroup$ Yes, it can, for instance, be like this $R=T\times_1 O\times_1 D\times_3 O=T\times_1 DO\times_3 O$, which change dimensions as follows $M\times M\times M\rightarrow 2\times M\times M\rightarrow 2\times M\times 2$ $\endgroup$ – Ignat Domanov Oct 4 '16 at 12:47

The multiplication of a tensor by a matrix (or by a vector) is called $n$-mode product.

Let $\mathcal{T} \in \mathbb{R}^{I_1 \times I_2 \times \cdots \times I_N}$ be an $N$-order tensor and $\mathbf{M} \in \mathbb{R}^{J \times I_n}$ be a matrix. The $n$-mode product is defined as

$$ (\mathcal{T} \times_{n} \mathbf{M})_{i_{1}\cdots i_{n-1}ji_{n+1}\cdots i_N} = \sum \limits_{i_n = 1}^{I_n} \mathcal{T}_{i_{1}i_{2}\cdots i_{n}\cdots i_{N}}\mathbf{M}_{ji_{n}}.$$

Note this is not a standard product like the product of matrices. However, you could perform a matricization of the tensor along its $n$-mode (dimension $n$) and thus effectuate a standard multiplication.

The $n$-mode matricization of $\mathcal{T}$, say $\mathbf{T}_{(n)}$, is an $I_{n} \times I_{1}\cdots I_{n-1}I_{n+1}\cdots I_{N}$ matrix representation of $\mathcal{T}$. In other words, it is just a matrix form to organize all the entries of $\mathcal{T}.$ Hence, the multiplications below are equivalent

$$\mathcal{Y} = \mathcal{T} \times_{n} \mathbf{M} \iff \mathbf{Y}_{(n)} = \mathbf{M} \mathbf{T}_{(n)}, $$ where $\mathbf{Y}_{(n)}$ is the $n$-mode matricization of the tensor $\mathcal{Y} \in \mathbb{R}^{I_1 \times \cdots \times I_{n-1} \times J \times I_{n+1} \times \cdots \times I_N}$.

For more details, see Tensor Decompositions and Applications.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.