0
$\begingroup$

Implementing a single-qubit gate in a multi-qubit register is relatively easy. For example, this gate:

enter image description here

This is equivalent to $I \otimes H \otimes I$. If the $H$ gate was on the first bit, it would be $H \otimes I^{\otimes 2}$ etc.

What about this gate?

enter image description here

There doesn't seem to be any Kronecker product of the CNOT matrix that will produce the correct matrix for this. Is there a simple way to calculate the matrix for the general case of a multi-qubit gate on a larger register?

I imagine it could be done by rearranging the qubits to put the gate on the first qubits of a register, and then reversing the rearrangement after the gate. This is a lot harder than the single-gate case though.

$\endgroup$
  • $\begingroup$ Hi Kendall! I flagged this as duplicate, can you please read the link in the previous comment and check if it answer your question? If not, can you edit your post to clarify the question? $\endgroup$ – Nelimee Mar 22 at 14:56
  • $\begingroup$ @Nelimee Indeed, that covers most of my question. I guess I missed it. Thanks! $\endgroup$ – Kendall Frey Mar 22 at 15:11
  • $\begingroup$ You may also find this useful. $\endgroup$ – Nelimee Mar 22 at 15:12