# Tensor product

(Redirected from )

In mathematics, the tensor product, denoted by $\otimes$, may be applied in different contexts to vectors, matrices, tensors, vector spaces, algebras, topological vector spaces, and modules, among many other structures or objects. In each case the significance of the symbol is the same: the most general bilinear operation. In some contexts, this product is also referred to as outer product. The term "tensor product" is also used in relation to monoidal categories. The $\boxtimes$ variant of $\otimes$ is used in control theory.

## Tensor product of vector spaces

The tensor product of two vector spaces V and W over a field K is another vector space over K. It is denoted V $\otimes$ K W, or V $\otimes$ W when the underlying field K is understood.

### Prerequisite: the free vector space

The definition of $\otimes$ requires the notion of the free vector space F(S) on some set S. The elements of the vector space F(S) are formal sums of elements of S with coefficients in a given field K. A formal sum is an expression written in the form of a sum in which no actual arithmetic operations can be carried out. For example $2a+3b$ is a formal sum, and $1 \over 1-x$ is a formal sum with no restrictions on values of x (versus the usual case where |x| must be <1 for a geometric series to converge), since no "plugging in" will actually be performed. For the set of all formal sums of elements of S with coefficients in K to be a vector space, we need to define addition and scalar multiplication. The terms of a formal sum can be written in any order and the addition of formal sums is associative.

Addition of formal sums is defined as follows: if $m \neq n, a_i \cdot s_m + a_j \cdot s_n$ cannot be simplified. If $m = n$, then $a_i \cdot s_m + a_j \cdot s_n = (a_i +a_j) \cdot s_m.$

Scalar multiplication of formal sums is defined as follows: If k is in the field K, then $k(a_1 \cdot s_1 + a_2 \cdot s_2 + \dots + a_n \cdot s_n) = ka_1 \cdot s_1 + ka_2 \cdot s_2 + \dots + ka_n \cdot s_n.$

The dimension of the vector space equals the number of elements in S.

### Definition

Given two vector spaces V and W, the Cartesian product V × W is the set consisting of pairs (v, w) with v in V and w in W. The tensor product is defined as a certain quotient vector space of F(V × W), the free K-vector space on the Cartesian product.

The free vector space is called "free" because different elements of the set V × W are not at all related in F(V × W). For example, given two different elements $v_1, v_2 \in V$, in the free vector space F(V × W), the expression $(v_1, w_1) + (v_2, w_2)$ is not equal to $(v_1 + v_2, w_1 + w_2)$, though these two expressions would be equal in the direct sum of vector spaces. Similarly $a (v_1, w_1)$ is not equal to $(a v_1, a w_1)$, again unlike the case of the direct sum. In other words, the direct sum and the tensor product give rise to different vector spaces. The dimension of the direct sum is the sum of the dimension of V and the dimension of W. The dimension of the free vector space on V × W is much larger, it is the product of the number of elements in V and the number of elements in W.

The dimension of the tensor product is equal to the product of the dimension of V and the dimension of W[1] and has a different addition and scalar multiplication.

To form the tensor product, we begin with the subspace R of F(V × W) generated by the following sets of elements:

\begin{align} (v_1, w) + (v_2, w) - (v_1 + v_2, w),\\ (v, w_1) + (v, w_2) - (v, w_1 + w_2),\\ c \cdot (v, w) - (cv, w),\\ c \cdot (v, w) - (v, cw), \end{align}

where v, v1 and v2 are arbitrary elements of V, while w, w1, and w2 are vectors from W, and c is from the underlying field K.

The tensor product is defined as the vector space

$V \otimes W := F(V \times W) / R.$

The tensor product of two vectors v and w is the equivalence class ((v,w) + R) of (v,w) in V × W. It is denoted v $\otimes$ w. The effect of forming the quotient group modulo R in the free vector space is that the following equations hold in V $\otimes$ W:

\begin{align} (v_1 + v_2) \otimes w &= v_1 \otimes w + v_2 \otimes w;\\ v \otimes (w_1 + w_2) &= v \otimes w_1 + v \otimes w_2;\\ cv \otimes w &= v \otimes cw = c(v \otimes w). \end{align}

### Notation and examples

Given bases {vi} and {wi} for V and W respectively, the tensors {vi $\otimes$ wj} form a basis for V $\otimes$ W. The dimension of the tensor product therefore is the product of dimensions of the original spaces; for instance Rm $\otimes$ Rn will have dimension mn.

