# When do we use Tensor?

I'm carious to see applications of tensor product. Is there any set of things that if they happen or we encounter them then we use tensor product, tensor algebra, ...? I will be happy if it be explained beside an example.

I will mention to two applications here and I hope you get some ideas and of course it may won't cover all cases.

Let $A$ be set of alleles for the type $i$ of the gamete. You can look at our gamete as a string with $N$ types ( $L:=\{1,\cdots,N\}$ set of types) and every type can have an allele from $A_i$, set of possible alleles for type $i$. Assuming $|A_1|=|A_2|=\cdots=|A_N|=m$ or even more $A_1=A_2=\cdots=A_N=A$ where $|A|=m$ then a gamete is a vector $\sigma=(\sigma_1,\cdots,\sigma_N)\in A^N$.

Now let us show gametes using tensors.

Let $A=\{e_1,\cdots,e_m\}\subseteq\mathbb{R}^m$ where $e_i$ is the $m\times 1$ vector with $i$th entry one and the rest zero. So for a gamete $\sigma$, every type of it is an element of the standard basis of $\mathbb{R}^m$.

Thus $\sigma=(e_{\sigma_1},\cdots,e_{\sigma_N})\in(\mathbb{R}^m)^N\cong\mathbb{R}^{mN}$.

But we are not going to use a $mN$-vector with no further structure on it to represent our gamete. Instead we use $$\sigma=e_{\sigma_1}\otimes\cdots\otimes e_{\sigma_N}\in\otimes_{i=1}^N\mathbb{R}^m=:(\mathbb{R}^m)^{\otimes N}$$

What is the benefit of using tensor?

Let's think we have an experiment environment containing numbers of gametes. Define $p_\sigma$ be the frequency of gametes of the type $\sigma$ (this type is not that type meaning places of the gamete) in this way, ratio of numbers or concentration of gametes (which are a kind of species) of type $\sigma$ to numbers or concentration of all gametes in the experiment environment. Then we can describe state of the experiment environment with one element in $(\mathbb{R}^m)^{\otimes N}$ as below. $$p:=\sum_{\sigma}p_\sigma\sigma$$ Pay attention that if we were using common vectors then this sum was not keeping all of those vectors separately but it is a nice property of tensor that $$v\otimes u+v'\otimes u'\neq (v+v')\otimes(u+u')$$ Also we have many nice other objects for tensor. For example if $f:V\longrightarrow U$ and $g:V'\longrightarrow U'$ be two maps then $f\otimes g:V\otimes U\longrightarrow V'\otimes U'$ is a map that operate this way $(f\otimes g)(v\otimes u)=f(v)\otimes g(u)$. Using this we more easily can formulate maps related to changes on our experiment environment using changes on individual gametes.

Also we have inner products, Fixing inner products on $V$ and $U$ we can define an inner product on $V\otimes U$ in this way $\langle \sum_i\lambda_i(v\otimes u),\sum_j\mu_j(v'\otimes u')\rangle=\sum_i\sum_j\lambda_i\mu_j\langle v,v'\rangle\langle u,u'\rangle$.

Another place you can see tensor useful, is in Quantum. Quantum mechanic framework according to the book Quantum Computation and Quantum Information has four postulate and the fourth is as following;

Postulate 4: The state space of a composite physical system is the tensor product of the state spaces of the component physical systems. Moreover, if we have systems numbered $1$ through $n$, and system number $i$ is prepared in the state $|\psi_i\rangle$, then the joint state of the total system is $|\psi_n\rangle\otimes|\psi_n\rangle\otimes\cdots\otimes|\psi_n\rangle$.

They are very useful in physics. For example, you need to use the tensor product to describe a system formed by two subsystems of spin $1/2$. You can find more information here.

Also this Physics SE question: https://physics.stackexchange.com/questions/53039/when-and-how-did-the-idea-of-the-tensor-product-originate-in-the-history-quantum can be useful to see that the tensor product of Hilbert spaces is used to describe quantum systems.