Search Knowledge

© 2026 LIBREUNI PROJECT

Linear Algebra / Linear Algebra

Tensors and Multilinear Algebra

Tensors and Multilinear Algebra

A scalar is a “rank-0” tensor (a single number). A vector is a “rank-1” tensor (an array). A matrix is a “rank-2” tensor (a grid). Beyond these lie higher-rank tensors—multi-dimensional arrays that follow specific transformation rules. Tensors are the natural language of General Relativity, Quantum Mechanics, and modern Deep Learning.

What is a Tensor?

While computer scientists often define a tensor as “a multidimensional array,” mathematicians define it by how it transforms or what it does.

A tensor is a multilinear map. Just as a matrix AA represents a linear map f(v)f(v), a tensor TT takes multiple vectors as input and produces a scalar (or another vector). For example, a rank-2 tensor T(u,v)T(u, v) is a function that is linear in uu AND linear in vv.

Covariance and Contravariance

In physics, we distinguish between:

  • Contravariant vectors (viv^i): Things like velocity or position that scale “with” the coordinate system.
  • Covariant vectors (wiw_i): Things like gradients or dual vectors that scale “against” the coordinate changes.

A general tensor TjiT^i_j can have both types of indices. This distinction is crucial for ensuring that physical laws remain the same regardless of the units or axes we choose.

The Tensor Product

The tensor product \otimes is a way to combine two vector spaces VV and WW into a larger space VWV \otimes W. If vVv \in V and wWw \in W, then vwv \otimes w is an element of the product space. If V=RmV = \mathbb{R}^m and W=RnW = \mathbb{R}^n, the tensor product VWV \otimes W has dimension m×nm \times n. You can think of this as the space of all possible m×nm \times n matrices.

python

Interactive Lab

Read the code, make a small change, then run it and inspect the output. Runtime setup messages stay outside the terminal so the result remains focused on what the program prints.

Step 1
Inspect the idea
Step 2
Edit the program
Step 3
Run and compare

Multilinear Forms and Determinants

The determinant is the most famous example of a multilinear form. It is an alternating (n,0)(n,0)-tensor. “Alternating” means that if you swap two input vectors, the sign of the output flips. This property is what allows the determinant to measure signed volume.

Einstein Summation Notation

In tensor calculus, we often drop the summation sign \sum. If an index appears twice (once up, once down), it is summed over. Instead of: yi=jAjixjy^i = \sum_j A^i_j x^j We write: yi=Ajixjy^i = A^i_j x^j This compact notation is the standard in engineering and theoretical physics.

Exercises

How is a rank-3 tensor typically visualized in computer science?

What does it mean for a map to be 'multilinear'?

In Einstein notation, what does 'R_ii' (repeated index) imply?

Previous Module Canonical Forms