Hadamard test

From HandWiki
Short description: Technique in quantum computation
Circuit for the 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 Re⟨ψ|U|ψ⟩, where |ψ⟩ is a quantum state and U is a unitary gate acting on the space of |ψ⟩.[1] The Hadamard test produces a random variable whose image is in {±1} and whose expected value is exactly Re⟨ψ|U|ψ⟩. It is possible to modify the circuit to produce a random variable whose expected value is Im⟨ψ|U|ψ⟩ by applying an S† gate after the first Hadamard gate.[1]

Description of the circuit

To perform the Hadamard test we first calculate the state 12(|0⟩+|1⟩)⊗|ψ⟩. We then apply the unitary operator on |ψ⟩ conditioned on the first qubit to obtain the state 12(|0⟩⊗|ψ⟩+|1⟩⊗U|ψ⟩). We then apply the Hadamard gate to the first qubit, yielding 12(|0⟩⊗(I+U)|ψ⟩+|1⟩⊗(I−U)|ψ⟩).

Measuring the first qubit, the result is |0⟩ with probability 14⟨ψ|(I+U†)(I+U)|ψ⟩, in which case we output 1. The result is |1⟩ with probability 14⟨ψ|(I−U†)(I−U)|ψ⟩, in which case we output −1. The expected value of the output will then be the difference between the two probabilities, which is 12⟨ψ|(U†+U)|ψ⟩=Re⟨ψ|U|ψ⟩

To obtain a random variable whose expectation is Im⟨ψ|U|ψ⟩ follow exactly the same procedure but start with 12(|0⟩−i|1⟩)⊗|ψ⟩.[2]

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 |ϕ1⟩ and |ϕ2⟩:[3] instead of starting from a state |ψ⟩ it suffice to start from the ground state |0⟩, and perform two controlled operations on the ancilla qubit. Controlled on the ancilla register being |0⟩, we apply the unitary that produces |ϕ1⟩ in the second register, and controlled on the ancilla register being in the state |1⟩, we create |ϕ2⟩ in the second register. The expected value of the measurements of the ancilla qubits leads to an estimate of ⟨ϕ1|ϕ2⟩. The number of samples needed to estimate the expected value with absolute error ϵ is O(1ϵ2), because of a Chernoff bound. This value can be improved to O(1ϵ) using amplitude estimation techniques.[3]

References

  1. ↑ 1.0 1.1 Dorit Aharonov Vaughan Jones, Zeph Landau (2009). "A Polynomial Quantum Algorithm for Approximating the Jones Polynomial". Algorithmica 55 (3): 395–421. doi:10.1007/s00453-008-9168-0. 
  2. ↑ quantumalgorithms.org - Hadamard test. Open Publishing. https://quantumalgorithms.org/chapter-intro.html#hadamard-test. Retrieved 27 February 2022. 
  3. ↑ 3.0 3.1 quantumalgorithms.org - Modified hadamard test. Open Publishing. https://quantumalgorithms.org/chapter-intro.html#modified-hadamard-test. Retrieved 27 February 2022. 

,