---
header-includes:
- \hypersetup{colorlinks=false,
allbordercolors={0 0 0},
pdfborderstyle={/S/U/W 1}}
title: "Quantum computing lecture notes"
author: "Kev M. Salikhov"
output:
beamer_presentation:
includes:
in_header: header_pagenrs.tex
---
# Quantum computing lecture notes (6-7)
## Lecture 6. Error correction
Errors come form interation with environment. How environment can affect, which types of error can occur, how to correct such errors?
Two major sources - dissipation and decoherence.
Formally thiere should be interation, this disturbance can be implemented as an unitary operation, which can be written in Pauli basis $V=c_0I+c_x\sigma_x+c_y\sigma_y + c_z\sigma_z$.
$\sigma_x$ has the shape of $\begin{pmatrix} 0 & 1 \\1 & 0\end{pmatrix}$ in the basis of $\sigma_z$. This acts as $NOT$, thus disturbance of this type of environment interation can bring an error ($|0\rangle\rightarrow|1\rangle$).
Also, if splitting of 2 levels fluctuate with time, this with time can bring coherence to 0.
---
### How $\sigma_z$ changes the phase of coherence?
$\sigma_z\psi=\begin{pmatrix} 1 & 0 \\ 0 & -1 \\ \end{pmatrix}\begin{pmatrix}a \\ b \end{pmatrix}=\begin{pmatrix}a \\ -b \end{pmatrix}$
$\psi=a|0\rangle+b|1\rangle \rightarrow^{\sigma_z}\rightarrow a|0\rangle + e^{i\pi}b|1\rangle$.
Operations which can be described as $\sigma_z$ work as phase change.
---
### How $\sigma_y$ changes?
$\sigma_y=\begin{pmatrix} 0 & -i \\ i & 0 \\ \end{pmatrix}$
$\sigma_y(a|0\rangle+b|1\rangle)=-ib|0\rangle+ia|1\rangle=-i(b|0\rangle-a|1\rangle)=-i(b|0\rangle+e^{i\pi}a|1\rangle)$
It gives the flip of amplitudes **and** phase shift. This is natural, as $\sigma_x\sigma_z=i\begin{pmatrix} 0 & -1 \\ 1 & 0 \\ \end{pmatrix}=i*\sigma_y$
**Any relaxation can be produces with flip ($\sigma_x$) and phase change ($\sigma_z$).**
---
### Spontaneous change
These transition are connected with change of energy (as we define qubit levels as 2 energetic levels). There can be spontaneous transition with probability ~$\omega^{3}$. In case of spins, $\omega\approx 10^{10}$. $p=|\frac{V_{int}}{\hbar}|^2*\tau_c$, there $\tau_c=\frac{1}{t}$, where $t$ is characteristic time of change.
---
If process of decoherence is faster than computing, we can only have probabilistic classic computer.
---
### Why density matrix is better for descrition?
$\rho=|\psi\rangle\langle\psi|=\begin{pmatrix}\rho_{11} & \rho_{12} \\ \rho_{21} & \rho_{22}\end{pmatrix}=\begin{pmatrix}|a|^2 & ab^* \\ a^*b & |b|^2\end{pmatrix}$
Density matrix elements are observable and can be measured. It allows to describe irreversible relaxation processes. $\rho_{12}$ can dissappear, but $\rho_{11}, \rho_{22}$ stay unchanged, and in wave function form we never nothice that.
$ab^*=\rho_{12}$
$\langle\psi|S_x|\psi\rangle=Re(ab^*)=Re[\rho_{12}]$
$\langle\psi|S_y|\psi\rangle=Im(ab^*)=Im[\rho_{12}]$
**Ref**: [Mesoscopic systems](https://en.wikipedia.org/wiki/Mesoscopic_physics) -- systems of the edge of classic (macro) and quantum systems, where one cannot reject quntum effects
---
We cannot average wave functions of 2 systems (why? e.g. for multiple experiments with the same process, or [ergodic process](https://en.wikipedia.org/wiki/Ergodic_process) is average over time). If we multiply a state by $e^{i\pi}=-1$ (this means nothing for a particle, but phase change). Average of original and changed state gives 0, but in fact density matrix doesn't change.
Density matrix gives ability to provide description avareged over system ensemble.
---
$\frac{\partial\rho}{\partial t}=-\frac{i}{\hbar}[H,\rho]+(\frac{\partial\rho}{\partial t})_{relax}$,
where
$(\frac{\partial\rho}{\partial t})_{relax}=-\frac{\rho}{\tau}$
With characherisic time $\tau$ we can include relaxation process in equation.
---
### How decoherence can happen
Electron spin is a qubit. $H=-\vec{\mu}B_o=+\hbar\omega_0\hat{S_z}$
$H=\hbar\omega S_z$
$S_z=\frac{1}{2}\begin{pmatrix}1 & 0 \\ 0 &-1\end{pmatrix}$
Let's apply this Hamiltonian over time.
$\psi_{t=0}=a|0\rangle+b|1\rangle\rightarrow^{H(t)}\rightarrow e^{-i\hat{H}t/\hbar}[a|0\rangle+b|1\rangle]=$
$=ae^{-i\omega_0t/2}|0\rangle+be^{+i\omega_0t/2}|1\rangle=
e^{-i\omega_0t/2}(|0\rangle+e^{i\omega_0t}b|1\rangle)$
What do we see? Phase of coherence changed. Phase changed.
What if $\vec{B}(t)$ is changing in time, preserving direction? It may fluctuate due to electric circuit, producing the field. This leads to fluctuating enery level splitting: $\Delta E=E_0-E_1$.
Then we get solution of Shr. eq. $e^{-i\int_0^t\omega(t)dt}$, which for constant $\omega$ converges to what we already shown. We can also write $\omega=\omega_{average}+x(t)$
Suppose $x(t)$ is normal. Any sum of centered normal processes is also normal. Thus we can express error as.
$<e^{i\int_0^t x(t)dt}>=e^{-<x^2>\frac{t^2}{2}}$
---
Phenomenologically we can describe decoherence might be described as
$\rho=\begin{pmatrix}\rho_{11} & \rho_{12}k(t) \\ \rho_{21}k(t) & \rho_{22}\end{pmatrix}$
where $k(t)$ decreases from 1 to 0 with time. It might have such forms as:
$k(t)=e^{\frac{-t}{T2}}$, $k(t)=e^{-gt^2}$, $k(t)=e^{-c\sqrt{t}}$.
Higher is the order of coherence, usually faster is the decoherence process.
---
If we identify the error, we can produce correcting operation. E.g. additionally applying $\sigma_x$
---
To make corrections we should know what happened and what to do.
Instead of qubits we use codewords: $\psi_0=a|000\rangle+b|111\rangle$. We add 2 more qubits. I want to check if qubit is in a proper state. We convert second and 3rd spins using $CNOT$ operator twice: $CNOT(1, 2)$ and $CNOT(1, 3)$.
Measurements of additional states can help us to identify types of disturbance, thus identifying reverse procedures.
E.g. some noise produced signle flip ($\sigma_x=NOT$) of one of qubits in $\psi_0=a|000\rangle+b|111\rangle$ state.
$\psi_1=\sigma_{1x}\psi=a|100\rangle+b|011\rangle$
$\psi_2=\sigma_{2x}\psi=a|010\rangle+b|101\rangle$
$\psi_3=\sigma_{3x}\psi=a|001\rangle+b|110\rangle$
even with 2 flips.
$\psi_3=\sigma_{1x}\sigma_{2x}\psi=a|110\rangle+b|001\rangle$
We don't investigate state of 1st! Prohibited.
In experiment we can observe (with sigle error!) one of $|00\rangle, |01\rangle, |10\rangle, |11\rangle$.
$|00\rangle, |11\rangle$ say "there was no single-flip error in 2,3 qubits". If we are sure the error occurs, then it happened for the first.
---
We can also use other observables, e.g. $|+\rangle, |-\rangle$. These are eigenfunctions of $S_x$ with eigenvalues $\pm\frac{1}{2}$
For this we additionally apply $H$ gate to all 3 qubits:
$\psi_0=a|+++\rangle+b|---\rangle$.
---
### Strategy of error correction.
- inspect and correct a logical qubit
- you encode the state of a logical qubit into some (up to hundreds) of qubits. This form a codeword.
- We should decide from physics which types of disturbances may occur, and how they project into errors (spectral diffusions, magnetic field fluctuations, ...).
- We measure states of all encoding qubits (except the logic one).
Suppose we have: $\psi=c_0|00011\rangle+c_1|10011\rangle$. We observe 2 qubits converted. We will apply $\sigma_{4x}\sigma_{5x}$ for fix.
---
Note: no one is discussing that qubits can affect each other, which is additional source of mistake.
---
## Lecture 7. Quantum cryptography. Quantum key distribution
### Plan
- secret keys
- why quanutum key distribution
- protocol of quantum key distribution
+ Physical implementation of quantum computers.
---
Alice and Bob exchanges, Eva is eavesdropping.
Simple key - length is the same as the length of the message.
---
### Basis states - rectilinear and diagonal polarizations

$|0_r\rangle, |1_r\rangle, |0_d\rangle, |1_d\rangle$
1. States of photons can be encoded with **either polarization basis randomly**.
2. Polarization of photons is easily controlled/manipulated.
---
### Light polarization
Some medium (e.g. salt $NaCl$, longer in 1 direction) make light to develop differently if it travels in different directions inside the crystal. And the speed of light is different. This is called [anisotropy](https://en.wikipedia.org/wiki/Anisotropy).
What if photon falls with some angle?
---
### Birefringence
Depending on polarization some materials have different refraction angles. This is called [birefringence](https://en.wikipedia.org/wiki/Birefringence). [Video demo](https://www.youtube.com/watch?v=WdrYRJfiUv0).

This leads that for some polarized photons can be detected by a detector, but othes - not.
---
We can chose an observable, for which vertical polarization is $|1\rangle$ and hoizontal is $|0\rangle$ (rectilinear).
But we can also choose diagonal basis ($\frac{\pi}{4}$ is $|0_d\rangle$ and $\frac{3\pi}{4}$ as $|1_d\rangle$). This can be achieved by $Rot(\pi/4)$ gate.
$P_r=|0\rangle\langle0|-|1\rangle\langle1|=\begin{pmatrix}1 & 0\\ 0 & -1 \end{pmatrix}$. This is $\sigma_z$ Pauli matrix. Eigenvalues are 1 and -1. Eigenvectors are $\begin{pmatrix}1 \\ 0\end{pmatrix}$ and $\begin{pmatrix}0 \\ 1\end{pmatrix}$.
Transition from rectilinear (+) basis to diagonal (x) is given by $\frac{\pi}{4}$ rotation.
$|0\rangle_d=\frac{1}{\sqrt{2}}(|0\rangle_r+|1\rangle_r)$
$|1\rangle_d=\frac{1}{\sqrt{2}}(|0\rangle_r-|1\rangle_r)$
$P_d=\begin{pmatrix}1 & 0\\ 0 & -1 \end{pmatrix}_d=\begin{pmatrix}0 & 1\\ 1 & 0 \end{pmatrix}_r$
Commutator?
$[P_r, R_d]_r = P_rP-d-P_dP_r \neq 0$
Means we cannot change the order of operators.
---
### We address cryptography with 2 types of polarizers.
Alice will randomly choose the type of polarizers (given some generator). She knows.
Bob chooses the polarizer also. He knows his own basis, but he has no idea about Alice's choise. Also, what is $|0\rangle$ and $|1\rangle$ is Alice's basis.
---
### Protocol
We want to send some 0-1's, and only Alice and Bob knows the sequence.
```
Alice (random basis choice):
+ + x + x x x x + x + + +
1 1 0 1 0 0 0 0 1 1 0 1 1
Bob (random basis choice):
+ x x + + x x x + + x + +
1 1 0 1 1 0 0 0 1 1 1 1 0
Sifted key (where basis match):
1 0 1 0 0 0 1 1 0
Testing (removed from final key):
? ? ? ? ?
Final key:
1 0 1 0
```
1. Alice sends randomly chosen polarized photons.
2. Bob measures photons in **randomly** chosen basis.
3. A and B shared polarization information (+, x) for the whole set, or just a subset.
4. This is how they choose where they used the same type of polarizer ("sifting"). BUT there might be a mistake, because Eva (eavesdropper) measures and re-issues a photon.
5. For a subset of photons A tells B **polarization orientation**, but doesn't tell what those bit values were.
6. Bob compares his polarization orientations with those of Alice. Then Bobs finds matching cases. It can be an evidence of eavesdropping. Testing qubits are not included in a key.
---
### Physical implementation of quantum computers with photons
**Requirements**:
1. 2-level system -- polarization (**solvable**)
2. Long enough decoherence time (**solvable**). Still there are external things which can change polarization (e.g. nuclear explosion). Thus we use optical fibers. If we are at the edge of good and bad time -- we are in the area of mesoscopic systems.
3. Able to measure a state of a qubit, manipulate the state selectively (**solvable**)
4. Implement 1- and 2-qubit gates, e.g. $NOT$ and $CNOT$. (**problem**)
Realization of $CNOT$ is not straightforward. We need interaction, but we know that photons do not mutually interact.
For 2 photons we can for add a beam of **atoms**. E.g. one photon polarizes the atom, and the atom will dictate the behavior of the second.
---
### On density matrix versus wave function (eigenvector)
In classic computers nobody cared about physical systems implementing the gates. For quantum computing this is of extreme importance. Otherwise this means we exclude [quantum coherence](https://en.wikipedia.org/wiki/Coherence_(physics)).
Wave function, full system description, but **not observable**:
$|\psi\rangle = a|0\rangle+b|1\rangle$
For ensembles we cannot add/average wave functions, only products. We cannot use our intuitive way.
Density matrix:
$\rho=|\psi\rangle\langle\psi| =( a|0\rangle+b|1\rangle)(a^*\langle0|+b^*\langle1|)$
$\rho=\begin{pmatrix}\rho_{00} & \rho_{01} \\ \rho_{10} & \rho_{11} \end{pmatrix}$
Density matrix is always given is some basis. **Diagonal numbers are always real numbers**, as they express level populations. Non-diagonal -- contribution of different basis states.
in 0-1-basis:
$\rho_{00}=\langle0|\rho|0\rangle=aa^*$
$\rho_{01}=\langle0|\rho|1\rangle=ab^*$
$\rho_{10}=\langle1|\rho|0\rangle=ba^*$
$\rho_{11}=\langle1|\rho|1\rangle=bb^*$
Example. When 2 atoms in a molecule electron occupies 2 orbital of 2 atoms. In co-valent connection product non-diagonal elements is highly close to the valency.
For density matrix we have equivalent (to Schrödinger eq.) equation:
$\frac{\partial\rho}{\partial t} = -\frac{i}{\hbar}[H,\rho]$.
---
### Advantages and disadvantages of density matrix
1. Can be obtained using wave function.
2. Number of equations increased (wave function - 2 numbers, matrix - 4).
3. Can be averaged in ensembles. This allows to work with **macroscopic** systems.
4. We know, how we can treat a part $A$ of a big system $AB$. If we are not going to discuss all parameters (e.g. spins only). $B$ might be a thermostat. The recipe -- convolution. For $B$ subsystem keep only populations, no coherence ($Tr_B$). In total: $\rho _A=Tr_B\rho_{AB}$. We loose a lot of coherence values and neglect coupling of A and AB. If B is thermostat, them trace is justified good with thermal equilibrium density matrix of B is reduced to diagonal, diagonal elements are given by Gibbs population of energy level.
5. Density matrix allows to describe the relaxation processes like decoherence of qubits. In this case the evolution of the density matrix is **not** described by unitary transformation. As a result of this non-unitary evolution of qubits, quantum gates loose their reversible evolution in time.
---
**Question for self test.**
Suppose you have 2-qubit system.
There are 2 computation bases of 2 qubits (different), and here is the state:
$\psi=a|00\rangle+b|01\rangle+c|10\rangle+d|11\rangle$.
1. Find $\rho=|\psi\rangle\langle \psi|$
2. And then find $\rho_A$ using $\rho _A=Tr_B\rho_{AB}$.