Quantum Toffoli gate equation





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3












$begingroup$


I was reading a research article on quantum computing and didn't understand the tensor notations for the unitary operations. The article defined two controlled gates.



Let $U_{2^m}$ be a $2^m times 2^m$ unitary matrix, $I_{2^m}$ be a $2^m times 2^m$ identity matrix. Then, controlled gates $C_n^j(U_{2^m})$ and $V_n^j(U_{2^m})$ with $n$ control qubits and $m$ target qubits are defined by $$ C_n^j(U_{2^m})=(|jrangle langle j|) otimes U_{2^m}+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| otimes I_{2^m}$$



$$ V_n^j(U_{2^m}) = U_{2^m} otimes (|jrangle langle j|) + sum_{i=0,i neq j}^{2^n-1}( I_{2^m} otimes (|irangle langle i| ))$$
Then they say that $C_2^j(X)$ and $V_2^j(X) $are toffoli gates.
Can someone explain the equations that are given
and how does this special case be a Toffoli?










share|improve this question











$endgroup$



















    3












    $begingroup$


    I was reading a research article on quantum computing and didn't understand the tensor notations for the unitary operations. The article defined two controlled gates.



    Let $U_{2^m}$ be a $2^m times 2^m$ unitary matrix, $I_{2^m}$ be a $2^m times 2^m$ identity matrix. Then, controlled gates $C_n^j(U_{2^m})$ and $V_n^j(U_{2^m})$ with $n$ control qubits and $m$ target qubits are defined by $$ C_n^j(U_{2^m})=(|jrangle langle j|) otimes U_{2^m}+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| otimes I_{2^m}$$



    $$ V_n^j(U_{2^m}) = U_{2^m} otimes (|jrangle langle j|) + sum_{i=0,i neq j}^{2^n-1}( I_{2^m} otimes (|irangle langle i| ))$$
    Then they say that $C_2^j(X)$ and $V_2^j(X) $are toffoli gates.
    Can someone explain the equations that are given
    and how does this special case be a Toffoli?










    share|improve this question











    $endgroup$















      3












      3








      3





      $begingroup$


      I was reading a research article on quantum computing and didn't understand the tensor notations for the unitary operations. The article defined two controlled gates.



      Let $U_{2^m}$ be a $2^m times 2^m$ unitary matrix, $I_{2^m}$ be a $2^m times 2^m$ identity matrix. Then, controlled gates $C_n^j(U_{2^m})$ and $V_n^j(U_{2^m})$ with $n$ control qubits and $m$ target qubits are defined by $$ C_n^j(U_{2^m})=(|jrangle langle j|) otimes U_{2^m}+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| otimes I_{2^m}$$



      $$ V_n^j(U_{2^m}) = U_{2^m} otimes (|jrangle langle j|) + sum_{i=0,i neq j}^{2^n-1}( I_{2^m} otimes (|irangle langle i| ))$$
      Then they say that $C_2^j(X)$ and $V_2^j(X) $are toffoli gates.
      Can someone explain the equations that are given
      and how does this special case be a Toffoli?










      share|improve this question











      $endgroup$




      I was reading a research article on quantum computing and didn't understand the tensor notations for the unitary operations. The article defined two controlled gates.



      Let $U_{2^m}$ be a $2^m times 2^m$ unitary matrix, $I_{2^m}$ be a $2^m times 2^m$ identity matrix. Then, controlled gates $C_n^j(U_{2^m})$ and $V_n^j(U_{2^m})$ with $n$ control qubits and $m$ target qubits are defined by $$ C_n^j(U_{2^m})=(|jrangle langle j|) otimes U_{2^m}+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| otimes I_{2^m}$$



      $$ V_n^j(U_{2^m}) = U_{2^m} otimes (|jrangle langle j|) + sum_{i=0,i neq j}^{2^n-1}( I_{2^m} otimes (|irangle langle i| ))$$
      Then they say that $C_2^j(X)$ and $V_2^j(X) $are toffoli gates.
      Can someone explain the equations that are given
      and how does this special case be a Toffoli?







      quantum-gate tensor-product






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 11 hours ago









      Sanchayan Dutta

      6,64141556




      6,64141556










      asked 16 hours ago









      UpstartUpstart

      1506




      1506






















          1 Answer
          1






          active

          oldest

          votes


















          4












          $begingroup$

          Here $i$ and $j$ are bit strings of size $n$. Correspondingly, $|irangle$, $|jrangle$ are some basis vectors in $2^n$-dimensional space, that corresponds to $n$-qubit register.



          Those controlled operations $C$ and $V$ act on $(n+m)$-qubit space. You can consider first $n$ qubits as control register and last $m$ qubits as target register. Now, $C_n^j(U_{2^m})$ applies unitary operation $U_{2^m}$ on the target register if control register is in the state $|jrangle$ and applies $I_{2^m}$ (i.e. do nothing) otherwise. You can see this by applying $C_n^j(U_{2^m})$ on some vector $|xrangle|yrangle$ from the $(n+m)$-qubit space, where $x$ is some $n$-bit string:



          $$
          C_n^j(U_{2^m}) |xrangle|yrangle = (|jrangle langle j|xrangle) otimes U_{2^m} |yrangle+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| x rangle) otimes |yrangle)
          $$



          Here $|irangle langle i|xrangle = 0$ if $xneq i$ and it equals $|irangle$ if $x=i$.
          Hence
          $$C_n^j(U_{2^m}) |xrangle|yrangle = |jrangle otimes U_{2^m} |yrangle + 0 = |xrangle otimes U_{2^m} |yrangle ~~text{if}~~ x=j$$
          and
          $$C_n^j(U_{2^m}) |xrangle|yrangle = 0 + |xrangle|yrangle = |xrangle|yrangle ~~text{if}~~ xneq j.$$



          Gate $V_n^j(U_{2^m})$ is basically the same as $C_n^j(U_{2^m})$, though we consider first $m$ qubits as target and last $n$ qubits as control register in this case.



          Now, if $j=11$ then $C_2^j(X)$ is exactly CCNOT gate on 3 qubits. Because we apply $X$ (i.e. negating the value) on the last qubit only if two first qubits are in $|11rangle$ state.






          share|improve this answer











          $endgroup$













          • $begingroup$
            $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
            $endgroup$
            – Upstart
            13 hours ago










          • $begingroup$
            yes, that is it.
            $endgroup$
            – Danylo Y
            12 hours ago












          • $begingroup$
            why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
            $endgroup$
            – Upstart
            12 hours ago












          • $begingroup$
            $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
            $endgroup$
            – Danylo Y
            12 hours ago










          • $begingroup$
            i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
            $endgroup$
            – Upstart
            12 hours ago












          Your Answer








          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f5899%2fquantum-toffoli-gate-equation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4












          $begingroup$

          Here $i$ and $j$ are bit strings of size $n$. Correspondingly, $|irangle$, $|jrangle$ are some basis vectors in $2^n$-dimensional space, that corresponds to $n$-qubit register.



          Those controlled operations $C$ and $V$ act on $(n+m)$-qubit space. You can consider first $n$ qubits as control register and last $m$ qubits as target register. Now, $C_n^j(U_{2^m})$ applies unitary operation $U_{2^m}$ on the target register if control register is in the state $|jrangle$ and applies $I_{2^m}$ (i.e. do nothing) otherwise. You can see this by applying $C_n^j(U_{2^m})$ on some vector $|xrangle|yrangle$ from the $(n+m)$-qubit space, where $x$ is some $n$-bit string:



          $$
          C_n^j(U_{2^m}) |xrangle|yrangle = (|jrangle langle j|xrangle) otimes U_{2^m} |yrangle+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| x rangle) otimes |yrangle)
          $$



          Here $|irangle langle i|xrangle = 0$ if $xneq i$ and it equals $|irangle$ if $x=i$.
          Hence
          $$C_n^j(U_{2^m}) |xrangle|yrangle = |jrangle otimes U_{2^m} |yrangle + 0 = |xrangle otimes U_{2^m} |yrangle ~~text{if}~~ x=j$$
          and
          $$C_n^j(U_{2^m}) |xrangle|yrangle = 0 + |xrangle|yrangle = |xrangle|yrangle ~~text{if}~~ xneq j.$$



          Gate $V_n^j(U_{2^m})$ is basically the same as $C_n^j(U_{2^m})$, though we consider first $m$ qubits as target and last $n$ qubits as control register in this case.



          Now, if $j=11$ then $C_2^j(X)$ is exactly CCNOT gate on 3 qubits. Because we apply $X$ (i.e. negating the value) on the last qubit only if two first qubits are in $|11rangle$ state.






          share|improve this answer











          $endgroup$













          • $begingroup$
            $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
            $endgroup$
            – Upstart
            13 hours ago










          • $begingroup$
            yes, that is it.
            $endgroup$
            – Danylo Y
            12 hours ago












          • $begingroup$
            why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
            $endgroup$
            – Upstart
            12 hours ago












          • $begingroup$
            $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
            $endgroup$
            – Danylo Y
            12 hours ago










          • $begingroup$
            i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
            $endgroup$
            – Upstart
            12 hours ago
















          4












          $begingroup$

          Here $i$ and $j$ are bit strings of size $n$. Correspondingly, $|irangle$, $|jrangle$ are some basis vectors in $2^n$-dimensional space, that corresponds to $n$-qubit register.



          Those controlled operations $C$ and $V$ act on $(n+m)$-qubit space. You can consider first $n$ qubits as control register and last $m$ qubits as target register. Now, $C_n^j(U_{2^m})$ applies unitary operation $U_{2^m}$ on the target register if control register is in the state $|jrangle$ and applies $I_{2^m}$ (i.e. do nothing) otherwise. You can see this by applying $C_n^j(U_{2^m})$ on some vector $|xrangle|yrangle$ from the $(n+m)$-qubit space, where $x$ is some $n$-bit string:



          $$
          C_n^j(U_{2^m}) |xrangle|yrangle = (|jrangle langle j|xrangle) otimes U_{2^m} |yrangle+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| x rangle) otimes |yrangle)
          $$



          Here $|irangle langle i|xrangle = 0$ if $xneq i$ and it equals $|irangle$ if $x=i$.
          Hence
          $$C_n^j(U_{2^m}) |xrangle|yrangle = |jrangle otimes U_{2^m} |yrangle + 0 = |xrangle otimes U_{2^m} |yrangle ~~text{if}~~ x=j$$
          and
          $$C_n^j(U_{2^m}) |xrangle|yrangle = 0 + |xrangle|yrangle = |xrangle|yrangle ~~text{if}~~ xneq j.$$



          Gate $V_n^j(U_{2^m})$ is basically the same as $C_n^j(U_{2^m})$, though we consider first $m$ qubits as target and last $n$ qubits as control register in this case.



          Now, if $j=11$ then $C_2^j(X)$ is exactly CCNOT gate on 3 qubits. Because we apply $X$ (i.e. negating the value) on the last qubit only if two first qubits are in $|11rangle$ state.






          share|improve this answer











          $endgroup$













          • $begingroup$
            $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
            $endgroup$
            – Upstart
            13 hours ago










          • $begingroup$
            yes, that is it.
            $endgroup$
            – Danylo Y
            12 hours ago












          • $begingroup$
            why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
            $endgroup$
            – Upstart
            12 hours ago












          • $begingroup$
            $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
            $endgroup$
            – Danylo Y
            12 hours ago










          • $begingroup$
            i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
            $endgroup$
            – Upstart
            12 hours ago














          4












          4








          4





          $begingroup$

          Here $i$ and $j$ are bit strings of size $n$. Correspondingly, $|irangle$, $|jrangle$ are some basis vectors in $2^n$-dimensional space, that corresponds to $n$-qubit register.



          Those controlled operations $C$ and $V$ act on $(n+m)$-qubit space. You can consider first $n$ qubits as control register and last $m$ qubits as target register. Now, $C_n^j(U_{2^m})$ applies unitary operation $U_{2^m}$ on the target register if control register is in the state $|jrangle$ and applies $I_{2^m}$ (i.e. do nothing) otherwise. You can see this by applying $C_n^j(U_{2^m})$ on some vector $|xrangle|yrangle$ from the $(n+m)$-qubit space, where $x$ is some $n$-bit string:



          $$
          C_n^j(U_{2^m}) |xrangle|yrangle = (|jrangle langle j|xrangle) otimes U_{2^m} |yrangle+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| x rangle) otimes |yrangle)
          $$



          Here $|irangle langle i|xrangle = 0$ if $xneq i$ and it equals $|irangle$ if $x=i$.
          Hence
          $$C_n^j(U_{2^m}) |xrangle|yrangle = |jrangle otimes U_{2^m} |yrangle + 0 = |xrangle otimes U_{2^m} |yrangle ~~text{if}~~ x=j$$
          and
          $$C_n^j(U_{2^m}) |xrangle|yrangle = 0 + |xrangle|yrangle = |xrangle|yrangle ~~text{if}~~ xneq j.$$



          Gate $V_n^j(U_{2^m})$ is basically the same as $C_n^j(U_{2^m})$, though we consider first $m$ qubits as target and last $n$ qubits as control register in this case.



          Now, if $j=11$ then $C_2^j(X)$ is exactly CCNOT gate on 3 qubits. Because we apply $X$ (i.e. negating the value) on the last qubit only if two first qubits are in $|11rangle$ state.






          share|improve this answer











          $endgroup$



          Here $i$ and $j$ are bit strings of size $n$. Correspondingly, $|irangle$, $|jrangle$ are some basis vectors in $2^n$-dimensional space, that corresponds to $n$-qubit register.



          Those controlled operations $C$ and $V$ act on $(n+m)$-qubit space. You can consider first $n$ qubits as control register and last $m$ qubits as target register. Now, $C_n^j(U_{2^m})$ applies unitary operation $U_{2^m}$ on the target register if control register is in the state $|jrangle$ and applies $I_{2^m}$ (i.e. do nothing) otherwise. You can see this by applying $C_n^j(U_{2^m})$ on some vector $|xrangle|yrangle$ from the $(n+m)$-qubit space, where $x$ is some $n$-bit string:



          $$
          C_n^j(U_{2^m}) |xrangle|yrangle = (|jrangle langle j|xrangle) otimes U_{2^m} |yrangle+ sum_{i=0,i neq j}^{2^n-1}((|irangle langle i| x rangle) otimes |yrangle)
          $$



          Here $|irangle langle i|xrangle = 0$ if $xneq i$ and it equals $|irangle$ if $x=i$.
          Hence
          $$C_n^j(U_{2^m}) |xrangle|yrangle = |jrangle otimes U_{2^m} |yrangle + 0 = |xrangle otimes U_{2^m} |yrangle ~~text{if}~~ x=j$$
          and
          $$C_n^j(U_{2^m}) |xrangle|yrangle = 0 + |xrangle|yrangle = |xrangle|yrangle ~~text{if}~~ xneq j.$$



          Gate $V_n^j(U_{2^m})$ is basically the same as $C_n^j(U_{2^m})$, though we consider first $m$ qubits as target and last $n$ qubits as control register in this case.



          Now, if $j=11$ then $C_2^j(X)$ is exactly CCNOT gate on 3 qubits. Because we apply $X$ (i.e. negating the value) on the last qubit only if two first qubits are in $|11rangle$ state.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 14 hours ago

























          answered 14 hours ago









          Danylo YDanylo Y

          45116




          45116












          • $begingroup$
            $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
            $endgroup$
            – Upstart
            13 hours ago










          • $begingroup$
            yes, that is it.
            $endgroup$
            – Danylo Y
            12 hours ago












          • $begingroup$
            why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
            $endgroup$
            – Upstart
            12 hours ago












          • $begingroup$
            $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
            $endgroup$
            – Danylo Y
            12 hours ago










          • $begingroup$
            i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
            $endgroup$
            – Upstart
            12 hours ago


















          • $begingroup$
            $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
            $endgroup$
            – Upstart
            13 hours ago










          • $begingroup$
            yes, that is it.
            $endgroup$
            – Danylo Y
            12 hours ago












          • $begingroup$
            why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
            $endgroup$
            – Upstart
            12 hours ago












          • $begingroup$
            $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
            $endgroup$
            – Danylo Y
            12 hours ago










          • $begingroup$
            i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
            $endgroup$
            – Upstart
            12 hours ago
















          $begingroup$
          $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
          $endgroup$
          – Upstart
          13 hours ago




          $begingroup$
          $y$ is an m bit string ? hence $|y rangle$ lies in a$2^m$ dimensional hilbert space?
          $endgroup$
          – Upstart
          13 hours ago












          $begingroup$
          yes, that is it.
          $endgroup$
          – Danylo Y
          12 hours ago






          $begingroup$
          yes, that is it.
          $endgroup$
          – Danylo Y
          12 hours ago














          $begingroup$
          why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
          $endgroup$
          – Upstart
          12 hours ago






          $begingroup$
          why is $langle i|xrangle=0$ if $xneq i$ i see that it is an inner product between them but how is it zero because two binary strings dot product can still be non zero if they are not equal
          $endgroup$
          – Upstart
          12 hours ago














          $begingroup$
          $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
          $endgroup$
          – Danylo Y
          12 hours ago




          $begingroup$
          $langle a | b rangle = langle a_1 | b_1 rangle langle a_2 | b_2 rangle ... langle a_n | b_n rangle$. This is zero if $a_i neq b_i$ at least for some $i$.
          $endgroup$
          – Danylo Y
          12 hours ago












          $begingroup$
          i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
          $endgroup$
          – Upstart
          12 hours ago




          $begingroup$
          i read that is $= a_1b_1+ a_2b_2+....+a_nb_n$
          $endgroup$
          – Upstart
          12 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Quantum Computing Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fquantumcomputing.stackexchange.com%2fquestions%2f5899%2fquantum-toffoli-gate-equation%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Statuo de Libereco

          Tanganjiko

          Liste der Baudenkmäler in Enneberg