Skip to content

Commit 6904c37

Browse files
committed
Update week2.do.txt
1 parent e6a0c2d commit 6904c37

File tree

1 file changed

+63
-113
lines changed

1 file changed

+63
-113
lines changed

doc/src/week2/week2.do.txt

Lines changed: 63 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ o Reminder on spectral Decomposition from last week
2424
o Bloch sphere and representation of qubits
2525
o Spectral Decomposition (again), Measurements and Density matrices
2626
o Wavefunction collapse as a result of measurement
27+
o Entaglement and relations to density matrices
2728
o "Video of lecture to be added":"https://youtu.be/"
2829
#o "Whiteboard notes":"https://github.com/CompPhysics/QuantumComputingMachineLearning/blob/gh-pages/doc/HandWrittenNotes/2024/NotesJanuary24.pdf"
2930
!eblock
3031

31-
#* _Reading recommendation_: Scherer, Mathematics of Quantum Computations, chapter 3.1-3.3 and Hundt, Quantum Computing for Programmers, chapter 2.1-2.5. Hundt's text is relevant for the programming part where we build from scratch the ingredients we will need.
32+
!split
33+
===== Readings =====
34+
* _Reading recommendation_: Scherer, Mathematics of Quantum Computations, chapter 3.1-3.3 and Hundt, Quantum Computing for Programmers, chapter 2.1-2.5. Hundt's text is relevant for the programming part where we build from scratch the ingredients we will need.
3235

3336

3437
#The code examples presented by Keran are at
@@ -261,7 +264,8 @@ and
261264
!et
262265

263266
!split
264-
===== The spectral decomposition, from last week =====
267+
===== The spectral decomposition =====
268+
265269
The results from the previous slide gives us
266270
the following spectral decomposition of $\bm{A}$
267271
!bt
@@ -282,19 +286,38 @@ which written out in all its details reads
282286
!split
283287
===== Bloch sphere =====
284288

289+
Classically, in a binary system, the bits take only two distinct
290+
values, either $0$ or $1$. The quantum mechanical counterpart is
291+
given by two state vectors (our simple computational basis)
292+
$\vert 0 \rangle$ and $\vert 1\rangle $ which can be used to realize the
293+
superposition
294+
!bt
295+
\[
296+
\vert \psi \rangle = \alpha \vert 0 \rangle +\beta\vert 1\rangle,
297+
\]
298+
!et
299+
which can be represented using the so-called Bloch sphere, depicted on the next slide (best seen using the jupyter-notebook).
300+
285301

286302
!split
287303
===== Meet the Bloch sphere =====
304+
The Bloch shere gives a vialable way to visualize a qubit and itsv possible realizations in terms of the angles $0\le \theta \le \pi$ and
305+
$0\le \phi \le 2\pi$.
288306
!bc pycod
289307
import numpy as np
290308
from qiskit.visualization import plot_bloch_vector
291-
292309
plot_bloch_vector([0,1,0], title="New Bloch Sphere")
293-
294-
# You can use spherical coordinates instead of cartesian.
295-
310+
!ec
311+
You can use spherical coordinates instead of cartesian ones.
312+
!bc pycod
296313
plot_bloch_vector([1, np.pi/2, np.pi/3], coord_type='spherical')
297314
!ec
315+
Using the Bloch sphere representation of the qubit $\vert \psi \rangle = \alpha \vert 0 \rangle +\beta\vert 1\rangle$, we can rewrite it as
316+
!bt
317+
\[
318+
\vert \psi \rangle = \cos{(\frac{\theta}{2})} \vert 0 \rangle +\sin{(\frac{\theta}{2})}\exp{(\imath\phi)}\vert 1\rangle,
319+
\]
320+
!et
298321

299322

300323
!split
@@ -395,7 +418,7 @@ and
395418
!et
396419

397420
!split
398-
===== Superposition state =====
421+
===== Superposition of states =====
399422

