How to derive the CNOT matrix for a 3-qbit system where the control & target qbits are not adjacent?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












In a three-qbit system, it's easy to derive the CNOT operator when the control & target qbits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in the untouched qbit's position of significance:



$C_10|phi_2phi_1phi_0rangle = (mathbbI_2 otimes C_10)|phi_2phi_1phi_0rangle$



However, it isn't obvious how to derive the CNOT operator when the control & target qbits are not adjacent in significance:



$C_20|phi_2phi_1phi_0rangle$



How is this done?










share|improve this question

























    up vote
    2
    down vote

    favorite












    In a three-qbit system, it's easy to derive the CNOT operator when the control & target qbits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in the untouched qbit's position of significance:



    $C_10|phi_2phi_1phi_0rangle = (mathbbI_2 otimes C_10)|phi_2phi_1phi_0rangle$



    However, it isn't obvious how to derive the CNOT operator when the control & target qbits are not adjacent in significance:



    $C_20|phi_2phi_1phi_0rangle$



    How is this done?










    share|improve this question























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      In a three-qbit system, it's easy to derive the CNOT operator when the control & target qbits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in the untouched qbit's position of significance:



      $C_10|phi_2phi_1phi_0rangle = (mathbbI_2 otimes C_10)|phi_2phi_1phi_0rangle$



      However, it isn't obvious how to derive the CNOT operator when the control & target qbits are not adjacent in significance:



      $C_20|phi_2phi_1phi_0rangle$



      How is this done?










      share|improve this question













      In a three-qbit system, it's easy to derive the CNOT operator when the control & target qbits are adjacent in significance - you just tensor the 2-bit CNOT operator with the identity matrix in the untouched qbit's position of significance:



      $C_10|phi_2phi_1phi_0rangle = (mathbbI_2 otimes C_10)|phi_2phi_1phi_0rangle$



      However, it isn't obvious how to derive the CNOT operator when the control & target qbits are not adjacent in significance:



      $C_20|phi_2phi_1phi_0rangle$



      How is this done?







      controlled-gates






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      ahelwer

      4046




      4046




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          For a presentation from first principles, I like Ryan O'Donnel's answer. But for a slightly higher-level algebraic treatment, here's how I would do it.



          The main feature of a controlled-$U$ operation, for any unitary $U$, is that it (coherently) performs an operation on some qubits depending on the value of some single qubit. The way that we can write this explicitly algebraically (with the control on the first qubit) is:
          $$ mathitCU ;=; defket#1lvert #1 rangledefbra#1langle #1 rvertket0!bra0 !otimes! mathbf 1 ,+, ket1!bra1 !otimes! U$$
          where $mathbf 1$ is an identity matrix of the same dimension as $U$. Here, $ket0!bra0$ and $ket1!bra1$ are projectors onto the states $ket0$ and $ket1$ of the control qubit — but we are not using them here as elements of a measurement, but to describe the effect on the other qubits depending on one or the other subspace of the state-space of the first qubit.



          We can use this to derive the matrix for the gate $mathitCX_1,3$ which performs an $X$ operation on qubit 3, coherently conditioned on the state of qubit 1, by thinking of this as a controlled-$(mathbf 1_2 !otimes! X)$ operation on qubits 2 and 3:
          $$
          beginaligned
          mathitCX_1,3 ;&=;
          ket0!bra0 otimes mathbf 1_4 ,+, ket1!bra1 otimes (mathbf 1_2 otimes X)
          \[1ex]&=;
          beginbmatrix
          mathbf 1_4 & mathbf 0_4 \
          mathbf 0_4 & (mathbf 1_2 !otimes! X)
          endbmatrix
          ;=;
          beginbmatrix
          mathbf 1_2 & mathbf 0_2 & mathbf 0_2 & mathbf 0_2 \
          mathbf 0_2 & mathbf 1_2 & mathbf 0_2 & mathbf 0_2 \
          mathbf 0_2 & mathbf 0_2 & X & mathbf 0_2 \
          mathbf 0_2 & mathbf 0_2 & mathbf 0_2 & X
          endbmatrix,
          endaligned
          $$
          where the latter two are block matrix representations to save on space (and sanity).



          Better still: we can recognise that — on some mathematical level where we allow ourselves to realise that the order of the tensor factors doesn't have to be in some fixed order — the control and the target of the operation can be on any two tensor factors, and that we can fill in the description of the operator on all of the other qubits with $mathbf 1_2$. This would allow us to jump straight to the representation
          $$
          beginalignat2
          mathitCX_1,3 ;&=&;
          underbraceket0!bra0_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace;mathbf 1_2;_!!!!texttarget!!!!
          &+,
          underbraceket1!bra1_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace; X;_!!!!texttarget!!!!
          \[1ex]&=&;
          beginbmatrix
          mathbf 1_2 & mathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
          mathbf 0_2 & mathbf 1_2 & phantommathbf 0_2 & phantommathbf 0_2 \
          phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
          phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2
          endbmatrix
          ,&+,
          beginbmatrix
          phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
          phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
          phantommathbf 0_2 & phantommathbf 0_2 & X & mathbf 0_2 \
          phantommathbf 0_2 & phantommathbf 0_2 & mathbf 0_2 & X
          endbmatrix
          endalignat
          $$
          and also allows us to immediately see what to do if the roles of control and target are reversed:
          $$
          beginalignat2
          mathitCX_3,1 ;&=&;
          underbrace;mathbf 1_2;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket0!bra0_textcontrol
          ,&+,
          underbrace;X;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket1!bra1_textcontrol
          \[1ex]&=&;
          scriptstylebeginbmatrix
          !ket0!bra0!! & & & \
          & !!ket0!bra0!! & & \
          & & !!ket0!bra0!! & \
          & & & !!ket0!bra0
          endbmatrix
          ,&+,
          scriptstylebeginbmatrix
          & & !!ket1!bra1!! & \
          & & & !!ket1!bra1 \
          !ket1!bra1!! & & & \
          & !!ket1!bra1 & &
          endbmatrix
          \[1ex]&=&;
          left[scriptstylebeginmatrix
          1 & 0 & 0 & 0 \
          0 & 0 & 0 & 0 \
          0 & 0 & 1 & 0 \
          0 & 0 & 0 & 0 \
          0 & 0 & 0 & 0 \
          0 & 1 & 0 & 0 \
          0 & 0 & 0 & 0 \
          0 & 0 & 0 & 1
          endmatrixright.,,&,,left.scriptstylebeginmatrix
          0 & 0 & 0 & 0 \
          0 & 1 & 0 & 0 \
          0 & 0 & 0 & 0 \
          0 & 0 & 0 & 1 \
          1 & 0 & 0 & 0 \
          0 & 0 & 0 & 0 \
          0 & 0 & 1 & 0 \
          0 & 0 & 0 & 0
          endmatrixright].
          endalignat
          $$
          But best of all: if you can write down these operators algebraically, you can take the first steps towards dispensing with the giant matrices entirely, instead reasoning about these operators algebraically using expressions such as $mathitCX_1,3 ,=,
          ket0!bra0 otimes mathbf 1_2 otimes mathbf 1_2 ,+,
          ket1!bra1 otimes mathbf 1_2 otimes X$
          and
          $mathitCX_3,1 ,=,
          mathbf 1_2 otimes mathbf 1_2 otimes ket0!bra0 ,+,
          X otimes mathbf 1_2 otimes ket1!bra1$.
          There will be a limit to how much you can do with these, of course — a simple change in representation is unlikely to make a difficult quantum algorithm efficiently solvable, let alone tractable by manual calculation — but you can reason about simple circuits much more effectively using these expressions than with giant space-eating matrices.






          share|improve this answer





























            up vote
            1
            down vote













            As a general idea CNOT flips target based on control. I choose to flip the target if control is $uparrow (= [1 0]^T)$, you may choose it $downarrow (= [0 1]^T)$ too. So assume any general multiparticle state $|phirangle=|uparrow_1downarrow_2downarrow_3....uparrow_n-1downarrow_nrangle$. Now you choose your control and target, lets say $i'th$ is control and $k'th$ is target. Applying CNOT on $|phirangle$ will be just
            beginequation
            CNOT|phirangle=CNOT|uparrow_1downarrow_2...uparrow_i...uparrow_k...uparrow_n-1downarrow_nrangle= |uparrow_1downarrow_2...uparrow_i...downarrow_k...uparrow_n-1downarrow_nrangle
            endequation



            To construct the matrix of such CNOT gate we apply $sigma_x$($x$-Pauli matrix) if $i'th$ state is up and we apply $I$($2times2$ Identity) if $i'th$ state is down. We apply these matrices at the $k'th$ position, which is our target. Mathematically,
            beginequation
            CNOT = Big[|uparrow_1...uparrow_i...uparrow_k-1ranglelangleuparrow_1...uparrow_i...uparrow_k-1|otimessigma_xotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
            + Big[|uparrow_1...downarrow_i...uparrow_k-1ranglelangleuparrow_1...downarrow_i...uparrow_k-1|otimes Iotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
            endequation



            Note $k'th$ state(target) is excluded while creating the permutation matrix and at $k'th$ position the operator $sigma_x$ or $I$ is written.



            Take an example of five qubits in which $2^nd$ qubit is target and $4^th$ is control. Lets build the permutation matrix of $CNOT$. I take, if control is $uparrow$ flip the target. You can take vice-versa too.



            beginalign
            CNOT & = |uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3downarrow_4uparrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|
            endalign






            share|improve this answer



























              up vote
              1
              down vote













              This is a good question; it's one that textbooks seem to sneak around. I reached this exact question when preparing a quantum computing lecture a couple days ago.



              As far as I can tell, there's no way of getting the desired 8x8 matrix using the Kronecker product $otimes$ notation for matrices. All you can really say is: Your operation of applying CNOT to three qubits, with the control being the first and the target being the third, has the following effects:



              $lvert 000rangle mapsto lvert 000rangle$



              $lvert 001rangle mapsto lvert 001rangle$



              $lvert 010rangle mapsto lvert 010rangle$



              $lvert 011rangle mapsto lvert 011rangle$



              $lvert 100rangle mapsto lvert 101rangle$



              $lvert 101rangle mapsto lvert 100rangle$



              $lvert 110 rangle mapsto lvert 111 rangle$



              $lvert 111 rangle mapsto lvert 110 rangle$



              and therefore it is given by the following matrix:



              $U = beginbmatrix
              1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
              0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \
              0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \
              0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \
              0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \
              0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \
              0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
              0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
              endbmatrix$



              This matrix $U$ is indeed neither $I_2 otimes mathrmCNOT$ nor $mathrmCNOT otimes I_2$. There is no succinct Kronecker-product-based notation for it; it just is what it is.






              share|improve this answer








              New contributor




              Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

















                Your Answer




                StackExchange.ifUsing("editor", function ()
                return StackExchange.using("mathjaxEditing", function ()
                StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
                StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
                );
                );
                , "mathjax-editing");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "694"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                convertImagesToLinks: false,
                noModals: false,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                noCode: true, onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f4252%2fhow-to-derive-the-cnot-matrix-for-a-3-qbit-system-where-the-control-target-qbi%23new-answer', 'question_page');

                );

                Post as a guest






























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                1
                down vote



                accepted










                For a presentation from first principles, I like Ryan O'Donnel's answer. But for a slightly higher-level algebraic treatment, here's how I would do it.



                The main feature of a controlled-$U$ operation, for any unitary $U$, is that it (coherently) performs an operation on some qubits depending on the value of some single qubit. The way that we can write this explicitly algebraically (with the control on the first qubit) is:
                $$ mathitCU ;=; defket#1lvert #1 rangledefbra#1langle #1 rvertket0!bra0 !otimes! mathbf 1 ,+, ket1!bra1 !otimes! U$$
                where $mathbf 1$ is an identity matrix of the same dimension as $U$. Here, $ket0!bra0$ and $ket1!bra1$ are projectors onto the states $ket0$ and $ket1$ of the control qubit — but we are not using them here as elements of a measurement, but to describe the effect on the other qubits depending on one or the other subspace of the state-space of the first qubit.



                We can use this to derive the matrix for the gate $mathitCX_1,3$ which performs an $X$ operation on qubit 3, coherently conditioned on the state of qubit 1, by thinking of this as a controlled-$(mathbf 1_2 !otimes! X)$ operation on qubits 2 and 3:
                $$
                beginaligned
                mathitCX_1,3 ;&=;
                ket0!bra0 otimes mathbf 1_4 ,+, ket1!bra1 otimes (mathbf 1_2 otimes X)
                \[1ex]&=;
                beginbmatrix
                mathbf 1_4 & mathbf 0_4 \
                mathbf 0_4 & (mathbf 1_2 !otimes! X)
                endbmatrix
                ;=;
                beginbmatrix
                mathbf 1_2 & mathbf 0_2 & mathbf 0_2 & mathbf 0_2 \
                mathbf 0_2 & mathbf 1_2 & mathbf 0_2 & mathbf 0_2 \
                mathbf 0_2 & mathbf 0_2 & X & mathbf 0_2 \
                mathbf 0_2 & mathbf 0_2 & mathbf 0_2 & X
                endbmatrix,
                endaligned
                $$
                where the latter two are block matrix representations to save on space (and sanity).



                Better still: we can recognise that — on some mathematical level where we allow ourselves to realise that the order of the tensor factors doesn't have to be in some fixed order — the control and the target of the operation can be on any two tensor factors, and that we can fill in the description of the operator on all of the other qubits with $mathbf 1_2$. This would allow us to jump straight to the representation
                $$
                beginalignat2
                mathitCX_1,3 ;&=&;
                underbraceket0!bra0_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace;mathbf 1_2;_!!!!texttarget!!!!
                &+,
                underbraceket1!bra1_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace; X;_!!!!texttarget!!!!
                \[1ex]&=&;
                beginbmatrix
                mathbf 1_2 & mathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                mathbf 0_2 & mathbf 1_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2
                endbmatrix
                ,&+,
                beginbmatrix
                phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                phantommathbf 0_2 & phantommathbf 0_2 & X & mathbf 0_2 \
                phantommathbf 0_2 & phantommathbf 0_2 & mathbf 0_2 & X
                endbmatrix
                endalignat
                $$
                and also allows us to immediately see what to do if the roles of control and target are reversed:
                $$
                beginalignat2
                mathitCX_3,1 ;&=&;
                underbrace;mathbf 1_2;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket0!bra0_textcontrol
                ,&+,
                underbrace;X;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket1!bra1_textcontrol
                \[1ex]&=&;
                scriptstylebeginbmatrix
                !ket0!bra0!! & & & \
                & !!ket0!bra0!! & & \
                & & !!ket0!bra0!! & \
                & & & !!ket0!bra0
                endbmatrix
                ,&+,
                scriptstylebeginbmatrix
                & & !!ket1!bra1!! & \
                & & & !!ket1!bra1 \
                !ket1!bra1!! & & & \
                & !!ket1!bra1 & &
                endbmatrix
                \[1ex]&=&;
                left[scriptstylebeginmatrix
                1 & 0 & 0 & 0 \
                0 & 0 & 0 & 0 \
                0 & 0 & 1 & 0 \
                0 & 0 & 0 & 0 \
                0 & 0 & 0 & 0 \
                0 & 1 & 0 & 0 \
                0 & 0 & 0 & 0 \
                0 & 0 & 0 & 1
                endmatrixright.,,&,,left.scriptstylebeginmatrix
                0 & 0 & 0 & 0 \
                0 & 1 & 0 & 0 \
                0 & 0 & 0 & 0 \
                0 & 0 & 0 & 1 \
                1 & 0 & 0 & 0 \
                0 & 0 & 0 & 0 \
                0 & 0 & 1 & 0 \
                0 & 0 & 0 & 0
                endmatrixright].
                endalignat
                $$
                But best of all: if you can write down these operators algebraically, you can take the first steps towards dispensing with the giant matrices entirely, instead reasoning about these operators algebraically using expressions such as $mathitCX_1,3 ,=,
                ket0!bra0 otimes mathbf 1_2 otimes mathbf 1_2 ,+,
                ket1!bra1 otimes mathbf 1_2 otimes X$
                and
                $mathitCX_3,1 ,=,
                mathbf 1_2 otimes mathbf 1_2 otimes ket0!bra0 ,+,
                X otimes mathbf 1_2 otimes ket1!bra1$.
                There will be a limit to how much you can do with these, of course — a simple change in representation is unlikely to make a difficult quantum algorithm efficiently solvable, let alone tractable by manual calculation — but you can reason about simple circuits much more effectively using these expressions than with giant space-eating matrices.






                share|improve this answer


























                  up vote
                  1
                  down vote



                  accepted










                  For a presentation from first principles, I like Ryan O'Donnel's answer. But for a slightly higher-level algebraic treatment, here's how I would do it.



                  The main feature of a controlled-$U$ operation, for any unitary $U$, is that it (coherently) performs an operation on some qubits depending on the value of some single qubit. The way that we can write this explicitly algebraically (with the control on the first qubit) is:
                  $$ mathitCU ;=; defket#1lvert #1 rangledefbra#1langle #1 rvertket0!bra0 !otimes! mathbf 1 ,+, ket1!bra1 !otimes! U$$
                  where $mathbf 1$ is an identity matrix of the same dimension as $U$. Here, $ket0!bra0$ and $ket1!bra1$ are projectors onto the states $ket0$ and $ket1$ of the control qubit — but we are not using them here as elements of a measurement, but to describe the effect on the other qubits depending on one or the other subspace of the state-space of the first qubit.



                  We can use this to derive the matrix for the gate $mathitCX_1,3$ which performs an $X$ operation on qubit 3, coherently conditioned on the state of qubit 1, by thinking of this as a controlled-$(mathbf 1_2 !otimes! X)$ operation on qubits 2 and 3:
                  $$
                  beginaligned
                  mathitCX_1,3 ;&=;
                  ket0!bra0 otimes mathbf 1_4 ,+, ket1!bra1 otimes (mathbf 1_2 otimes X)
                  \[1ex]&=;
                  beginbmatrix
                  mathbf 1_4 & mathbf 0_4 \
                  mathbf 0_4 & (mathbf 1_2 !otimes! X)
                  endbmatrix
                  ;=;
                  beginbmatrix
                  mathbf 1_2 & mathbf 0_2 & mathbf 0_2 & mathbf 0_2 \
                  mathbf 0_2 & mathbf 1_2 & mathbf 0_2 & mathbf 0_2 \
                  mathbf 0_2 & mathbf 0_2 & X & mathbf 0_2 \
                  mathbf 0_2 & mathbf 0_2 & mathbf 0_2 & X
                  endbmatrix,
                  endaligned
                  $$
                  where the latter two are block matrix representations to save on space (and sanity).



                  Better still: we can recognise that — on some mathematical level where we allow ourselves to realise that the order of the tensor factors doesn't have to be in some fixed order — the control and the target of the operation can be on any two tensor factors, and that we can fill in the description of the operator on all of the other qubits with $mathbf 1_2$. This would allow us to jump straight to the representation
                  $$
                  beginalignat2
                  mathitCX_1,3 ;&=&;
                  underbraceket0!bra0_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace;mathbf 1_2;_!!!!texttarget!!!!
                  &+,
                  underbraceket1!bra1_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace; X;_!!!!texttarget!!!!
                  \[1ex]&=&;
                  beginbmatrix
                  mathbf 1_2 & mathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                  mathbf 0_2 & mathbf 1_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                  phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                  phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2
                  endbmatrix
                  ,&+,
                  beginbmatrix
                  phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                  phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                  phantommathbf 0_2 & phantommathbf 0_2 & X & mathbf 0_2 \
                  phantommathbf 0_2 & phantommathbf 0_2 & mathbf 0_2 & X
                  endbmatrix
                  endalignat
                  $$
                  and also allows us to immediately see what to do if the roles of control and target are reversed:
                  $$
                  beginalignat2
                  mathitCX_3,1 ;&=&;
                  underbrace;mathbf 1_2;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket0!bra0_textcontrol
                  ,&+,
                  underbrace;X;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket1!bra1_textcontrol
                  \[1ex]&=&;
                  scriptstylebeginbmatrix
                  !ket0!bra0!! & & & \
                  & !!ket0!bra0!! & & \
                  & & !!ket0!bra0!! & \
                  & & & !!ket0!bra0
                  endbmatrix
                  ,&+,
                  scriptstylebeginbmatrix
                  & & !!ket1!bra1!! & \
                  & & & !!ket1!bra1 \
                  !ket1!bra1!! & & & \
                  & !!ket1!bra1 & &
                  endbmatrix
                  \[1ex]&=&;
                  left[scriptstylebeginmatrix
                  1 & 0 & 0 & 0 \
                  0 & 0 & 0 & 0 \
                  0 & 0 & 1 & 0 \
                  0 & 0 & 0 & 0 \
                  0 & 0 & 0 & 0 \
                  0 & 1 & 0 & 0 \
                  0 & 0 & 0 & 0 \
                  0 & 0 & 0 & 1
                  endmatrixright.,,&,,left.scriptstylebeginmatrix
                  0 & 0 & 0 & 0 \
                  0 & 1 & 0 & 0 \
                  0 & 0 & 0 & 0 \
                  0 & 0 & 0 & 1 \
                  1 & 0 & 0 & 0 \
                  0 & 0 & 0 & 0 \
                  0 & 0 & 1 & 0 \
                  0 & 0 & 0 & 0
                  endmatrixright].
                  endalignat
                  $$
                  But best of all: if you can write down these operators algebraically, you can take the first steps towards dispensing with the giant matrices entirely, instead reasoning about these operators algebraically using expressions such as $mathitCX_1,3 ,=,
                  ket0!bra0 otimes mathbf 1_2 otimes mathbf 1_2 ,+,
                  ket1!bra1 otimes mathbf 1_2 otimes X$
                  and
                  $mathitCX_3,1 ,=,
                  mathbf 1_2 otimes mathbf 1_2 otimes ket0!bra0 ,+,
                  X otimes mathbf 1_2 otimes ket1!bra1$.
                  There will be a limit to how much you can do with these, of course — a simple change in representation is unlikely to make a difficult quantum algorithm efficiently solvable, let alone tractable by manual calculation — but you can reason about simple circuits much more effectively using these expressions than with giant space-eating matrices.






                  share|improve this answer
























                    up vote
                    1
                    down vote



                    accepted







                    up vote
                    1
                    down vote



                    accepted






                    For a presentation from first principles, I like Ryan O'Donnel's answer. But for a slightly higher-level algebraic treatment, here's how I would do it.



                    The main feature of a controlled-$U$ operation, for any unitary $U$, is that it (coherently) performs an operation on some qubits depending on the value of some single qubit. The way that we can write this explicitly algebraically (with the control on the first qubit) is:
                    $$ mathitCU ;=; defket#1lvert #1 rangledefbra#1langle #1 rvertket0!bra0 !otimes! mathbf 1 ,+, ket1!bra1 !otimes! U$$
                    where $mathbf 1$ is an identity matrix of the same dimension as $U$. Here, $ket0!bra0$ and $ket1!bra1$ are projectors onto the states $ket0$ and $ket1$ of the control qubit — but we are not using them here as elements of a measurement, but to describe the effect on the other qubits depending on one or the other subspace of the state-space of the first qubit.



                    We can use this to derive the matrix for the gate $mathitCX_1,3$ which performs an $X$ operation on qubit 3, coherently conditioned on the state of qubit 1, by thinking of this as a controlled-$(mathbf 1_2 !otimes! X)$ operation on qubits 2 and 3:
                    $$
                    beginaligned
                    mathitCX_1,3 ;&=;
                    ket0!bra0 otimes mathbf 1_4 ,+, ket1!bra1 otimes (mathbf 1_2 otimes X)
                    \[1ex]&=;
                    beginbmatrix
                    mathbf 1_4 & mathbf 0_4 \
                    mathbf 0_4 & (mathbf 1_2 !otimes! X)
                    endbmatrix
                    ;=;
                    beginbmatrix
                    mathbf 1_2 & mathbf 0_2 & mathbf 0_2 & mathbf 0_2 \
                    mathbf 0_2 & mathbf 1_2 & mathbf 0_2 & mathbf 0_2 \
                    mathbf 0_2 & mathbf 0_2 & X & mathbf 0_2 \
                    mathbf 0_2 & mathbf 0_2 & mathbf 0_2 & X
                    endbmatrix,
                    endaligned
                    $$
                    where the latter two are block matrix representations to save on space (and sanity).



                    Better still: we can recognise that — on some mathematical level where we allow ourselves to realise that the order of the tensor factors doesn't have to be in some fixed order — the control and the target of the operation can be on any two tensor factors, and that we can fill in the description of the operator on all of the other qubits with $mathbf 1_2$. This would allow us to jump straight to the representation
                    $$
                    beginalignat2
                    mathitCX_1,3 ;&=&;
                    underbraceket0!bra0_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace;mathbf 1_2;_!!!!texttarget!!!!
                    &+,
                    underbraceket1!bra1_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace; X;_!!!!texttarget!!!!
                    \[1ex]&=&;
                    beginbmatrix
                    mathbf 1_2 & mathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    mathbf 0_2 & mathbf 1_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2
                    endbmatrix
                    ,&+,
                    beginbmatrix
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & X & mathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & mathbf 0_2 & X
                    endbmatrix
                    endalignat
                    $$
                    and also allows us to immediately see what to do if the roles of control and target are reversed:
                    $$
                    beginalignat2
                    mathitCX_3,1 ;&=&;
                    underbrace;mathbf 1_2;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket0!bra0_textcontrol
                    ,&+,
                    underbrace;X;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket1!bra1_textcontrol
                    \[1ex]&=&;
                    scriptstylebeginbmatrix
                    !ket0!bra0!! & & & \
                    & !!ket0!bra0!! & & \
                    & & !!ket0!bra0!! & \
                    & & & !!ket0!bra0
                    endbmatrix
                    ,&+,
                    scriptstylebeginbmatrix
                    & & !!ket1!bra1!! & \
                    & & & !!ket1!bra1 \
                    !ket1!bra1!! & & & \
                    & !!ket1!bra1 & &
                    endbmatrix
                    \[1ex]&=&;
                    left[scriptstylebeginmatrix
                    1 & 0 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 1 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 1 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 0 & 1
                    endmatrixright.,,&,,left.scriptstylebeginmatrix
                    0 & 0 & 0 & 0 \
                    0 & 1 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 0 & 1 \
                    1 & 0 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 1 & 0 \
                    0 & 0 & 0 & 0
                    endmatrixright].
                    endalignat
                    $$
                    But best of all: if you can write down these operators algebraically, you can take the first steps towards dispensing with the giant matrices entirely, instead reasoning about these operators algebraically using expressions such as $mathitCX_1,3 ,=,
                    ket0!bra0 otimes mathbf 1_2 otimes mathbf 1_2 ,+,
                    ket1!bra1 otimes mathbf 1_2 otimes X$
                    and
                    $mathitCX_3,1 ,=,
                    mathbf 1_2 otimes mathbf 1_2 otimes ket0!bra0 ,+,
                    X otimes mathbf 1_2 otimes ket1!bra1$.
                    There will be a limit to how much you can do with these, of course — a simple change in representation is unlikely to make a difficult quantum algorithm efficiently solvable, let alone tractable by manual calculation — but you can reason about simple circuits much more effectively using these expressions than with giant space-eating matrices.






                    share|improve this answer














                    For a presentation from first principles, I like Ryan O'Donnel's answer. But for a slightly higher-level algebraic treatment, here's how I would do it.



                    The main feature of a controlled-$U$ operation, for any unitary $U$, is that it (coherently) performs an operation on some qubits depending on the value of some single qubit. The way that we can write this explicitly algebraically (with the control on the first qubit) is:
                    $$ mathitCU ;=; defket#1lvert #1 rangledefbra#1langle #1 rvertket0!bra0 !otimes! mathbf 1 ,+, ket1!bra1 !otimes! U$$
                    where $mathbf 1$ is an identity matrix of the same dimension as $U$. Here, $ket0!bra0$ and $ket1!bra1$ are projectors onto the states $ket0$ and $ket1$ of the control qubit — but we are not using them here as elements of a measurement, but to describe the effect on the other qubits depending on one or the other subspace of the state-space of the first qubit.



                    We can use this to derive the matrix for the gate $mathitCX_1,3$ which performs an $X$ operation on qubit 3, coherently conditioned on the state of qubit 1, by thinking of this as a controlled-$(mathbf 1_2 !otimes! X)$ operation on qubits 2 and 3:
                    $$
                    beginaligned
                    mathitCX_1,3 ;&=;
                    ket0!bra0 otimes mathbf 1_4 ,+, ket1!bra1 otimes (mathbf 1_2 otimes X)
                    \[1ex]&=;
                    beginbmatrix
                    mathbf 1_4 & mathbf 0_4 \
                    mathbf 0_4 & (mathbf 1_2 !otimes! X)
                    endbmatrix
                    ;=;
                    beginbmatrix
                    mathbf 1_2 & mathbf 0_2 & mathbf 0_2 & mathbf 0_2 \
                    mathbf 0_2 & mathbf 1_2 & mathbf 0_2 & mathbf 0_2 \
                    mathbf 0_2 & mathbf 0_2 & X & mathbf 0_2 \
                    mathbf 0_2 & mathbf 0_2 & mathbf 0_2 & X
                    endbmatrix,
                    endaligned
                    $$
                    where the latter two are block matrix representations to save on space (and sanity).



                    Better still: we can recognise that — on some mathematical level where we allow ourselves to realise that the order of the tensor factors doesn't have to be in some fixed order — the control and the target of the operation can be on any two tensor factors, and that we can fill in the description of the operator on all of the other qubits with $mathbf 1_2$. This would allow us to jump straight to the representation
                    $$
                    beginalignat2
                    mathitCX_1,3 ;&=&;
                    underbraceket0!bra0_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace;mathbf 1_2;_!!!!texttarget!!!!
                    &+,
                    underbraceket1!bra1_textcontrol otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbrace; X;_!!!!texttarget!!!!
                    \[1ex]&=&;
                    beginbmatrix
                    mathbf 1_2 & mathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    mathbf 0_2 & mathbf 1_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2
                    endbmatrix
                    ,&+,
                    beginbmatrix
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 & phantommathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & X & mathbf 0_2 \
                    phantommathbf 0_2 & phantommathbf 0_2 & mathbf 0_2 & X
                    endbmatrix
                    endalignat
                    $$
                    and also allows us to immediately see what to do if the roles of control and target are reversed:
                    $$
                    beginalignat2
                    mathitCX_3,1 ;&=&;
                    underbrace;mathbf 1_2;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket0!bra0_textcontrol
                    ,&+,
                    underbrace;X;_!!!!texttarget!!!! otimes underbrace;mathbf 1_2;_!!!!textuninvolved!!!! otimes underbraceket1!bra1_textcontrol
                    \[1ex]&=&;
                    scriptstylebeginbmatrix
                    !ket0!bra0!! & & & \
                    & !!ket0!bra0!! & & \
                    & & !!ket0!bra0!! & \
                    & & & !!ket0!bra0
                    endbmatrix
                    ,&+,
                    scriptstylebeginbmatrix
                    & & !!ket1!bra1!! & \
                    & & & !!ket1!bra1 \
                    !ket1!bra1!! & & & \
                    & !!ket1!bra1 & &
                    endbmatrix
                    \[1ex]&=&;
                    left[scriptstylebeginmatrix
                    1 & 0 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 1 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 1 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 0 & 1
                    endmatrixright.,,&,,left.scriptstylebeginmatrix
                    0 & 0 & 0 & 0 \
                    0 & 1 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 0 & 1 \
                    1 & 0 & 0 & 0 \
                    0 & 0 & 0 & 0 \
                    0 & 0 & 1 & 0 \
                    0 & 0 & 0 & 0
                    endmatrixright].
                    endalignat
                    $$
                    But best of all: if you can write down these operators algebraically, you can take the first steps towards dispensing with the giant matrices entirely, instead reasoning about these operators algebraically using expressions such as $mathitCX_1,3 ,=,
                    ket0!bra0 otimes mathbf 1_2 otimes mathbf 1_2 ,+,
                    ket1!bra1 otimes mathbf 1_2 otimes X$
                    and
                    $mathitCX_3,1 ,=,
                    mathbf 1_2 otimes mathbf 1_2 otimes ket0!bra0 ,+,
                    X otimes mathbf 1_2 otimes ket1!bra1$.
                    There will be a limit to how much you can do with these, of course — a simple change in representation is unlikely to make a difficult quantum algorithm efficiently solvable, let alone tractable by manual calculation — but you can reason about simple circuits much more effectively using these expressions than with giant space-eating matrices.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 1 hour ago

























                    answered 1 hour ago









                    Niel de Beaudrap

                    4,329829




                    4,329829






















                        up vote
                        1
                        down vote













                        As a general idea CNOT flips target based on control. I choose to flip the target if control is $uparrow (= [1 0]^T)$, you may choose it $downarrow (= [0 1]^T)$ too. So assume any general multiparticle state $|phirangle=|uparrow_1downarrow_2downarrow_3....uparrow_n-1downarrow_nrangle$. Now you choose your control and target, lets say $i'th$ is control and $k'th$ is target. Applying CNOT on $|phirangle$ will be just
                        beginequation
                        CNOT|phirangle=CNOT|uparrow_1downarrow_2...uparrow_i...uparrow_k...uparrow_n-1downarrow_nrangle= |uparrow_1downarrow_2...uparrow_i...downarrow_k...uparrow_n-1downarrow_nrangle
                        endequation



                        To construct the matrix of such CNOT gate we apply $sigma_x$($x$-Pauli matrix) if $i'th$ state is up and we apply $I$($2times2$ Identity) if $i'th$ state is down. We apply these matrices at the $k'th$ position, which is our target. Mathematically,
                        beginequation
                        CNOT = Big[|uparrow_1...uparrow_i...uparrow_k-1ranglelangleuparrow_1...uparrow_i...uparrow_k-1|otimessigma_xotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                        + Big[|uparrow_1...downarrow_i...uparrow_k-1ranglelangleuparrow_1...downarrow_i...uparrow_k-1|otimes Iotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                        endequation



                        Note $k'th$ state(target) is excluded while creating the permutation matrix and at $k'th$ position the operator $sigma_x$ or $I$ is written.



                        Take an example of five qubits in which $2^nd$ qubit is target and $4^th$ is control. Lets build the permutation matrix of $CNOT$. I take, if control is $uparrow$ flip the target. You can take vice-versa too.



                        beginalign
                        CNOT & = |uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3downarrow_4uparrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                        & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                        & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|
                        endalign






                        share|improve this answer
























                          up vote
                          1
                          down vote













                          As a general idea CNOT flips target based on control. I choose to flip the target if control is $uparrow (= [1 0]^T)$, you may choose it $downarrow (= [0 1]^T)$ too. So assume any general multiparticle state $|phirangle=|uparrow_1downarrow_2downarrow_3....uparrow_n-1downarrow_nrangle$. Now you choose your control and target, lets say $i'th$ is control and $k'th$ is target. Applying CNOT on $|phirangle$ will be just
                          beginequation
                          CNOT|phirangle=CNOT|uparrow_1downarrow_2...uparrow_i...uparrow_k...uparrow_n-1downarrow_nrangle= |uparrow_1downarrow_2...uparrow_i...downarrow_k...uparrow_n-1downarrow_nrangle
                          endequation



                          To construct the matrix of such CNOT gate we apply $sigma_x$($x$-Pauli matrix) if $i'th$ state is up and we apply $I$($2times2$ Identity) if $i'th$ state is down. We apply these matrices at the $k'th$ position, which is our target. Mathematically,
                          beginequation
                          CNOT = Big[|uparrow_1...uparrow_i...uparrow_k-1ranglelangleuparrow_1...uparrow_i...uparrow_k-1|otimessigma_xotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                          + Big[|uparrow_1...downarrow_i...uparrow_k-1ranglelangleuparrow_1...downarrow_i...uparrow_k-1|otimes Iotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                          endequation



                          Note $k'th$ state(target) is excluded while creating the permutation matrix and at $k'th$ position the operator $sigma_x$ or $I$ is written.



                          Take an example of five qubits in which $2^nd$ qubit is target and $4^th$ is control. Lets build the permutation matrix of $CNOT$. I take, if control is $uparrow$ flip the target. You can take vice-versa too.



                          beginalign
                          CNOT & = |uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3downarrow_4uparrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                          & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                          & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|
                          endalign






                          share|improve this answer






















                            up vote
                            1
                            down vote










                            up vote
                            1
                            down vote









                            As a general idea CNOT flips target based on control. I choose to flip the target if control is $uparrow (= [1 0]^T)$, you may choose it $downarrow (= [0 1]^T)$ too. So assume any general multiparticle state $|phirangle=|uparrow_1downarrow_2downarrow_3....uparrow_n-1downarrow_nrangle$. Now you choose your control and target, lets say $i'th$ is control and $k'th$ is target. Applying CNOT on $|phirangle$ will be just
                            beginequation
                            CNOT|phirangle=CNOT|uparrow_1downarrow_2...uparrow_i...uparrow_k...uparrow_n-1downarrow_nrangle= |uparrow_1downarrow_2...uparrow_i...downarrow_k...uparrow_n-1downarrow_nrangle
                            endequation



                            To construct the matrix of such CNOT gate we apply $sigma_x$($x$-Pauli matrix) if $i'th$ state is up and we apply $I$($2times2$ Identity) if $i'th$ state is down. We apply these matrices at the $k'th$ position, which is our target. Mathematically,
                            beginequation
                            CNOT = Big[|uparrow_1...uparrow_i...uparrow_k-1ranglelangleuparrow_1...uparrow_i...uparrow_k-1|otimessigma_xotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                            + Big[|uparrow_1...downarrow_i...uparrow_k-1ranglelangleuparrow_1...downarrow_i...uparrow_k-1|otimes Iotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                            endequation



                            Note $k'th$ state(target) is excluded while creating the permutation matrix and at $k'th$ position the operator $sigma_x$ or $I$ is written.



                            Take an example of five qubits in which $2^nd$ qubit is target and $4^th$ is control. Lets build the permutation matrix of $CNOT$. I take, if control is $uparrow$ flip the target. You can take vice-versa too.



                            beginalign
                            CNOT & = |uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3downarrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|
                            endalign






                            share|improve this answer












                            As a general idea CNOT flips target based on control. I choose to flip the target if control is $uparrow (= [1 0]^T)$, you may choose it $downarrow (= [0 1]^T)$ too. So assume any general multiparticle state $|phirangle=|uparrow_1downarrow_2downarrow_3....uparrow_n-1downarrow_nrangle$. Now you choose your control and target, lets say $i'th$ is control and $k'th$ is target. Applying CNOT on $|phirangle$ will be just
                            beginequation
                            CNOT|phirangle=CNOT|uparrow_1downarrow_2...uparrow_i...uparrow_k...uparrow_n-1downarrow_nrangle= |uparrow_1downarrow_2...uparrow_i...downarrow_k...uparrow_n-1downarrow_nrangle
                            endequation



                            To construct the matrix of such CNOT gate we apply $sigma_x$($x$-Pauli matrix) if $i'th$ state is up and we apply $I$($2times2$ Identity) if $i'th$ state is down. We apply these matrices at the $k'th$ position, which is our target. Mathematically,
                            beginequation
                            CNOT = Big[|uparrow_1...uparrow_i...uparrow_k-1ranglelangleuparrow_1...uparrow_i...uparrow_k-1|otimessigma_xotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                            + Big[|uparrow_1...downarrow_i...uparrow_k-1ranglelangleuparrow_1...downarrow_i...uparrow_k-1|otimes Iotimes|uparrow_k+1...uparrow_nranglelangleuparrow_k+1...uparrow_n| + all permutations of states other then i'thBig]
                            endequation



                            Note $k'th$ state(target) is excluded while creating the permutation matrix and at $k'th$ position the operator $sigma_x$ or $I$ is written.



                            Take an example of five qubits in which $2^nd$ qubit is target and $4^th$ is control. Lets build the permutation matrix of $CNOT$. I take, if control is $uparrow$ flip the target. You can take vice-versa too.



                            beginalign
                            CNOT & = |uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4uparrow_5ranglelangleuparrow_3uparrow_4uparrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|uparrow_3uparrow_4downarrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4uparrow_5ranglelangledownarrow_3uparrow_4uparrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimessigma_xotimes|downarrow_3uparrow_4downarrow_5ranglelangledownarrow_3uparrow_4downarrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3downarrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                            & +|uparrow_1ranglelangleuparrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4uparrow_5ranglelangleuparrow_3uparrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|uparrow_3downarrow_4downarrow_5ranglelangleuparrow_3downarrow_4downarrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4uparrow_5ranglelangledownarrow_3downarrow_4uparrow_5|\
                            & +|downarrow_1ranglelangledownarrow_1|otimes Iotimes|downarrow_3downarrow_4downarrow_5ranglelangledownarrow_3downarrow_4downarrow_5|
                            endalign







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 2 hours ago









                            Jitendra

                            1755




                            1755




















                                up vote
                                1
                                down vote













                                This is a good question; it's one that textbooks seem to sneak around. I reached this exact question when preparing a quantum computing lecture a couple days ago.



                                As far as I can tell, there's no way of getting the desired 8x8 matrix using the Kronecker product $otimes$ notation for matrices. All you can really say is: Your operation of applying CNOT to three qubits, with the control being the first and the target being the third, has the following effects:



                                $lvert 000rangle mapsto lvert 000rangle$



                                $lvert 001rangle mapsto lvert 001rangle$



                                $lvert 010rangle mapsto lvert 010rangle$



                                $lvert 011rangle mapsto lvert 011rangle$



                                $lvert 100rangle mapsto lvert 101rangle$



                                $lvert 101rangle mapsto lvert 100rangle$



                                $lvert 110 rangle mapsto lvert 111 rangle$



                                $lvert 111 rangle mapsto lvert 110 rangle$



                                and therefore it is given by the following matrix:



                                $U = beginbmatrix
                                1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
                                0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \
                                0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \
                                0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \
                                0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \
                                0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \
                                0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
                                0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
                                endbmatrix$



                                This matrix $U$ is indeed neither $I_2 otimes mathrmCNOT$ nor $mathrmCNOT otimes I_2$. There is no succinct Kronecker-product-based notation for it; it just is what it is.






                                share|improve this answer








                                New contributor




                                Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.





















                                  up vote
                                  1
                                  down vote













                                  This is a good question; it's one that textbooks seem to sneak around. I reached this exact question when preparing a quantum computing lecture a couple days ago.



                                  As far as I can tell, there's no way of getting the desired 8x8 matrix using the Kronecker product $otimes$ notation for matrices. All you can really say is: Your operation of applying CNOT to three qubits, with the control being the first and the target being the third, has the following effects:



                                  $lvert 000rangle mapsto lvert 000rangle$



                                  $lvert 001rangle mapsto lvert 001rangle$



                                  $lvert 010rangle mapsto lvert 010rangle$



                                  $lvert 011rangle mapsto lvert 011rangle$



                                  $lvert 100rangle mapsto lvert 101rangle$



                                  $lvert 101rangle mapsto lvert 100rangle$



                                  $lvert 110 rangle mapsto lvert 111 rangle$



                                  $lvert 111 rangle mapsto lvert 110 rangle$



                                  and therefore it is given by the following matrix:



                                  $U = beginbmatrix
                                  1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
                                  0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \
                                  0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \
                                  0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \
                                  0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \
                                  0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \
                                  0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
                                  0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
                                  endbmatrix$



                                  This matrix $U$ is indeed neither $I_2 otimes mathrmCNOT$ nor $mathrmCNOT otimes I_2$. There is no succinct Kronecker-product-based notation for it; it just is what it is.






                                  share|improve this answer








                                  New contributor




                                  Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.



















                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote









                                    This is a good question; it's one that textbooks seem to sneak around. I reached this exact question when preparing a quantum computing lecture a couple days ago.



                                    As far as I can tell, there's no way of getting the desired 8x8 matrix using the Kronecker product $otimes$ notation for matrices. All you can really say is: Your operation of applying CNOT to three qubits, with the control being the first and the target being the third, has the following effects:



                                    $lvert 000rangle mapsto lvert 000rangle$



                                    $lvert 001rangle mapsto lvert 001rangle$



                                    $lvert 010rangle mapsto lvert 010rangle$



                                    $lvert 011rangle mapsto lvert 011rangle$



                                    $lvert 100rangle mapsto lvert 101rangle$



                                    $lvert 101rangle mapsto lvert 100rangle$



                                    $lvert 110 rangle mapsto lvert 111 rangle$



                                    $lvert 111 rangle mapsto lvert 110 rangle$



                                    and therefore it is given by the following matrix:



                                    $U = beginbmatrix
                                    1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
                                    0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \
                                    0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \
                                    0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \
                                    0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \
                                    0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \
                                    0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
                                    0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
                                    endbmatrix$



                                    This matrix $U$ is indeed neither $I_2 otimes mathrmCNOT$ nor $mathrmCNOT otimes I_2$. There is no succinct Kronecker-product-based notation for it; it just is what it is.






                                    share|improve this answer








                                    New contributor




                                    Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    This is a good question; it's one that textbooks seem to sneak around. I reached this exact question when preparing a quantum computing lecture a couple days ago.



                                    As far as I can tell, there's no way of getting the desired 8x8 matrix using the Kronecker product $otimes$ notation for matrices. All you can really say is: Your operation of applying CNOT to three qubits, with the control being the first and the target being the third, has the following effects:



                                    $lvert 000rangle mapsto lvert 000rangle$



                                    $lvert 001rangle mapsto lvert 001rangle$



                                    $lvert 010rangle mapsto lvert 010rangle$



                                    $lvert 011rangle mapsto lvert 011rangle$



                                    $lvert 100rangle mapsto lvert 101rangle$



                                    $lvert 101rangle mapsto lvert 100rangle$



                                    $lvert 110 rangle mapsto lvert 111 rangle$



                                    $lvert 111 rangle mapsto lvert 110 rangle$



                                    and therefore it is given by the following matrix:



                                    $U = beginbmatrix
                                    1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \
                                    0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \
                                    0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \
                                    0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \
                                    0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \
                                    0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \
                                    0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \
                                    0 & 0 & 0 & 0 & 0 & 0 & 1 & 0
                                    endbmatrix$



                                    This matrix $U$ is indeed neither $I_2 otimes mathrmCNOT$ nor $mathrmCNOT otimes I_2$. There is no succinct Kronecker-product-based notation for it; it just is what it is.







                                    share|improve this answer








                                    New contributor




                                    Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    share|improve this answer



                                    share|improve this answer






                                    New contributor




                                    Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    answered 2 hours ago









                                    Ryan O'Donnell

                                    1112




                                    1112




                                    New contributor




                                    Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.





                                    New contributor





                                    Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






                                    Ryan O'Donnell is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f4252%2fhow-to-derive-the-cnot-matrix-for-a-3-qbit-system-where-the-control-target-qbi%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Comments

                                        Popular posts from this blog

                                        What does second last employer means? [closed]

                                        Installing NextGIS Connect into QGIS 3?

                                        One-line joke