In quantum computation, the Hadamard test is a method used to create a random variable whose expected value is the expected real part of the observed value of a quantum state with respect to some unitary operator.[1]

Let ${\displaystyle \left|\psi \right\rangle }$ be a state which can be efficiently generated, and let ${\displaystyle U}$ be a unitary gate. The Hadamard test produces a random variable whose image is in ${\displaystyle \{\pm 1\}}$ and whose expected value is exactly ${\displaystyle \mathrm {Re} \left\langle \psi \mid U\mid \psi \right\rangle }$. A variant of the test produces a random variable whose expected value is ${\displaystyle \mathrm {Im} \left\langle \psi \mid U\mid \psi \right\rangle }$.[1]

To perform the Hadamard test we first calculate the state ${\displaystyle {\frac {1}{\sqrt {2}}}\left(\left|0\right\rangle +\left|1\right\rangle \right)\otimes \left|\psi \right\rangle }$. We then apply the unitary operator on ${\displaystyle \left|\psi \right\rangle }$ conditioned on the first qubit to obtain the state ${\displaystyle {\frac {1}{\sqrt {2}}}\left(\left|0\right\rangle \otimes \left|\psi \right\rangle +\left|1\right\rangle \otimes U\left|\psi \right\rangle \right)}$. We then apply the Hadamard gate to the first qubit, yielding ${\displaystyle {\frac {1}{2}}\left(\left|0\right\rangle \otimes (I+U)\left|\psi \right\rangle +\left|1\right\rangle \otimes (I-U)\left|\psi \right\rangle \right)}$.

Measuring the first qubit, the result is ${\displaystyle \left|0\right\rangle }$ with probability ${\displaystyle {\frac {1}{4}}\left\langle \psi \mid (I+U^{\dagger })(I+U)\mid \psi \right\rangle }$, in which case we output ${\displaystyle 1}$. The result is ${\displaystyle \left|1\right\rangle }$ with probability ${\displaystyle {\frac {1}{4}}\left\langle \psi \mid (I-U^{\dagger })(I-U)\mid \psi \right\rangle }$, in which case we output ${\displaystyle -1}$. The expected value of the output will then be the difference between the two probabilities, which is ${\displaystyle {\frac {1}{2}}\left\langle \psi \mid (U^{\dagger }+U)\mid \psi \right\rangle =\mathrm {Re} \left\langle \psi \mid U\mid \psi \right\rangle }$

To obtain a random variable whose expectation is ${\displaystyle \mathrm {Im} \left\langle \psi \mid U\mid \psi \right\rangle }$ follow exactly the same procedure but start with ${\displaystyle {\frac {1}{\sqrt {2}}}\left(\left|0\right\rangle -i\left|1\right\rangle \right)\otimes \left|\psi \right\rangle }$.

The Hadamard test has many applications in quantum algorithms such as the Aharonov-Jones-Landau algorithm.

References

1. ^ a b Dorit Aharonov Vaughan Jones, Zeph Landau (2009). "A Polynomial Quantum Algorithm for Approximating the Jones Polynomial". Algorithmica. 55 (3): 395–421. arXiv:quant-ph/0511096. doi:10.1007/s00453-008-9168-0.