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 represents a linear map , a tensor takes multiple vectors as input and produces a scalar (or another vector). For example, a rank-2 tensor is a function that is linear in AND linear in .
Covariance and Contravariance
In physics, we distinguish between:
- Contravariant vectors (): Things like velocity or position that scale “with” the coordinate system.
- Covariant vectors (): Things like gradients or dual vectors that scale “against” the coordinate changes.
A general tensor 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 is a way to combine two vector spaces and into a larger space . If and , then is an element of the product space. If and , the tensor product has dimension . You can think of this as the space of all possible matrices.
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.
Multilinear Forms and Determinants
The determinant is the most famous example of a multilinear form. It is an alternating -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 . If an index appears twice (once up, once down), it is summed over. Instead of: We write: This compact notation is the standard in engineering and theoretical physics.