HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How do two H gates act on two entangled qubits?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
actentangledgatestwohowqubits

Problem

In this circuit, if the two qubits are initialized at state 0, then after the oracle they are entangled and in the state:

$$\frac{1}{2} (|00\rangle+|01\rangle+|10\rangle-|11\rangle)$$

My question is, how do the two $H$ gates act on them? Do they act like:

$$\frac{1}{4} [(|0\rangle+|1\rangle)\otimes(|0\rangle+|1\rangle) + (|0\rangle+|1\rangle)\otimes(|0\rangle-|1\rangle) + (|0\rangle-|1\rangle)\otimes(|0\rangle+|1\rangle) - (|0\rangle-|1\rangle)\otimes(|0\rangle-|1\rangle)]$$

which in the end nothing has changed. My intuition tells me that it's wrong.

Update: The figure above is from a circuit to implement Grover's algorithm. The whole figure is given below:

The state is indeed not changed after the two $H$ gates, so why do they add them here?

Solution

The Hadamard gate performs the following operation on a single qubit:
\begin{align}
|0\rangle &\to \frac{|0\rangle + |1\rangle}{\sqrt{2}} \\
|1\rangle &\to \frac{|0\rangle - |1\rangle}{\sqrt{2}}
\end{align}
This gives the action on pure states. The action extends linearly to mixed states:
$$
\alpha|0\rangle + \beta|1\rangle \to \alpha\frac{|0\rangle + |1\rangle}{\sqrt{2}} + \beta\frac{|0\rangle - |1\rangle}{\sqrt{2}}
$$

What happens when there are seveal qubits around? In this case, it is common to denote $|a\rangle \otimes |b\rangle$ by $|ab\rangle$, for brevity. If we apply a Hadamard gate on the first qubit, then it only affects the first qubit:
\begin{align}
|0b\rangle &\to \frac{|0b\rangle + |1b\rangle}{\sqrt{2}} \\
|1b\rangle &\to \frac{|0b\rangle - |1b\rangle}{\sqrt{2}}
\end{align}
Similarly, if we apply a Hadamard gate on the second qubit, then it only affects the second qubit:
\begin{align}
|a0\rangle &\to \frac{|a0\rangle + |a1\rangle}{\sqrt{2}} \\
|a1\rangle &\to \frac{|a0\rangle - |a1\rangle}{\sqrt{2}}
\end{align}
The two operations commute.

What happens to a general mixed state? Denoting by $\stackrel{(i)}\to$ the application of $H$ on the $i$'th bit, we get
\begin{align}
&\alpha|00\rangle + \beta|01\rangle + \gamma|10\rangle + \delta|11\rangle \\
\stackrel{(1)}\to
&\alpha\frac{|00\rangle + |10\rangle}{\sqrt{2}} + \gamma\frac{|00\rangle - |10\rangle}{\sqrt{2}} +
\beta\frac{|01\rangle + |11\rangle}{\sqrt{2}} + \delta\frac{|01\rangle - |11\rangle}{\sqrt{2}} \\ =
&\frac{\alpha+\gamma}{\sqrt{2}} |00\rangle + \frac{\beta+\delta}{\sqrt{2}} |01\rangle +
\frac{\alpha-\gamma}{\sqrt{2}} |10\rangle + \frac{\beta-\delta}{\sqrt{2}} |11\rangle \\
\stackrel{(2)} \to
&\frac{\alpha+\gamma}{\sqrt{2}} \frac{|00\rangle + |01\rangle}{\sqrt{2}} +
\frac{\beta+\delta}{\sqrt{2}} \frac{|00\rangle - |01\rangle}{\sqrt{2}} +
\frac{\alpha-\gamma}{\sqrt{2}} \frac{|10\rangle + |11\rangle}{\sqrt{2}} +
\frac{\beta-\delta}{\sqrt{2}} \frac{|10\rangle - |11\rangle}{\sqrt{2}} \\ =
&\frac{\alpha+\beta+\gamma+\delta}{2} |00\rangle +
\frac{\alpha-\beta+\gamma-\delta}{2} |01\rangle +
\frac{\alpha+\beta-\gamma-\delta}{2} |10\rangle +
\frac{\alpha-\beta-\gamma+\delta}{2} |11\rangle
\end{align}

The Hadamard gate is Hermitian, and so applying it twice in a row results in the starting point: $HH = I$. Therefore if the oracle does nothing, you do get what you started from. But usually the oracle does change the qubits somehow.

Context

StackExchange Computer Science Q#135196, answer score: 2

Revisions (0)

No revisions yet.