Elements of V $\otimes$ W are sometimes referred to as tensors, although this term refers to many other related concepts as well.[2] An element of V $\otimes$ W of the form v $\otimes$ w is called a pure or simple tensor. In general, an element of the tensor product space is not a pure tensor, but rather a finite linear combination of pure tensors. That is to say, if v1 and v2 are linearly independent, and w1 and w2 are also linearly independent, then v1 $\otimes$ w1 + v2 $\otimes$ w2 cannot be written as a pure tensor. The number of simple tensors required to express an element of a tensor product is called the tensor rank (not to be confused with tensor order, which is the number of spaces one has taken the product of, in this case 2; in notation, the number of indices), and for linear operators or matrices, thought of as (1,1) tensors (elements of the space V $\otimes$ V), it agrees with matrix rank.

### Tensor product of linear maps

The tensor product also operates on linear maps between vector spaces. Specifically, given two linear maps S : VX and T : WY between vector spaces, the tensor product of the two linear maps S and T is a linear map

$S\otimes T:V\otimes W\rightarrow X\otimes Y$

defined by

$(S\otimes T)(v\otimes w)=S(v)\otimes T(w).$

In this way, the tensor product becomes a bifunctor from the category of vector spaces to itself, covariant in both arguments.[3]

If S and T are both injective, surjective, or continuous then $S \otimes T$ is, respectively, injective, surjective, continuous.

By choosing bases of all vector spaces involved, the linear maps S and T can be represented by matrices. Then, the matrix describing the tensor product $S \otimes T$ is the Kronecker product of the two matrices. For example, if V, X, W, and Y above are all two-dimensional and bases have been fixed for all of them, and S and T are given by the matrices $\begin{bmatrix} a_{1,1} & a_{1,2} \\ a_{2,1} & a_{2,2} \\ \end{bmatrix}$ and $\begin{bmatrix} b_{1,1} & b_{1,2} \\ b_{2,1} & b_{2,2} \\ \end{bmatrix}$, respectively, then the tensor product of these two matrices is

$\begin{bmatrix} a_{1,1} & a_{1,2} \\ a_{2,1} & a_{2,2} \\ \end{bmatrix} \otimes \begin{bmatrix} b_{1,1} & b_{1,2} \\ b_{2,1} & b_{2,2} \\ \end{bmatrix} = \begin{bmatrix} a_{1,1} \begin{bmatrix} b_{1,1} & b_{1,2} \\ b_{2,1} & b_{2,2} \\ \end{bmatrix} & a_{1,2} \begin{bmatrix} b_{1,1} & b_{1,2} \\ b_{2,1} & b_{2,2} \\ \end{bmatrix} \\ & \\ a_{2,1} \begin{bmatrix} b_{1,1} & b_{1,2} \\ b_{2,1} & b_{2,2} \\ \end{bmatrix} & a_{2,2} \begin{bmatrix} b_{1,1} & b_{1,2} \\ b_{2,1} & b_{2,2} \\ \end{bmatrix} \\ \end{bmatrix} = \begin{bmatrix} a_{1,1} b_{1,1} & a_{1,1} b_{1,2} & a_{1,2} b_{1,1} & a_{1,2} b_{1,2} \\ a_{1,1} b_{2,1} & a_{1,1} b_{2,2} & a_{1,2} b_{2,1} & a_{1,2} b_{2,2} \\ a_{2,1} b_{1,1} & a_{2,1} b_{1,2} & a_{2,2} b_{1,1} & a_{2,2} b_{1,2} \\ a_{2,1} b_{2,1} & a_{2,1} b_{2,2} & a_{2,2} b_{2,1} & a_{2,2} b_{2,2} \\ \end{bmatrix}.$

The resultant rank is at most 4, and the resultant dimension 16. Here rank denotes the tensor rank (number of requisite indices), while the matrix rank counts the number of degrees of freedom in the resulting array.

A dyadic product is the special case of the tensor product between two vectors of the same dimension.

### Universal property

