Generalised Approach Towards Reduced Density Matrix Calculation
Date: 10 May, 2025
Category: Computational Physics
Table of contents
- What is a density matrix?
- Route to mixedness: Reduced density matrices
- What’s the point of this article?
- Taking care of fermions signs: The quantum state as a tensor
What is a density matrix?
Density matrix as a quantum probability distribution
Since this article is primarily for demonstrating the computation of reduced density matrices, I won’t spend too much time on introducing them.
A density matrix plays the role of a probability density function (PDF) for a quantum system. A classical variable that can take values has a PDF , which is used, for example, for calculating the average value (expectation value) of the variable:
In quantum mechanics, the variables we are interested in are operators , and a quantum PDF will then give the expectation value of the operator, in a fashion similar to its classical counterpart:
here, the integral over the classical values is replaced by a sum over the all possible quantum states (complete orthonormal basis) of the system. However, we already know that the expectation value of a quantum operator is given by
To bring this form closer to the one in terms of (eq. 2), we insert an identity resolution: :
A comparison of this equation to eq. (2) gives
a density matrix (also called density operator) is therefore formally defined as the outer product of the wavefunction with its conjugate. It encodes all information about the state; for example, the probability of measuring the system to be at a position (hence in a state ) is given by . From its definition in eq. (5), the DM has the very important property that it has unity trace:
where is the trace of an operator. This is seen very easily be taking the trace in an orthonormal basis in which the state is one of the basis states.
While the state satisfies the Schrodinger equation ( being the Hamiltonian of the system), the DM satisfies a Heisenberg-like time-evolution equation:
Mixedness of a state
If a DM is constructed from a single state (as defined in eq. 5), we have the property that , where is the trace of an operator. This is because, we can write
so that . In the above manipulation, we used the normalisation property of the state, . This is however not a defining property of DMs. The only defining properties are eqs. (2), (6) and (7); these properties are however linear in , are therefore also satisfied by statistical superpositions of DMs. For example, consider the DM
where are orthogonal normalised states. The trace of for such a state is only ; such states satifying are termed mixed states; the DM describing such states cannot be written in the form for any wavefunction . On the other hand, the DMs that can be expressed like that are termed pure states, and have .
Route to mixedness: Reduced density matrices
Reduced density matrix as a post-measurement state
One way in which a pure state can be realistically converted into a mixed state is through a measurement process. Consider the zero total spin state formed by two spins:
The state has the first spin pointing up and the second one down, and this is in a superposition with the its flipped counterpart . This is clearly a pure state.
If we now measure the state of the second spin, it will collapse into one of it’s two states; the other spin will collapse into the opposite state (given the antiparallel configurations of the spins). What this means is that until one checks what the result of the measurement is, the first spin remains in a statistical superposition of both outcomes (up and down). This is formally expressed through a partial trace operation: the state of the first spin after a measurement of the second spin is obtained by taking the full density matrix and computing its trace over the states of the second spin, leaving out the states of the first spin from the trace:
where sums over the states and of the second spin. this partial tracing operation codifies the measurement process, and the partially traced density matrix is termed a reduced density matrix (RDM) of the first spin, because it only captures information about the first spin (the second spin has been traced out).
To see the connection with mixedness, let us compute the RDM for the first spin explicitly:
where the numbered subscripts on the kets and bras indicate that they only act on the respective Hilbert spaces. To see that describes a mixed state, we adopt a specific representation:
The trace of is half, hence it is a mixed state.
Physical implications of mixedness: Connection to entanglement
The deviation of trace of from its maximum value of unity can be thought of as a measure of the lost information. In the example above, when we traced out the states of the second spin, we lost some information about the state of the first spin as well. This is because the two spins were entangled; they had quantum correlations between them. The entanglement arises from the fact that the states of the two spins are anti-correlated.
If instead we had chosen a non-entangled parent state to start from, the reduced density matrix would not have been mixed. For example, consider the state
It is easy to see that this state does not contain any correlations between the two spins - no matter the configuration of the second spin, the first spin is always in the state . The RDM for the first spin comes out to be
revealing that is not mixed.
What’s the point of this article?
While the above examples were for a system of two spins, in general our system will consist of a large number of qubits (which may be spins or electrons). The RDM can then describe any subset—e.g., all spins on even lattice sites—while the rest are traced out.
In physical problems, the main challenge is usually finding the eigenstates of the Hamiltonian, since its size grows exponentially with the number of particles. In this article, we focus on the more modest task of numerically computing reduced density matrices once the eigenstates are given.
Though simple in principle, complications arise in two cases:
- if we have fermion signs, or
- the full basis cannot be expressed as a direct product of local basis sets.
The former arises if we are dealing with fermions, and the latter arises if we are working in a rotated basis. We will tackle these scenarios one by one. I will first show an approach that takes care of the fermion signs, but still assumes of a product basis. With that out of the way, I will show a basis-independent way of calculating RDMs that solves both of the above issues.
Taking care of fermions signs: The quantum state as a tensor
In order to explain this approach, I will first write down a general expression for various matrix elements of the RDM . Let the states (not) being traced over be spanned by the basis () . The matrix elements of are obviously indexed by the labels . Each such matrix element can be expressed as
We define a rank 2 tensor whose elements are defined as . The matrix element can then be expressed as
This tells us that , where was defined above, and is simply a matrix whose rows are indexed by the states being traced over, and its columns by the states not being traced over. It is essentially a matrix representation of the state .
It turns out that this greatly simplifies the calculation of reduced density matrices for the case in which our subsystems are continguous - that is, if the indices of the qubits that are being traced over appear one after another. Denoting the size of the Hilbert spaces of the traced subsystem to be and that of the untraced subsystem to be , the state is a column vector of size , while the matrix has rows and columns. The total number of qubits is then of course . Since we have assumed that the subsystem indices are all contiguous, the untraced system must consist of the indices , while the traced subsystem has the indices .
Computing the matrix is then as simple as reshaping the state vector into a matrix of the appropriate size. This works out because the indices are all continuously distributed, with no gaps. Such a reshape operation is often either present in the standard library of high-level languages or available in popular packages. For example, the Numpy library of Python provides a numpy.reshape
function that does this exact operation.
We now write down the algorithm for this simplified scenario in more detail:
import numpy as np
### total number of qubits in the problem is N ###
### subsystem being traced over has m qubits ###
### these are assumed to be defined ###
###### algorithm for RDM calculation ######
# 1. get spectrum (eigvals and eigvecs)
# 2. store ground state in gstate variable
# (simply the first element of eigvecs)
# 3. store dimension of traced and untraced Hilbert spaces
# in separate variables sizeTraced and sizeUntraced
# (these sizes are simply 2**N_1 and 2**N_2, where N_1
# and N_2 are the number of qubits being traced over
# and not being traced over, respectively.)
# 4. create C_matrix by reshaping gstate into size (sizeTraced, sizeUntraced)
# 5. finally obtain the subsystem RDM using the expression C * C^\dagger
This is enough to obtain the RDM for the simplified case of continuous subsystems.