Solution (source code)

= Solution

A <quantum state ensemble> of normalized states $|\psi_i\rangle$, with <probabilities> $p_i\ge0$ and $\sum_i p_i=1$, has <density operator>
$$
\boxed{\rho=\sum_i p_i|\psi_i\rangle\langle\psi_i|.}
$$
It is a <positive semidefinite> <Hermitian operator> with <trace> one, and the <Born rule> assigns a measurement outcome with projector $\Pi$ the <probability> $\operatorname{Tr}(\rho\Pi)$.

A <pure state> has $\rho=|\psi\rangle\langle\psi|$, hence $\rho^2=\rho$ and <purity of a density operator> $\operatorname{Tr}(\rho^2)=1$. Its only nonzero <eigenvalue> is one. A <mixed state> has at least two nonzero <eigenvalues> and $\operatorname{Tr}(\rho^2)<1$. The <spectral theorem> proves the converse criteria, since the nonnegative <eigenvalues> sum to one. Different <quantum state ensembles> may give the same <density operator>; the mere presence of several terms in a preparation list does not make the state mixed if all positive-weight terms represent the same <quantum state ray>.