The tensor product as defined above is a universal property. In this context, this means that the tensor product is uniquely defined, up to isomorphism: there is only one tensor product. In the context of linear algebra and vector spaces, the maps in question are required to be linear maps. The tensor product of vector spaces, as defined above, satisfies the following universal property: there is a bilinear map (i.e., linear in each variable v and w) $\varphi\colon V\times W\to V \otimes W$ such that given any other vector space Z together with a bilinear map $h\colon V\times W\to Z$, there is a unique linear map $\tilde{h}\colon V\otimes W\to Z$ satisfying $h=\tilde{h}\circ \varphi$. In this sense, $\varphi$ is the most general bilinear map that can be built from $V \times W$. In particular, this implies that any spaces with such a (uniquely defined) tensor product are examples of symmetric monoidal categories, as this is the defining characteristic of the category. Uniqueness of the tensor product means that for any other bilinear map $\varphi'\colon V\times W\to V \otimes' W$ with the above property there is an isomorphism $k\colon V\otimes W\to V \otimes' W$ such that $\varphi'=k\circ \varphi$ holds.

This characterization can simplify proving statements about the tensor product. For example, the tensor product is symmetric: that is, there is a canonical isomorphism:

$V \otimes W \cong W \otimes V.$

To construct, say, a map from left to right, it suffices, by the universal property, to give a bilinear map $V \times W \to W \otimes V.$ This is done by mapping (v, w) to $w \otimes v$. Constructing a map in the opposite direction is done similarly, as is checking that the two linear maps $V \otimes W \to W \otimes V$ and $W \otimes V \to V \otimes W$ are inverse to one another.

Similar reasoning can be used to show that the tensor product is associative, that is, there are natural isomorphisms

$V_1\otimes(V_2\otimes V_3)\cong (V_1\otimes V_2)\otimes V_3.$

Therefore, it is customary to omit the parentheses and write $V_1\otimes V_2\otimes V_3$.

### Tensor powers and braiding

Let n be a non-negative integer. The nth tensor power of the vector space V is the n-fold tensor product of V with itself. That is

$V^{\otimes n} \;\overset{\mathrm{def}}{=}\; \underbrace{V\otimes\cdots\otimes V}_{n}.$

A permutation σ of the set {1, 2, ..., n} determines a mapping of the nth Cartesian power of V

$\sigma : V^n\to V^n$

defined by

$\sigma(v_1,v_2,\dots,v_n) = (v_{\sigma 1}, v_{\sigma 2},\dots,v_{\sigma n}).$

Let

$\varphi:V^n \to V^{\otimes n}$

be the natural multilinear embedding of the Cartesian power of V into the tensor power of V. Then, by the universal property, there is a unique isomorphism

$\tau_\sigma : V^{\otimes n} \to V^{\otimes n}$

such that

$\varphi\circ\sigma = \tau_\sigma\circ\varphi.$

The isomorphism τσ is called the braiding map associated to the permutation σ.

## Product of tensors

For non-negative integers r and s a (r,s)-tensor on a vector space V is an element of

$T^r_s(V) = \underbrace{ V\otimes \dots \otimes V}_{r} \otimes \underbrace{ V^*\otimes \dots \otimes V^*}_{s} = V^{\otimes r}\otimes V^{*\otimes s}.$

Here $V^*$ is the dual vector space (which consists of all linear maps f from V to the ground field K).

There is a product map, called the (tensor) product of tensors

$T^r_s (V) \otimes_K T^{r'}_{s'} (V) \to T^{r+r'}_{s+s'}(V).$

It is defined by grouping all occurring "factors" V together: writing $v_i$ for an element of V and $f_i$ for elements of the dual space,

