{"id":4088,"date":"2024-09-21T13:19:02","date_gmt":"2024-09-21T13:19:02","guid":{"rendered":"https:\/\/workhouse.sweetdishy.com\/?p=4088"},"modified":"2024-09-24T11:46:39","modified_gmt":"2024-09-24T11:46:39","slug":"simons-algorithm","status":"publish","type":"post","link":"https:\/\/workhouse.sweetdishy.com\/index.php\/2024\/09\/21\/simons-algorithm\/","title":{"rendered":"Simon\u2019s Algorithm"},"content":{"rendered":"\n<p>Even though the Bernstein\u2013Vazirani algorithm o\ufb00ers such a great speedup,<\/p>\n\n\n\n<p>the classical solution is still not exponential. Daniel Simon came up with an<\/p>\n\n\n\n<p>algorithm [65] in 1994 that is the \ufb01rst to demonstrate a dramatic exponential<\/p>\n\n\n\n<p>speedup over a hard classical problem, but the solution is probabilistic. This<\/p>\n\n\n\n<p>feature is characteristic of many quantum algorithms. Simon\u2019s problem also<\/p>\n\n\n\n<p>illustrates a class of problems that basically use Fourier transforms, in the<\/p>\n\n\n\n<p>form of the amplitudes of the output states that \u201cinterfere\u201d to give a large<\/p>\n\n\n\n<p>probability for the expected solution.<\/p>\n\n\n\n<p>The problem: Given a black box implementing a function<\/p>\n\n\n\n<p>f : {0, 1}<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>7\u2192 {0, 1}<\/p>\n\n\n\n<p>n\u22121<\/p>\n\n\n\n<p>such thatf(x \u2295 a) = f(x), a \u2208 [0, 2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\u2212 1], (8.15)<\/p>\n\n\n\n<p>determine a with the minimum number of queries to the box.<\/p>\n\n\n\n<p>Example 8.3.1. The functions considered in Simon\u2019s algorithm can be thought<\/p>\n\n\n\n<p>of as \u201cperiodic\u201d under bitwise addition. For example, let\u2019s look at the 3-bit<\/p>\n\n\n\n<p>function<\/p>\n\n\n\n<p>x 000 001 010 011 100 101 110 111<\/p>\n\n\n\n<p>f(x) 3 2 2 3 1 4 4 1<\/p>\n\n\n\n<p>The \ufb01rst repetition is of the value f(1) = f(2). The \u201cperiod\u201d is therefore<\/p>\n\n\n\n<p>a = 001 \u2295 010 = 011 = 3. You can verify that all the other repetitions also<\/p>\n\n\n\n<p>satisfy the same condition.<\/p>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"https:\/\/learning.oreilly.com\/api\/v2\/epubs\/urn:orm:book:9781482238129\/files\/bgb0.png\" width=\"446\" height=\"787\"><\/p>\n\n\n\n<p>Quantum Algorithms 151<\/p>\n\n\n\n<p>The classical solution to this problem is hard, i.e., the number of runs<\/p>\n\n\n\n<p>of the function grows exponentially as the size of the input. We would query<\/p>\n\n\n\n<p>the oracle with successive values of n-bit numbers x until we found a repeated<\/p>\n\n\n\n<p>value for the output: f (x<\/p>\n\n\n\n<p>i<\/p>\n\n\n\n<p>) = f (x<\/p>\n\n\n\n<p>j<\/p>\n\n\n\n<p>). Then we could calculate a = x<\/p>\n\n\n\n<p>i<\/p>\n\n\n\n<p>\u2295 x<\/p>\n\n\n\n<p>j<\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<p>However, a could be any one of 2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>possible numbers. By the m<\/p>\n\n\n\n<p>th<\/p>\n\n\n\n<p>run,<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>m(m\u2212<\/p>\n\n\n\n<p>1) pairs have been compared and eliminated as possible a\u2019s. For reasonable<\/p>\n\n\n\n<p>chance of success, we need<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>m(m\u22121) \u2265 2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>=\u21d2 a lower bound on the number<\/p>\n\n\n\n<p>of trials m = \u03a9(2<\/p>\n\n\n\n<p>n\/2<\/p>\n\n\n\n<p>), which is exponential in the number of bits.<\/p>\n\n\n\n<p>The quantum circuit (Figure 8.7) that solves this problem is essentially<\/p>\n\n\n\n<p>the same as the Deutsch\u2013Josza circuit except that the lower register is also<\/p>\n\n\n\n<p>expanded to n qubit, and initialized to |0i<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>(we dispense with the phase<\/p>\n\n\n\n<p>kickback).<\/p>\n\n\n\n<p>|\u03c8<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>i |\u03c8<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>i |\u03c8<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>i<\/p>\n\n\n\n<p>|0i<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\/<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>H<\/p>\n\n\n\n<p>\u2297n<\/p>\n\n\n\n<p>\/<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>U<\/p>\n\n\n\n<p>f<\/p>\n\n\n\n<p>H<\/p>\n\n\n\n<p>\u2297n<\/p>\n\n\n\n<p>\/<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>|0i<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\/<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>f(x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>)<\/p>\n\n\n\n<p>FIGURE 8.7: The circuit for the Simon algorithm.<\/p>\n\n\n\n<p>The input to the oracle gives us<\/p>\n\n\n\n<p>U<\/p>\n\n\n\n<p>f<\/p>\n\n\n\n<p>|\u03c8<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>i \u2297 |0i = U<\/p>\n\n\n\n<p>f<\/p>\n\n\n\n<p>&#8220;<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\u22121<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>x=0<\/p>\n\n\n\n<p>|xi \u2297 |0i<\/p>\n\n\n\n<p>#<\/p>\n\n\n\n<p>=<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\u22121<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>x=0<\/p>\n\n\n\n<p>|xi \u2297 |f(x)i. (8.16)<\/p>\n\n\n\n<p>In order to analyze the solution, let us use the reverse of the principle of<\/p>\n\n\n\n<p>delayed measurement, and assume we measure the lower register after the<\/p>\n\n\n\n<p>action of U<\/p>\n\n\n\n<p>f<\/p>\n\n\n\n<p>. Let\u2019s denote the outcome by f (x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>), which is generated from<\/p>\n\n\n\n<p>two possible inputs x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>or x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>\u2295 a. The top register therefore collapses to a<\/p>\n\n\n\n<p>superposition of these two states alone:<\/p>\n\n\n\n<p>|\u03c8<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>i =<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>\u221a<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>(|x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>i + |x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>\u2295 ai) . (8.17)<\/p>\n\n\n\n<p>If we now apply H to each qubit in the upper register, we get<\/p>\n\n\n\n<p>|\u03c8<\/p>\n\n\n\n<p>3<\/p>\n\n\n\n<p>i =<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>\u221a<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>\u221a<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\u22121<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>y=0<\/p>\n\n\n\n<p>h<\/p>\n\n\n\n<p>(\u22121)<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>\u00b7y<\/p>\n\n\n\n<p>+ (\u22121)<\/p>\n\n\n\n<p>(x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>\u2295a)\u00b7y<\/p>\n\n\n\n<p>i<\/p>\n\n\n\n<p>|yi. (8.18)<\/p>\n\n\n\n<p>Now a \u00b7 y is either 0 or 1. If a \u00b7 y = 1, then the amplitude for |yi is zero and<\/p>\n\n\n\n<p>all those states do not occur in the output. Thus the only states that can be<\/p>\n\n\n\n<p>measured in the output are those for which the condition a \u00b7y = 0 is satis\ufb01ed.<\/p>\n\n\n\n<p>This is a binary algebraic equation with n unknowns (the bits of a). We can<\/p>\n\n\n\n<p>\ufb01nd a if we can obtain n independent equations, corresponding to n di\ufb00erent<\/p>\n\n\n\n<p>values of y. If we repeat the experiment until we have collected n distinct,<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>152 Introduction to Quantum Physics and Information Processing<\/p>\n\n\n\n<p>non-zero y\u2019s then we can solve for the bits of a. It is not guaranteed that we<\/p>\n\n\n\n<p>will get a distinct y on each run, so we may most probably have to run the<\/p>\n\n\n\n<p>oracle more than n times.<\/p>\n\n\n\n<p>To determine the complexity of this problem, we will need to estimate<\/p>\n\n\n\n<p>how the number of runs of the oracle scales with n. It can be shown (see Box<\/p>\n\n\n\n<p>8.3) that the number of times the oracle has to be queried is n + m where m<\/p>\n\n\n\n<p>doesn\u2019t depend on n. This algorithm is thus a sub-exponential solution to a<\/p>\n\n\n\n<p>classically hard problem.<\/p>\n\n\n\n<p>Box 8.1: Complexity Analysis for Simon\u2019s Algorithm<\/p>\n\n\n\n<p>As in many quantum algorithms, the analysis of why the algorithm is com-<\/p>\n\n\n\n<p>putationally more e\ufb03cient than the classical case involves a detailed math-<\/p>\n\n\n\n<p>ematical examination of the solution. In the case of Simon\u2019s algorithm, the<\/p>\n\n\n\n<p>output after measurement is an n-bit string y such that<\/p>\n\n\n\n<p>a \u00b7 y = a<\/p>\n\n\n\n<p>n\u22121<\/p>\n\n\n\n<p>y<\/p>\n\n\n\n<p>n\u22121<\/p>\n\n\n\n<p>\u2295 a<\/p>\n\n\n\n<p>n\u22122<\/p>\n\n\n\n<p>y<\/p>\n\n\n\n<p>n\u22122<\/p>\n\n\n\n<p>\u2295 \u00b7\u00b7\u00b7 \u2295 a<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>y<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>\u2295 a<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>y<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>= 0.<\/p>\n\n\n\n<p>We need to collect at least n \u22121 such distinct bit-strings in order to determine<\/p>\n\n\n\n<p>the coe\ufb03cients a. So we need to query the oracle at least n \u22121 times and need<\/p>\n\n\n\n<p>to \ufb01nd a lower bound on the probability of success.<\/p>\n\n\n\n<p>Suppose we ran the algorithm k times and got linearly independent y\u2019s.<\/p>\n\n\n\n<p>What\u2019s the probability that the next run gives a di\ufb00erent y? The minimum<\/p>\n\n\n\n<p>probability for this occurring is<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\u2212 2<\/p>\n\n\n\n<p>k<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>= 1 \u2212 2<\/p>\n\n\n\n<p>k\u2212n<\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<p>So the probability of getting n \u2212 1 independent y\u2019s is just<\/p>\n\n\n\n<p>P =<\/p>\n\n\n\n<p>\ue012<\/p>\n\n\n\n<p>1 \u2212<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>\ue013\ue012<\/p>\n\n\n\n<p>1 \u2212<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>n\u22121<\/p>\n\n\n\n<p>\ue013<\/p>\n\n\n\n<p>. . .<\/p>\n\n\n\n<p>\ue012<\/p>\n\n\n\n<p>1 \u2212<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>\ue013<\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<p>Now notice that (1 \u2212 s)(1 \u2212 t) = 1 \u2212 (s + t) + st \u2265 1 \u2212 (s + t). So we have<\/p>\n\n\n\n<p>P \u2265<\/p>\n\n\n\n<p>1 \u2212<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>i=1<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>i<\/p>\n\n\n\n<p>!<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>\u2265<\/p>\n\n\n\n<p>\ue012<\/p>\n\n\n\n<p>1 \u2212<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>\ue013<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>=<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>4<\/p>\n\n\n\n<p>.<\/p>\n\n\n\n<p>This means that there is a \ufb01nite minimum probability with which we will<\/p>\n\n\n\n<p>succeed in n runs. To ensure success, we\u2019ll have to run the algorithm a few<\/p>\n\n\n\n<p>more times, independent of n, so that the number of runs is still O(n).<\/p>\n\n\n\n<p>The trick that makes the kind of algorithms considered so far work is that<\/p>\n\n\n\n<p>the output before measuring in the X basis has f(x)-dependent phases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Even though the Bernstein\u2013Vazirani algorithm o\ufb00ers such a great speedup, the classical solution is still not exponential. Daniel Simon came up with an algorithm [65] in 1994 that is the \ufb01rst to demonstrate a dramatic exponential speedup over a hard classical problem, but the solution is probabilistic. This feature is characteristic of many quantum algorithms. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4042,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[497],"tags":[],"class_list":["post-4088","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-quantum-algorithms"],"jetpack_featured_media_url":"https:\/\/workhouse.sweetdishy.com\/wp-content\/uploads\/2024\/09\/algorithm-1.png","_links":{"self":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/4088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/comments?post=4088"}],"version-history":[{"count":2,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/4088\/revisions"}],"predecessor-version":[{"id":4585,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/4088\/revisions\/4585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/media\/4042"}],"wp:attachment":[{"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/media?parent=4088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/categories?post=4088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/tags?post=4088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}