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?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityLet'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?
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.