Solution (source code)

= Solution

For a <positive operator> $A$, the <spectral theorem> writes $A=\sum_j a_j|j\rangle\langle j|$ with $a_j\ge0$. Hence its unique <positive square root of an operator> is $\sqrt A=\sum_j\sqrt{a_j}|j\rangle\langle j|$. Conjugating this spectral decomposition shows $\sqrt{UAU^\dagger}=U\sqrt A U^\dagger$ for a <unitary operator> $U$.

Let $\Delta=\rho_1-\rho_2$ and $\rho_i'=U\rho_iU^\dagger$. Then $\Delta'=U\Delta U^\dagger$ and $(\Delta')^\dagger\Delta'=U\Delta^\dagger\Delta U^\dagger$. The square-root covariance and the <cyclic property of the trace> give
$$
D(\rho_1',\rho_2')=\frac12\operatorname{Tr}\!\left(U\sqrt{\Delta^\dagger\Delta}\,U^\dagger\right)=\frac12\operatorname{Tr}\sqrt{\Delta^\dagger\Delta}=D(\rho_1,\rho_2).
$$
For the <quantum fidelity>, covariance first gives $(\rho_1')^{1/2}=U\rho_1^{1/2}U^\dagger$. Therefore
$$
(\rho_1')^{1/2}\rho_2'(\rho_1')^{1/2}=U\bigl(\rho_1^{1/2}\rho_2\rho_1^{1/2}\bigr)U^\dagger.
$$
Apply the same square-root identity and the <cyclic property of the trace> to obtain
$$
F(\rho_1',\rho_2')=\operatorname{Tr}\!\left(U\sqrt{\rho_1^{1/2}\rho_2\rho_1^{1/2}}\,U^\dagger\right)=F(\rho_1,\rho_2).
$$
Thus <unitary invariance of trace distance and fidelity> gives
$$
\boxed{D(U\rho_1U^\dagger,U\rho_2U^\dagger)=D(\rho_1,\rho_2),\qquad F(U\rho_1U^\dagger,U\rho_2U^\dagger)=F(\rho_1,\rho_2).}
$$
The same $U$ acts on both <quantum states>: these quantities depend on the relative distinguishability of the <quantum states>, not on a choice of basis.