Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
[BasicGates] Add task 1.10 to the workbook (#728)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyHoldroyd authored Jan 14, 2022
1 parent 85b9fc3 commit 2b68127
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions BasicGates/BasicGates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Can't come up with a solution? See the explained solution in the [Basic Gates Workbook](./Workbook_BasicGates.ipynb#Task-1.10.-Bell-state-change---3).*"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
45 changes: 45 additions & 0 deletions BasicGates/Workbook_BasicGates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,51 @@
"source": [
"[Return to Task 1.9 of the Basic Gates kata](./BasicGates.ipynb#Task-1.9.-Bell-state-change---2)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Task 1.10. Bell state change - 3\n",
"\n",
"**Input:** Two entangled qubits in Bell state $|\\Phi^{+}\\rangle = \\frac{1}{\\sqrt{2}} \\big(|00\\rangle + |11\\rangle\\big)$.\n",
"\n",
"**Goal:** Change the two-qubit state, without adding a global phase, to $|\\Psi^{-}\\rangle = \\frac{1}{\\sqrt{2}} \\big(|01\\rangle - |10\\rangle\\big)$."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Solution ##\n",
"We remember from Task 1.3 that the Pauli-Z gate leaves the sign of the $|0\\rangle$ component of the single qubit superposition unchanged but flips the sign of the $|1\\rangle$ component of the superposition. We have also just seen in Task 1.9 how to change our input state to the state $\\frac{1}{\\sqrt{2}} \\big(|01\\rangle + |10\\rangle\\big)$, which is almost our goal state (disregarding the phase change for the moment). So it would seem that a combination of these two gates wiill be what we need here. The remaining question is in what order to apply them, and to which qubit.\n",
"\n",
"First of all, which qubit? Looking back at Task 1.9, it seems clear that we need to use qubit `qs[0]`, like we did there.\n",
"\n",
"Second, in what order should we apply the gates? Remember that the Pauli-Z gate flips the phase of the $|1\\rangle$ component of the superposition and leaves the $|0\\rangle$ component alone. \n",
"Let's experiment with applying X to `qs[0]` first. Looking at our \"halfway answer\" state $\\frac{1}{\\sqrt{2}} \\big(|01\\rangle + |10\\rangle\\big)$, we can see that if we apply the Z gate to `qs[0]`, it will leave the $|0_{A}\\rangle$ alone but flip the phase of $|1_{A}\\rangle$ to $-|1_{A}\\rangle$, thus flipping the phase of the $|11\\rangle$ component of our Bell state. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%kata T110_BellStateChange3\n",
"\n",
"operation BellStateChange3 (qs : Qubit[]) : Unit is Adj+Ctl {\n",
" X(qs[0]);\n",
" Z(qs[0]);\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to Task 1.10 of the Basic Gates kata](./BasicGates.ipynb#Task-1.10.-Bell-state-change---3)."
]
}
],
"metadata": {
Expand Down

0 comments on commit 2b68127

Please sign in to comment.