3

Let's say that you have a 6 qubit system and you want to apply a Hadamard gate to qubits 2 and 4.

How would you construct a matrix that did that, while leaving the state of the other qubits alone?

Alan Wolfe
  • 1,358
  • 10
  • 21

1 Answers1

3

Imagine that the qubits were $0$ and $1$ (or $1$ and $2$, depending on your numbering scheme). You want to apply the Hadamard gate on the first two coordinates, and nothing – the identity – on the rest. This leads to a block diagonal matrix whose second block is the $4\times 4$ identity.

Now make the necessary arrangements for the qubits you're interesting it.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
  • My question is specifically, what are the necessary arrangements when not using neighboring qubits? :p – Alan Wolfe Oct 18 '15 at 20:48
  • You take the tensor product of your gate and the identity on the rest of the bits. I don't know what you mean by arrangement. In terms of matrices, this is just a block diagonal matrices with its rows and columns shuffled. – Yuval Filmus Oct 18 '15 at 20:53
  • It turns out I didn't ask the question I intended to ask, due to incomplete understanding. Sorry about that Yuval and thanks for your answer! – Alan Wolfe Oct 21 '15 at 14:59
  • Yuval, I meant to ask about a multi qubit gate. For instance, let's say you wanted to apply a controlled not to qubits 2 and 4, in a 6 qubit system. I'd like to ask a new question for that, but the title is going to be the same as the title of this question so not sure. Think I ought to delete this one?? – Alan Wolfe Oct 28 '15 at 05:08
  • @AlanWolfe You'll have to ask the moderators. – Yuval Filmus Oct 28 '15 at 07:24
  • 1
    I just went ahead and asked a new one, in case you want some more points hehe. http://cs.stackexchange.com/questions/48834/applying-a-multi-qubit-quantum-gate-to-specific-qubits – Alan Wolfe Oct 29 '15 at 04:05