Tensor contraction
In multilinear algebra, a tensor contraction is an operation on a tensor that arises from the canonical pairing of a vector space and its dual.
This example with two small matrices (tensors) shows how it works.
When calculating with matrices or tensors, often it's useful to move the second tensor up, and put the result underneath, just for calculation purposes. That way, each row of the first matrix (1234), and each column of the second matrix (5678), point to the cell of the result that they produce. Of course, these matrices can be larger than 2x2; often 3x3 or 4x4 are used, but any size is allowed.
In simple index notation, this is written where i, j and k all range over 1, 2. Notice how the index j, in between, disappears; this is the essence of tensor contraction.
In Einstein notation, this would be . The superscripts work just like subscripts, with a different meaning. Only repeated, raised and lowered indices are summed over. Objects can have more than two indices, also.
Tensor contraction can be seen as a generalization of the trace.