Hadamard test
In quantum computation, the Hadamard test is a method used to create a random variable whose expected value is the expected real part, where is a quantum state and is a unitary gate acting on the space of. The Hadamard test produces a random variable whose image is in and whose expected value is exactly. It is possible to modify the circuit to produce a random variable whose expected value is by applying an gate after the first Hadamard gate.
Description of the circuit
To perform the Hadamard test we first calculate the state. We then apply the unitary operator on conditioned on the first qubit to obtain the state. We then apply the Hadamard gate to the first qubit, yielding.Measuring the first qubit, the result is with probability, in which case we output. The result is with probability, in which case we output. The expected value of the output will then be the difference between the two probabilities, which is
To obtain a random variable whose expectation is follow exactly the same procedure but start with.
The Hadamard test has many applications in quantum algorithms such as the Aharonov-Jones-Landau algorithm.
Via a very simple modification it can be used to compute inner product between two states and : instead of starting from a state it suffice to start from the ground state, and perform two controlled operations on the ancilla qubit. Controlled on the ancilla register being, we apply the unitary that produces in the second register, and controlled on the ancilla register being in the state, we create in the second register. The expected value of the measurements of the ancilla qubits leads to an estimate of. The number of samples needed to estimate the expected value with absolute error is, because of a Chernoff bound. This value can be improved to using amplitude estimation techniques.