# Variance of an Overlap Between States: Bra-Ket Notation?

Imagine two eigenstates of a system $$|0\rangle$$ and $$|1\rangle$$, and suppose you manage to prepare your system in the superposition $$|\psi_{in}\rangle = (|0\rangle + |1\rangle)/\sqrt{2}$$. After some time, the system evolves naturally to the state $$|\psi_{out}\rangle = (|0\rangle + e^{i\phi}|1\rangle)/\sqrt{2}$$. The probability of the output being the same as the input is $$p(\phi) = |\langle \psi_{in}|\psi_{out} \rangle|^2$$.

I'm reading a paper that claims we can estimate this quantity with a statistical error (meaning variance) of $$\Delta^2p(\phi) = \langle \psi_{out}| \left( |\psi_{in}\rangle \langle \psi_{in}| \right)^2 |\psi_{out}\rangle - p^2(\phi)$$. Can anyone tell me where this expression comes from? Maybe I'm missing something obvious, but it's not clear how this relates to any of the usual expressions I know for variance or standard deviation.

The variance of an operator $$\hat A$$ is $$\langle \psi| \hat A ^2 |\psi\rangle - \langle \psi | \hat A |\psi\rangle^2 ,$$ as in statistics, $$\overline{A^2}-\bar {A}^2$$. You have used this in the uncertainty principle.
Your operator $$\hat A$$ here, however, is a projector, $$P=|\psi_{in}\rangle \langle \psi_{in}|=P^2$$, yielding $$p-p^2$$.
So $$(\tfrac{1}{2}\sin \phi)^2$$. Which paper?