# Tensors - Part 3: Tensor Products of Vector Spaces

# Tensors - Part 3: Tensor Products of Vector Spaces

### In Part III of this series, John Cook explores how tensor products are defined.

Join the DZone community and get the full member experience.

Join For FreeHortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

In the previous post, we defined the tensor product of two tensors, but you’ll often see tensor products of **spaces**. How are these tensor products defined?

## Tensor Product Splines

For example, you may have seen tensor product splines. Suppose you have a function over a rectangle that you’d like to approximate by patching together polynomials so that the interpolation has the specified values at grid points, and the patches fit together smoothly. In one dimension, you do this by constructing splines. Then you can bootstrap your way from one dimension to two dimensions by using tensor product splines. A tensor product spline in *x* and *y* is a sum of terms consisting of a spline in *x* and a spline in *y*. Notice that a tensor product spline is not simply a product of two ordinary splines, but a *sum* of such products.

If *X* is the vector space of all splines in the *x*-direction and *Y* the space of all splines in the *y*-direction, the space of tensor product splines is the tensor product of the spaces *X* and *Y*. Suppose a set *s _{i}*, for

*i*running from 1 to

*n,*is a basis for

*X*. Similarly, suppose

*t*, for

_{j}*j*running from 1 to

*m*, is a basis for

*Y*. Then the products

*s*form a basis for the tensor product

_{i}t_{j}*X*and

*Y*, the tensor product splines over the rectangle. Notice that if

*X*has dimension

*n*and

*Y*has dimension

*m*then their tensor product has dimension

*nm*. Notice that if we only allowed products of splines, not sums of products of splines, we’d get a much smaller space, one of dimension

*n*+

*m*.

## Tensor Products of Vector Spaces

We can use the same process to define the tensor product of any two vector spaces. A basis for the tensor product is all products of basis elements in one space and basis elements in the other. There’s a more general definition of tensor products that doesn’t involve bases sketched below.

## Tensor Products of Modules

You can also define tensor products of *modules*, a generalization of vector spaces. You could think of a module as a vector space where the scalars come from a ring ideas of a field. Since rings are more general than fields, modules are more general than vector spaces.

The tensor product of two modules over a commutative ring is defined by taking the Cartesian product and moding out by the necessary relations to make things bilinear. (This description is very hand-wavy. A detailed presentation needs its own blog post or two.)

Tensor products of modules hold some surprises. For example, let *m* and *n* be two relatively prime integers. You can think of the integers mod *m* or *n* as a module over the integers. The tensor product of these modules is zero because you end up moding out by everything. This kind of collapse doesn’t happen over vector spaces.

## Past and future

The first two posts in this series:

I plan to leave the algebraic perspective aside for a while, though as I mentioned above there’s more to come back to.

Next, I plan to write about the analytic/geometric view of tensors. Here we get into things like changes of coordinates and it looks at first as if a tensor is something completely different.

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

Published at DZone with permission of John Cook . See the original article here.

Opinions expressed by DZone contributors are their own.

## {{ parent.title || parent.header.title}}

## {{ parent.tldr }}

## {{ parent.linkDescription }}

{{ parent.urlSource.name }}