diff --git a/learning/modules/quantum-mechanics/get-started-with-qiskit.ipynb b/learning/modules/quantum-mechanics/get-started-with-qiskit.ipynb index e8189918a7c3..3989d2758b77 100644 --- a/learning/modules/quantum-mechanics/get-started-with-qiskit.ipynb +++ b/learning/modules/quantum-mechanics/get-started-with-qiskit.ipynb @@ -533,9 +533,15 @@ "\n", "Two-qubit gates can resemble classical two-bit gates, but with one important caveat: all quantum gates must be reversible. In linear algebra terms, this means they are represented by unitary matrices. Thus, two input qubits always map to two output qubits, and the operation can, in principle, be undone. This stands in contrast to the classical gates we saw above such as AND or OR, which lose information and are irreversible — given an output, you cannot uniquely determine the input.\n", "\n", - "__CNOT (Controlled-NOT) gate:__ The two input qubits are called the \"control\" and \"target\" qubits. The control qubit remains unchanged, but its state dictates what happens to the target qubit. If the control qubit is in the state $\\vert 1\\rangle$, then an $X$ gate is applied to that target; if the state of the control qubit is $\\vert 0\\rangle$, then no change is made. In the notation below, assume the qubit $A$ (rightmost qubit) is the control, and qubit $B$ (the leftmost qubit) is the target. Below, the notation used is $CNOT(q_{control},q_{target})\\vert BA\\rangle$.\n", + "__CNOT (Controlled-NOT) gate:__ The two input qubits are called the \"control\" and \"target\" qubits. The control qubit remains unchanged, but its state dictates what happens to the target qubit. If the control qubit is in the state $\\vert 1\\rangle$, then an $X$ gate is applied to the target; if the control qubit is in the state $\\vert 0\\rangle$, then no change is made.\n", "\n", - "$$CNOT(A,B)\\vert BA\\rangle_{input} = \\vert BA\\rangle_{output}$$\n", + "The gate arguments are ordered as $CNOT(q_{control},q_{target})$, just as in Qiskit's `qc.cx(control, target)`. The order of bits in a ket follows a separate convention: Qiskit writes two-qubit basis states as $\\vert q_1q_0\\rangle$. Here, let $A=q_0$ be the control and $B=q_1$ be the target, so the ket is $\\vert BA\\rangle$, with the control on the right. See the [bit-ordering guide](/docs/guides/bit-ordering) for more details.\n", + "\n", + "For computational basis values $a,b\\in\\{0,1\\}$ of qubits $A$ and $B$, the gate acts as follows:\n", + "\n", + "$$CNOT(A,B)\\vert ba\\rangle = \\vert (b\\oplus a)\\,a\\rangle$$\n", + "\n", + "Here, $\\oplus$ denotes addition modulo 2 (XOR). The control value $a$ stays the same, while the target value $b$ flips when $a=1$.\n", "\n", "| Input | Output |\n", "| :------- | -------: |\n", @@ -544,7 +550,7 @@ "| $\\vert 10\\rangle$ | $\\vert 10\\rangle$ |\n", "| $\\vert 11\\rangle$ | $\\vert 01\\rangle$ |\n", "\n", - "So, the matrix representing this action is:\n", + "Using the ordered basis $\\vert 00\\rangle,\\vert 01\\rangle,\\vert 10\\rangle,\\vert 11\\rangle$ for $\\vert BA\\rangle$, the matrix representing this action is:\n", "\n", "$$CNOT=\\begin{pmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 0 & 0 & 1 \\\\ 0 & 0 & 1 & 0 \\\\ 0 & 1 & 0 & 0\\end{pmatrix}$$" ]