Density Matrix in quantum mechanics.

Density Matrix Explained Simply: A Complete Guide with Examples

TL;DR

Below, you can find a quick summary of key points about density matrix:

  • What is a density matrix?

A density matrix is a representation of a linear operator (or density operator) that describes the statistical state of a quantum system. It generalizes the wavefunction approach by representing pure coherent states and mixed classical ensembles of states.

  • Is a density matrix Hermitian?

Yes, a density matrix is always Hermitian, satisfying the property ρ=ρ†\rho = \rho^\dagger. This property is physically required to ensure that all measurement expectation values are real numbers and that diagonal elements correspond to valid classical probabilities. 

  • How do you calculate a density matrix?

To calculate a density matrix, find the pure state vectors |ψi⟩\lvert \psi_i \rangle of the system and their classical probabilities pip_i. Compute the outer product |ψi⟩⟨ψi|\lvert \psi_i \rangle \langle \psi_i \rvert for each state by multiplying the column vector by its conjugate transpose row vector, then sum the weighted outer products. 

  • What is the difference between a density matrix and a density operator?

A density operator and a density matrix refer to the same physical object. The density operator is the abstract linear operator acting on the Hilbert space, while the density matrix is its coordinate representation after choosing a specific orthonormal basis. 

  • What is the density matrix used for in quantum mechanics?

In quantum mechanics, the density matrix is used to calculate expectation values of observables and to model mixed states arising from noise or thermal variations. It is widely used in quantum computing to track decoherence, in statistical mechanics to represent thermal ensembles, and in the analysis of entangled subsystems. 

  • What is a reduced density matrix?

A reduced density matrix describes a subsystem’s quantum state within a larger, entangled system. It is calculated by tracing out other subsystems’ degrees of freedom, isolating the local state for analysis.

In the classical world, particles possess definite positions and velocities. Quantum mechanics offers a richer picture. The density matrix mathematically describes pure and mixed quantum states, providing insights from quantum decoherence to quantum computing.

In this article, we will walk you through everything you need to know about the density matrix.

Here is what we will cover:

  • What is a density matrix?
  • Properties of a density matrix
  • How to calculate a density matrix
  • Reduced density matrix and reduced density operator
  • Density matrix in quantum mechanics
  • Density matrix vs wavefunction

What is a density matrix?

A density matrix is a representation of a linear operator, called the density operator, acting on the system’s Hilbert space (an abstract vector space) that describes its physical state. 

Wavefunctions describe pure states where the quantum state is fully known. A density matrix can describe both pure states and mixed states, where there is some uncertainty about which quantum state the system is in.

John von Neumann introduced this idea in 1927 to bridge the gap between quantum mechanics and statistical physics.

Density Matrix showing pure state and mixed state representations in quantum mechanics.
The density matrix in quantum mechanics. Source

Here is a simple way to understand a mixed state. If you prepare a qubit using a machine. Half of the time, the machine prepares the qubit in state ∣0⟩. The other half, it prepares the qubit in state ∣1⟩.

You receive the qubit, but you do not know which state the machine prepared in a particular run. You only know the probabilities:

p0=0.5p_0 = 0.5

and

p1=0.5p_1 = 0.5

A single wavefunction cannot represent this classical uncertainty. A density matrix can describe the complete situation by combining the possible quantum states with their probabilities.

The density operator and density matrix refer to the same thing. A density operator is the general mathematical operation that describes the quantum state. When we choose a basis and write that operator as a table of numbers, we get the density matrix.

Density matrices are also useful for systems made of multiple quantum parts. For example, two qubits can become entangled. The complete two-qubit system may be in a pure state, while one qubit considered on its own appears to be in a mixed state.

Simply put, a density matrix lets us describe both the complete quantum system and its individual parts.

The general formula of a density matrix is:

ρ=βˆ‘ipi|ψi⟩⟨ψi|\rho = \sum_i p_i |\psi_i\rangle \langle\psi_i|

Here:

  • ρ\rho represents the density matrix.
  • pip_i is the probability of the system being prepared in state |ψi⟩|\psi_i\rangle.
  • |ψi⟩|\psi_i\rangle represents a possible quantum state.
  • ⟨ψi|\langle\psi_i| is the conjugate transpose of |ψi⟩|\psi_i\rangle.
  • |ψi⟩⟨ψi||\psi_i\rangle\langle\psi_i| creates a matrix that represents that pure state.

The formula says: take every possible quantum state, multiply it by the probability of that state occurring, and combine the results into one matrix.

Because pip_i​ represents probabilities, all probabilities must add up to 1:

βˆ‘ipi=1\sum_i p_i = 1