$(v_1 \otimes f_1) \otimes (v'_1) = v_1 \otimes v'_1 \otimes f_1.$

Picking a basis of V and the corresponding dual basis of $V^*$, $T^r_s(V)$ is endowed with a natural basis (this basis is described in the article on Kronecker products). In terms of these bases, the components of a (tensor) product of two (or more) tensors can be computed. For example, if F and G are two covariant tensors of rank m and n (respectively) (i.e. FTm0, and GTn0), then the components of their tensor product are given by

$(F\otimes G)_{i_1i_2...i_{m+n}} = F_{i_{1}i_{2}...i_{m}}G_{i_{m+1}i_{m+2}i_{m+3}...i_{m+n}}.$

[4] Thus, the components of the tensor product of two tensors are the ordinary product of the components of each tensor. Another example: let U be a tensor of type (1,1) with components Uαβ, and let V be a tensor of type (1,0) with components Vγ. Then

$U^\alpha {}_\beta V^\gamma = (U \otimes V)^\alpha {}_\beta {}^\gamma$

and

$V^\mu U^\nu {}_\sigma = (V \otimes U)^{\mu \nu} {}_\sigma.$

## Relation to dual space

A particular example is the tensor product of some vector space V with its dual vector space $V^*$ (which consists of all linear maps f from V to the ground field K). In this case, there is a natural "evaluation" map

$V \otimes V^* \to K$

which on elementary tensors is defined by

$v \otimes f \mapsto f(v).$

The resulting map

$T^r_s (V) \to T^{r-1}_{s-1}(V)$

is called tensor contraction (for r, s > 0).

On the other hand, if V is finite-dimensional, there is a map in the other direction (called coevaluation)

$K \to V \otimes V^*, \lambda \mapsto \sum_i \lambda v_i \otimes v^*_i.$

where $v_1, \dots, v_n$ is a basis of V, and $v^*_i$ is its dual basis. The interplay of evaluation and coevaluation map can be used to characterize finite-dimensional vector spaces without referring to bases.[5]

### Tensor product vs. Hom

Given three vector spaces U, V, W the tensor product is linked to the vector space of all linear maps, as follows:

$\mathrm{Hom} (U \otimes V, W) \cong \mathrm{Hom} (U, \mathrm{Hom}(V, W)).$

Here $\mathrm{Hom} (-,-)$ denotes the K-vector space of all linear maps. This is an example of adjoint functors: the tensor product is "left adjoint" to Hom.

The tensor $\scriptstyle T^r_s(V)$ may be naturally viewed as a module for the Lie algebra End(V) by means of the diagonal action: for simplicity let us assume r = s = 1, then, for each $\scriptstyle u \in\mathrm{End}(V)$,

$u(a \otimes b) = u(a) \otimes b - a \otimes u^*(b),$

where u in End(V) is the transpose of u, that is, in terms of the obvious pairing on VV,

$\langle u(a), b \rangle = \langle a, u^*(b) \rangle$.

There is a canonical isomorphism $\scriptstyle T^1_1(V) \rightarrow \mathrm{End}(V)$ given by

$(a \otimes b)(x) = \langle x, b \rangle a.$

Under this isomorphism, every u in End(V) may be first viewed as an endomorphism of $\scriptstyle T^1_1(V)$ and then viewed as an endomorphism of End(V). In fact it is the adjoint representation ad(u) of End(V) .

## Tensor products of modules over a ring

The tensor product of two modules A and B over a commutative ring $R$ is defined in exactly the same way as the tensor product of vector spaces over a field:

$A \otimes_R B := F (A \times B) / G$

where now $F (A \times B)$ is the free R-module generated by the cartesian product and G is the R-module generated by the same relations as above.

More generally, the tensor product can be defined even if the ring is non-commutative (abba). In this case A has to be a right-R-module and B is a left-R-module, and instead of the last two relations above, the relation

$(ar,b)-(a,rb)$

is imposed. If R is non-commutative, this is no longer an R-module, but just an abelian group.

The universal property also carries over, slightly modified: the map $\phi: A \times B \to A \otimes_R B$ defined by $(a,b) \mapsto a \otimes b$ is a middle linear map (referred to as "canonical Middle Linear Map".[6]); that is,[7] it satisfies:

\begin{align} \phi(a+a',b)=\phi(a,b)+\phi(a',b) \\ \phi(a,b+b')=\phi(a,b)+\phi(a,b') \\ \phi(ar,b)=\phi(a,rb) \end{align}

The first two properties make $\phi$ a bilinear map of the abelian group $A \times B$. For any middle linear map $\psi$ of $A \times B$, a unique group homomorphism $f$ of $A \otimes_R B$ satisfies $\psi = f \circ \phi$, and this property determines $\phi$ within group isomorphism. See the main article for details.

### Computing the tensor product

For vector spaces, the tensor product $V \otimes W$ is quickly computed since bases of V of W immediately determine a basis of $V \otimes W$, as was mentioned above. For modules over a general (commutative) ring, not every module is free. For example, Z/n is not a free abelian group (=Z-module). The tensor product with Z/n is given by

$M \otimes_\mathbf Z \mathbf Z/n = M/n.$

More generally, given a presentation of some R-module M, that is, a number of generators $m_i \in M, i \in I$ together with relations $\sum_{j \in J} a_{ji} m_i = 0$, with $a_{ji} \in R$, the tensor product can be computed as the following cokernel:

$M \otimes_R N = \operatorname{coker} (N^J \rightarrow N^I)$

Here $N^J := \oplus_{j \in J} N$ and the map is determined by sending some $n \in N$ in the jth copy of $N^J$ to $a_{ji} n$ (in $N^I$). Colloquially, this may be rephrased by saying that a presentation of M gives rise to a presentation of $M \otimes_R N$. This is referred to by saying that the tensor product is a right exact functor. It is not in general left exact, that is, given an injective map of R-modules $M_1 \to M_2$, the tensor product

$M_1 \otimes_R N \to M_2 \otimes_R N$

is not usually injective. For example, tensoring the (injective) map given by multiplication with n, $n: \mathbf Z \to \mathbf Z$ with $\mathbf Z/n$ yields the 0 map $0 : \mathbf Z/n \to \mathbf Z/n$ which is not injective. Higher Tor functors measure the defect of the tensor product being not left exact. All higher Tor functors are assembled in the derived tensor product.

## Tensor product of algebras

Let R be a commutative ring. The tensor product of R-modules applies, in particular, if A and B are R-algebras. In this case, the tensor product $A \otimes_R B$ is an R-algebra itself by putting

$(a_1 \otimes b_1) \cdot (a_2 \otimes b_2) = (a_1 \cdot a_2) \otimes (b_1 \cdot b_2).$

For example,

$R[x] \otimes_R R[y] \cong R[x, y].$

A particular example is when A and B are fields containing a common subfield R. The tensor product of fields is closely related to Galois theory: if, say, $A = R[x] / f(x)$, where f is some irreducible polynomial with coefficients in R, the tensor product can be calculated as

$A \otimes_R B \cong B[x] / f(x)$

where now f is interpreted as the same polynomial, but with its coefficients regarded as elements of B. In the larger field B, the polynomial may become reducible, which brings in Galois theory. For example, if A = B is a Galois extension of R, then

$A \otimes_R A \cong A[x] / f(x)$

is isomorphic (as an A-algebra) to the $A^{\deg(f)}$.

## Other examples of tensor products

### Tensor product of multilinear maps

Given multilinear maps $\scriptstyle f (x_1,\dots,x_k)$ and $\scriptstyle g (x_1,\dots, x_m)$ their tensor product is the multilinear function

$(f \otimes g) (x_1,\dots,x_{k+m}) = f(x_1,\dots,x_k) g(x_{k+1},\dots,x_{k+m}).$

### Monoidal categories

A general context for tensor product is that of a monoidal category.

## Applications

### Exterior and symmetric algebra

Two notable constructions in linear algebra can be constructed as quotients of the tensor product: the exterior algebra and the symmetric algebra. For example, given a vector space V, the exterior product

$V \wedge V$

is defined as

$V \otimes V/(v\otimes v \text{ for all } v\in V).$

Note that when V's underlying field does not have characteristic 2, then this definition is equivalent to

$V \otimes V / (v_1 \otimes v_2 + v_2 \otimes v_1 \text{ for all } v_1, v_2 \in V).$

The image of $v_1 \otimes v_2$ in the exterior product is usually denoted $v_1 \wedge v_2$ and satisfies, by construction, $v_1 \wedge v_2 = - v_2 \wedge v_1$. Similar constructions are possible for $V \otimes \dots \otimes V$ (n factors), giving rise to $\Lambda^n V$, the n-th exterior power of V. The latter notion is the basis of differential n-forms.

The symmetric algebra is constructed in a similar manner:

$Sym^n V := \underbrace{V \otimes \dots \otimes V}_n / (\dots \otimes v_i \otimes v_{i+1} \otimes \dots - \dots \otimes v_{i+1} \otimes v_{i} \otimes \dots)$

That is, in the symmetric algebra two adjacent vectors (and therefore all of them) can be interchanged. The resulting objects are called symmetric tensors.

## Tensor product in programming

### Array programming languages

Array programming languages may have this pattern built in. For example, in APL the tensor product is expressed as $\scriptstyle\circ . \times$ (for example $\scriptstyle A \circ . \times B$ or $\scriptstyle A \circ . \times B \circ . \times C$). In J the tensor product is the dyadic form of */ (for example a */ b or a */ b */ c).

Note that J's treatment also allows the representation of some tensor fields, as a and b may be functions instead of constants. This product of two functions is a derived function, and if a and b are differentiable, then a */ b is differentiable.

However, these kinds of notation are not universally present in array languages. Other array languages may require explicit treatment of indices (for example, MATLAB), and/or may not support higher-order functions such as the Jacobian derivative (for example, Fortran/APL).