# Is there any meaning of tensor contraction?

Is there any meaning behind tensor contraction. Or is it just randomly getting rid of some components by only selecting those with same index and sum them up?

For example, I know tensor is interpreted as a multilinear map. Maybe the contraction is doing some transformation to the map?

Or since matrix multiplication is also a tensor contraction. If we know what the meaning of matrix multiplication is and generalise it, we will know what tensor contraction means in a more general setting?

I don't know if you'll find the following helpful, but let $$V$$ be a vector space and let $$T^i_j$$ be a $$\binom11$$-tensor.

Probably you are aware that $$V^\ast\otimes V \cong \operatorname{End}(V) \cong \mathcal M_n(\mathbb R)$$, the space of $$n\times n$$ real matrices, where $$n$$ is the dimension of $$V$$. If you are not, then just convince yourself that the element $$\phi\otimes v\in V^\ast\otimes V$$ gives you an endomorphism of $$V$$ by $$x\mapsto \phi(x)v$$, and that extending this map by linearity we get an isomorphism.

The contraction $$T^i_i$$ is simply the trace of this matrix, as you probably also know. For some geometric interpretations of the trace, see this mathoverflow post.

Now let's consider a general $$\binom mn$$-tensor $$T^{i_1\ldots i_m}_{j_1\ldots j_n}$$. Let's say for ease of notation that we want to contract $$i_1$$ with $$j_1$$. We can view $$T^{i_1\ldots i_m}_{j_1\ldots j_n}$$ as a matrix $$T^{i_1}_{j_1}$$ whose entries are $$\binom {m-1}{n-1}$$-tensors, namely $$T^{i_2\ldots i_m}_{j_2\ldots j_n}$$. The contraction of $$j_1$$ with $$j_2$$ is the trace of this matrix, which is a $$\binom {m-1}{n-1}$$-tensor as well.

It's all about vector in -> vector out, and generalizations of that. You want a way to act on a vector so that the result is a vector, i.e. not just some set of $$N$$ quantities, but a set that transforms the right way and therefore can be said to be components of a vector. This is enough to tell you what contraction between a second rank and first rank object is doing. After that you can think about all the other ranks by virtue of outer product. (A higher rank thing can always be considered to be a sum of outer products of vectors and/or one-forms).

For simple physical examples, look at e.g. $$D^i = \epsilon^i_{\, j}\, E^j$$ and $$j^i = \sigma^i_{\, k} E^k$$ for a linear crystalline solid.

There is a couple of meanings of the tensor contraction. The trace is one of them. However, I believe another meaning is more common in practical applications of tensors.

A tensor can be interpreted as a multilinear map. The contraction in duet with tensor extension can be interpreted as a composition of two maps. In other words, substitution of one map into one parameter of second map.

A simple example: let's take a vector space $$\mathbb{V}$$ over a field $$\mathbb{T}$$ and two linear maps $$L_A, L_B: \mathbb{V}\rightarrow\mathbb{V}$$. Tensor algebra doesn't work with maps but with multilinear forms. Hence, we will take isomorphic bilinear forms $$B_A, B_B: \mathbb{V^*}\times\mathbb{V}\rightarrow\mathbb{T}$$. Now, we will substitute one vector $$\mathbf{v}\in\mathbb{V}$$ into the form $$B_A(\varphi, \mathbf{v}) = U(\varphi), \varphi\in\mathbb{V^*}$$. The resulted linear form is a member of the dual-dual vector space $$U\in\mathbb{V^{**}}$$, which is isomorphic with a vector $$\mathbf{u}\in\mathbb{V}$$. The isomorphism between the map $$L_A$$ and bilinear form $$B_A$$ is constructed such way that $$\mathbf{u} = L_A(\mathbf{v})$$.

In coordinates against a basis $$\mathbf{e_1},\dots,\mathbf{e_n}\in\mathbb{V}$$ and $$\mathbf{\epsilon_1},\dots,\mathbf{\epsilon_n}\in\mathbb{V^*}$$ we can write $$B_A(\sum_i\varphi_i\mathbf{\epsilon_i}, \sum_j v_j\mathbf{e_j}) = U(\sum_i\varphi_i\mathbf{\epsilon_i}) = \sum_i\sum_j\varphi_i v_j B_A(\mathbf{\epsilon_i}, \mathbf{v_j}) = \sum_i\sum_j\varphi_i v_j A_{ij}$$ Now put the vector $$\mathbf{u}$$ into the bilinear form $$B_B$$: $$C(\mathbf{\mu}, \mathbf{v}) = B_B(\mathbf{\mu}, L_A(\mathbf{v}))$$ and against the basis $$\begin{split} B_B(\sum_k\mu_k\mathbf{\epsilon_k}, \sum_m u_m\mathbf{e_m}) &=\sum_k\sum_m\mu_k u_m B_{km} =\sum_k\sum_m\sum_j\mu_k v_j A_{mj} B_{km} \\ &=\sum_k\sum_j \mu_k v_j \left(\sum_m A_{mj} B_{km}\right) = \sum_k\sum_j \mu_k v_j C_{jk} \end{split}$$

Coefficients of newly created form $$C$$ are exactly what the tensor contraction is - sum of components with the same index: $$C_{jk} = \sum_m A_{mj} B_{km}$$

At the tensor side we have two isomorphic tensors $$\begin{split} T_A &= \sum_i\sum_j A_{ij}\mathbf{e_i}\otimes\mathbf{\epsilon_j} \\ T_B &= \sum_k\sum_m B_{km}\mathbf{e_k}\otimes\mathbf{\epsilon_m} \end{split}$$ These two tensors are firstly extended $$T_A \otimes T_B = \sum_i\sum_j\sum_k\sum_m A_{ij}B_{km} \mathbf{e_i}\otimes\mathbf{\epsilon_j} \otimes\mathbf{e_k}\otimes\mathbf{\epsilon_m}$$ and then contracted in components $$i$$ and $$m$$ $$T_C = \sum_j\sum_k (\sum_d A_{dj}B_{kd}) \mathbf{\epsilon_j}\otimes\mathbf{e_k} = \sum_j\sum_k C_{jk} \mathbf{\epsilon_j}\otimes\mathbf{e_k}$$ This tensor is isomorphic to the bilinear form $$C$$. (Note: for two linear maps we have got just the matrix multiplication. However, one can do similar steps for any multilinear maps.)

Tensors can be simply visualized as vectors but vectors work great in a 4 dimensional space ,tensors work greater in what is abstractly named manifold what you called "multilinear map"it's a "space" needed to create equations that remains invariable even when we change observators. One of the greatest advantage of tensors ,their ability to be computed like vectors with all of what beautiful a vector is offering.when you contract a tensor you're computing a multilinear vector, it don't change space , you're just adding or abstracting some multilinear vector to see what's space look like