Skip to main content
IBM Quantum Platform

Density matrix basics

We'll begin by describing what density matrices are in mathematical terms, and then we'll take a look at some examples. After that, we'll discuss a few basic aspects of how density matrices work and how they relate to quantum state vectors in the simplified formulation of quantum information.


Definition

Suppose that we have a quantum system named X,\mathsf{X}, and let Σ\Sigma be the (finite and nonempty) classical state set of this system. Here we're mirroring the naming conventions used in the "Basics of quantum information" course, which we'll continue to do when the opportunity arises.

In the general formulation of quantum information, a quantum state of the system X\mathsf{X} is described by a density matrix ρ\rho whose entries are complex numbers and whose indices (for both its rows and columns) have been placed in correspondence with the classical state set Σ.\Sigma. The lowercase Greek letter ρ\rho is a conventional first choice for the name of a density matrix, although σ\sigma and ξ\xi are also common choices.

Here are a few examples of density matrices that describe states of qubits:

(1000),(12121212),(34i8i814),and(120012).\begin{pmatrix} 1 & 0\\ 0 & 0 \end{pmatrix}, \quad \begin{pmatrix} \frac{1}{2} & \frac{1}{2}\\[2mm] \frac{1}{2} & \frac{1}{2} \end{pmatrix}, \quad \begin{pmatrix} \frac{3}{4} & \frac{i}{8}\\[2mm] -\frac{i}{8} & \frac{1}{4} \end{pmatrix}, \quad\text{and}\quad \begin{pmatrix} \frac{1}{2} & 0\\[2mm] 0 & \frac{1}{2} \end{pmatrix}.

To say that ρ\rho is a density matrix means that these two conditions, which will be explained momentarily, are both satisfied:

  1. Unit trace: Tr(ρ)=1.\operatorname{Tr}(\rho) = 1.
  2. Positive semidefiniteness: ρ0.\rho \geq 0.

The trace of a matrix

The first condition on density matrices refers to the trace of a matrix. This is a function that is defined, for all square matrices, as the sum of the diagonal entries:

Tr(α0,0α0,1α0,n1α1,0α1,1α1,n1αn1,0αn1,1αn1,n1)=α0,0+α1,1++αn1,n1.\operatorname{Tr} \begin{pmatrix} \alpha_{0,0} & \alpha_{0,1} & \cdots & \alpha_{0,n-1}\\[1.5mm] \alpha_{1,0} & \alpha_{1,1} & \cdots & \alpha_{1,n-1}\\[1.5mm] \vdots & \vdots & \ddots & \vdots\\[1.5mm] \alpha_{n-1,0} & \alpha_{n-1,1} & \cdots & \alpha_{n-1,n-1} \end{pmatrix} = \alpha_{0,0} + \alpha_{1,1} + \cdots + \alpha_{n-1,n-1}.

The trace is a linear function: for any two square matrices AA and BB of the same size, and any two complex numbers α\alpha and β,\beta, the following equation is always true.

Tr(αA+βB)=αTr(A)+βTr(B)\operatorname{Tr}(\alpha A + \beta B) = \alpha \operatorname{Tr}(A) + \beta\operatorname{Tr}(B)

The trace is an extremely important function and there's a lot more that can be said about it, but we'll wait until the need arises to say more.

Positive semidefinite matrices

The second condition refers to the property of a matrix being positive semidefinite, which is a fundamental concept in quantum information theory and in many other subjects. A matrix PP is positive semidefinite if there exists a matrix MM such that

P=MM.P = M^{\dagger} M.

Here we can either demand that MM is a square matrix of the same size as PP or allow it to be non-square — we obtain the same class of matrices either way.

There are several alternative (but equivalent) ways to define this condition, including these:

  • A matrix PP is positive semidefinite if and only if PP is Hermitian (i.e., equal to its own conjugate transpose) and all of its eigenvalues are nonnegative real numbers. Checking that a matrix is Hermitian and all of its eigenvalues are nonnegative is a simple computational way to verify that it's positive semidefinite.

  • A matrix PP is positive semidefinite if and only if ψPψ0\langle \psi \vert P \vert \psi \rangle \geq 0 for every complex vector ψ\vert\psi\rangle having the same indices as the rows and columns of P.P.

An intuitive way to think about positive semidefinite matrices is that they're like matrix analogues of nonnegative real numbers. That is, positive semidefinite matrices are to complex square matrices as nonnegative real numbers are to complex numbers. For example, a complex number α\alpha is a nonnegative real number if and only if

α=ββ\alpha = \overline{\beta} \beta

for some complex number β,\beta, which matches the definition of positive semidefiniteness when we replace matrices with scalars. While matrices are more complicated objects than scalars in general, this is nevertheless a helpful way to think about positive semidefinite matrices.

This also explains the common notation P0,P\geq 0, which indicates that PP is positive semidefinite. Notice in particular that P0P\geq 0 does not mean that each entry of PP is nonnegative in this context; there are positive semidefinite matrices having negative entries, as well as matrices whose entries are all positive that are not positive semidefinite.

