# Estimating imaginary part of an inner product of two quantum states

Suppose I want to estimate $$Im(\langle \psi_1\lvert \sigma_x\lvert \psi_2\rangle)$$ by using quantum circuit.

At first, I thought of using the Swap test, but since it gives $$|\langle \psi_1|\psi_2\rangle|^2$$, it won't give the imaginary part.

Then, I thought of Hadamard test + phase gate, which gives $$Im(\langle \psi \lvert U |\psi \rangle)$$, so that I have to find $$U = \sigma_x U'$$ where $$U'|\psi_2\rangle = |\psi_1\rangle$$. However, what if finding $$U'$$ is very complicated so that I want to avoid? Is there any clever way to estimate $$Im(\langle \psi_1\lvert \sigma_x\lvert \psi_2\rangle)$$?

• In which form are you given psi_1 and psi_2? Apr 15, 2022 at 17:22

In this article, an overlap estimation algorithm (OEA) algorithm is introduced, and it can help calculate $$Im(\langle\psi_1|\sigma_x|\psi_2\rangle)$$. I have verified the proposal long ago.

First, prepare the initial state $$|x\rangle=(|0\rangle|\psi_1\rangle-i|1\rangle|\psi_2^\prime\rangle)$$, where $$|\psi^\prime_2\rangle=\sigma_x|\psi_2\rangle$$. Then, apply $$H\otimes I$$.

Finally, measuring the ancilla qubit can give you the result. Denote the probability that the measurement obtains $$|1\rangle$$ as $$p_1$$, then $$Im(\langle\psi_1|\sigma_x|\psi_2\rangle)=2\times p_1-1$$.

• I agree that $p_1=\||\psi_1\rangle+i X|\psi_2\rangle\|^2$, which thus gives the stated overlap, but I think it's worth pointing out that this is not an overlap between quantum states. It's an overlap between classical vectors encoded (in a specific way) in the amplitudes of a two-qubit state
• not that it's clear from the OP, but I think the idea here is to compute the given overlap where $|\psi_i\rangle$ are not really quantum states, but rather just vectors encoded in the amplitudes of a state (where the "state" is the larger two-qubit one, so that one can effectively encode vectors with specific global phases in it). So it won't be possible to build a circuit taking as inputs $|\psi_i\rangle$ (as states) that gives the given quantity, as that wouldn't make sense for the reasons you point out. But you can do a circuit with inputs the vector components of the $|\psi_i\rangle$