TransWikia.com

A CNOT between two Hadamard gates: why does the CNOT changed the output of the second Hadamard gate?

Quantum Computing Asked by Devymex on March 3, 2021

Applying the Hadamard gate twice in a row, it restores the original input:
Two Hadamard gayes

https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22H%22]]}

However, if a CNOT control is added between the two Hadamard gates, the output of the second Hadamard gate changes:

A CxNOT gate

https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22%E2%80%A2%22,%22X%22],[%22Chance%22],[%22H%22]]}

I can’t understand the behavior of the second Hadamard gate: the input has remaining $frac{|0rangle+|1rangle}{sqrt{2}}$ and the gate does not seem to have any effect.

One Answer

This is because the CNOT gate created an an entangled state and the system after the CNOT gate can't be written individually. That is, you can't stay that your first qubit is in the state $dfrac{|0rangle + |1rangle}{sqrt{2}}$ anymore.

That is consider the circuit:

enter image description here

Here $q_0 $ and $q_1$ both start in the state $|0rangle$. So you start with the initial state $|psirangle_{init} = |0rangle otimes |0rangle = |00rangle$.

  1. By first applying the Hadamard gate on the first qubit put the system in the state $|psi rangle_0 = dfrac{|0rangle + |1rangle}{sqrt{2}} otimes |0rangle = dfrac{|00rangle + |10rangle}{sqrt{2}}$. Here you can say that your first qubit $q_0$ is in the state $|q_0 rangle = dfrac{|0rangle + |1rangle}{sqrt{2}}$ and your second qubit $q_1$ is in the state $|q_1rangle = |0rangle$.

  1. Then, applying the CNOT gate here with the controlled-qubit being $q_0$ and target qubit being $q_1$ puts the state in $|psi rangle_1 = dfrac{|00rangle + |11rangle}{sqrt{2}} $. Note that you can no longer can write $|psi rangle_1 = |q_0 rangle otimes |q_1rangle$. That is, you can't say that the first qubit is in the state $|q_0rangle = dfrac{|0rangle + |1rangle}{sqrt{2}}$ and the second qubit in some state $|q_1rangle$. They are entangled to one another.

  1. Lastly, if you apply the Hadamard gate to the first qubit, which is applying the operation $H otimes I = dfrac{1}{sqrt{2}} begin{pmatrix} 1 & 1 1 &-1 end{pmatrix} otimes begin{pmatrix} 1 & 0 0 & 1 end{pmatrix} $ to the state $|psi rangle = dfrac{|00rangle + |11rangle}{sqrt{2}} = dfrac{1}{sqrt{2}} begin{pmatrix} 1 0 0 1 end{pmatrix} $ we will get the final state $|psirangle_{final} = dfrac{|00rangle + |01rangle + |10rangle - |11rangle}{2} = dfrac{1}{2} begin{pmatrix} 1 1 1 -1 end{pmatrix}$

This is the reason why you see that you have $50%$ probability of measuring the first qubit $q_0$ in the state $|0rangle$ and $50%$ probability of measuring it in the state $|1rangle$.

Correct answer by KAJ226 on March 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP