✦ For everyone, free.

Practical knowledge for real and everyday life

Home

8.21.4 Tensor Matrix to Index Translation

Tensor Matrix to Index Translation converts multi-dimensional arrays into indexed notation, simplifying tensor operations in mathematical physics and engineering.

Tensor Matrix to Index Translation is the reverse of the index-to-matrix correspondence: the process of taking an expression written in matrix and vector notation — products, transposes, inverses, traces, quadratic forms — and rewriting it in tensor index notation with the correct number of indices and the correct upper/lower placement on each, a placement that matrix notation itself does not record and that must instead be inferred from what role each matrix or vector plays in the calculation. Because ordinary matrix notation treats every index as an undifferentiated row or column position, this translation is the step that reintroduces the contravariant/covariant distinction that matrix notation silently discards.


Translating the Basic Building Blocks

Vectors, Covectors, and Linear Maps

A column vector v translates to an upper-indexed vⁱ, and a linear map represented by a square matrix A acting on column vectors translates to the mixed tensor A^i_j, with the row index upper and the column index lower, matching the way Av translates to A^i_j v^j. A bilinear form represented by a matrix g, used as in u^T g v, translates instead to a doubly-lower tensor g_{ij}, since both of its indices are consumed by contraction against the upper indices of the two vectors it acts on — the same matrix shape can therefore require two different index placements depending on how it is used.

uT g v  ↔  gij ui vj

Matrix Multiplication Becomes a Contracted Pair

The matrix product AB translates to A^i_j B^j_k, with the shared inner dimension of the multiplication becoming the contracted (dummy) index j, and the surviving row and column of the product matrix becoming the two free indices i and k. This single correspondence is the most frequently applied rule in matrix-to-index translation, since chained matrix products are common and each adjacent pair in the chain translates to one contracted index pair.


Translating Matrix Operations That Change Variance

Transpose Swaps Index Positions

The matrix transpose A^T translates to swapping the positions of the two indices of A^i_j, producing A^j_i viewed with the roles of row and column exchanged; whether this corresponds to a genuinely different tensor or to the same tensor merely relabeled depends on whether the original matrix represented a (1,1) tensor (in which case transposition changes which index is treated as which) or a symmetric (0,2) or (2,0) tensor (in which case transposition leaves the components unchanged).

Inverse Requires the Corresponding Contracted Identity

The matrix inverse A⁻¹, when it exists, translates to the tensor (A⁻¹)^i_j satisfying the contracted identity (A⁻¹)^i_k A^k_j = δ^i_j; the index form of the inverse is defined precisely by this contraction property rather than by any direct component-wise formula, so translating an inverse into index notation is best expressed as stating this defining contracted relation.


Determining Variance When the Matrix Notation Is Ambiguous

The Same Matrix Shape, Different Roles

Because ordinary matrix notation does not distinguish a linear map from a bilinear form, matrix-to-index translation cannot proceed from the matrix's shape alone; it requires knowing, from the surrounding context, whether the matrix is being multiplied against one vector on one side (a linear map, (1,1)) or against two vectors on both sides (a bilinear form, (0,2) or (2,0)), since these two roles demand different index placements even for numerically identical matrices.

Orthonormal Bases Obscure the Distinction Further

In a calculation carried out entirely in an orthonormal basis, upper and lower components of the same underlying tensor are numerically identical, and matrix notation in such a setting often uses only subscripts for everything; matrix-to-index translation performed on such a calculation must reconstruct the correct upper/lower placement based on the tensor's actual transformation behavior under a general (non-orthonormal) change of basis, not merely on the subscript pattern used in the orthonormal-basis matrix expression.


Diagram of Matrix Multiplication Translated to Index Notation

Matrix form: AB Index form: Aᵢᴰ Bᴰᵤ j is contracted (shared inner dimension); i and k are free (row and column of the product).

Handling Non-Square and Higher-Order Cases

Rectangular Matrices Translate With Independent Index Ranges

A rectangular matrix, mapping an m-dimensional space to an n-dimensional one, translates to a tensor whose upper and lower indices range over different sizes, A^i_j with i ∈ {1,...,n} and j ∈ {1,...,m}; matrix-to-index translation must record this distinction explicitly, since treating both indices as ranging over a single common dimension would misstate the translated tensor's domain and codomain.

Beyond Matrix Notation Entirely

Any quantity that genuinely requires three or more indices to describe — such as a bilinear map's derivative or a structure constant of an algebra — has no native matrix expression to translate from in the first place; matrix-to-index translation is therefore confined to the rank-0, rank-1, and rank-2 building blocks that matrix and vector notation can represent, with higher-order tensor content necessarily introduced directly in index notation rather than obtained by translating from a matrix source.