# Homodyne detection source code question

Hello I had some questions on how strawberry fields implements homodyne detection in the Fock backend. In particular when the final projector is constructed. Once the homodyne sample is generated from the probability distribution the variable inf_squeezed_vac is created which I assume is the ket for an approximate infinitely squeezed vacuum state. I assume this is meant to serve as an approximation for the |0\rangle eigenstate of the quadrature being measured. This state is then displaced by alpha = homodyne_sample * sqrt(m_omega_over_hbar / 2) to make it into an approximation of the eigenstate that was actually sampled. What is confusing to me is when the final projector is created it is created as projector = np.outer(vac_state, eigenstate.conj()) where vac_state is the vacuum state and eigenstate is the eigenstate of the quadrature we measured the mode to be in. However this is confusing because this means the projector is of the form |0\rangle \langle \alpha| when I would have thought it would be of the form |\alpha\rangle \langle \alpha|, |\alpha\rangle of course being the eigenstate of the quadrature we sampled. Iām wondering why the vacuum state is used here? And if there are any resources that could be referenced for the implementation of this function?

Hey @Amanuel! Welcome back

Sorry for the late response! I had to ask a colleague for help on this one and here is what they said:

This is the Kraus operator associated with a measurement. What this means is that after you apply that the Kraus operator onto the state, it maps the state to vacuum:

K |\psi\rangle = |0\rangle \langle \text{hom} | \psi \rangle \propto |0\rangle

This is simply because measurements in quantum optics are destructive, meaning once you measure a mode, that mode is now in vacuum.

Note that the way to construct the POVM element (i.e. the projection operator used to compute probabilities of measurement outcomes) is by taking the product of the Kraus operator with its dagger:

|\text{hom}\rangle \langle\text{hom}| = K^\dagger K = |\text{hom} \rangle \langle 0|0 \rangle \langle \text{hom}| \\ \text{Tr}(K^\dagger K |\psi\rangle \langle \psi|) = |<\text{hom}|\psi\rangle|^2 = \text{prob}_\text{hom}

So it does ultimately still agree with what your intuition was.

Let me know if that makes sense!

Thanks for the reply @isaacdevlugt, that all makes sense!

1 Like

Awesome! Glad we were able to help