Skip to content

Commit 49852a6

Browse files
committed
improve the explanation for the Deutsch Jozsa algo
1 parent 3cb59c7 commit 49852a6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

quantum_parallelism_Deutsch_Jozsa.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,11 @@
564564
"\\left| - \\right\\rangle\n",
565565
"$$\n",
566566
"\n",
567-
"Now the qubits are back to Alice. She applies Hadamard gates on the input register and obtains in the input register $H^{\\otimes n} \\frac{1}{\\sqrt{2^n}}\\sum_{x} (-1)^{f(x)}\\left| x \\right\\rangle$. This is enough to calculate what is the probability of measuring $|00...0\\rangle = \\left| 0^{\\otimes n} \\right\\rangle$ state, that will indicate whether the function is balanced or constant. For that, firstly, we should take the inner product of $\\left| 0^{\\otimes n} \\right\\rangle$ state and $H^{\\otimes n} \\frac{1}{\\sqrt{2^n}}\\sum_{x} (-1)^{f(x)}\\left| x \\right\\rangle$ state (similar to [[4](https://courses.edx.org/courses/course-v1:MITx+8.370.2x+1T2018/course/)]):\n",
567+
"Now the qubits are back to Alice. She applies Hadamard gates on the input register and obtains in the input register $H^{\\otimes n} \\frac{1}{\\sqrt{2^n}}\\sum_{x} (-1)^{f(x)}\\left| x \\right\\rangle$. This is enough to calculate what is the probability of measuring $\\left|00...0 \\right\\rangle = \\left| 0^{\\otimes n} \\right\\rangle$ state, that will indicate whether the function is balanced or constant. For that, firstly, we should take the inner product of $\\left| 0^{\\otimes n} \\right\\rangle$ state and $H^{\\otimes n} \\frac{1}{\\sqrt{2^n}}\\sum_{x} (-1)^{f(x)}\\left| x \\right\\rangle$ state (similar to [[4](https://courses.edx.org/courses/course-v1:MITx+8.370.2x+1T2018/course/)]):\n",
568568
"\n",
569569
"\\begin{equation*}\n",
570570
"\\frac{1}{\\sqrt{2^n}}\\left\\langle 0^{\\otimes n} \\right| H^{\\otimes n} \\sum_{x} (-1)^{f(x)}\\left| x \\right\\rangle = \\frac{1}{2^n}\\sum_{y} \\left\\langle y \\right| \\sum_{x} (-1)^{f(x)}\\left| x \\right\\rangle = \n",
571-
"\\\\\n",
572-
"= \\frac{1}{2^n}\\sum_{x,y} (-1)^{f(x)} \\delta_{x,y} = \\frac{1}{2^n}\\sum_{x} (-1)^{f(x)}\n",
571+
"\\frac{1}{2^n}\\sum_{x,y} (-1)^{f(x)} \\delta_{x,y} = \\frac{1}{2^n}\\sum_{x} (-1)^{f(x)}\n",
573572
"\\end{equation*}\n",
574573
"\n",
575574
"where we took into account that $\\left\\langle 0^{\\otimes n} \\right| H^{\\otimes n} = \\sum_{y} \\left\\langle y \\right|$ and $\\langle y|x \\rangle = \\delta_{x,y}$, $\\delta_{x=y} = 1$ and $\\delta_{x \\ne y} = 0$, because of the orthonormality of the states. If we have a constant function ($f(x) = 1$ for all $x$ or $f(x) = 0$ for all $x$) then the probability of measuring $\\left| 0^{\\otimes n} \\right\\rangle$ will be equal to $1$ (we should take the square of the module of the inner product in order to obtain the probability). So, if the function is constant then Alice always will measure $\\left| 0^{\\otimes n} \\right\\rangle$. Otherwise, if Bob's chosen function is balanced then half of the $(-1)^{f(x)}$ terms in the sum will be equal to $-1$, and the other half will be equal to $+1$, because of the definition of the balanced function. So, $\\frac{1}{2^n}\\sum_{x} (-1)^{f(x)} \\left\\langle x \\right| \\left| x \\right\\rangle = 0$ for a balanced function, thus Alice will have $0$ probability of measuring $\\left| 0^{\\otimes n} \\right\\rangle$. Therefore, if Alice measures $\\left| 0^{\\otimes n} \\right\\rangle$ it is an indicator that the function was constant, otherwise, if she doesn't measure $\\left| 0^{\\otimes n} \\right\\rangle$ then Bob's function was balanced.\n",

0 commit comments

Comments
 (0)