Interpretation of density matrices

At this point, the definition of density matrices may seem rather arbitrary and abstract, as we have not yet associated any meaning with these matrices or their entries. The way density matrices work and can be interpreted will be clarified as the lesson continues, but for now it may be helpful to think about the entries of density matrices in the following (somewhat informal) way.

  • The diagonal entries of a density matrix give us the probabilities for each classical state to appear if we perform a standard basis measurement — so we can think about these entries as describing the "weight" or "likelihood" associated with each classical state.

  • The off-diagonal entries of a density matrix describe the degree to which the two classical states corresponding to that entry (meaning the one corresponding to the row and the one corresponding to the column) are in quantum superposition, as well as the relative phase between them.

It is certainly not obvious a priori that quantum states should be represented by density matrices. Indeed, there is a sense in which the choice to represent quantum states by density matrices leads naturally to the entire mathematical description of quantum information. Everything else about quantum information actually follows pretty logically from this one choice!


Connection to quantum state vectors

Recall that a quantum state vector ψ\vert\psi\rangle describing a quantum state of X\mathsf{X} is a column vector having Euclidean norm equal to 11 whose entries have been placed in correspondence with the classical state set Σ.\Sigma. The density matrix representation ρ\rho of the same state is defined as follows.

ρ=ψψ\rho = \vert\psi\rangle\langle\psi\vert

To be clear, we're multiplying a column vector to a row vector, so the result is a square matrix whose rows and columns correspond to Σ.\Sigma. Matrices of this form, in addition to being density matrices, are always projections and have rank equal to 1.1.

For example, let's define two qubit state vectors.

+i=120+i21=(12i2)i=120i21=(12i2)\begin{aligned} \vert {+i} \rangle & = \frac{1}{\sqrt{2}} \vert 0 \rangle + \frac{i}{\sqrt{2}} \vert 1 \rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] \frac{i}{\sqrt{2}} \end{pmatrix} \\[5mm] \vert {-i} \rangle & = \frac{1}{\sqrt{2}} \vert 0 \rangle - \frac{i}{\sqrt{2}} \vert 1 \rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] -\frac{i}{\sqrt{2}} \end{pmatrix} \end{aligned}

The density matrices corresponding to these two vectors are as follows.

+i+i=(12i2)(12i2)=(12i2i212)ii=(12i2)(12i2)=(12i2i212)\begin{aligned} \vert {+i} \rangle\langle{+i}\vert & = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] \frac{i}{\sqrt{2}}\end{pmatrix} \begin{pmatrix} \frac{1}{\sqrt{2}} & - \frac{i}{\sqrt{2}}\end{pmatrix} = \begin{pmatrix} \frac{1}{2} & -\frac{i}{2}\\[2mm] \frac{i}{2} & \frac{1}{2} \end{pmatrix}\\[5mm] \vert {-i} \rangle\langle{-i}\vert & = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] -\frac{i}{\sqrt{2}}\end{pmatrix} \begin{pmatrix} \frac{1}{\sqrt{2}} & \frac{i}{\sqrt{2}}\end{pmatrix} = \begin{pmatrix} \frac{1}{2} & \frac{i}{2}\\[2mm] -\frac{i}{2} & \frac{1}{2} \end{pmatrix} \end{aligned}

Here's a table listing these states along with a few other basic examples: 0,\vert 0\rangle, 1,\vert 1\rangle, +,\vert {+}\rangle, and .\vert {-}\rangle. We'll see these six states again later in the lesson.

State vectorDensity matrix
0=(10)\vert 0\rangle = \begin{pmatrix} 1 \\[1mm] 0 \end{pmatrix}00=(1000)\vert 0\rangle\langle 0\vert = \begin{pmatrix} 1 & 0\\[1mm] 0 & 0 \end{pmatrix}
1=(01)\vert 1\rangle = \begin{pmatrix} 0 \\[1mm] 1 \end{pmatrix}11=(0001)\vert 1\rangle\langle 1\vert = \begin{pmatrix} 0 & 0\\[1mm] 0 & 1 \end{pmatrix}
+=(1212)\vert {+}\rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] \frac{1}{\sqrt{2}} \end{pmatrix}++=(12121212)\vert {+}\rangle\langle {+}\vert = \begin{pmatrix} \frac{1}{2} & \frac{1}{2}\\[2mm] \frac{1}{2} & \frac{1}{2} \end{pmatrix}
=(1212)\vert {-} \rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] -\frac{1}{\sqrt{2}}\end{pmatrix}=(12121212)\vert {-}\rangle\langle {-}\vert = \begin{pmatrix} \frac{1}{2} & -\frac{1}{2}\\[2mm] -\frac{1}{2} & \frac{1}{2} \end{pmatrix}
+i=(12i2)\vert {+i} \rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] \frac{i}{\sqrt{2}} \end{pmatrix}+i+i=(12i21212)\vert {+i} \rangle\langle {+i} \vert = \begin{pmatrix} \frac{1}{2} & -\frac{i}{2}\\[2mm] \frac{1}{2} & \frac{1}{2} \end{pmatrix}
i=(12i2)\vert {-i} \rangle = \begin{pmatrix} \frac{1}{\sqrt{2}} \\[2mm] -\frac{i}{\sqrt{2}}\end{pmatrix}ii=(12i2i212)\vert {-i} \rangle\langle {-i} \vert = \begin{pmatrix} \frac{1}{2} & \frac{i}{2}\\[2mm] -\frac{i}{2} & \frac{1}{2} \end{pmatrix}

