Skip to content
Snippets Groups Projects
Commit 933356d4 authored by Stefan Stump's avatar Stefan Stump
Browse files

Added shors algorithmus and minor fixes in bernstein-vazirani

parent b4a87c55
Branches
No related tags found
1 merge request!3Summer25 dev
Showing
with 1761 additions and 140 deletions
No preview for this file type
......@@ -30,6 +30,7 @@ ul.task-list li input[type="checkbox"] {
<script src="../site_libs/quarto-search/fuse.min.js"></script>
<script src="../site_libs/quarto-search/quarto-search.js"></script>
<meta name="quarto:offset" content="../">
<link href="../content/shorsAlgorithm.html" rel="next">
<link href="../content/ketNotation.html" rel="prev">
<script src="../site_libs/quarto-html/quarto.js" type="module"></script>
<script src="../site_libs/quarto-html/tabsets/tabsets.js" type="module"></script>
......@@ -218,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link active">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......@@ -263,13 +270,15 @@ window.Quarto = {
</figure>
</div>
<p>Note that <span class="math inline">\(U_f\)</span> is defined with the explanation below.</p>
<p>We start with <span class="math inline">\(n\)</span> qubits on the top wire. All of these qubits are in the state <span class="math inline">\(\ket{0}\)</span>, which we write <span class="math inline">\(\ket{0}^n = \ket{0} \otimes \dots \otimes \ket{0}\)</span>. The bottom wire is in the state <span class="math inline">\(\ket{1}\)</span>. Both wires composed together can be written as <span class="math inline">\(\psi_1 = \ket{0}^n \otimes \ket{1}\)</span>, which is the overall starting state of our algorithm. We now perform the following steps</p>
<p>We start with <span class="math inline">\(n\)</span> qubits on the top wire. All of these qubits are in the state <span class="math inline">\(\ket{0}\)</span>, which we write <span class="math inline">\(\ket{0}^n = \ket{0} \otimes \dots \otimes \ket{0}\)</span>. The bottom wire is in the state <span class="math inline">\(\ket{1}\)</span>. Both wires composed together can be written as <span class="math inline">\(\ket{\psi_0} = \ket{0^n1} = \ket{0}^n \otimes \ket{1}\)</span>, which is the overall starting state of our algorithm. We now perform the following steps</p>
<ol type="1">
<li><p>First we apply a Hadamard gate on all qubits. This is denoted for the first <span class="math inline">\(n\)</span> qubits by the <span class="math inline">\(H^{\otimes n}\)</span> gate and for the last qubit by the <span class="math inline">\(H\)</span> gate on the bottom wire. The resulting quantum state is calculated as follows: <span class="math display">\[
\begin{aligned}
\psi_2 &amp;= \left(H^{\otimes n} \otimes H\right) \left(\ket{0}^n \otimes \ket{1}\right)\\
\ket{\psi_1}
&amp;= \left(H^{\otimes n} \otimes H\right) \left(\ket{\psi_0}\right)\\
&amp;= \left(H^{\otimes n} \otimes H\right) \left(\ket{0}^n \otimes \ket{1}\right)\\
&amp;=\left(H^{\otimes n}\ket{0}^n\right) \otimes H\ket{1}\\
&amp;=\left(\ket{+}\right)^{\otimes n} \otimes \ket{-}\\
&amp;=\ket{+}^{\otimes n} \otimes \ket{-}\\
&amp;=\left(\frac{1}{\sqrt{2}} \ket{0} + \frac{1}{\sqrt{2}} \ket{1} \right)^{\otimes n} \otimes \ket{-}\\
&amp;=\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}
\end{aligned}
......@@ -278,15 +287,18 @@ window.Quarto = {
U_f\,\ket{x,y} = \ket{x,y \oplus f(x)}
\]</span> This unitary represents the function <span class="math inline">\(f\)</span> and combines the output of <span class="math inline">\(f(x)\)</span> with the bottom wire <span class="math inline">\(y\)</span>. For our quantum states, this means that the state after <span class="math inline">\(U_f\)</span> can be calculated as follows: <span class="math display">\[
\begin{aligned}
\psi_3&amp;=U_f\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}\\
\ket{\psi_2}
&amp;= U_f\ket{\psi_1}\\
&amp;= U_f\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}\\
&amp;= U_f\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}\\
&amp;=\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} U_f\Bigl (\ket{x} \otimes \ket{-}\Bigr) \\
&amp;\stackrel{*}{=}\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} (-1)^{f(x)}\ket{x} \otimes \ket{-} \\
&amp;=\left(\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} (-1)^{f(x)}\ket{x} \right) \otimes \ket{-}
\end{aligned}
\]</span> Note that the <span class="math inline">\(*\)</span> holds since we can rewrite <span class="math inline">\(U_f(\ket{x}\otimes\ket{-})\)</span> as <span class="math display">\[
\]</span> Note that the <span class="math inline">\(*\)</span> holds since we can rewrite <span class="math inline">\(U_f\Bigl(\ket{x}\otimes\ket{-}\Bigr)\)</span> as <span class="math display">\[
\begin{aligned}
&amp;U_f\Bigl(\ket{x}\otimes\ket{-}\Bigr)\\
&amp;= \frac{1}{\sqrt{2}} U_f\ket{x,0} - \frac{1}{\sqrt{2}} \ket{x,1}\\
U_f\Bigl(\ket{x}\otimes\ket{-}\Bigr)
&amp;= \frac{1}{\sqrt{2}} U_f\ket{x,0} - \frac{1}{\sqrt{2}} U_f\ket{x,1}\\
&amp;= \frac{1}{\sqrt{2}} \ket{x,f(x)} - \frac{1}{\sqrt{2}} \ket{x,\overline{f(x)}}\\
&amp;= \begin{cases} \frac{1}{\sqrt{2}} \ket{x,0} - \frac{1}{\sqrt{2}} \ket{x,1} &amp; f(x)=0\\
\frac{1}{\sqrt{2}} \ket{x,1} - \frac{1}{\sqrt{2}} \ket{x,0} &amp; f(x)=1 \end{cases}\\
......@@ -295,9 +307,11 @@ U_f\,\ket{x,y} = \ket{x,y \oplus f(x)}
&amp;= (-1)^{f(x)} \ket{x} \otimes \ket{-}
\end{aligned}
\]</span> The bottom wire has not changed and is still <span class="math inline">\(\ket{-}\)</span>. But on the top wire, we now have <span class="math inline">\(f(x)\)</span> somehow encoded into our quantum state. The phenomenon that the output of <span class="math inline">\(f\)</span> is encoded as a <span class="math inline">\(-1\)</span> in the input register is called phase kickback. Measuring this quantum state would not give us any advantage, since we would just get one random <span class="math inline">\(x\)</span>. We therefore perform one final step before measuring.</p></li>
<li><p>As the final unitary, we perform another <span class="math inline">\(H^{\otimes n}\)</span> on the top wire. We hope that the result of this unitary transformation is the state <span class="math inline">\(\ket{s}\)</span>. To check, whether our hopes become reality, we can calculate <span class="math inline">\(\left(H^{\otimes n}\right)^\dagger \ket{s} \otimes \ket{-}\)</span> and check if it is equal to <span class="math inline">\(\psi_3\)</span>. We do it in this direction, since these calculations are a bit simpler: <span class="math display">\[
<li><p>As the final unitary, we perform another <span class="math inline">\(H^{\otimes n}\)</span> on the top wire. We hope that the result of this unitary transformation is the state <span class="math inline">\(\ket{\psi_3} = \ket{s} \otimes \ket{-}\)</span>. To check, whether our hopes become reality, we can calculate <span class="math inline">\(\left(H^{\otimes n}\right)^\dagger \ket{s} \otimes \ket{-}\)</span> and check if it is equal to <span class="math inline">\(\ket{\psi_2}\)</span>. We do it in this direction, since these calculations are a bit simpler: <span class="math display">\[
\begin{aligned}
\left( H^{\otimes n}\right )^\dagger \ket{s}\otimes \ket{-} &amp;= H^{\otimes n} \ket{s}\otimes \ket{-} \\
\left(\left( H^{\otimes n}\right )^\dagger \otimes I \right) \ket{\psi_3}
&amp;= \left( H^{\otimes n}\right )^\dagger \ket{s}\otimes \ket{-}\\
&amp;= H^{\otimes n} \ket{s}\otimes \ket{-} \\
&amp;= H^{\otimes n} (\ket{s_1} \otimes \dots \otimes \ket{s_n})\otimes \ket{-}\\
&amp;= H\ket{s_1} \otimes \dots \otimes H\ket{s_n}\otimes \ket{-}\\
&amp;= \bigotimes_{i=1}^n \left(\frac{1}{\sqrt{2}} \ket{0} + (-1)^{s_i}\frac{1}{\sqrt{2}} \ket{1}\right) \otimes \ket{-}\\
......@@ -306,7 +320,7 @@ U_f\,\ket{x,y} = \ket{x,y \oplus f(x)}
&amp;=\frac{1}{\sqrt{2^{n}}}\sum_{x\in\{0,1\}^n} \left( (-1)^{\sum_i x_is_i \bmod 2}\ket{x}\right) \otimes \ket{-}\\
&amp;=\frac{1}{\sqrt{2^{n}}}\sum_{x\in\{0,1\}^n} (-1)^{s\cdot x}\ket{x} \otimes \ket{-}\\
&amp;=\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} (-1)^{f(x)}\ket{x} \otimes \ket{-}\\
&amp;= \psi_3
&amp;= \ket{\psi_2}
\end{aligned}
\]</span> This calculation shows that we have the quantum state <span class="math inline">\(\ket{s} \otimes \ket{-}\)</span> before the measurement.</p></li>
<li><p>We now perform a measurement on the top wire and measure <span class="math inline">\(s\)</span> as a result.</p></li>
......@@ -722,6 +736,9 @@ U_f\,\ket{x,y} = \ket{x,y \oplus f(x)}
</a>
</div>
<div class="nav-page nav-page-next">
<a href="../content/shorsAlgorithm.html" class="pagination-link" aria-label="Shor's Algorithm">
<span class="nav-page-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span> <i class="bi bi-arrow-right-short"></i>
</a>
</div>
</nav>
</div> <!-- /content -->
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
This diff is collapsed.
<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 3.4.3 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='258.693024pt' height='76.46501pt' viewBox='-68.681163 -69.078205 258.693024 76.46501'>
<defs>
<font id='cmsy10' horiz-adv-x='0'>
<font-face font-family='cmsy10' units-per-em='1000' ascent='775' descent='960'/>
<glyph unicode='' horiz-adv-x='388' vert-adv-y='388' glyph-name='angbracketright' d='M273 233C278 245 278 247 278 250S278 255 273 267L98 727C92 744 86 750 75 750S55 741 55 730C55 727 55 725 60 714L237 250L60-212C55-223 55-225 55-230C55-241 64-250 75-250C88-250 92-240 96-230L273 233Z'/>
<glyph unicode='|' horiz-adv-x='277' vert-adv-y='277' glyph-name='bar' d='M159 714C159 732 159 750 139 750S119 732 119 714V-214C119-232 119-250 139-250S159-232 159-214V714Z'/>
</font>
<font id='cmr7' horiz-adv-x='0'>
<font-face font-family='cmr7' units-per-em='1000' ascent='750' descent='250'/>
<glyph unicode='1' horiz-adv-x='569' vert-adv-y='569' glyph-name='one' d='M335 636C335 663 333 664 305 664C241 601 150 600 109 600V564C133 564 199 564 254 592V82C254 49 254 36 154 36H116V0C134 1 257 4 294 4C325 4 451 1 473 0V36H435C335 36 335 49 335 82V636Z'/>
<glyph unicode='2' horiz-adv-x='569' vert-adv-y='569' glyph-name='two' d='M505 182H471C468 160 458 101 445 91C437 85 360 85 346 85H162C267 178 302 206 362 253C436 312 505 374 505 469C505 590 399 664 271 664C147 664 63 577 63 485C63 434 106 429 116 429C140 429 169 446 169 482C169 500 162 535 110 535C141 606 209 628 256 628C356 628 408 550 408 469C408 382 346 313 314 277L73 39C63 30 63 28 63 0H475L505 182Z'/>
<glyph unicode='3' horiz-adv-x='569' vert-adv-y='569' glyph-name='three' d='M273 334C351 334 407 280 407 173C407 49 335 12 277 12C237 12 149 23 107 82C154 84 165 117 165 138C165 170 141 193 110 193C82 193 54 176 54 135C54 41 158-20 279-20C418-20 514 73 514 173C514 251 450 329 340 352C445 390 483 465 483 526C483 605 392 664 281 664S85 610 85 530C85 496 107 477 137 477C168 477 188 500 188 528C188 557 168 578 137 580C172 624 241 635 278 635C323 635 386 613 386 526C386 484 372 438 346 407C313 369 285 367 235 364C210 362 208 362 203 361C201 361 193 359 193 348C193 334 202 334 219 334H273Z'/>
</font>
<font id='cmmi10' horiz-adv-x='0'>
<font-face font-family='cmmi10' units-per-em='1000' ascent='750' descent='250'/>
<glyph unicode='ψ' horiz-adv-x='651' vert-adv-y='651' glyph-name='psi' d='M482 668C483 672 485 678 485 683C485 693 478 694 473 694C463 694 462 692 458 674L292 13C216 22 178 59 178 125C178 145 178 171 232 311C236 323 243 340 243 360C243 405 211 442 161 442C66 442 29 297 29 288C29 278 39 278 41 278C51 278 52 280 57 296C84 391 124 420 158 420C166 420 183 420 183 388C183 362 173 337 160 302C112 176 112 150 112 133C112 38 190-3 286-9C278-45 278-47 264-100C261-111 241-192 241-195C241-196 241-205 253-205C255-205 260-205 262-201C265-199 271-174 274-160L312-11C349-11 437-11 531 96C572 142 593 186 604 216C613 241 635 328 635 372C635 428 608 442 591 442C566 442 541 416 541 394C541 381 547 375 556 367C567 356 592 330 592 282C592 218 540 136 505 100C417 11 353 11 317 11L482 668Z'/>
<glyph unicode='H' horiz-adv-x='831' vert-adv-y='831' glyph-name='H' d='M763 606C772 642 774 652 847 652C873 652 881 652 881 672C881 683 870 683 867 683C839 683 767 680 739 680C710 680 639 683 610 683C602 683 591 683 591 663C591 652 600 652 619 652C621 652 640 652 657 650C675 648 684 647 684 634C684 630 683 628 680 615L620 371H315L374 606C383 642 386 652 458 652C484 652 492 652 492 672C492 683 481 683 478 683C450 683 378 680 350 680C321 680 250 683 221 683C213 683 202 683 202 663C202 652 211 652 230 652C232 652 251 652 268 650C286 648 295 647 295 634C295 630 294 627 291 615L157 78C147 39 145 31 66 31C48 31 39 31 39 11C39 0 51 0 53 0C81 0 152 3 180 3C201 3 223 2 244 2C266 2 288 0 309 0C317 0 329 0 329 20C329 31 320 31 301 31C264 31 236 31 236 49C236 55 238 60 239 66L307 340H612C570 174 547 79 543 64C533 32 514 31 452 31C437 31 428 31 428 11C428 0 440 0 442 0C470 0 541 3 569 3C590 3 612 2 633 2C655 2 677 0 698 0C706 0 718 0 718 20C718 31 709 31 690 31C653 31 625 31 625 49C625 55 627 60 628 66L763 606Z'/>
<glyph unicode='R' horiz-adv-x='759' vert-adv-y='759' glyph-name='R' d='M375 614C381 638 384 648 403 651C412 652 444 652 464 652C535 652 646 652 646 553C646 519 630 450 591 411C565 385 512 353 422 353H310L375 614ZM519 340C620 362 739 432 739 533C739 619 649 683 518 683H233C213 683 204 683 204 663C204 652 213 652 232 652C234 652 253 652 270 650C288 648 297 647 297 634C297 630 296 627 293 615L159 78C149 39 147 31 68 31C50 31 41 31 41 11C41 0 53 0 55 0C83 0 153 3 181 3S280 0 308 0C316 0 328 0 328 20C328 31 319 31 300 31C263 31 235 31 235 49C235 55 237 60 238 66L304 331H423C514 331 532 275 532 240C532 225 524 194 518 171C511 143 502 106 502 86C502-22 622-22 635-22C720-22 755 79 755 93C755 105 744 105 743 105C734 105 732 98 730 91C705 17 662 0 639 0C606 0 599 22 599 61C599 92 605 143 609 175C611 189 613 208 613 222C613 299 546 330 519 340Z'/>
<glyph unicode='j' horiz-adv-x='411' vert-adv-y='411' glyph-name='j' d='M397 625C397 644 383 661 359 661C336 661 306 638 306 608C306 588 320 572 343 572C370 572 397 598 397 625ZM196-50C177-126 129-183 73-183C67-183 52-183 34-174C64-167 79-141 79-121C79-105 68-86 41-86C16-86-13-107-13-143C-13-183 27-205 75-205C145-205 238-152 263-53L355 313C360 333 360 347 360 350C360 407 318 442 268 442C166 442 109 297 109 288C109 278 119 278 121 278C130 278 131 279 139 298C164 359 210 420 265 420C279 420 297 416 297 374C297 351 294 340 290 323L196-50Z'/>
</font>
</defs>
<style type='text/css'>
<![CDATA[text.f0 {font-family:cmsy10;font-size:9.96264px}
text.f1 {font-family:cmmi10;font-size:9.96264px}
text.f2 {font-family:cmr7;font-size:6.973848px}
]]>
</style>
<g id='page1'>
<path d='M-35.0781-60.543H-49.2502' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M-3.8438-60.543H-18.0156' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M30.3359-60.543H16.1641' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M73.043-60.543H50.3398' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M73.043-60.543H50.3398' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M105.75-60.543H73.043' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M105.75-60.543H73.043' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M138.457-60.543H105.75' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M138.457-60.543H105.75' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M161.1602-60.543V-.3984' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M161.1602-60.543H138.457' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M175.3318-60.543H161.1602' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M-26.5469-30.097656H-49.2502' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M-26.5469-30.097656H-49.2502' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M6.1602-31.796875V-52.4062' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M4.4609-30.097656H-26.5469' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M40.3359-30.097656H7.8594' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M40.3359-30.097656H7.8594' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M64.51172-30.097656H40.3359' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M95.7461-30.097656H81.5742' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M138.457-30.097656H115.7539' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M138.457-30.097656H115.7539' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M161.1602-30.097656H138.457' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M161.1602-30.097656H138.457' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M175.3318-30.097656H161.1602' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M-26.5469-.3984H-49.2502' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M-26.5469-.3984H-49.2502' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M6.1602-.3984H-26.5469' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M6.1602-.3984H-26.5469' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M40.3359-2.1016V-52.4062' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M38.6367-.3984H6.1602' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M73.043-.3984H42.0391' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M73.043-.3984H42.0391' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M105.75-2.1016V-21.96094' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M104.0508-.3984H73.043' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M129.9258-.3984H107.4492' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M161.1602-.3984H146.9883' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M175.3318-.3984H161.1602' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10' stroke-linecap='round'/>
<path d='M157.67165-57.05465L164.6443-64.03121M157.67165-64.03121L164.6443-57.05465' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<path d='M7.85916-30.097616C7.85916-31.035116 7.097438-31.79683 6.159938-31.79683C5.218532-31.79683 4.45681-31.035116 4.45681-30.097616C4.45681-29.156209 5.218532-28.3984 6.159938-28.3984C7.097438-28.3984 7.85916-29.156209 7.85916-30.097616Z'/>
<path d='M7.85938-30.097616C7.85938-31.035116 7.097658-31.79683 6.160158-31.79683C5.218752-31.79683 4.45703-31.035116 4.45703-30.097616C4.45703-29.156209 5.218752-28.3984 6.160158-28.3984C7.097658-28.3984 7.85938-29.156209 7.85938-30.097616Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<path d='M42.03493-.398397C42.03493-1.339803 41.277116-2.10152 40.33571-2.10152C39.39821-2.10152 38.63649-1.339803 38.63649-.398397C38.63649 .539103 39.39821 1.30082 40.33571 1.30082C41.277116 1.30082 42.03493 .539103 42.03493-.398397Z'/>
<path d='M42.03513-.398437C42.03513-1.339843 41.277316-2.10156 40.33591-2.10156C39.39841-2.10156 38.63669-1.339843 38.63669-.398437C38.63669 .539063 39.39841 1.30078 40.33591 1.30078C41.277316 1.30078 42.03513 .539063 42.03513-.398437Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<path d='M107.449-.398397C107.449-1.339803 106.687285-2.10152 105.749785-2.10152C104.808379-2.10152 104.04666-1.339803 104.04666-.398397C104.04666 .539103 104.808379 1.30082 105.749785 1.30082C106.687285 1.30082 107.449 .539103 107.449-.398397Z'/>
<path d='M107.449-.398437C107.449-1.339843 106.687285-2.10156 105.749785-2.10156C104.808379-2.10156 104.04666-1.339843 104.04666-.398437C104.04666 .539063 104.808379 1.30078 105.749785 1.30078C106.687285 1.30078 107.449 .539063 107.449-.398437Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<path d='M157.67165 3.08594L164.6443-3.88672M157.67165-3.88672L164.6443 3.08594' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f0' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 -131.723 -27.208)'>|</text>
<text class='f1' x='65.809246' y='-30.845055' transform='matrix(1 0 0 1 -131.723 -27.208)'>j</text>
<text class='f2' x='69.911931' y='-29.350674' transform='matrix(1 0 0 1 -131.723 -27.208)'>1</text>
<text class='f0' x='74.381301' y='-30.845055' transform='matrix(1 0 0 1 -131.723 -27.208)'></text>
<path d='M-35.0781-53.1562H-18.0156V-67.9336H-35.0781Z' fill='#fff'/>
<path d='M-35.0781-53.1562H-18.0156V-67.9336H-35.0781Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 -94.1333 -26.2947)'>H</text>
<path d='M-3.8438-52.4062H16.1641V-68.6797H-3.8438Z' fill='#fff'/>
<path d='M-3.8438-52.4062H16.1641V-68.6797H-3.8438Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 -62.898669 -27.0419)'>R</text>
<text class='f2' x='70.606368' y='-29.350674' transform='matrix(1 0 0 1 -62.898669 -27.0419)'>2</text>
<path d='M30.3359-52.4062H50.3398V-68.6797H30.3359Z' fill='#fff'/>
<path d='M30.3359-52.4062H50.3398V-68.6797H30.3359Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 -28.721 -27.0419)'>R</text>
<text class='f2' x='70.606368' y='-29.350674' transform='matrix(1 0 0 1 -28.721 -27.0419)'>3</text>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 116.5092 -27.208)'>ψ</text>
<text class='f2' x='69.531421' y='-29.350674' transform='matrix(1 0 0 1 116.5092 -27.208)'>1</text>
<text class='f0' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 -131.723 3.2379)'>|</text>
<text class='f1' x='65.809246' y='-30.845055' transform='matrix(1 0 0 1 -131.723 3.2379)'>j</text>
<text class='f2' x='69.911931' y='-29.350674' transform='matrix(1 0 0 1 -131.723 3.2379)'>2</text>
<text class='f0' x='74.381301' y='-30.845055' transform='matrix(1 0 0 1 -131.723 3.2379)'></text>
<path d='M64.51172-22.70703H81.5742V-37.48828H64.51172Z' fill='#fff'/>
<path d='M64.51172-22.70703H81.5742V-37.48828H64.51172Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 5.4566 4.1511)'>H</text>
<path d='M95.7461-21.96094H115.7539V-38.23437H95.7461Z' fill='#fff'/>
<path d='M95.7461-21.96094H115.7539V-38.23437H95.7461Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 36.6912 3.4039)'>R</text>
<text class='f2' x='70.606368' y='-29.350674' transform='matrix(1 0 0 1 36.6912 3.4039)'>2</text>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 116.5092 3.2379)'>ψ</text>
<text class='f2' x='69.531421' y='-29.350674' transform='matrix(1 0 0 1 116.5092 3.2379)'>2</text>
<text class='f0' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 -131.723 32.93655)'>|</text>
<text class='f1' x='65.809246' y='-30.845055' transform='matrix(1 0 0 1 -131.723 32.93655)'>j</text>
<text class='f2' x='69.911931' y='-29.350674' transform='matrix(1 0 0 1 -131.723 32.93655)'>3</text>
<text class='f0' x='74.381301' y='-30.845055' transform='matrix(1 0 0 1 -131.723 32.93655)'></text>
<path d='M129.9258 6.9883H146.9883V-7.7891H129.9258Z' fill='#fff'/>
<path d='M129.9258 6.9883H146.9883V-7.7891H129.9258Z' stroke='#000' fill='none' stroke-width='.79701' stroke-miterlimit='10'/>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 70.8692 33.8498)'>H</text>
<text class='f1' x='63.041837' y='-30.845055' transform='matrix(1 0 0 1 116.5092 32.93655)'>ψ</text>
<text class='f2' x='69.531421' y='-29.350674' transform='matrix(1 0 0 1 116.5092 32.93655)'>3</text>
</g>
</svg>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
......@@ -219,6 +219,12 @@ window.Quarto = {
<a href="../content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="../content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......
This diff is collapsed.
......@@ -9,7 +9,7 @@
<meta name="author" content="Jannik Hellenkamp">
<meta name="author" content="Stefan Stump">
<meta name="author" content="Dominique Unruh">
<meta name="dcterms.date" content="2025-05-16">
<meta name="dcterms.date" content="2025-06-03">
<title>Introduction to Quantum Computing</title>
<style>
......@@ -193,6 +193,12 @@ ul.task-list li input[type="checkbox"] {
<a href="./content/bernsteinVazirani.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">9</span>&nbsp; <span class="chapter-title">Bernstein-Vazirani Algorithm</span></span></a>
</div>
</li>
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./content/shorsAlgorithm.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">10</span>&nbsp; <span class="chapter-title">Shor’s Algorithm</span></span></a>
</div>
</li>
</ul>
</li>
......@@ -206,10 +212,7 @@ ul.task-list li input[type="checkbox"] {
<h2 id="toc-title">Table of contents</h2>
<ul>
<li><a href="#welcome" id="toc-welcome" class="nav-link active" data-scroll-target="#welcome">Welcome</a>
<ul class="collapse">
<li><a href="#changelog" id="toc-changelog" class="nav-link" data-scroll-target="#changelog">Changelog</a></li>
</ul></li>
<li><a href="#welcome" id="toc-welcome" class="nav-link active" data-scroll-target="#welcome">Welcome</a></li>
</ul>
</nav>
</div>
......@@ -238,7 +241,7 @@ ul.task-list li input[type="checkbox"] {
<div>
<div class="quarto-title-meta-heading">Published</div>
<div class="quarto-title-meta-contents">
<p class="date">May 16, 2025</p>
<p class="date">June 3, 2025</p>
</div>
</div>
......@@ -259,18 +262,8 @@ ul.task-list li input[type="checkbox"] {
<p>If you spot an error, please report it to <a href="https://git.rwth-aachen.de/unruh/script-intro-qc/">Gitlab</a>. Alternatively, you can send Stefan Stump an e-mail (stefan.stump@rwth-aachen.de).If you have a question of understanding, please ask it in the Moodle forum.</p>
<p>These lecture notes are released under the CC BY-NC 4.0 license, which can be found <a href="https://creativecommons.org/licenses/by-nc/4.0/">here</a>.</p>
<p>The Jupyter notebooks created during the lectures can be found in the <a href="https://jupyter.rwth-aachen.de/">JupyterHub</a> in the course “[IQC] Introduction to Quantum Computing” or in Moodle. These will be added shortly after the lectures. If changes are made to the files, they can be easily reset with the usual git commands using “Git” and then “Open Git Repository in Terminal.</p>
<section id="changelog" class="level2 unnumbered">
<h2 class="unnumbered anchored" data-anchor-id="changelog">Changelog</h2>
<section id="section" class="level4">
<h4 class="anchored" data-anchor-id="section">16.05.2025</h4>
<ul>
<li>started the lecture notes for the summer term 2025</li>
<li>added chapters 1 to 9 (except 4.3)</li>
</ul>
</section>
</section>
</section>
</main> <!-- /main -->
......
This diff is collapsed.
......@@ -2,46 +2,50 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/index.html</loc>
<lastmod>2025-05-16T15:50:32.669Z</lastmod>
<lastmod>2025-06-03T15:52:33.090Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/introduction.html</loc>
<lastmod>2025-05-10T11:43:43.511Z</lastmod>
<lastmod>2025-05-19T12:07:45.152Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/probabilisticSystems.html</loc>
<lastmod>2025-05-16T14:08:33.952Z</lastmod>
<lastmod>2025-05-19T12:07:45.236Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/quantumSystems.html</loc>
<lastmod>2025-05-13T11:25:06.952Z</lastmod>
<lastmod>2025-05-19T12:07:45.249Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/observingSystems.html</loc>
<lastmod>2025-05-16T14:03:14.603Z</lastmod>
<lastmod>2025-05-19T12:07:45.214Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/partialObserving.html</loc>
<lastmod>2025-05-16T14:09:38.516Z</lastmod>
<lastmod>2025-05-19T12:07:45.216Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/compositeSystems.html</loc>
<lastmod>2025-05-16T15:34:57.178Z</lastmod>
<lastmod>2025-05-19T12:07:44.906Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/quantumCircuits.html</loc>
<lastmod>2025-05-16T15:35:58.896Z</lastmod>
<lastmod>2025-05-19T12:07:45.236Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/ketNotation.html</loc>
<lastmod>2025-05-16T15:43:17.881Z</lastmod>
<lastmod>2025-05-19T12:07:45.172Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/bernsteinVazirani.html</loc>
<lastmod>2025-05-16T15:41:32.344Z</lastmod>
<lastmod>2025-05-30T18:54:32.195Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/content/shorsAlgorithm.html</loc>
<lastmod>2025-06-03T15:46:14.791Z</lastmod>
</url>
<url>
<loc>https://qis.rwth-aachen.de/teaching/25ss/intro-quantum-computing/script/Introduction-to-Quantum-Computing.pdf</loc>
<lastmod>2025-05-16T15:51:08.539Z</lastmod>
<lastmod>2025-06-03T15:53:37.480Z</lastmod>
</url>
</urlset>
......@@ -31,7 +31,7 @@ book:
- part: "Quantum algorithms"
chapters:
- content/bernsteinVazirani.qmd
# - content/shorsAlgorithm.qmd
- content/shorsAlgorithm.qmd
# - content/groversAlgorithm.qmd
#- part: "Physical background"
# chapters:
......
......@@ -14,15 +14,17 @@ We will now look at a quantum algorithm which will find $s$ with only one evalua
Note that $U_f$ is defined with the explanation below.
We start with $n$ qubits on the top wire. All of these qubits are in the state $\ket{0}$, which we write $\ket{0}^n = \ket{0} \otimes \dots \otimes \ket{0}$. The bottom wire is in the state $\ket{1}$. Both wires composed together can be written as $\psi_1 = \ket{0}^n \otimes \ket{1}$, which is the overall starting state of our algorithm.
We start with $n$ qubits on the top wire. All of these qubits are in the state $\ket{0}$, which we write $\ket{0}^n = \ket{0} \otimes \dots \otimes \ket{0}$. The bottom wire is in the state $\ket{1}$. Both wires composed together can be written as $\ket{\psi_0} = \ket{0^n1} = \ket{0}^n \otimes \ket{1}$, which is the overall starting state of our algorithm.
We now perform the following steps
1. First we apply a Hadamard gate on all qubits. This is denoted for the first $n$ qubits by the $H^{\otimes n}$ gate and for the last qubit by the $H$ gate on the bottom wire. The resulting quantum state is calculated as follows:
$$
\begin{aligned}
\psi_2 &= \left(H^{\otimes n} \otimes H\right) \left(\ket{0}^n \otimes \ket{1}\right)\\
\ket{\psi_1}
&= \left(H^{\otimes n} \otimes H\right) \left(\ket{\psi_0}\right)\\
&= \left(H^{\otimes n} \otimes H\right) \left(\ket{0}^n \otimes \ket{1}\right)\\
&=\left(H^{\otimes n}\ket{0}^n\right) \otimes H\ket{1}\\
&=\left(\ket{+}\right)^{\otimes n} \otimes \ket{-}\\
&=\ket{+}^{\otimes n} \otimes \ket{-}\\
&=\left(\frac{1}{\sqrt{2}} \ket{0} + \frac{1}{\sqrt{2}} \ket{1} \right)^{\otimes n} \otimes \ket{-}\\
&=\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}
\end{aligned}
......@@ -36,17 +38,20 @@ $$
This unitary represents the function $f$ and combines the output of $f(x)$ with the bottom wire $y$. For our quantum states, this means that the state after $U_f$ can be calculated as follows:
$$
\begin{aligned}
\psi_3&=U_f\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}\\
\ket{\psi_2}
&= U_f\ket{\psi_1}\\
&= U_f\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}\\
&= U_f\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} \ket{x} \otimes \ket{-}\\
&=\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} U_f\Bigl (\ket{x} \otimes \ket{-}\Bigr) \\
&\stackrel{*}{=}\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} (-1)^{f(x)}\ket{x} \otimes \ket{-} \\
&=\left(\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} (-1)^{f(x)}\ket{x} \right) \otimes \ket{-}
\end{aligned}
$$
Note that the $*$ holds since we can rewrite $U_f(\ket{x}\otimes\ket{-})$ as
Note that the $*$ holds since we can rewrite $U_f\Bigl(\ket{x}\otimes\ket{-}\Bigr)$ as
$$
\begin{aligned}
&U_f\Bigl(\ket{x}\otimes\ket{-}\Bigr)\\
&= \frac{1}{\sqrt{2}} U_f\ket{x,0} - \frac{1}{\sqrt{2}} \ket{x,1}\\
U_f\Bigl(\ket{x}\otimes\ket{-}\Bigr)
&= \frac{1}{\sqrt{2}} U_f\ket{x,0} - \frac{1}{\sqrt{2}} U_f\ket{x,1}\\
&= \frac{1}{\sqrt{2}} \ket{x,f(x)} - \frac{1}{\sqrt{2}} \ket{x,\overline{f(x)}}\\
&= \begin{cases} \frac{1}{\sqrt{2}} \ket{x,0} - \frac{1}{\sqrt{2}} \ket{x,1} & f(x)=0\\
\frac{1}{\sqrt{2}} \ket{x,1} - \frac{1}{\sqrt{2}} \ket{x,0} & f(x)=1 \end{cases}\\
......@@ -57,10 +62,12 @@ $$
$$
The bottom wire has not changed and is still $\ket{-}$. But on the top wire, we now have $f(x)$ somehow encoded into our quantum state. The phenomenon that the output of $f$ is encoded as a $-1$ in the input register is called phase kickback. Measuring this quantum state would not give us any advantage, since we would just get one random $x$. We therefore perform one final step before measuring.
3. As the final unitary, we perform another $H^{\otimes n}$ on the top wire. We hope that the result of this unitary transformation is the state $\ket{s}$. To check, whether our hopes become reality, we can calculate $\left(H^{\otimes n}\right)^\dagger \ket{s} \otimes \ket{-}$ and check if it is equal to $\psi_3$. We do it in this direction, since these calculations are a bit simpler:
3. As the final unitary, we perform another $H^{\otimes n}$ on the top wire. We hope that the result of this unitary transformation is the state $\ket{\psi_3} = \ket{s} \otimes \ket{-}$. To check, whether our hopes become reality, we can calculate $\left(H^{\otimes n}\right)^\dagger \ket{s} \otimes \ket{-}$ and check if it is equal to $\ket{\psi_2}$. We do it in this direction, since these calculations are a bit simpler:
$$
\begin{aligned}
\left( H^{\otimes n}\right )^\dagger \ket{s}\otimes \ket{-} &= H^{\otimes n} \ket{s}\otimes \ket{-} \\
\left(\left( H^{\otimes n}\right )^\dagger \otimes I \right) \ket{\psi_3}
&= \left( H^{\otimes n}\right )^\dagger \ket{s}\otimes \ket{-}\\
&= H^{\otimes n} \ket{s}\otimes \ket{-} \\
&= H^{\otimes n} (\ket{s_1} \otimes \dots \otimes \ket{s_n})\otimes \ket{-}\\
&= H\ket{s_1} \otimes \dots \otimes H\ket{s_n}\otimes \ket{-}\\
&= \bigotimes_{i=1}^n \left(\frac{1}{\sqrt{2}} \ket{0} + (-1)^{s_i}\frac{1}{\sqrt{2}} \ket{1}\right) \otimes \ket{-}\\
......@@ -69,7 +76,7 @@ $$
&=\frac{1}{\sqrt{2^{n}}}\sum_{x\in\{0,1\}^n} \left( (-1)^{\sum_i x_is_i \bmod 2}\ket{x}\right) \otimes \ket{-}\\
&=\frac{1}{\sqrt{2^{n}}}\sum_{x\in\{0,1\}^n} (-1)^{s\cdot x}\ket{x} \otimes \ket{-}\\
&=\frac{1}{\sqrt{2^{n}}}\sum_{x\in \{0,1\}^n} (-1)^{f(x)}\ket{x} \otimes \ket{-}\\
&= \psi_3
&= \ket{\psi_2}
\end{aligned}
$$
This calculation shows that we have the quantum state $\ket{s} \otimes \ket{-}$ before the measurement.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment