In textbook, it states that the CNOT gate with the X gate applied on second qubit is \begin{array}{cccc} 1&0&0&0\\ 0&1&0&0\\ 0&0&0&1\\ 0&0&1&0 \end{array} However, By tensor products, wouldn't it be $I$ $\otimes$ $U_{x}$ , which gives \begin{array}{cccc} 0&1&0&0\\ 1&0&0&0\\ 0&0&0&1\\ 0&0&1&0 \end{array}

  • $\begingroup$ May I ask the title of the book you are reading? $\endgroup$
    – ChoMedit
    May 31, 2019 at 3:56
  • $\begingroup$ QM by david mcyintire $\endgroup$ May 31, 2019 at 4:03

1 Answer 1


The way that we can write controlled-not operation explicitly algebraically with the control on the first qubit is as follows: $$ \mathit{CNOT} \;=\; \def\ket#1{\lvert #1 \rangle}\def\bra#1{\langle #1 \rvert}\ket{0}\!\bra{0} \!\otimes\! \mathbf 1 \,+\, \ket{1}\!\bra{1} \!\otimes\! \: \sigma_x$$ where $\mathbf 1$ is an identity matrix of $2\times2$ order.

You can now see why it should give the desired answer.

  • $\begingroup$ Thanks that works out. can you explain thought why we cannot switch the order of the tensor products(I know tensor products are generally not commutative), but why does the CNOT operator happen to have the outer proudct on the left side? is there a specific reason? $\endgroup$ Feb 12, 2019 at 9:11
  • $\begingroup$ I'm sorry, could you explain what do you mean? If you are interested in writing any unitary gate operation in terms of a matrix, refer to this question. $\endgroup$
    – exp ikx
    Feb 12, 2019 at 17:32
  • $\begingroup$ As you stated, tensor products are not commutative. Kronecker products are written in the order the gates are applied. $\endgroup$
    – exp ikx
    Feb 12, 2019 at 17:35
  • $\begingroup$ BY same logic, if x gate was now acting on first qubit, control on second, then wouldn't it be $$ \mathit{CNOT} \;=\; \def\ket#1{\lvert #1 \rangle}\def\bra#1{\langle #1 \rvert}\ket{0}\!\bra{0} \!\otimes\! \sigma_x \,+\, \ket{1}\!\bra{1} \!\otimes\! \: \mathbf 1$$, which gives incorrect operator matrix? $\endgroup$ Feb 13, 2019 at 6:55
  • $\begingroup$ Yes, but how is it incorrect? You have changed the control to second qubit and the action on the first will be negated, which is to say you have reversed the control and the operating qubits and the corresponding matric is what you have written. $\endgroup$
    – exp ikx
    Feb 13, 2019 at 16:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .