JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Index Notation, Valence, and Contraction

Once tensors are real objects we need a working language for them: upper and lower indices, the Einstein summation convention, and contraction — the operation that generalizes matrix multiplication and the trace.

Indices up and down

In index notation a vector's components carry an upper index v^i, and a covector's (a functional's) carry a lower index a_i. A tensor of type (p,q) has p upper and q lower indices, e.g. T^{ij}_k. The type, also called the valence, says how many vector slots and how many covector slots the tensor has. A matrix of a linear map is type (1,1): one up, one down, written A^i_j.

Contraction generalizes the trace

Contraction pairs one upper index with one lower index of the same tensor and sums over them, lowering the type from (p,q) to (p-1,q-1). Contract the only two indices of A^i_j by setting j = i and summing: A^i_i = sum_i A^i_i, which is exactly the trace. Contraction is the coordinate-free engine behind almost every tensor formula.

Matrix multiplication is a tensor contraction:
  (A B)^i_k = A^i_j B^j_k        (sum over the dummy j)

Trace is a self-contraction:
  tr(A) = A^i_i = sum_i A^i_i

Bilinear form acting on two vectors:
  f(u,v) = B_{ij} u^i v^j         (contract both lower indices)

Applying a (1,1) tensor and then taking trace (contracting twice):
  start from T^i_j v^j  -> w^i,    then contract: w^i with a_i -> a_i T^i_j v^j

Rule of thumb: count free indices to know the OUTPUT type.
  A^i_j B^j_k  has free i (up), k (down)  => result is type (1,1), a matrix.
Matrix product, trace, and form evaluation are all contractions in disguise.

Stacking spaces: the Kronecker product

When you write a tensor product of two operators in coordinates you get the Kronecker product A (x) B: replace each entry a_{ij} of A by the block a_{ij} B. It is the concrete matrix of the map A (x) B acting on V tensor W, and it satisfies (A (x) B)(C (x) D) = (AC) (x) (BD) — the abstract tensor identity, made arithmetic.

A = [a b; c d]   (2x2),   B = [p q; r s]   (2x2)

A (x) B = [ a*B  b*B ]   = [ a p   a q   b p   b q ]
          [ c*B  d*B ]     [ a r   a s   b r   b s ]
                           [ c p   c q   d p   d q ]
                           [ c r   c s   d r   d s ]    (4x4)

Size: (m1 x n1) (x) (m2 x n2)  ->  (m1 m2) x (n1 n2)
Useful facts:  (A (x) B)^T = A^T (x) B^T,   tr(A (x) B) = tr(A) tr(B).
The Kronecker product is the matrix realization of the tensor product of operators.