[Physics] Question on hadamard gate and cnot gate circuit tables

homework-and-exercisesquantum-information

I'm trying to solve this problem for homework:

Now show that if the CNOT gate is applied in the Hadamard basis – i.e. apply the Hadamard gate to
the inputs and outputs of the CNOT gate – then the result is a CNOT gate with the control and target
qubit swapped.

So I've computed the truth table for $a/b$ with just a CNOT gate, but I'm not sure how to "apply the Hadamard gate". I know that applying Hadamard twice will leave the bit unchanged (verified this via matrix multiplication), but I'm stuck at this part:

Let's say $a$ and $b$ are qubits and both go through the Hadamard gate. Then they go into a CNOT, where $b$ is the control. If $a$ and $b$ started off at $|0 \rangle$, then their matrix version is $\frac{1}{\sqrt 2}$ $[ 1 1 ]$, but how do you apply that to a CNOT? Alternatively, if you leave them as kets, then how do you represent $H |0 \rangle $? It was straight forward just applying a CNOT since the states remain as either $|0 \rangle$ or $|1 \rangle$, but I don't understand what happens if you apply a Hadamard gate to a $0$ or $1$ qubit.

Best Answer

Here's a calculation to get you started.$\def\ket#1{\lvert#1\rangle}$

  • Define $\ket{h_j} = H\ket{j}$: $$\begin{align*} \ket{h_0} &= \tfrac1{\sqrt 2}\Bigl(\ket0 + \ket1\Bigr) \\ \ket{h_1} &= \tfrac1{\sqrt 2}\Bigl(\ket0 - \ket1\Bigr) \end{align*}$$

  • Compute (for example) $ \ket{h_0}\ket{h_1}$ by distributing the tensor product over the addition and subtraction: $$ \ket{h_0}\ket{h_1} = \tfrac12 \Big( \ket0\ket0 - \ket0\ket1 + \ket1\ket0 - \ket1\ket1 \Bigr) $$

  • Compute the effect of CNOT on this state, distributing it over the additions and subtractions, applying it to each standard basis state in the expression: $$\begin{align*} \mathbf{CNOT} \ket{h_0}\ket{h_1} &= \tfrac12\Bigl( \mathbf{CNOT} \ket0\ket0 - \mathbf{CNOT} \ket0\ket1 + \mathbf{CNOT} \ket1\ket0 - \mathbf{CNOT} \ket1\ket1 \Bigr) \\ &= \tfrac12\Bigl( \ket0\ket0 - \ket0\ket1 + \ket1\ket1 - \ket1\ket0 \Bigr) \\ &= \tfrac12\Bigl( \ket0\ket0 - \ket0\ket1 - \ket1\ket0 + \ket1\ket1 \Bigr) \end{align*} $$

  • Identify which state $\ket{h_j}\ket{h_k}$ (if any) this output represents. It may be useful to compute them ahead of time, for the purposes of comparison.

Alternatively, there is another way you can do it: compute $(H \otimes H) \mathbf{CNOT} (H \otimes H)^\dagger $ and determine what operation it performs on the standard basis — this is a more direct way of solving the problem.

Related Question