Each probability must also be between 0 and 1:

0≀pi≀10 \leq p_i \leq 1

For example, if a qubit has a 50% chance of being in |0⟩|0\rangle and a 50% chance of being in |1⟩|1\rangle, then:

p0=0.5,p1=0.5p_0 = 0.5, \qquad p_1 = 0.5

and:

p0+p1=1p_0 + p_1 = 1

Properties of a density matrix

A density matrix must follow a few mathematical rules to represent a valid quantum state. These rules make sure that the matrix gives real and valid probabilities when we use it to predict measurement results.

The main properties of a density matrix are Hermiticity, a trace of 1, positive semi-definiteness, and a valid purity value.

Is a density matrix hermitian?

Yes. A density matrix is always Hermitian. This means the matrix is equal to its conjugate transpose: ρ=ρ†\rho = \rho^\dagger. The symbol ρ†\rho^\dagger means the conjugate transpose of the density matrix.

The trace must equal 1.

The trace of the density matrix must always be equal to one, ensuring that the probabilities of all possible states sum to unity: Tr⁑(ρ)=1\operatorname{Tr}(\rho) = 1

A density matrix must be positive semi-definite.

For any state vector |ψq⟩|\psi_q\rangle in the Hilbert space, the expectation value must be non-negative: ⟨ψq|ρ|ψq⟩β‰₯0\langle\psi_q|\rho|\psi_q\rangle \geq 0, which is written as ρβ‰₯0\rho \geq 0. This prevents any physical state from having a negative probability of occurrence.

Purity tells us whether a state is pure or mixed.

The trace of the squared density matrix is less than or equal to one: Tr⁑(ρ2)≀1\operatorname{Tr}(\rho^2) \leq 1. The value equals 1 if and only if the state is pure, and is strictly less than 1 if the state is mixed (Tr⁑\operatorname{Tr} means the trace (sum of the numbers on the matrix main diagonal)). For a system of dimension d, the maximally mixed state reaches the minimum value of Tr⁑(ρ2)=1d\operatorname{Tr}(\rho^2) = \frac{1}{d}.

For example, consider the pure state |0⟩|0\rangle (we know exactly which state the qubit is in). Its density matrix is:

ρ=(1000)\rho = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

Squaring the matrix gives:

ρ2=(1000)\rho^2 = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

So:

Tr⁑(ρ2)=1\operatorname{Tr}(\rho^2) = 1

So, ∣0⟩ is a pure state.

Now consider the 50/50 mixed state:

ρmix=(0.5000.5)\rho_{\text{mix}} = \begin{pmatrix} 0.5 & 0 \\ 0 & 0.5 \end{pmatrix}

Squaring it gives:

ρmix2=(0.25000.25)\rho_{\text{mix}}^2 = \begin{pmatrix} 0.25 & 0 \\ 0 & 0.25 \end{pmatrix}

The purity is: Tr⁑(ρmix2)=0.25+0.25=0.5\operatorname{Tr}(\rho_{\text{mix}}^2) = 0.25 + 0.25 = 0.5. Because 0.5<10.5 < 1 the state is mixed.

For a quantum system with dimension d, the lowest possible purity is: Tr⁑(ρ2)=1d\operatorname{Tr}(\rho^2) = \frac{1}{d}. This value represents a maximally mixed state, where the system has the greatest possible uncertainty among its d basis states.

How to calculate a density matrix (worked examples)

To calculate a density matrix, take each possible quantum state, convert it into a matrix, multiply that matrix by the probability of the state occurring, and then add the matrices together.

Here are the steps you need to follow:

  • Identify the possible quantum states. Write each state as a normalized state vector |ψi⟩|\psi_i\rangle.
  • Find the probability of each state. Assign a probability pip_i to every possible state. All probabilities must add up to 1.
  • Create the outer product. Multiply each state vector |ψi⟩|\psi_i\rangle by its conjugate transpose ⟨ψi|\langle\psi_i|:
|ψi⟩⟨ψi||\psi_i\rangle \langle\psi_i|
  • Multiply each matrix by its probability. For each state, calculate:
pi|ψi⟩⟨ψi|p_i |\psi_i\rangle \langle\psi_i|
  • Add all the matrices together. The result is the final density matrix:
ρ=βˆ‘ipi|ψi⟩⟨ψi|\rho = \sum_i p_i |\psi_i\rangle \langle\psi_i|

Now, let’s see how this calculation works with actual qubits.

Example 1: Pure state (qubit |0⟩)

Suppose we prepare a qubit in state |0⟩|0\rangle.

Because we know exactly which state the qubit is in, it is a pure state. The probability of state |0⟩|0\rangle is:

