{"id":4086,"date":"2024-09-21T13:17:26","date_gmt":"2024-09-21T13:17:26","guid":{"rendered":"https:\/\/workhouse.sweetdishy.com\/?p=4086"},"modified":"2024-09-21T13:17:26","modified_gmt":"2024-09-21T13:17:26","slug":"the-bernstein-vazirani-algorithm","status":"publish","type":"post","link":"https:\/\/workhouse.sweetdishy.com\/index.php\/2024\/09\/21\/the-bernstein-vazirani-algorithm\/","title":{"rendered":"The Bernstein\u2013Vazirani Algorithm"},"content":{"rendered":"\n<p>We\u2019ll now look at algorithms that show more substantial speedups com-<\/p>\n\n\n\n<p>pared to classical ones. One such algorithm was invented by Umesh Vazirani<\/p>\n\n\n\n<p>and his student Ethan Bernstein in 1993 [11]. This algorithm identi\ufb01es a linear<\/p>\n\n\n\n<p>Boolean function in one query of the oracle.<\/p>\n\n\n\n<p>The problem: given a function evaluator for<\/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} where f (x) = a \u00b7 x, a \u2208 [0, 2<\/p>\n\n\n\n<p>n<\/p>\n\n\n\n<p>], (8.11)<\/p>\n\n\n\n<p>and the dot is a bitwise product with modulo 2 addition:<\/p>\n\n\n\n<p>a \u00b7 x \u2261 a<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>\u2295 a<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>\u2295 \u00b7\u00b7\u00b7 \u2295 a<\/p>\n\n\n\n<p>n\u22121<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>n\u22121<\/p>\n\n\n\n<p>, (8.12)<\/p>\n\n\n\n<p>determine the function, or in other words \ufb01nd a.<\/p>\n\n\n\n<p>Example 8.2.1. An example of such a function for n = 2 and a = 11, which<\/p>\n\n\n\n<p>evaluates to<\/p>\n\n\n\n<p>f(00) = 0<\/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\/bgae.png\" width=\"685\" height=\"892\"><\/p>\n\n\n\n<p>Quantum Algorithms 149<\/p>\n\n\n\n<p>f(01) = 0.1 \u2295 1.1 = 1<\/p>\n\n\n\n<p>f(10) = 1.1 \u2295 0.1 = 1<\/p>\n\n\n\n<p>f(11) = 1.1 \u2295 1.1 = 0<\/p>\n\n\n\n<p>Classically, we can determine the k<\/p>\n\n\n\n<p>th<\/p>\n\n\n\n<p>bit of a if we feed the oracle the<\/p>\n\n\n\n<p>input x = 2<\/p>\n\n\n\n<p>k<\/p>\n\n\n\n<p>, that has only the k<\/p>\n\n\n\n<p>th<\/p>\n\n\n\n<p>bit as 1 and all the rest as 0. This becomes<\/p>\n\n\n\n<p>obvious when you look at the binary expansion of a:<\/p>\n\n\n\n<p>a = a<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>+ a<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>+ \u00b7\u00b7\u00b7 + a<\/p>\n\n\n\n<p>k<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>k<\/p>\n\n\n\n<p>+ . . . =\u21d2 a<\/p>\n\n\n\n<p>k<\/p>\n\n\n\n<p>= a \u00b7 2<\/p>\n\n\n\n<p>k<\/p>\n\n\n\n<p>. (8.13)<\/p>\n\n\n\n<p>This calls the function n times.<\/p>\n\n\n\n<p>The quantum algorithm, which uses the same circuit as for the<\/p>\n\n\n\n<p>Deutsch\u2013Josza algorithm, succeeds with one call!<\/p>\n\n\n\n<p>Let\u2019s analyze the output of the circuit of Figure 8.4 for this form of the<\/p>\n\n\n\n<p>function:<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>y<\/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>(\u22121)<\/p>\n\n\n\n<p>f(x)+x\u00b7y<\/p>\n\n\n\n<p>|yi \u2297 |\u2212i =<\/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>X<\/p>\n\n\n\n<p>y<\/p>\n\n\n\n<p>&#8220;<\/p>\n\n\n\n<p>X<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>(\u22121)<\/p>\n\n\n\n<p>a\u00b7x+y\u00b7x<\/p>\n\n\n\n<p>#<\/p>\n\n\n\n<p>|yi \u2297 |\u2212i<\/p>\n\n\n\n<p>. (8.14)<\/p>\n\n\n\n<p>The amplitude for |yi is<\/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>P<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>(\u22121)<\/p>\n\n\n\n<p>a\u00b7x+y\u00b7x<\/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>n<\/p>\n\n\n\n<p>P<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>(\u22121)<\/p>\n\n\n\n<p>(a+y)\u00b7x<\/p>\n\n\n\n<p>= 1 if<\/p>\n\n\n\n<p>y = a! It\u2019s easy to see why it is zero for all other values of y. Thus with<\/p>\n\n\n\n<p>certainty, the output of the circuit gives us a.<\/p>\n\n\n\n<p>A more explicit way of seeing why this works is by analyzing the circuit for<\/p>\n\n\n\n<p>U<\/p>\n\n\n\n<p>f<\/p>\n\n\n\n<p>. This analysis is lucidly given in Mermin [48]. The black box for a\u00b7x \ufb02ips the<\/p>\n\n\n\n<p>bit in the lower register whenever a bit of the input x and the corresponding<\/p>\n\n\n\n<p>bit of a are both 1. For instance, suppose we had a = 11010 with n = 5. Then<\/p>\n\n\n\n<p>it can easily be seen that a \u00b7 x is implemented by the circuit of Figure 8.5.<\/p>\n\n\n\n<p>a = 11010<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>4<\/p>\n\n\n\n<p>\u2022<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>3<\/p>\n\n\n\n<p>\u2022<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>2<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>\u2022<\/p>\n\n\n\n<p>x<\/p>\n\n\n\n<p>0<\/p>\n\n\n\n<p>|0i |a \u00b7 xi<\/p>\n\n\n\n<p>FIGURE 8.5: A circuit that executes U<\/p>\n\n\n\n<p>f<\/p>\n\n\n\n<p>for f = 11010 \u00b7 x.<\/p>\n\n\n\n<p>Coming to the circuit for solving the Bernstein\u2013Vazirani problem, it has<\/p>\n\n\n\n<p>an H gate before each qubit enters the function evaluator and after. This is<\/p>\n\n\n\n<p>true even of the lower register, which can be thought of as initialized to |1i.<\/p>\n\n\n\n<p>Note that an H gate before and after a CNOT interchanges the roles of the<\/p>\n\n\n\n<p>control and target qubits (see Figure 7.8).<\/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\/bgaf.png\" width=\"685\" height=\"1082\"><\/p>\n\n\n\n<p>150 Introduction to Quantum Physics and Information Processing<\/p>\n\n\n\n<p>|0i |1i<\/p>\n\n\n\n<p>|0i |1i<\/p>\n\n\n\n<p>|0i |0i<\/p>\n\n\n\n<p>|0i |1i<\/p>\n\n\n\n<p>|0i |0i<\/p>\n\n\n\n<p>|1i<\/p>\n\n\n\n<p>\u2022 \u2022 \u2022<\/p>\n\n\n\n<p>FIGURE 8.6: Analysis of circuit for the Bernstein\u2013Vazirani algorithm for a =<\/p>\n\n\n\n<p>11010.<\/p>\n\n\n\n<p>The solution is therefore the circuit of Figure 8.6, whose output directly<\/p>\n\n\n\n<p>reads out the bits of a.<\/p>\n\n\n\n<p>The algorithm thus gives an n-fold speedup over the classical case<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ll now look at algorithms that show more substantial speedups com- pared to classical ones. One such algorithm was invented by Umesh Vazirani and his student Ethan Bernstein in 1993 [11]. This algorithm identi\ufb01es a linear Boolean function in one query of the oracle. The problem: given a function evaluator for f : {0, 1} [&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-4086","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\/4086","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=4086"}],"version-history":[{"count":1,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/4086\/revisions"}],"predecessor-version":[{"id":4087,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/posts\/4086\/revisions\/4087"}],"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=4086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/categories?post=4086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/workhouse.sweetdishy.com\/index.php\/wp-json\/wp\/v2\/tags?post=4086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}