Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question
I am guessing you know the action of a Hadamard gate on the computational basis: H(|0>)=1/sqrt(2)(|0>+|1>) and H(|1>)=1/sqrt(2)(|0>-|1>). What state do you get when you apply a Hadamard to each qubit when the initial state is |00>? To compute the action of the CNOT gate, just use linearity the of quantum mechanics. For example CNOT(|00>+|11>)=CNOT|00>+CNOT|11>. – Juan Miguel Arrazola Apr 24 '13 at 4:06

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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.