400423
Assume thereafter that we have a state $\vert \psi\rangle$ which is a superposition of the above two qubit states
401424
!bt
@@ -468,6 +491,7 @@ which results in a projection operator
468491
\vert \psi \rangle\langle \psi\vert = \begin{bmatrix} \vert \alpha \vert^2 & \alpha\beta^* \\ \alpha^*\beta & \vert\beta\vert^2\end{bmatrix}.
469492
\]
470493
!et
494+
471495
!split
472496
===== Computing matrix products =====
473497
We have that
@@ -479,10 +503,14 @@ We have that
479503
and computing the matrix product $\bm{P}_0\vert\psi\rangle\langle \psi\vert$ gives
480504
!bt
481505
\[
482-
\bm{P}_0\vert\psi\rangle\langle \psi\vert=\begin{bmatrix} 1 & 0 \\ 0 & 0\end{bmatrix}\begin{bmatrix} \vert \alpha \vert^2 & \alpha\beta^* \\ \alpha^*\beta & \vert\beta\vert^2\end{bmatrix}=\begin{bmatrix} \vert \alpha \vert^2 & \alpha\beta^* \\ 0 & 0\end{bmatrix},
506+
\bm{P}_0\vert\psi\rangle\langle \psi\vert=\begin{bmatrix} 1 & 0 \\ 0 & 0\end{bmatrix}\begin{bmatrix} \vert \alpha \vert^2 & \alpha\beta^* \\ \alpha^*\beta & \vert\beta\vert^2\end{bmatrix}=\begin{bmatrix} \vert \alpha \vert^2 & \alpha\beta^* \\ 0 & 0\end{bmatrix}.
483507
\]
484508
!et
485-
and taking the trace of this matrix, that is computing
509+
510+
!split
511+
==== Taking the trace =====
512+
513+
Taking the trace of the above matrix, that is computing
486514
!bt
487515
\[
488516
\mathrm{Prob}(\psi(0))=\mathrm{Tr}\left[\bm{P}_0^{\dagger}\bm{P}_0\vert \psi\rangle\langle \psi\vert\right]=\vert \alpha\vert^2,
@@ -512,6 +540,9 @@ which we also could have obtained by computing
512540
\]
513541
!et
514542

