A key aspect of density matrices is that probabilistic selections of quantum states are represented by convex combinations of their associated density matrices.
For example, if we have two density matrices, ρ and σ, representing quantum states of a system X, and we prepare the system in the state ρ with probability p and σ with probability 1−p, then the resulting quantum state is represented by the density matrix
pρ+(1−p)σ.
More generally, if we have m quantum states represented by density matrices ρ0,…,ρm−1, and a system is prepared in the state ρk with probability pk for some probability vector (p0,…,pm−1), the resulting state is represented by the density matrix
k=0∑m−1pkρk.
This is a convex combination of the density matrices ρ0,…,ρm−1.
It follows that if we have m quantum state vectors ∣ψ0⟩,…,∣ψm−1⟩, and we prepare a system in the state ∣ψk⟩ with probability pk for each k∈{0,…,m−1}, the state we obtain is represented by the density matrix
k=0∑m−1pk∣ψk⟩⟨ψk∣.
For example, if a qubit is prepared in the state ∣0⟩ with probability 1/2 and in the state ∣+⟩ with probability 1/2, the density matrix representation of the state we obtain is given by
is not a valid quantum state vector because its Euclidean norm is not equal to 1.
A more extreme example that shows that this doesn't work for quantum state vectors is that we fix any quantum state vector ∣ψ⟩ that we wish, and then we take our state to be ∣ψ⟩ with probability 1/2 and −∣ψ⟩ with probability 1/2.
These states differ by a global phase, so they're actually the same state — but averaging gives us the zero vector, which is not a valid quantum state vector.
Suppose we set the state of a qubit to be ∣0⟩ or ∣1⟩ randomly, each with probability 1/2.
The density matrix representing the resulting state is as follows.
(In this equation the symbol I denotes the 2×2 identity matrix.)
This is a special state known as the completely mixed state.
It represents complete uncertainty about the state of a qubit, similar to a uniform random bit in the probabilistic setting.
Now suppose that we change the procedure: in place of the states ∣0⟩ and ∣1⟩ we'll use the states ∣+⟩ and ∣−⟩.
We can compute the density matrix that describes the resulting state in a similar way.