# Expectation value of an observable containing a single projector vs Born rule for the projector

Suppose I have a state $$|\psi\rangle$$ and I want to estimate the probability of obtaining a computational basis state $$|x\rangle$$. Then by Born rule:

$$p(x) = |\langle x|\psi\rangle|^2 = Tr[|x\rangle \langle x|\psi\rangle \langle \psi|].$$

However, I could alternatively achieve the same by defining an observable $$O = |x\rangle\langle x|$$. This satisfies the definition of observable - $$O$$ is Hermitian; and the only projector $$|x\rangle\langle x|$$ is Hermitian and $$(|x\rangle\langle x|)^2 = |x\rangle\langle x|$$. So now I can calculate expectation value of the observable:

$$\langle O \rangle = Tr[O|\psi \rangle \langle \psi|] = Tr[|x\rangle \langle x|\psi\rangle \langle \psi|] = p(x).$$

Is this reasoning correct?

In fact, it can be generalized beyond pure states. By definition, every mixed quantum state $$\rho$$ is a positive semidefinite operator with unit trace. Since every positive semidefinite operator is Hermitian, we may interpret $$\rho$$ as an observable.
In this case, the expectation of observable $$\rho$$ in state $$\sigma$$
$$\langle\rho\rangle_\sigma = \mathrm{tr}(\rho\sigma) = \langle\sigma\rangle_\rho$$
is the Hilbert-Schmidt inner product of the two operators. Moreover, if one of the states is pure then $$\mathrm{tr}(\rho\sigma)$$ is the fidelity $$F(\rho, \sigma)$$ between $$\rho$$ and $$\sigma$$.