Solution (source code)

= Solution

If the preparation label $i$ is sampled with probability $p_i$ but is not supplied to the experimenter, the <quantum state ensemble> is represented by
$$
\boxed{\rho=\sum_{i=1}^n p_i|\psi_i\rangle\langle\psi_i|,\qquad
p_i\geq0,\quad\sum_i p_i=1.}
$$
For normalized states, this <density operator> is Hermitian, positive semidefinite and has trace one. The states in an ensemble need not be orthogonal or distinct. For any <quantum measurement> effect $E$, averaging the <Born rule> over the preparation label gives
$$
P(E)=\sum_i p_i\langle\psi_i|E|\psi_i\rangle=\operatorname{Tr}(E\rho).
$$
Thus the density operator summarizes all measurements performed on the prepared system alone. For an ensemble of mixed states $\rho_i$, the same reasoning gives $\rho=\sum_i p_i\rho_i$.