# How to measure the sign of quantum amplitudes

I have a quantum state on $$n$$ qubits ($$2^n$$ amplitudes) for which I know the amplitudes are real numbers. I want to take the state out as a vector. I can estimate the magnitude of the amplitudes by doing some measurements and taking the square root of the probabilities, but I loose the sign information.

What kind of measurements do I need to make to recover the sign information? I read a little about state tomography, but it looks really unpractical for $$n>2$$ (my scale is $$n > 10$$). Is there an easier way?

An empirical solution could be to use the Grover's Diffusion Operator $$D$$.

Lets say the qubits are in an initial state $$|\psi\rangle = \sum_{0}^{2^n-1}\alpha_i|i\rangle$$. Since global phase/sign is irrelevant. We can assume that phase/sign of $$\alpha_0$$ is + for the sake of convenience (If $$\alpha_0=0$$ choose the lowest index with non-zero amplitude).
We can find the constants $$|\alpha_i|\forall i$$ by taking square roots of probabilities and hence we can assume their knowledge.

Grover's Diffusion Operator maps $$|\psi\rangle = \sum_{0}^{2^n-1}\alpha_i|i\rangle$$ to $$D|\psi\rangle = \sum_{0}^{2^n-1}(2\mu-\alpha_i)|i\rangle$$ where $$\mu = \sum_{0}^{2^n-1}\alpha_i$$. We can find the probability distribution of this state and let us say we now also have knowledge of $$|2\mu-\alpha_i| \forall i$$

Using values of $$|\alpha_i|$$ and $$|2\mu-\alpha_i|$$ we get 4 possible values of $$\mu = \frac{\pm|\alpha_i| \pm|2\mu-\alpha_i|}{2}$$.

Remember we have $$2^n$$ values of $$i$$ each which can give us a group of $$4$$ possible values of $$\mu$$. We find the common value of $$\mu$$ across all these $$2^n$$ groups of $$4$$.

Since we assumed $$\alpha_0>0$$ we only get 2 possible values of $$\mu = \frac{|\alpha_i| \pm|2\mu-\alpha_i|}{2}$$ So at max there can only be $$2$$ values of $$\mu$$. Hopefully we have narrowed down to a single value of $$\mu\ne0$$. If we have then we can use it to easily calculated $$\alpha_i$$ from $$|\alpha_i|$$ and $$|2\mu-\alpha_i|$$ thus giving us the sign information for all $$i$$.

If $$\mu=0$$ or there are $$2$$ possible $$\mu$$ then we must modify the original state. A possible solution is too selectively flip the sign (using $$Controlled$$ $$Z$$ gates) if and only if the state is $$|j\rangle$$ for some $$j$$ which has an amplitude $$\alpha_j\ne0$$.
This will result in a new $$\mu'$$ which cannot be zero if $$\mu=0$$. Applying same procedure on this state will yield 1/2 value(s) which can be used to deduce original $$\mu$$. Since $$Z$$ gate only changes sign but not magnitude of amplitude the probability distributions will remain same.

I know this isn't a complete formal solution but hopefully it helps.

• Interesting approach. I tried it for 10 qubits. My first mean turned out to be close to 0 (0.0005) so I flipped the sign of the larges amplitude (|0>). This gave me a new mean ~ 0.001. Unfortunately with a large number of measurements (100k) I only got the sign right for ~80% of the relevant amplitudes (larger than 0.001). This is due to the intrinsic randomness of measurements. Jul 30, 2020 at 9:00
• That sounds very interesting. Did you write a program for this? I would love to play around with the code. Jul 31, 2020 at 10:46

Being restricted to real amplitudes means that you don't need to go for full on tomography. If you were looking at a single qubit, for example, to do full tomography with projective measurements, you'd need to make $$X$$, $$Y$$ and $$Z$$ measurements, while for the real-only version, you'd only need to make $$X$$ and $$Z$$ measurements.

The question, then, is what's a good tactic? It's not something I've thought/read about previously. Here's a couple of options depending on how complex you want to make your experiment:

• Hadamard every qubit and repeat your amplitude determination step. The results should be sufficient to reverse engineer the signs, it's "just" a classical computation (I make no promises that it's an easy computation).

• Assume the weights are $$\alpha_i^2$$, and that these are ordered. Apply a measurement with projectors onto states $$(|2n\rangle\pm|2n+1\rangle)/\sqrt{2}$$. Since $$\alpha_{2n}^2\approx\alpha_{2n+1}$$, it shouldn't take many measurements (relatively!) to determine the relative signs of the amplitudes $$\alpha_{2n},\alpha_{2n+1}$$. Repeat using projectors onto states $$(|2n\rangle\pm|2n-1\rangle)/\sqrt{2}$$ and that's enough to globally reconstruct the phases.

• I wonder if there's a smarter method, similar to the previous one, but incorporating a "divide and conquer" strategy where you group the amplitudes into two sets with total weights as close to 1/2 as possible. But I don't immediately see it...

• the answer of user1294287 looks plausible (aside from some normalisation issues), although I wonder what accuracy one has to achieve.