# How to show that the trace distance equals the maximal total variation distance?

Let $$\rho$$ and $$\sigma$$ be two density operators such that probability of obtaining $$a$$ is $$tr(\rho E_a)$$ if the state before measurement was $$\rho$$ and $$tr(\sigma E_a)$$ if the state before measurement was $$\sigma$$, where $$E_a$$'s are 1-dim orthogonal projectors with $$\sum_a E_a=I$$. In that case we have $$$$d(p,q)=\sum_a|p_a-q_a|\leq||ρ-σ||_1=d(ρ,σ)$$$$ How should I proceed to find the optimal set of projectors $$E_a$$'s such that the inequality in the above equation becomes an equality?

You're essentially asking how to prove one of the characterisations of the trace distance: given any pair of states $$\rho,\sigma$$, you have $$\|\rho-\sigma\|_1 = \max_{P}\operatorname{tr}[P(\rho-\sigma)],$$ with the maximisation performed with respect to all Hermitian operators $$P$$ such that $$0\le P\le I$$. Equivalently, the optimisation is performed with respect to all projections $$P$$.
You can find the complete proof in the Wikipedia article. For what concerns finding the maximum, you simply need to use as $$P$$ the projection onto the subspace spanning the positive eigenvalues of $$\rho-\sigma$$. With this choice, call it $$P^*$$, you have $$\operatorname{tr}[P^*(\rho-\sigma)] = \sum_k \lambda_k^+$$ with $$\lambda_k^+$$ the positive eigenvalues of $$\rho-\sigma$$. Because $$\operatorname{tr}(\rho-\sigma)=0$$, the sum of all eigenvalues vanishes, hence $$\sum_k\lambda_k^+=-\sum_k\lambda_k^-$$ with $$\lambda_k^-<0$$ the negative eigenvalues, and therefore the trace distance, which equals in general (for Hermitian operators) the sum of the absolute values of the eigenvalues, reads $$\|\rho-\sigma\|_1 = \sum_k |\lambda_k|= \sum_k \lambda_k^+ - \sum_k \lambda_k^- = 2 \sum_k \lambda_k^+ = 2\operatorname{tr}[P^*(\rho-\sigma)].$$
The answer to your question follows immediately from this, because the total variation distance, which is (modulo a factor of 2) the LHS in your equation, equals half of $$\operatorname{tr}[P^*(\rho-\sigma)]$$, again because $$\sum_a (p_a-q_a)=0$$.