For one more example, here's a state from the Single systems lesson of the "Basics of quantum information" course, including both its state vector and density matrix representations.

v=1+2i30231vv=(5924i92+4i949)\vert v\rangle = \frac{1 + 2 i}{3}\,\vert 0\rangle - \frac{2}{3}\,\vert 1\rangle \qquad \vert v\rangle\langle v\vert = \begin{pmatrix} \frac{5}{9} & \frac{-2 - 4 i}{9}\\[2mm] \frac{-2 + 4 i}{9} & \frac{4}{9} \end{pmatrix}

Density matrices that take the form ρ=ψψ\rho = \vert \psi \rangle \langle \psi \vert for a quantum state vector ψ\vert \psi \rangle are known as pure states. Not every density matrix can be written in this form; some states are not pure.

As density matrices, pure states always have one eigenvalue equal to 11 and all other eigenvalues equal to 0.0. This is consistent with the interpretation that the eigenvalues of a density matrix describe the randomness or uncertainty inherent to that state. In essence, there's no uncertainty for a pure state ρ=ψψ\rho = \vert \psi \rangle \langle \psi \vert — the state is definitely ψ.\vert \psi \rangle.

In general, for a quantum state vector

ψ=(α0α1αn1)\vert\psi\rangle = \begin{pmatrix} \alpha_0\\ \alpha_1\\ \vdots\\ \alpha_{n-1} \end{pmatrix}

for a system with nn classical states, the density matrix representation of the same state is as follows.

ψψ=(α0α0α0α1α0αn1α1α0α1α1α1αn1αn1α0αn1α1αn1αn1)=(α02α0α1α0αn1α1α0α12α1αn1αn1α0αn1α1αn12)\begin{aligned} \vert\psi\rangle\langle\psi\vert & = \begin{pmatrix} \alpha_0 \overline{\alpha_0} & \alpha_0 \overline{\alpha_1} & \cdots & \alpha_0 \overline{\alpha_{n-1}}\\[1mm] \alpha_1 \overline{\alpha_0} & \alpha_1 \overline{\alpha_1} & \cdots & \alpha_1 \overline{\alpha_{n-1}}\\[1mm] \vdots & \vdots & \ddots & \vdots\\[1mm] \alpha_{n-1} \overline{\alpha_0} & \alpha_{n-1} \overline{\alpha_1} & \cdots & \alpha_{n-1} \overline{\alpha_{n-1}} \end{pmatrix}\\[10mm] & = \begin{pmatrix} \vert\alpha_0\vert^2 & \alpha_0 \overline{\alpha_1} & \cdots & \alpha_0 \overline{\alpha_{n-1}}\\[1mm] \alpha_1 \overline{\alpha_0} & \vert\alpha_1\vert^2 & \cdots & \alpha_1 \overline{\alpha_{n-1}}\\[1mm] \vdots & \vdots & \ddots & \vdots\\[1mm] \alpha_{n-1} \overline{\alpha_0} & \alpha_{n-1} \overline{\alpha_1} & \cdots & \vert\alpha_{n-1}\vert^2 \end{pmatrix} \end{aligned}

So, for the special case of pure states, we can verify that the diagonal entries of a density matrix describe the probabilities that a standard basis measurement would output each possible classical state.

A final remark about pure states is that density matrices eliminate the degeneracy concerning global phases found for quantum state vectors. Suppose we have two quantum state vectors that differ by a global phase: ψ\vert \psi \rangle and ϕ=eiθψ,\vert \phi \rangle = e^{i \theta} \vert \psi \rangle, for some real number θ.\theta. Because they differ by a global phase, these vectors represent exactly the same quantum state, despite the fact that the vectors may be different. The density matrices that we obtain from these two state vectors, on the other hand, are identical.

ϕϕ=(eiθψ)(eiθψ)=ei(θθ)ψψ=ψψ\vert \phi \rangle \langle \phi \vert = \bigl( e^{i\theta} \vert \psi \rangle \bigr) \bigl( e^{i\theta} \vert \psi \rangle \bigr)^{\dagger} = e^{i(\theta - \theta)} \vert \psi \rangle \langle \psi \vert = \vert \psi \rangle \langle \psi \vert

In general, density matrices provide a unique representation of quantum states: two quantum states are identical, generating exactly the same outcome statistics for every possible measurement that can be performed on them, if and only if their density matrix representations are equal. Using mathematical parlance, we can express this by saying that density matrices offer a faithful representation of quantum states.

Was this page helpful?
Report a bug or request content on GitHub.