543+
!split
544+
===== Extending the expressions =====
545+
515546
We can now extend these expressions to the complete ensemble of measurements. Using the spectral decomposition we have that the probability of an outcome $p(x)$ is
516547
!bt
517548
\[
@@ -585,6 +616,7 @@ The subsystems could represent single particles or composite many-particle syste
585616

586617
!split
587618
===== Computational basis =====
619+
588620
This leads to the many-body computational basis states
589621

590622
!bt
@@ -633,6 +665,7 @@ Bell states
633665

634666
!split
635667
===== The next two =====
668+
636669
!bt
637670
\[
638671
\vert \Psi^+\rangle = \frac{1}{\sqrt{2}}\left[\vert 10\rangle +\vert 01\rangle\right]=\frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ 1 \\ 1 \\ 0\end{bmatrix},
@@ -651,6 +684,7 @@ It is easy to convince oneself that these states also form an orthonormal basis.
651684

652685
!split
653686
===== Measurement =====
687+
654688
Measuring one of the qubits of one of the above Bell states,
655689
automatically determines, as we will see below, the state of the
656690
second qubit. To convince ourselves about this, let us assume we perform a measurement on the qubit in system $A$ by introducing the projections with outcomes $0$ or $1$ as
@@ -801,137 +835,53 @@ $\rho_B$, that is we have for a given probability distribution $p_i$
801835
!et
802836

803837

804-
!split
805-
===== Two-qubit system and calculation of density matrices and exercise =====
806838

807-
_This part is best seen using the jupyter-notebook_.
808839

809-
The system we discuss here is a continuation of the two qubit example from week 2.
810840

811841

812-
This system can be thought of as composed of two subsystems
813-
$A$ and $B$. Each subsystem has computational basis states
814842

815-
!bt
816-
\[
817-
\vert 0\rangle_{\mathrm{A,B}}=\begin{bmatrix} 1 & 0\end{bmatrix}^T \hspace{1cm} \vert 1\rangle_{\mathrm{A,B}}=\begin{bmatrix} 0 & 1\end{bmatrix}^T.
818-
\]
819-
!et
820-
The subsystems could represent single particles or composite many-particle systems of a given symmetry.
821-
This leads to the many-body computational basis states
822843

823-
!bt
824-
\[
825-
\vert 00\rangle = \vert 0\rangle_{\mathrm{A}}\otimes \vert 0\rangle_{\mathrm{B}}=\begin{bmatrix} 1 & 0 & 0 &0\end{bmatrix}^T,
826-
\]
827-
!et
828-
and
829-
!bt
830-
\[
831-
\vert 01\rangle = \vert 0\rangle_{\mathrm{A}}\otimes \vert 1\rangle_{\mathrm{B}}=\begin{bmatrix} 0 & 1 & 0 &0\end{bmatrix}^T,
832-
\]
833-
!et
834-
and
835-
!bt
836-
\[
837-
\vert 10\rangle = \vert 1\rangle_{\mathrm{A}}\otimes \vert 0\rangle_{\mathrm{B}}=\begin{bmatrix} 0 & 0 & 1 &0\end{bmatrix}^T,
838-
\]
839-
!et
840-
and finally
841-
!bt
842-
\[
843-
\vert 11\rangle = \vert 1\rangle_{\mathrm{A}}\otimes \vert 1\rangle_{\mathrm{B}}=\begin{bmatrix} 0 & 0 & 0 &1\end{bmatrix}^T.
844-
\]
845-
!et
846844

847-
These computational basis states define also the eigenstates of the non-interacting Hamiltonian
848-
!bt
849-
\[
850-
H_0\vert 00 \rangle = \epsilon_{00}\vert 00 \rangle,
851-
\]
852-
!et
853-
!bt
854-
\[
855-
H_0\vert 10 \rangle = \epsilon_{10}\vert 10 \rangle,
856-
\]
857-
!et
858-
!bt
859-
\[
860-
H_0\vert 01 \rangle = \epsilon_{01}\vert 01 \rangle,
861-
\]
862-
!et
863-
and
864-
!bt
865-
\[
866-
H_0\vert 11 \rangle = \epsilon_{11}\vert 11 \rangle.
867-
\]
868-
!et
869-
The interacting part of the Hamiltonian $H_{\mathrm{I}}$ is given by the tensor product of two $\sigma_x$ and $\sigma_z$ matrices, respectively, that is
870-
!bt
871-
\[
872-
H_{\mathrm{I}}=H_x\sigma_x\otimes\sigma_x+H_z\sigma_z\otimes\sigma_z,
873-
\]
874-
!et
875-
where $H_x$ and $H_z$ are interaction strength parameters. Our final Hamiltonian matrix is given by
876-
!bt
877-
\[
878-
\bm{H}=\begin{bmatrix} \epsilon_{00}+H_z & 0 & 0 & H_x \\
879-
0 & \epsilon_{10}-H_z & H_x & 0 \\
880-
0 & H_x & \epsilon_{01}-H_z & 0 \\
881-
H_x & 0 & 0 & \epsilon_{11} +H_z \end{bmatrix}.
882-
\]
883-
!et
884845

885-
The four eigenstates of the above Hamiltonian matrix can in turn be used to
886-
define density matrices. As an example, the density matrix of the
887-
first eigenstate (lowest energy $E_0$) $\Psi_0$ is given by the outerproduct
846+
!split
847+
===== Second exercise set =====
888848

889-
!bt
890-
\[
891-
\rho_0=\left(\alpha_{00}\vert 00 \rangle+\alpha_{10}\vert 10 \rangle+\alpha_{01}\vert 01 \rangle+\alpha_{11}\vert 11 \rangle\right)\left(\alpha_{00}^*\langle 00\vert+\alpha_{10}^*\langle 10\vert+\alpha_{01}^*\langle 01\vert+\alpha_{11}^*\langle 11\vert\right),
892-
\]
893-
!et
894849

895-
where the coefficients $\alpha_{ij}$ are the eigenvector coefficients
896-
resulting from the solution of the above eigenvalue problem.
850+
We bring back the last two exercises from last week as they are meant to build the basis for
851+
the two projects we will work on during the semester. The first
852+
project deals with implementing the so-called
853+
_Variational Quantum Eigensolver_ algorithm for finding the eigenvalues and eigenvectors of selected Hamiltonians.
897854

855+
!split
856+
===== Ex1: One-qubit basis and Pauli matrices =====
898857

899-
We can
900-
then in turn define the density matrix for the subsets $A$ or $B$ as
858+
Write a function which sets up a one-qubit basis and apply the various Pauli matrices to these basis states.
901859

902-
!bt
903-
\[
904-
\rho_A=\mathrm{Tr}_B(\rho_{0})=\langle 0 \vert \rho_{0} \vert 0\rangle_{B}+\langle 1 \vert \rho_{0} \vert 1\rangle_{B},
905-
\]
906-
!et
860+
!split
861+
===== Ex2: Hadamard and Phase gates =====
862+
863+
Apply the Hadamard and Phase gates to the same one-qubit basis states and study their actions on these states.
907864

908-
or
909865

866+
!split
867+
===== Ex3: Traces of operators =====
868+
869+
Prove that the trace is cyclic, that is for three operators $\bm{A}$, $\bm{B}$ and $\bm{C}$, we have
910870
!bt
911871
\[
912-
\rho_B=\mathrm{Tr}_A(\rho_0)=\langle 0 \vert \rho_{0} \vert 0\rangle_{A}+\langle 1 \vert \rho_{0} \vert 1\rangle_{A}.
872+
\mathrm{Tr}\{\bm{ABC}\}=\mathrm{Tr}\{\bm{CAB}\}=\mathrm{Tr}\{\bm{BCA}\}.
913873
\]
914874
!et
915875

916-
The density matrices for these subsets can be used to compute the
917-
so-called von Neumann entropy, which is one of the possible measures
918-
of entanglement. A pure state has entropy equal zero while entangled
919-
state have an entropy larger than zero. The von-Neumann entropy is
920-
defined as
876+
921877

922878

923879

924880
!split
925881
===== The next lecture =====
926882

927883
In our next lecture, we will discuss
928-
o Reminder and review of entropy and entanglement
884+
o Discussion of ntropy and entanglement
929885
o Gates and circuits and how to perform operations on states
930886

931887
"Reading: Chapters 2.1-2.11 of Hundt's text":"https://github.com/CompPhysics/QuantumComputingMachineLearning/blob/gh-pages/doc/Textbooks/Programming/chapter2.pdf"
932-
933-
934-
935-
936-
937-

0 commit comments

Comments
 (0)