I was wondering if there is any way to present the CNOT matrix as we usually present single qubit operations

$$... 1 \otimes NOT \otimes 1 ...$$

I know that for adjacent qubits in a circuit we can present it identically

$$... 1 \otimes CNOT \otimes 1 ...$$

But is there a way to present the operation mathematically if there are several CNOTs acting on not neighboring wires?


2 Answers 2


If you are only referring to the abstract circuit representation, then you can just reorder your basis such that all the qubits partaking in CNOTs are made "adjacent" according to your labeling. For example, if the basis is ordered like $1,2,3$, and you want to perform a CNOT between qubits 1 and 3, then you just write something like

$$ CNOT_{1,3} \otimes I_2 $$

where the basis is now ordered $1,3,2$. But if you don't want to reorder the basis, there is also another way of writing the CNOT:

$$ |0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes X $$

which could include an identity on the state of the second qubit like

$$ (|0\rangle\langle0|)_1 \otimes I_2 \otimes I_3 + (|1\rangle\langle1|)_1 \otimes I_2 \otimes X_3 $$

This is no longer just a product of unitaries, which is expected since the action of the CNOT should not factorize into product of operations.

  • $\begingroup$ This is my preferred way too. I don't care much for the "bra"/"ket" notation myself so I would use $Z^+=(I+Z)/2$ for $(|0><0|$ and $Z^-=(I-Z)/2$ for $(|1><1|$. $\endgroup$
    – unknown
    Commented Aug 18, 2020 at 17:04
  • $\begingroup$ ...so $CNOT_{1,3}=Z_1^+ I_2 I_3 + Z_1^- I_2 X_3=Z_1^+ + Z_1^- X_3$.... $\endgroup$
    – unknown
    Commented Aug 18, 2020 at 18:07
  • $\begingroup$ @unknown: For type-checking, I'd prefer to write $\mathrm{CNOT}_{1,3} = Z_1^+ I_3 + Z_1^- X_3$, but your notational style is pretty good. Every once in a while, though, it does come in handy to be able to separate the kets from the bras. $\endgroup$ Commented Aug 18, 2020 at 21:14

Personally, I just define myself some notation. For example, instead of the NOT that you wrote down, I define $X_n$ to be $$ X_n=1^{\otimes(n-1)}\otimes X\otimes 1^{\otimes(N-n)}. $$ Similarly, I might then define $CNOT^i_j$ to be a controlled-not controlled off $i$ and targeting $j$. If I had to write it out as tensor products, I'd probably do something like $$ 1^{\otimes N}+1^{\otimes (i-1)}\otimes |1\rangle\langle 1|\otimes 1^{\otimes(j-i-1)}\otimes(X-1)\otimes 1^{\otimes(N-j)} $$ assuming $j>i$.

  • $\begingroup$ Here's a generalization : if you have $T=T_1 \otimes \cdots \otimes T_n$ then the applying it based on the state of qubit $k$ can be written as $T=Z_k^+ + R$ with $R$ being $T_1 \otimes \cdots \otimes (T_k \to Z_k^-) \otimes T_n$. ($Z^\pm = (I \pm Z)/2$. $\endgroup$
    – unknown
    Commented Aug 18, 2020 at 17:14

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