Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
PGelss authored May 31, 2024
1 parent 5f1eddc commit 4278bd2
Show file tree
Hide file tree
Showing 2 changed files with 1,049 additions and 0 deletions.
244 changes: 244 additions & 0 deletions Exercises/Session 4 - Quantum Information (with solutions).ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "e4f44eb7",
"metadata": {},
"source": [
"$\\def\\tcoreleft{\\underset{\\tiny\\mid}{\\textcolor{MidnightBlue}{⦸}}}$\n",
"$\\def\\tcorecenter{\\underset{\\tiny\\mid}{\\textcolor{RedOrange}{⦿}}}$\n",
"$\\def\\tcoreright{\\underset{\\tiny\\mid}{\\textcolor{MidnightBlue}{\\oslash}}}$\n",
"<h1 style=\"text-align: center;\"><b>TMQS Workshop 2024</b> @ Zuse Institute Berlin</h1>\n",
"<h2 style=\"text-align: center;\">Summer School on Tensor Methods for Quantum Simulation</h2>\n",
"<h2 style=\"text-align: center;\">June 3 - 5, 2024</h2>\n",
"<h1 style=\"text-align: center; background-color:#D6EAF8 ;padding:50px\">$\\tcoreleft - \\tcoreleft - \\tcoreleft - \\cdots - \\tcorecenter - \\cdots - \\tcoreright - \\tcoreright$</h1>\n",
"</br>"
]
},
{
"cell_type": "markdown",
"id": "6f6cc702",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "74ce99d5-268a-4ad8-980b-de19d60b6be6",
"metadata": {},
"source": [
"## **Session 4 - Quantum Information**"
]
},
{
"cell_type": "markdown",
"id": "e8441c54-ffd4-45b4-ab04-ff8cf85e6474",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "a781c1c8",
"metadata": {},
"source": [
"## Exercise 4.1\n",
"\n",
"Which of the following are valid quantum states?\n",
"\n",
"$\\hspace{1cm}$$\\begin{pmatrix} 0 \\\\ 1\\end{pmatrix}$, $\\quad \\begin{pmatrix} 1 \\\\ 1\\end{pmatrix}$, $\\quad \\frac{1}{\\sqrt{2}}\\begin{pmatrix} 0 \\\\ -i\\end{pmatrix}$, $\\quad \\frac{1}{\\sqrt{3}}\\begin{pmatrix} 1 \\\\ 2\\end{pmatrix}$, $\\quad \\begin{pmatrix} \\sqrt{2/3} \\\\ i/\\sqrt{3}\\end{pmatrix}$\n",
"\n",
"What is the probability to measure $0$ and $1$ for the valid quantum states?"
]
},
{
"cell_type": "markdown",
"id": "9c481a4d-7f0e-45a0-8ea6-19ce1accee7c",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "ffc18314-42a9-4adf-a0ad-bcf763e8899e",
"metadata": {},
"source": [
"$\\textcolor{red}{\\textbf{SOLUTION:}}$"
]
},
{
"cell_type": "markdown",
"id": "61ad94fb-c6d8-4b79-b143-4850e790d826",
"metadata": {},
"source": [
"Consider the euclidean norm of each vector, we get\n",
"\n",
"$\\hspace{0.5cm}$$\\left\\lVert\\begin{pmatrix} 0 \\\\ 1\\end{pmatrix}\\right\\rVert_2=1$, \n",
"$\\quad \\left\\lVert\\begin{pmatrix} 1 \\\\ 1\\end{pmatrix}\\right\\rVert_2=\\sqrt{2}$, \n",
"$\\quad \\left\\lVert\\frac{1}{\\sqrt{2}}\\begin{pmatrix} 0 \\\\ -i\\end{pmatrix}\\right\\rVert_2 = \\frac{1}{\\sqrt{2}}$, \n",
"$\\quad \\left\\lVert\\frac{1}{\\sqrt{3}}\\begin{pmatrix} 1 \\\\ 2\\end{pmatrix}\\right\\rVert_2 = \\sqrt{\\frac{5}{3}}$, \n",
"$\\quad \\left\\lVert\\begin{pmatrix} \\sqrt{2/3} \\\\ i/\\sqrt{3}\\end{pmatrix}\\right\\rVert_2 = 1$.\n",
"\n",
"Only the first and the last vector represent valid quantum states!"
]
},
{
"cell_type": "markdown",
"id": "6e1b9898-10a5-422d-8cdb-a8f42bdc01c4",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "0e8243a2-a54e-4aaf-b460-f1f7f9e369b0",
"metadata": {},
"source": [
"## Exercise 4.2\n",
"\n",
"**a)**$\\quad$Write down the state vector of two quantum states \n",
"\n",
"$\\hspace{1cm}$$\\displaystyle|\\Psi_1\\rangle = \\alpha_1 |0\\rangle + \\beta_1 |1\\rangle \\quad $ and $\\quad |\\Psi_2\\rangle = \\alpha_2 |0\\rangle + \\beta_2 |1\\rangle$, \n",
"\n",
"$\\hspace{0.35cm}$$\\quad$i.e. the tensor product, in the computational basis. Write down the basis vectors of the composite system.\n",
"\n",
"**b)**$\\quad$Consider the $2$-qubit state \n",
"\n",
"$\\hspace{1cm}$$\\displaystyle|\\Psi\\rangle = \\frac{1}{\\sqrt{2}} |00\\rangle + \\frac{1}{2}|01\\rangle + \\frac{1}{2} |11\\rangle$. \n",
"\n",
"$\\hspace{0.35cm}$$\\quad$What is the state after a measurement of the first qubit where you obtain $|0\\rangle$?\n",
"\n",
"$\\hspace{0.35cm}$$\\quad$Is this an entangled state?\n",
"\n",
"$\\hspace{0.35cm}$$\\quad$*Hint:* Quantum states are normalized!"
]
},
{
"cell_type": "markdown",
"id": "f1b9d1e8-8c3a-4ac4-a26c-e285881cf7bf",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "b9d96ea3-335a-4219-a46e-a52aada2c31e",
"metadata": {},
"source": [
"$\\textcolor{red}{\\textbf{SOLUTION:}}$"
]
},
{
"cell_type": "markdown",
"id": "ac34fc7e-46d8-4b58-9025-2f88b3c93405",
"metadata": {},
"source": [
"**a)**$\\quad$$|\\Psi_1\\rangle \\otimes |\\Psi_2\\rangle = \\left( \\alpha_1 |0\\rangle + \\beta_1 |1\\rangle \\right) \\otimes \\left( \\alpha_2 |0\\rangle + \\beta_2 |1\\rangle \\right) = \\alpha_1 \\alpha_2 | 00 \\rangle + \\alpha_1 \\beta_2 | 01 \\rangle + \\beta_1 \\alpha_2 | 10\\rangle + \\beta_1 \\beta_2 | 11\\rangle$\n",
"\n",
"$\\hspace{2.95cm}$$\\widehat{=}~ \\begin{pmatrix} \\alpha_1 \\alpha_2 & \\alpha_1 \\beta_2 & \\beta_1 \\alpha_2 & \\beta_1 \\beta_2\\end{pmatrix}^\\top$\n",
"\n",
"$\\hspace{0.35cm}$$\\quad$basis vectors: $\\quad \\begin{pmatrix} 1 & 0 & 0 & 0 \\end{pmatrix}^\\top, \\dots, \\begin{pmatrix} 0 & 0 & 0 & 1 \\end{pmatrix}^\\top$\n",
"\n",
"**b)**$\\quad$The classical state $|11\\rangle$ drops off, and we obtain (after normalization):\n",
"\n",
"$\\hspace{1.5cm}$$\\displaystyle \\sqrt{\\frac{4}{3}}\\left( \\frac{1}{\\sqrt{2}} |00\\rangle + \\frac{1}{2}|01\\rangle \\right) = \\sqrt{\\frac{2}{3}} |00\\rangle + \\sqrt{\\frac{1}{3}} |01\\rangle$\n",
"\n",
"$\\hspace{0.35cm}$$\\quad$This state cannot be written as a tensor-product term. \n",
"\n",
"$\\hspace{0.35cm}$$\\quad$You can also see this from the fact that we get different probabilities for the outcomes of the second qubit depending on the different outcomes of the first qubit."
]
},
{
"cell_type": "markdown",
"id": "818bf57f-be0c-408a-9776-414578b7763a",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "bed85201-1bfb-45a2-a57a-44332f370276",
"metadata": {},
"source": [
"## Exercise 4.3\n",
"\n",
"Suppose you have $n + 1$ qubits. We will write $|\\vec{x}\\rangle$ to mean the $n$-qubit classical state given by the number $x$ in binary. For instance, if $n = 2$ then:\n",
"\n",
"$\\hspace{0.5cm}$$|\\vec{0}\\rangle = |00\\rangle , \\quad |\\vec{1}\\rangle = |01\\rangle, \\quad |\\vec{2}\\rangle = |10\\rangle, \\quad |\\vec{3}\\rangle = |11\\rangle$.\n",
"\n",
"Assume the qubits are in the state\n",
"\n",
"$\\hspace{0.5cm}$$\\displaystyle |\\Psi\\rangle = \\frac{1}{\\sqrt{2^n}} \\sum_{x=0}^{2^n -1} | \\vec{x} \\rangle \\otimes | x~\\text{mod}~2 \\rangle$.\n",
"\n",
"**a)**$\\quad$What is the resulting state if we measure the last qubit and obtain $|0\\rangle$?\n",
"\n",
"**b)**$\\quad$What is the resulting state if we measure the last qubit and obtain $|1\\rangle$?"
]
},
{
"cell_type": "markdown",
"id": "1166e9c0-7a64-4cf6-a269-0c83743afa43",
"metadata": {},
"source": [
"***"
]
},
{
"cell_type": "markdown",
"id": "464bcad9-fe4c-420e-8b41-dad09248a94f",
"metadata": {},
"source": [
"$\\textcolor{red}{\\textbf{SOLUTION:}}$"
]
},
{
"cell_type": "markdown",
"id": "bb28814f-8792-4365-ac53-15be05d0549f",
"metadata": {},
"source": [
"**a)**$\\quad$If we measure $|0\\rangle$, all states with last qubit $|1\\rangle$ disappear from the summation and we have\n",
"\n",
"$\\hspace{1cm}$$\\displaystyle\\frac{1}{\\sqrt{2^{n-1}}} \\sum_{x=0, x~\\text{even}}^{2^n -1} | \\vec{x} \\rangle \\otimes | 0 \\rangle = \\frac{1}{\\sqrt{2^{n-1}}} \\sum_{x=0}^{2^{n-1} -1} | \\overrightarrow{2x} \\rangle \\otimes | 0 \\rangle $\n",
"\n",
"**b)**$\\quad$If we measure $|1\\rangle$, all states with last qubit $|0\\rangle$ disappear from the summation and we have\n",
"\n",
"$\\hspace{1cm}$$\\displaystyle\\frac{1}{\\sqrt{2^{n-1}}} \\sum_{x=0, x~\\text{odd}}^{2^n -1} | \\vec{x} \\rangle \\otimes | 0 \\rangle = \\frac{1}{\\sqrt{2^{n-1}}} \\sum_{x=0}^{2^{n-1} -1} | \\overrightarrow{2x+1} \\rangle \\otimes | 0 \\rangle $"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c5f602d6-775a-4c77-a737-c2e6168794a5",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
805 changes: 805 additions & 0 deletions Exercises/Session 5 - Quantum Computing (with solutions).ipynb

Large diffs are not rendered by default.

0 comments on commit 4278bd2

Please sign in to comment.