Tensor Product Ordering
Tensor-product ordering is the convention that says which subsystem is first, which basis vectors appear first in a coordinate column, how local operators are embedded into the full space, and which array axes are contracted in a partial trace.
The abstract Hilbert spaces and are naturally isomorphic when the factors have been identified. Their coordinate representations are not the same object until an ordering convention has been chosen. An ordering mismatch can turn an operation on A into an apparent operation on B or contract the wrong indices in a reduced state.
Helpful background. Product Bases explains how paired labels become coefficients; Operators on Composite Systems explains which factor an operator acts on.
Ordered tensor factors
Section titled “Ordered tensor factors”Always declare the ordered tensor product before using compact labels. For a bipartite system the default convention is
For three factors the default convention is
Then the compact ket
means
The subscript is not decoration. It records the order in which the slots are being read. If one writes and later writes , the labels are being read in different ordered tensor products.
Parentheses do not usually carry physical information in finite tensor products:
Ordering does carry information for coordinates, matrices, and software arrays.
Basis Ordering for Qubits
Section titled “Basis Ordering for Qubits”For two qubits ordered as , the default computational basis order is
This is the order used for coordinate columns and matrix rows unless a page states otherwise. In this convention,
| Array index | Basis state | Bit values |
|---|---|---|
| 0 | ||
| 1 | ||
| 2 | ||
| 3 |
Thus a state
has coordinate column
Equivalently, for ,
For qubits ordered as , the displayed bit string is read left to right:
This is a big-endian convention for displayed bit strings. Other conventions are common in quantum information software and circuit diagrams, so the convention must be stated whenever a calculation depends on array indices.
Coordinate Columns Are Convention Dependent
Section titled “Coordinate Columns Are Convention Dependent”The same abstract vector can have different coordinate columns under different orderings. Conversely, the same column vector can represent different physical states if the ordering convention changes.
For example, in the default order,
represents , meaning
If a calculation silently changes to the order, the same displayed column would be read as , meaning
Those are not the same statement about the subsystems.
The swap map makes the distinction explicit. Define
by
For two qubits, if both spaces use the displayed computational order, the corresponding permutation matrix is
so that
The same two-qubit permutation matrix can describe two different tasks. A physical SWAP exchanges the states of the devices while their labels stay fixed. A coordinate permutation rewrites the same physical situation in BA order. For the latter, transform all arrays together:
Then . Moving only the state array generally changes the prediction.
Unequal local dimensions
Section titled “Unequal local dimensions”For dimensions , AB order uses , whereas BA order uses . Thus
The new column reads the old entries in the order . This permutation is not its own inverse. The return map is , with the local dimensions reversed; the familiar two-qubit identity does not apply to every unequal-dimension coordinate permutation.
Operator Ordering
Section titled “Operator Ordering”Operator order follows subsystem order. If
then an operator acting only on is embedded as
An operator acting on and but not is embedded as
only after one has explained how it is placed inside the ordering. In explicit tensor notation, a product operator on and has the form
A genuinely joint operator on and with as spectator is best described by its matrix elements or by a permutation into adjacent factors, application of the joint operator, and permutation back. The identity on the spectator factor cannot simply be omitted from a matrix implementation.
For two factors,
This equation fixes the matrix convention. The row and column labels are ordered pairs. In the default basis, the row label is flattened using the same rule as the state-vector index.
Matrix Example: Acting on the Second Qubit
Section titled “Matrix Example: Acting on the Second Qubit”Let
In the default two-qubit order, the operator that flips the second qubit is
Its matrix in the basis is
The operator that flips the first qubit is
The two matrices are different because they act on different tensor factors. A reliable calculation names the factor, writes the identity factors, and checks the basis order used to flatten the product basis.
Partial-Trace Ordering
Section titled “Partial-Trace Ordering”Partial trace is basis independent as an operator operation, but array formulas require a basis order. For
write a matrix element of as
The reduced state on is obtained by setting the bra and ket labels equal and summing:
The reduced state on is
For three factors ordered as , a density matrix has labels
Tracing out gives an operator on :
In code this is an axis contraction. The axis labels should be named before the contraction is performed. For a density matrix reshaped as
tracing out contracts the second and fifth axes. It does not contract the first and fourth axes, and it does not depend merely on which subsystem has dimension two.
Array order in calculations
Section titled “Array order in calculations”Array memory layout and subsystem order are distinct choices. For example, if a row-major reshape turns a matrix into axes , tracing B means contracting the second and fourth axes. A column-major reshape generally needs a different axis interpretation. Label the axes before taking a trace.
A compact description is enough:
The factor order is AB, array indices are , and the density-matrix axes are . Tracing B contracts the two B axes.
If a library numbers displayed bits differently, first map its qubit labels to A, B, and so on. The computational examples provide checks using unequal dimensions, which are better at exposing an accidental axis exchange than symmetric Bell states.
Common pitfalls
Section titled “Common pitfalls”Identical arrays can mean different states. The column with its second entry equal to one denotes only after the basis order is known.
Partial trace follows labels, not dimensions. Several subsystems may have the same dimension. Contract the named row/column pair, not whichever two axes happen to have equal length.
Coordinate changes also act on operators. Use the same permutation on both sides of a density matrix or observable. A permutation of amplitudes alone is a different physical prediction unless the observable is invariant.
References
Section titled “References”- M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press, 2010, section 2.1.
- J. Watrous, The Theory of Quantum Information, Cambridge University Press, 2018, chapter 1. Author manuscript.
Exercises
Section titled “Exercises”- In the default two-qubit basis order, what coordinate column represents ?
Solution
The default order is
Therefore is the third basis vector:
- For a three-qubit register ordered as , write the operator that applies to only.
Solution
The operator is
The identity factors specify that and are spectators.
- Let have components in the order. Write the component formula for tracing out .
Solution
Tracing out sets the row and column labels equal and sums over them:
The remaining operator acts on in the induced order.
- For the qubit–qutrit system above, has diagonal entries in AB order. Find its diagonal in BA order. Check the eigenvalue on the physical state in both descriptions.
Solution
Permuting rows and columns together gives , the diagonal of . The state occupies AB array index 3 and BA array index 1. Both corresponding diagonal entries equal , so the physical result is unchanged.