Solution (source code)

= Solution

Write $\rho_1=|\psi\rangle\langle\psi|$ and $\rho_2=|\varphi\rangle\langle\varphi|$. A pure-state <density matrix> is a rank-one <orthogonal projector>, so $\rho_1^{1/2}=\rho_1$ and
$$
\rho_1\rho_2\rho_1=|\langle\psi|\varphi\rangle|^2\rho_1.
$$
Taking its square root and <trace> yields the unsquared <quantum fidelity>
$$
F=|\langle\psi|\varphi\rangle|.
$$
Use <unitary invariance of trace distance and fidelity> to choose a basis of the span of the two <quantum states> in which $|\psi\rangle=|0\rangle$ and $|\varphi\rangle=c|0\rangle+s|1\rangle$, with $c=F\ge0$ and $s=\sqrt{1-c^2}\ge0$. Choosing state-vector phases to make the coefficients nonnegative does not change either <density matrix>. On that span,
$$
\rho_1-\rho_2=\begin{pmatrix}s^2&-cs\\-cs&-s^2\end{pmatrix},\qquad (\rho_1-\rho_2)^2=s^2I.
$$
Its <eigenvalues> are $s$ and $-s$, with zero <eigenvalues> on the orthogonal complement. The positive square root of $\Delta^\dagger\Delta$ therefore has two <eigenvalues> $s$, so the <trace distance> is $(s+s)/2=s$. Thus the <pure-state trace distance and fidelity identity> is
$$
\boxed{D(\rho_1,\rho_2)=\sqrt{1-F(\rho_1,\rho_2)^2}.}
$$
Identical <pure quantum states> give $F=1,D=0$; orthogonal <pure quantum states> give $F=0,D=1$. If the span is one-dimensional, the identical-state result follows directly, so no second basis vector is required. This formula uses the unsquared fidelity convention in the paper; if fidelity denotes squared overlap instead, the square inside the formula is omitted.