# Finding a basis for quantum measurement with maximum distinguishability

I wish to find a basis state for the quantum measurement of two states which provides the maximum possible distinguishability. In this example let's say we wish to find the best basis ($|\psi\rangle$) to distinguish between $|0\rangle$ and $|+\rangle$.

My approach was to generalize the quantum states as density matrices:

$\rho_+=|+\rangle\langle+|=\frac{1}{\sqrt{2}}\pmatrix{1\cr1}\frac{1}{\sqrt{2}}\pmatrix{1&1}=\frac{1}{2}\pmatrix{1&1\cr1&1}$

$\rho_0=|0\rangle\langle0|=\pmatrix{1\cr0}\pmatrix{1&0}=\pmatrix{1&0\cr0&0}$

$\rho_{\psi}=\frac{1}{2}\left(I+r_x\pmatrix{0&1\cr1&0}+r_y\pmatrix{0&-i\cr{i}&0}+r_z\pmatrix{1&0\cr0&-1}\right)=\frac{1}{2}\pmatrix{1+r_z&r_x-ir_y\cr{r_x+ir_y}&1-r_z}$

$\left|\vec{r}\right|\le1$

My next step was to maximize the difference in quantum fidelity, which I assume is calculated as:

$\Delta Fidelity=p_\psi\left(|+\rangle\right)-p_\psi\left(|0\rangle\right)=|\langle+|\psi\rangle|^2-|\langle0|\psi\rangle|^2=tr\left(\rho_+\rho_\psi\right)-tr\left(\rho_0\rho_\psi\right)$

$\rho_+\rho_\psi=\frac{1}{2}\pmatrix{1&1\cr1&1}\frac{1}{2}\pmatrix{1+r_z&r_x-ir_y\cr{r_x+ir_y}&1-r_z}=\frac{1}{4}\pmatrix{1+r_x+ir_y+r_z&1+r_x-ir_y-r_z\cr1+r_x+ir_y+r_z&1+r_x-ir_y-r_z}$

$tr\left(\rho_+\rho_\psi\right)=\frac{1}{2}\left(1+r_x\right)$

$\rho_0\rho_\psi=\pmatrix{1&0\cr0&0}\frac{1}{2}\pmatrix{1+r_z&r_x-ir_y\cr{r_x+ir_y}&1-r_z}=\frac{1}{2}\pmatrix{1+r_z&r_x-ir_y\cr0&0}$

$tr\left(\rho_0\rho_\psi\right)=\frac{1}{2}\left(1+r_z\right)$

As far as I can tell, the work so far looks right, since a density matrix with $r_x=1$ and $r_x=r_y=0$ is the density matrix of state $|+\rangle$, same for $|0\rangle$. This next part is where I get stuck. I try to find the basis state which maximizes distinguishably by finding the quantum state which results in the largest difference in fidelity:

$\Delta Fidelity=\frac{1}{2}\left(1+r_x\right)-\frac{1}{2}\left(1+r_z\right)=\frac{1}{2}\left(r_x-r_z\right)$

I know the correct answer here is $|\psi\rangle=\frac{|+\rangle+|0\rangle}{2cos\left(\frac{\pi}{8}\right)}$, which is a quantum state where $r_x=\frac{1}{\sqrt{2}}$ and $r_z=\frac{1}{\sqrt{2}}$. This quantum state has a fidelity of 0.854 with $|+\rangle$ and a fidelity of 0.146 with $|0\rangle$. However, I coudld not have gotten to this answer with $\Delta Fidelity=\frac{1}{2}\left(r_x-r_z\right)$, since that equation would have led me to picking $r_x=1$ and $r_z=0$ (which is $|+\rangle$) as a measurement basis.

I'm wondering what it is I missed here?

I figured out what I missed. $\Delta Fidelity=\frac{1}{2}\left(r_x-r_z\right)$ is indeed correct. However, what I missed was the fact that $r_z$ could be less than 0, since the only requirement is that $\left|\vec{r}\right|\le1$. Therefore, to achieve the maximum value of $\Delta Fidelity$, we set $r_x=\frac{1}{\sqrt{2}}$ and $r_z=-\frac{1}{\sqrt{2}}$. This means the actual correct answer is $|\psi\rangle=\frac{|+\rangle+|1\rangle}{2cos\left(\frac{\pi}{8}\right)}$, because a density matrix with $r_z=-1$ and $r_x=r_y=0$ is the density matrix of the $|1\rangle$ state, and the state $|\psi\rangle$ is a midway state between $|+\rangle$ and $|1\rangle$.