Quantum Computing Master Course — 092. Density Matrices
Lesson 092: Density Matrices
Smartyfy Quantum Computing Master Course
Prerequisites and objectives
A density matrix summarizes every measurement prediction for a finite-dimensional quantum system. You will construct one from an ensemble, check its mathematical validity, use the trace form of the Born rule, and evolve it under a unitary. These skills replace informal pictures of mixtures with calculations that can be audited.
We write matrices as nested row lists. The qubit basis order is |0⟩,|1⟩. The symbol † means conjugate transpose, and Tr means the sum of diagonal entries.
Three validity checks
A valid density matrix ρ is Hermitian, has trace one, and is positive semidefinite. Hermitian means ρ†=ρ. Positive semidefinite means ⟨v|ρ|v⟩≥0 for every vector |v⟩, including unnormalized vectors.
For a Hermitian matrix, positivity is equivalent to every eigenvalue being nonnegative. Since the eigenvalues sum to the trace, a density matrix has eigenvalues between zero and one whose sum is one.
Some definitions include Hermiticity within the phrase positive semidefinite. We list it explicitly as a useful separate check. Nonnegative entries are neither required nor sufficient: off-diagonal entries may be negative or complex.
| Condition | Practical check | Statistical role |
|---|---|---|
| Hermitian | ρji=conjugate(ρij) | Real expectation values |
| Unit trace | Sum of diagonal entries is one | Normalized total probability |
| Positive semidefinite | All eigenvalues are nonnegative | No negative measurement probabilities |
Construct a complex pure-state matrix
Take |ψ⟩=(√3/2)|0⟩+(i/2)|1⟩. Its squared norm is 3/4+1/4=1. The outer product ρ=|ψ⟩⟨ψ| is [[3/4,−i√3/4],[i√3/4,1/4]].
The upper-right entry uses the conjugate of the second amplitude: (√3/2)(−i/2). Forgetting that conjugate would give the same sign in both off-diagonal entries and fail Hermiticity.
The trace is one. For any |v⟩, ⟨v|ρ|v⟩=|⟨ψ|v⟩|²≥0, proving positivity directly. The matrix has eigenvalue one along |ψ⟩ and zero along its orthogonal direction.
This outer product is a state representation, not a unitary gate. Applying it as a matrix to an arbitrary state would project toward |ψ⟩ and generally would not preserve norm.
Construct a nonorthogonal ensemble
Now prepare |0⟩ with probability 0.6 and |+⟩ with probability 0.4. The states in an ensemble need not be orthogonal. Adding their weighted outer products gives ρ=[[0.8,0.2],[0.2,0.2]].
The trace is one and the determinant is (0.8)(0.2)−(0.2)²=0.12. Its characteristic equation is λ²−λ+0.12=0, giving eigenvalues (1±√0.52)/2, approximately 0.860555 and 0.139445.
Both eigenvalues are positive, so the matrix is valid. Notice that they are not the ensemble weights 0.6 and 0.4. Only an orthonormal eigenvector ensemble directly identifies its weights with eigenvalues.
The computational measurement probabilities are 0.8 and 0.2. The plus probability is 0.6(1/2)+0.4(1)=0.7. These provide two independent checks on the matrix construction.
A useful qubit positivity criterion
Any Hermitian trace-one qubit matrix has the form [[a,c],[conjugate(c),1−a]], with a real. It is positive semidefinite exactly when 0≤a≤1 and |c|²≤a(1−a).
The last condition says its determinant is nonnegative. Together with nonnegative diagonal entries, this is sufficient for a two-by-two Hermitian matrix. Do not generalize the single determinant check as a complete positivity test in arbitrary dimensions.
For the complex pure example, |c|²=3/16 and a(1−a)=3/16, saturating the bound. For the ensemble example, |c|²=0.04 is less than 0.16, consistent with both eigenvalues being strictly positive.
Trace and Hermiticity alone are not enough
Consider T=[[0.5,0.8],[0.8,0.5]]. It is Hermitian and has trace one, but its eigenvalues are 1.3 and −0.3. It cannot represent a state.
The normalized vector |−⟩ is an eigenvector with eigenvalue −0.3, so the proposed probability ⟨−|T|−⟩ would be negative. This is an operational reason to reject the matrix, rather than just a formal rule violation.
Conversely, a matrix with positive diagonal entries can still fail Hermiticity. For [[0.5,i/4],[i/4,0.5]], the lower-left entry is not the conjugate of the upper-right entry. Correct total population does not repair inconsistent coherence entries.
Measurement probabilities in trace form
For a projective yes-or-no measurement with projector P, the yes probability is Tr(Pρ). A projector obeys P†=P and P²=P. For a one-dimensional outcome P=|v⟩⟨v|, this equals ⟨v|ρ|v⟩.
To see the ensemble connection, substitute ρ=Σk pk|ψk⟩⟨ψk|. Linearity of the trace yields Σk pk⟨ψk|P|ψk⟩, exactly the classical average of each preparation’s Born probability.
For a complete set of mutually orthogonal projectors summing to I, the outcome probabilities sum to Tr(ρ)=1. Positivity guarantees they are nonnegative. These two validity conditions therefore have direct measurement meaning.
Unitary evolution acts on both sides
If the same unitary U is applied to every preparation, each outer product becomes U|ψk⟩⟨ψk|U†. Summing gives the rule ρ→UρU†. Multiplying on only one side is not the density-matrix evolution rule.
For the ensemble matrix above, applying X swaps the basis labels and produces [[0.2,0.2],[0.2,0.8]]. The trace and eigenvalues stay unchanged, while computational measurement probabilities swap.
More general noise and measurement updates need additional mathematical maps, introduced later. Knowing a matrix is valid does not by itself tell us which physical preparation or channel produced it.
Four exercises with worked solutions
-
Is [[0.7,0.1i],[−0.1i,0.3]] a valid density matrix?
Solution. It is Hermitian and has trace one. Its diagonal entries are nonnegative, and |c|²=0.01≤0.7×0.3=0.21. The qubit criterion proves positivity, so it is valid.
-
Why is [[0.5,0.6],[0.6,0.5]] invalid?
Solution. Its eigenvalues are 0.5±0.6, namely 1.1 and −0.1. Equivalently, its determinant is −0.11. Trace one and Hermiticity do not compensate for the negative eigenvalue.
-
For the 0.6|0⟩,0.4|+⟩ ensemble, calculate the minus probability.
Solution. The |0⟩ component contributes 0.6×1/2=0.3, while |+⟩ contributes zero. The answer is 0.3, complementary to the plus probability 0.7.
-
What does a global phase on U do to UρU†?
Solution. Replacing U by e^(iγ)U introduces conjugate factors on the two sides. They cancel, leaving the same evolved density matrix.
Five explained multiple-choice questions
-
Positive semidefinite means: A. Every matrix entry is positive. B. Every diagonal entry is nonnegative, with no other condition. C. Every vector expectation is nonnegative. D. The determinant alone is positive in every dimension.
Answer: C. This condition ensures nonnegative probabilities in every measurement direction.
-
The density matrix of a pure vector is: A. |ψ⟩⟨ψ|. B. ⟨ψ|ψ⟩ alone. C. The outer product without conjugating the row. D. A diagonal matrix of basis probabilities only.
Answer: A. Its outer product supplies both populations and phase-sensitive entries.
-
The example ensemble has eigenvalues equal to its preparation weights: A. Necessarily for every ensemble. B. Only because its states overlap. C. Whenever the trace is one. D. No; its eigenvalues are approximately 0.860555 and 0.139445.
Answer: D. Nonorthogonal ensemble components are not an eigenbasis.
-
A projective outcome probability is: A. Tr(ρ) regardless of outcome. B. Tr(Pρ). C. The determinant of Pρ. D. The sum of all matrix entries without a projector.
Answer: B. The projector identifies the measured outcome subspace.
-
Unitary evolution of ρ is: A. UρU†. B. Uρ only. C. ρU only. D. UρU without conjugation.
Answer: A. Both the ket and bra factors evolve consistently.
Pitfalls and summary
Check Hermiticity, trace, and positivity separately; conjugate the bra correctly; and distinguish ensemble weights from eigenvalues. The trace Born rule and two-sided unitary update then provide a consistent calculation framework.
Primary sources and further study
These sources support the definitions and context. The numerical examples, exercises, and explanations here were prepared for this lesson. Research papers are optional advanced reading.