Solution (source code)

= Solution

The <Schmidt decomposition theorem> says that a normalized vector in the <tensor product> of two finite-dimensional <Hilbert spaces> can be written
$$
|\psi\rangle=\sum_{j=1}^r\sqrt{\lambda_j}\,|u_j\rangle\otimes|v_j\rangle,\qquad
\lambda_j>0,\quad\sum_{j=1}^r\lambda_j=1,\quad r\leq n_1,
$$
where both families are orthonormal. The numbers $\sqrt{\lambda_j}$ are its <Schmidt coefficients>. The <Schmidt rank> $r$ and coefficients, including multiplicities, are uniquely determined by the state; the local vectors may be changed within degenerate eigenspaces and by compensating phases. Zero coefficients may be appended to make $n_1$ terms, since $n_2\geq n_1$.

For a proof, form the <reduced density matrix> $\rho_1=\operatorname{Tr}_2|\psi\rangle\langle\psi|$. It is a <Hermitian matrix> that is <positive semidefinite>, with <trace> one. The <spectral theorem> supplies an <orthonormal basis> $u_1,\ldots,u_{n_1}$ of <eigenvectors> with nonnegative <eigenvalues> $\lambda_j$. Define the unnormalized relative vectors in the second <Hilbert space> by
$$
|w_j\rangle=(\langle u_j|\otimes I)|\psi\rangle.
$$
Completeness of the first <orthonormal basis> gives $|\psi\rangle=\sum_j|u_j\rangle|w_j\rangle$. In any <orthonormal basis> $e_b$ of the second factor, the definition of the <partial trace> gives
$$
\langle w_i|w_j\rangle
=\sum_b\langle\psi|u_i,e_b\rangle\langle u_j,e_b|\psi\rangle
=\langle u_j|\rho_1|u_i\rangle
=\lambda_i\delta_{ij}.
$$
Thus a zero <eigenvalue> gives $w_j=0$, and for each positive <eigenvalue> the vector $v_j=w_j/\sqrt{\lambda_j}$ has unit norm. Distinct such vectors are orthogonal by the same identity. Substituting them gives the required <Schmidt decomposition>, with at most $n_1$ nonzero terms.

Taking the other <partial trace> now gives
$$
\rho_1=\sum_{j=1}^r\lambda_j|u_j\rangle\langle u_j|,\qquad
\rho_2=\sum_{j=1}^r\lambda_j|v_j\rangle\langle v_j|.
$$
Therefore \b[the two reduced density matrices have identical nonzero eigenvalues, namely the squared Schmidt coefficients]. This also proves uniqueness of the coefficient multiset and shows that the <pure state> is a <product state> exactly when $r=1$.