p=1p = 1

The state |0⟩|0\rangle is written as a column vector:

|0⟩=(10)|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}

Its conjugate transpose, called a bra vector, is:

⟨0|=(10)\langle 0| = \begin{pmatrix} 1 & 0 \end{pmatrix}

Now multiply the column vector by the row vector:

|0⟩⟨0|=(10)(10)|0\rangle\langle 0| = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \begin{pmatrix} 1 & 0 \end{pmatrix}

The result is:

ρ|0⟩=(1000)\rho_{|0\rangle} = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

This is the density matrix for the pure state |0⟩|0\rangle. What does the matrix tell us? Look at the diagonal values:

(1000)\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

The value 1 means there is a 100% probability of finding the qubit in state |0⟩|0\rangle. The value 0 means there is no probability of finding it in state |1⟩|1\rangle.

So, the matrix density represents the known state of the qubit.

Example 2: Mixed state (50/50 statistical mixture)

Now imagine a machine prepares a qubit in one of two states:

  • 50% of the time, it prepares ∣0⟩|0\rangle.
  • 50% of the time, it prepares ∣1⟩|1\rangle.

The probabilities are:

p0=0.5p_0 = 0.5

and

p1=0.5p_1 = 0.5

You receive a qubit from the machine, but you do not know which state it prepared. This is a mixed state.

We already know the density matrix for |0⟩|0\rangle:

|0⟩⟨0|=(1000)|0\rangle\langle 0| = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

Now calculate the matrix for ⟨1|\langle 1|.

The state vector is:

|1⟩=(01)|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}

Its bra vector is:

⟨1|=(01)\langle 1| = \begin{pmatrix} 0 & 1 \end{pmatrix}

The outer product is:

|1⟩⟨1|=(0001)|1\rangle\langle 1| = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}

Because each state has a probability of 0.5, multiply both matrices by 0.5 and add them:

ρmix=0.5(1000)+0.5(0001)\rho_{\text{mix}} = 0.5 \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} + 0.5 \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}

This gives:ρmix=(0.5000.5)\rho_{\text{mix}} = \begin{pmatrix} 0.5 & 0 \\ 0 & 0.5 \end{pmatrix}

We can also write it as:

ρmix=12𝕀\rho_{\text{mix}} = \frac{1}{2}\mathbb{I}

where 𝕀\mathbb{I} is the 2Γ—2 identity matrix. This density matrix tells us that the qubit has a 50% chance of being in ∣0⟩|0\rangle and a 50% chance of being in ∣1⟩|1\rangle. Because neither state is more likely than the other, this is called a maximally mixed state.

Example 3: Bloch sphere representation

Bloch sphere visualization showing a pure qubit state, quantum state vector, and spherical coordinates.
Bloch sphere visualization | Source

The Bloch sphere gives us a visual way to represent the state of a single qubit. Every valid 2Γ—2 density matrix for a qubit can be represented by a point on or inside the Bloch sphere.

The density matrix formula is:

ρ=12(𝕀+rβ†’β‹…Οƒβ†’)\rho = \frac{1}{2}\left(\mathbb{I} + \vec{r} \cdot \vec{\sigma}\right)

We can expand the formula as:

ρ=12(𝕀+rxΟƒx+ryΟƒy+rzΟƒz)\rho = \frac{1}{2}\left(\mathbb{I} + r_x\sigma_x + r_y\sigma_y + r_z\sigma_z\right)

Here, r⃗\vec{r} is called the Bloch vector:

r→=(rx,ry,rz)\vec{r} = (r_x, r_y, r_z)

You can think of rxr_x​, ryr_y​, and rzr_z​ as the coordinates of the quantum state on or inside the Bloch sphere.

The symbols Οƒx,Οƒy,Οƒz\sigma_x, \sigma_y, \sigma_z​ represent the three Pauli matrices:

Οƒx=(0110),Οƒy=(0βˆ’ii0),Οƒz=(100βˆ’1)\sigma_x = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \qquad \sigma_y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \qquad \sigma_z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}

To find the Bloch vector coordinates from a density matrix, calculate:

rx=Tr⁑(ρσx),ry=Tr⁑(ρσy),rz=Tr⁑(ρσz)r_x = \operatorname{Tr}(\rho\sigma_x), \qquad r_y = \operatorname{Tr}(\rho\sigma_y), \qquad r_z = \operatorname{Tr}(\rho\sigma_z)

For the pure ρ|+⟩\rho_{|+\rangle} state:

ρ|+⟩=12(1111)\rho_{|+\rangle} = \frac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}

the calculations give:

