# How do you test a pair of unknown qubits for orthogonality with certainty?

If you want to check if a pair of unknown qubits are the same, a standard test is the controlled SWAP test. This gives a result of 0 with certainty if the states are the same and 1 with a 50% chance if the states are orthogonal. The resulting probability distribution can also be used to approximate fidelity, etc.

Is there a/what is the equivalent test to determine orthogonality with certainty, i.e. giving a result of 0 with certainty if the states are orthogonal and 1 with some probability if the states are identical?

Alternatively, is there a more balanced test, which gives the same (lower than 50%) error in detecting either orthogonality or similarity?

Obviously, one opton is to carry out state tomography on each qubit to get their mathematical descriptions and calculate the orthogonality/fidelity accordingly, but this may not be the best solution in terms of copies required for a given accuracy.

It is not possible for a measurement to deterministically give one outcome or the other depending on whether two states are equal or orthogonal. Such a measurement would be some two-outcome POVM $$\mu$$ such that $$\langle\mu(\text{yes}),\rho\otimes\rho\rangle=1, \qquad \langle\mu(\text{no}),\rho\otimes\sigma\rangle=1,$$ for all states $$\rho$$ and $$\sigma$$ with $$\langle\sigma,\rho\rangle=0$$.
This would imply, in particular, that $$\langle \mu(\text{yes}),\mathbb P_0\otimes \mathbb P_0\rangle =\langle \mu(\text{yes}),\mathbb P_1\otimes \mathbb P_1\rangle =1,\\ \langle \mu(\text{yes}),\mathbb P_0\otimes \mathbb P_1\rangle =\langle \mu(\text{yes}),\mathbb P_1\otimes \mathbb P_0\rangle =0, \\ 1 = \langle \mu(\text{yes}),\mathbb P_+\otimes \mathbb P_+\rangle = \frac12 + \frac14 \langle\mu(\text{yes}),I\otimes X+X\otimes I\rangle, \\ 1 = \langle \mu(\text{yes}),\mathbb P_-\otimes \mathbb P_-\rangle = \frac12 - \frac14 \langle\mu(\text{yes}),I\otimes X+X\otimes I\rangle,$$ where I'm using the shorthand notation $$\mathbb P_\psi\equiv|\psi\rangle\!\langle\psi|$$, and $$X\equiv|0\rangle\!\langle1|+|1\rangle\!\langle0|$$.
The last two conditions are clearly inconsistent, as summing them we'd get $$2=1$$, thus no such measurement can exist.
A measurement that always gives the outcome "yes" when the input has the form $$\rho\otimes \rho$$ is possible, for example, the trivial "measurement" that always returns "yes". But this clearly will not correctly classify orthogonal input states.