An operation of tensor algebra that associates with a tensor with components $a^{i_{1} \ldots i_{p}}_{j_{1} \ldots j_{q}}$, $p,q \geq 1$, the tensor \begin{align} b^{i_{2} \ldots i_{p}}_{j_{1} \ldots j_{q - 1}} & = a^{1 i_{2} \ldots i_{p}}_{j_{1} \ldots j_{q - 1} 1} + a^{2 i_{2} \ldots i_{p}}_{j_{1} \ldots j_{q - 1} 2} + \cdots + a^{n i_{2} \ldots i_{p}}_{j_{1} \ldots j_{q - 1} n} \\ & = a^{\alpha i_{2} \ldots i_{p}}_{j_{1} \ldots j_{q - 1} \alpha}. \end{align} (Here, the contraction is made with respect to the pair of indices $i_{1}$ and $j_{q}$). The contraction of a tensor with respect to any pair of upper and lower indices is defined similarly. The $p$-fold contraction of a tensor that is $p$-times covariant and $p$-times contravariant is an invariant. Thus, the contraction of the tensor with components $a^{i}_{j}$ is an invariant $a^{i}_{i}$, called the trace of the tensor; it is denoted by $\text{Sp}(a^{i}_{j})$, or $\text{tr}(a^{i}_{j})$. A contraction of the product of two tensors is a contraction of the product with respect to an upper index of one factor and a lower index of the other.