rx=Tr⁑[12(1111)(0110)]=Tr⁑[12(1111)]=1r_x = \operatorname{Tr}\left[ \frac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \right] = \operatorname{Tr}\left[ \frac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \right] = 1
ry=Tr⁑[12(1111)(0βˆ’ii0)]=Tr⁑[12(iβˆ’iiβˆ’i)]=0r_y = \operatorname{Tr}\left[ \frac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix} \right] = \operatorname{Tr}\left[ \frac{1}{2} \begin{pmatrix} i & -i \\ i & -i \end{pmatrix} \right] = 0
rz=Tr⁑[12(1111)(100βˆ’1)]=Tr⁑[12(1βˆ’11βˆ’1)]=0r_z = \operatorname{Tr}\left[ \frac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \right] = \operatorname{Tr}\left[ \frac{1}{2} \begin{pmatrix} 1 & -1 \\ 1 & -1 \end{pmatrix} \right] = 0

So:

r→=(1,0,0)\vec{r} = (1,0,0)

This places the |+⟩ state on the positive x-axis of the Bloch sphere. The location of a state also tells us something about its purity. Pure states sit on the surface of the Bloch sphere. Mixed states sit inside the sphere. The maximally mixed state sits exactly at the center.

Reduced density matrix and reduced density operator

A reduced density matrix describes one part of a larger quantum system. The term reduced density operator refers to the same mathematical object.

For example, imagine a quantum system with two qubits, A and B. The complete density matrix describes both qubits together. But what if you only want to study qubit A?

You can remove the information about qubit B using a mathematical operation called the partial trace (ignoring one qubit mathematically so you can focus only on the other qubit). The result is the reduced density matrix of qubit A.

The formula is:

ρA=TrB⁑(ρAB)\rho_A = \operatorname{Tr}_B(\rho_{AB})

Here:

  • ρAB\rho_{AB} is the density matrix of the complete two-qubit system.
  • TrB⁑\operatorname{Tr}_B means taking the partial trace over qubit B.
  • ρA\rho_A is the reduced density matrix of qubit A.

Why does a reduced density matrix matter?

The reduced density matrix is especially useful for studying quantum entanglement.

When two qubits are entangled, you cannot fully describe one qubit with its own wavefunction. The state of one qubit depends on its connection with the other qubit.

A reduced density operator solves this problem. It lets you describe the local state of one qubit even when that qubit belongs to a larger entangled system.

Worked example: Two-qubit entangled system

Consider two qubits, A and B, in the Bell state:

|Φ+⟩=12(|00⟩+|11⟩)|\Phi^+\rangle = \frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle\right)

This is an entangled quantum state.

The formula tells us that the two qubits are connected in the following way: if we measure the first qubit as 0, the second qubit is also 0. If we measure the first qubit as 1, the second qubit is also 1.

Before measurement, the complete system is described by the Bell state.

To create its density matrix, we take the outer product:

ρAB=|Φ+⟩⟨Φ+|\rho_{AB} = |\Phi^+\rangle\langle\Phi^+|

Expanding the formula gives:

ρAB=12(|00⟩⟨00|+|00⟩⟨11|+|11⟩⟨00|+|11⟩⟨11|)\rho_{AB} = \frac{1}{2} \left( |00\rangle\langle00| + |00\rangle\langle11| + |11\rangle\langle00| + |11\rangle\langle11| \right)

Using the basis:

{|00⟩,|01⟩,|10⟩,|11⟩}\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\}

the density matrix is:

ρAB=12(1001000000001001)\rho_{AB} = \frac{1}{2} \begin{pmatrix} 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 \end{pmatrix}

This matrix describes qubits A and B together.

But suppose we only want to study qubit A. We take the partial trace over qubit B:

ρA=TrB⁑(ρAB)\rho_A = \operatorname{Tr}_B(\rho_{AB})

More explicitly:

ρA=⟨0|BρAB|0⟩B+⟨1|BρAB|1⟩B\rho_A = \langle0|_B\rho_{AB}|0\rangle_B + \langle1|_B\rho_{AB}|1\rangle_B

The calculation uses the following rules:

⟨0|0⟩=1,⟨1|1⟩=1,⟨0|1⟩=0,⟨1|0⟩=0\langle0|0\rangle = 1, \qquad \langle1|1\rangle = 1, \qquad \langle0|1\rangle = 0, \qquad \langle1|0\rangle = 0

The first two expressions equal 1 because the states match. The last two equal 0 because the states are different.

After applying these rules, the reduced density matrix becomes:

