# Decomposing a tensor in terms of matrices and bases

I want to represent a 3D cartesian Tensor T of order m x n x p as a sum of 2D tensors and bases.

If I slice T in the first dimension:

$$T_{1::} = \begin{pmatrix} T_{111} & \cdots & T_{11p} \\ \vdots & & \vdots \\ T_{1n1} & \cdots & T_{1np} \end{pmatrix}$$

I would like to represent $$T$$ as

$$T = T_{1::}u_0 + ... + T_{m::}u_m$$

I think $$u_1 = \sum_{n, p} e_1 \otimes e_n \otimes e_p$$ but I am unsure?

Similarly, if I slice it in the middle dimension:

$$T_{:1:} = \begin{pmatrix} T_{111} & \cdots & T_{11p} \\ \vdots & & \vdots \\ T_{m11} & \cdots & T_{m1p} \end{pmatrix}$$

I would also like to decompose T like so:

$$T = T_{:1:}v_1 + ... + T_{:n:}v_p$$

How do I represent the basis vectors $$u$$ and $$v$$ above?

• How do you define a product like $T_{1::}\ u_1$? Commented Nov 23, 2023 at 17:56
• @VladimirLysikov Good question: whatever definition provides the correct representation Commented Nov 23, 2023 at 18:01
• Well, for a matrix $M=(m_{ij})$ and a vector $u=(u_k)$ we can define their tensor product $M \otimes u$ as an order 3 tensor with components $t_{ijk}=m_{ij} u_k$. Then $T = \sum_{k = 1}^p T_{::k} \otimes e_k$ where $T_{::k}$ are slices of $T$ and $e_k$ are basis vectors. Is this what you need? Commented Nov 24, 2023 at 22:52
• Yes that's it - thanks! Commented Nov 27, 2023 at 13:40

## Background: bases and tensor product

The bases of a matrix can be constructed by applying the tensor product $$(\otimes)$$ of two basis vectors:

$$\hat{e}_{1} \otimes \hat{e}_{2}=\hat{e}_{1,2}=\binom{1}{0} \otimes\binom{0}{1}=\left(\begin{array}{ll} 0 & 1 \\ 0 & 0 \end{array}\right)$$

A matrix can be expressed using its basis:

\begin{aligned} X & =1 \hat{e}_{1} \otimes \hat{e}_{1}+2 \hat{e}_{1} \otimes \hat{e}_{2}+3 \hat{e}_{2} \otimes \hat{e}_{1}+4 \hat{e}_{2} \otimes \hat{e}_{2} \\ & =\left(\begin{array}{ll} 1 & 2 \\ 3 & 4 \end{array}\right) \end{aligned}

To represent an order-3 tensor $$T$$, we can write it as a linear combination of its basis:

\begin{aligned} T= & 1 \hat{e}_{1,1,1}+2 \hat{e}_{1,1,2}+3 \hat{e}_{1,2,1}+4 \hat{e}_{1,2,2} \\ & +5 \hat{e}_{2,1,1}+6 \hat{e}_{2,1,2}+7 \hat{e}_{2,2,1}+8 \hat{e}_{2} \hat{e}_{2,2,2} \\ = & \sum_{i, j, k} t_{i j k} \hat{e}_{i j k} \\ = & \hat{e}_{1} \otimes\left(\begin{array}{ll} 1 & 2 \\ 3 & 4 \end{array}\right)+\hat{e}_{2} \otimes\left(\begin{array}{ll} 5 & 6 \\ 7 & 8 \end{array}\right) \end{aligned}

## Anwser

An order-3 tensor $$T$$ with axes m x n x p can be decomposed as a linear sum of matricies by doing:

$$T = \sum_m \hat{e}_{m} \otimes T_{m::}$$

Or

$$T = \sum_p T_{::p} \otimes \hat{e}_{p}$$

However, you can't slice the middle axes as the tensor product of the bases would be in the wrong order and the tensor product isn't commutative.