ρA=12(|0⟩⟨0|+|1⟩⟨1|)\rho_A = \frac{1}{2} \left( |0\rangle\langle0| + |1\rangle\langle1| \right)

In matrix form:

ρA=12(1001)\rho_A = \frac{1}{2} \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}

or:

ρA=(0.5000.5)\rho_A = \begin{pmatrix} 0.5 & 0 \\ 0 & 0.5 \end{pmatrix}

his is a maximally mixed state.

The result tells us something interesting. The complete two-qubit system is in a pure Bell state, but qubit A, when studied alone, has a 50% probability associated with ∣0⟩ and a 50% probability associated with ∣1⟩.

We can check this using purity. For the complete system:

Tr⁑(ρAB2)=1\operatorname{Tr}(\rho_{AB}^2) = 1

so, the complete system is pure. For qubit A:

Tr⁑(ρA2)=0.5\operatorname{Tr}(\rho_A^2) = 0.5

Because the purity is less than 1, the reduced state of qubit A is mixed.

The key idea is simple: the complete entangled system can be perfectly known, while one part of that system looks mixed when studied alone.

Density matrix vs Wavefunction

A wavefunction describes a quantum system in a pure state, while a density matrix can describe both pure and mixed states. This makes the density matrix a more general tool, especially when dealing with statistical uncertainty, quantum noise, thermal states, or part of an entangled system.

Here is the comparison table:

ComparisonWavefunctionDensity Matrix
Physical ScopeDescribes pure quantum states.Describes both pure and mixed quantum states.
Mathematical ObjectA state vector in a Hilbert space.A positive semi-definite, Hermitian operator with trace 1.
Statistical MixturesCannot directly represent a classical mixture of quantum states.Represents statistical mixtures using probabilities.
Global PhaseTwo wavefunctions that differ only by a global phase represent the same physical state.Global phase cancels when constructing the density matrix.
Subsystem RepresentationCannot fully describe one part of an entangled system with a wavefunction alone.Describes a subsystem using a reduced density matrix.
Time EvolutionFor a closed system, follows the SchrΓΆdinger equation.For a closed system, follows the von Neumann equation; open-system dynamics require more general equations.
Expectation ValueCalculated using ⟨ψ|A|ψ⟩\langle\psi|A|\psi\rangleTr⁑(ρA)\operatorname{Tr}(\rho A)
Thermal StatesCannot generally represent a thermal mixed state with a single wavefunction.Represents thermal states using a thermal density matrix.

Density matrix in quantum mechanics

Real quantum systems are rarely completely isolated. Noise, temperature, and environmental interactions can change a quantum state.

A wavefunction alone cannot always describe these situations. A density matrix can represent pure states, mixed states, and quantum systems affected by noise.

Key applications of the density matrix in quantum mechanics inlcudes:

Quantum Computing

Quantum computers use qubits to store and process quantum information. However, real qubits are sensitive to noise and hardware errors. These problems can cause a qubit to lose its quantum properties over time.

Density matrices help researchers model these noisy qubits and understand how errors affect a quantum circuit. Engineers can use this information to test quantum error correction methods and study the behavior of quantum gates.

Developers can also work with density matrices through quantum programming languages and software frameworks. These tools let you simulate quantum states, model noise, and study how quantum circuits behave before running them on real quantum hardware.

Statistical Mechanics

Density matrices also help physicists study quantum systems affected by temperature.

For example, if a quantum system is in contact with a warm environment. The system can exchange energy with its surroundings, so it may not stay in one pure quantum state. Instead, different energy states can occur with different probabilities.

A thermal density matrix describes this situation:

ρ=eβˆ’Ξ²HZ\rho = \frac{e^{-\beta H}}{Z}

Here:

  • ρ\rho represents the thermal density matrix.
  • HH describes the energy of the quantum system.
  • Ξ²=1kBT\beta = \frac{1}{k_B T} connects the calculation to temperature.
  • ZZ is a normalization value that ensures the total probability adds up to 1.

Key takeaways

The density matrix provid a unified mathematical language to describe both coherent quantum phenomena and classical statistical mixtures. Its primary benefits include:

  • Modeling noisy quantum systems: It helps describe quantum systems that interact with their environment and lose quantum coherence through decoherence.
  • Describing parts of entangled systems: A reduced density matrix lets you study one part of a larger entangled quantum system.
  • Predicting measurement results: It helps calculate the expected value of measurements for pure, mixed, and thermal quantum states.
  • Removing global phase: The global phase cancels automatically when a density matrix is created, so it does not affect the description of the physical quantum state.

QbitNeural

AI and quantum research, decoded.
Paper summaries, model releases, and QML breakthroughs written for practitioners.

Subscribe