# Qiskit Summer School
---
## [Day 1](https://drive.google.com/file/d/1Chg7M6AWfZWJbbI1P45hxzr0JN8dbEYS/view?usp=sharing) - Elisa Bäumer
### General Quantum Computing Introduction / QuSphere / Teleportation
* $H \otimes S$ will shift the Qubit Measurement base onto ***Y-axis***
* $\mid a \times b\mid$ = ∣a⟩⟨b∣ **{Outer Product[Ket-Bra]=Cross Product}**
* ∣a⟩⟨b∣ =$\begin{pmatrix}a\\b\end{pmatrix}\begin{pmatrix} c & d \end{pmatrix}$=Cross Product
* ⟨b∣a⟩ =$\begin{pmatrix} c & d \end{pmatrix}\begin{pmatrix}a\\b\end{pmatrix}$=Scalar Product
* $\sigma_{y}$ performs **Phase And Bit Flip**
* An entangled pair of Qubit cannot have be distuinguished into its constituent Qubits.
* For bell states where **$|\psi^{00}\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$** , we can find general $|\psi^{ij}\rangle = (I \otimes \sigma^{j}_{x} \sigma^{i}_{z})|\psi^{00}\rangle$
* For the Q-sphere visualization, the number of 1's **increases** (i.e. hamming weight) from top to bottom for the enumerated states
---
## [Day 2](https://drive.google.com/file/d/1fpX_QUEZNE5FnIAUMUyhxWxb19pJmUA0/view?usp=sharing) - Elisa Bäumer
### Duetsch Algo / Grovers Algo
* New take for me on Hadamard gate:
- for $x \in \{0,1\}$ , $$H|x\rangle = |y\rangle = \frac{1}{\sqrt{2}}\sum\limits_{k \in \{0,1\}} -1^{k * x}|k\rangle$$
- for $x \in \{0,1\}^n$ , $$H^{\otimes n}|x\rangle^{\otimes n} = |y\rangle^{\otimes n} = \frac{1}{\sqrt{2^n}}\sum\limits_{k \in \{0,1\}^n} -1^{k * x}|k\rangle$$
* An oracle has $|x,y\oplus f(x)\rangle$ as output to maintain reversibility.
* **Phase Oracle : $U_{ph}|x\rangle = (-1)^{f(x)}|x\rangle$**
* Duetsch Algorithm has no practical application , it shows that certain problem are better solved on a Quantum Computer
* Grover's algorithm:
* New take for describing $U_f$ and $U_{f_0}$:
- $U_f: |w\rangle \to -|w\rangle$ and $|x\rangle \to |x\rangle ~~ \forall x \not= w$
$U_f = I - 2|w \times w|$
- $U_{f_0}: |0\rangle^{\otimes n} \to |0\rangle^{\otimes n}$ and $|x\rangle \to -|x\rangle ~~ \forall x \not= 00...0$
$$U_{f_0} = 2|0 \times 0|^{\otimes n} - I$$
- $U_f$ is the selector and $V = H^{\otimes n}U_{f_0}H^{\otimes n}$ is the diffusion operator, so the algorithm carries out $(V*U_f)^r$ on state $|s\rangle$ where $r = \frac{\pi}{4*arcsin(\frac{1}{\sqrt{2^n}})} - \frac{1}{2}$
- For multiple marked elements it amplifies faster than a single case because $r = O(\frac{\sqrt{N}}{\sqrt{M}})$
- One trick for the phase oracle is to simply make an identity matrix where any index you want to mark is set to **-1** at the diagonal entry (index, index)
- For $U_{f_0}$ in the diffusion operator, $V$, you would you also use the identity matrix with a -1 in the (0, 0) entry, which is like calling the phase oracle with the 0 entry.
---
## [Day 3](https://drive.google.com/file/d/1n9NPsoNQU68RvWM2KbCt2OxSrl4iHF09/view?usp=sharing) - Abe Asfaw
### QFT/QPE
* Implication Of Borns Rule:
* Unitary Operation = Non Preserving Matrix
* $U^{\dagger}\times U=U \times U^{\dagger}=I$
* $U^{\dagger}=U^{-1}$
* ∣det(U)∣=1
* if $U^{\dagger}= U$, then it is Hermitian, which also means that all the off-diagonal entries are real
* For a single qubit, unitary operations rotate the qubit around on the surface of the Bloch sphere
* Eigenvalue and Eigenvector of U are special:
* U $|x\rangle$ = $\lambda _{x}|x\rangle$
* Eigenvalue has to be of form $e^{i\theta}$ , i.e it applies a phase
* If $\lambda _{x} != \lambda _{y}$ then ⟨x∣y⟩=0
* QFT is the change of basis from Computational base to Fourier Base.
* Computational Bases |0$\rangle$ and |1$\rangle$
* Fourier Bases |+$\rangle$ and |-$\rangle$
* This change of base allows playing with phase.
* Single Qubit QFT is just H gate
* QFT(|x$\rangle$)=$\frac{1}{\sqrt N} \sum_{y=0}^{N-1} e^\frac{2 \pi ixy}{2^k}|y\rangle$
* QFT(|x$\rangle_{k}$) = |0$\rangle + e^{\frac{2 \pi ix}{2^k}}$|1$\rangle$
* Two Operation:
* H(|x$\rangle_{k}$) =$\frac{|0\rangle + e^{\frac{2 \pi ix_{k}}{2}}|1\rangle}{\sqrt2}$
* $URot_{k}$(|x$_{j}\rangle$)=$e^{\frac{2 \pi ix_{j}}{2^k}}$|x$_{j}\rangle$
* 
* Quantum Phase Estimation(Application Of QFT)
* Problem : U |x$\rangle$ = $e^{ i\theta _x} |$x$\rangle$ : Find $\theta_{x}$
* Converting phase to amplitude
* On measuring the circuit repeatidely , to find stats about how many time we got 0 and 1 , respectively.
* QPE is same as QFT with $\theta_{x}=\frac{\theta}{2^{n}}2\pi$ and from this difference we can perform an inverse QFT at the end on the measurement qubits in order to get back $|2^n\theta_x\rangle$
* Output is in the form $0.b_0b_1...b_n = \frac{b_0}{2^1} + \frac{b_1}{2^2} + ... \frac{b_n}{2^{n+1}}$
Ex. $|001> \to 0.100 = \frac{1}{2} + \frac{0}{4} + \frac{0}{8} = \frac{1}{2}$
* 
---
## [Day 4](https://drive.google.com/file/d/1HJWrxcCrnAxLl7c1alBtL5O_hrfqGaeD/view?usp=sharing) - Abe Asfaw
### Shors Algo
* **Shors Algorithm**
* Problem : N=p.q ,where p and q are prime
* Classical : $O(exp(c.n^{1/3}(logn)^{2/3}))$
* Shors Algo : $O(n^{3})$
* Modular Arthmetic:
* 5 / 3 = 1 (Rem: 2) => 5 $\equiv$ 2(mod 3)
* If x $\equiv$ 0 (mod 3) => x is a multiple of 3
* If x $\equiv$ y (mod 3) => $x = 3k+y$
* Periodicity:
* x $\equiv$ y (mod N) means y $\in$ {0...N-1}
* Protocol:
* Pick a number "a" that is co prime with N
* Find the 'order' **r** of function a (mod N) $\equiv$ smallest r such that a$^{r}\equiv$ 1 (mod N)
* Do the following:
* If r is even :
* x $\equiv a^{r/2}$(mod N)
* If x+1 !$\equiv$ 0 (mod N)
* {p,q} is {gcd(x+1,N), gcd(x-1,N)}[Recquired Numbers]
* else : find another a
* Quantum Circuit:
* We use QFT$^{\dagger}$ to get the frequency distribution onto computational basis.
* Measurement as a way to reduce further the probabilities of other results.
* Interference used to benifit as only the term we need are able to survive.
* Measurement Result peek near $j \frac{N}{r}$ for some $j\in Z$.
* Then apply the protocal for values of j and r that satisfies the given ,$j \frac{N}{r}$=Measurement Value.
* U$_{f_{a,n}}$ [$f_{a,n}$=$a^{x}(mod N)$] is implemented through QPE.
---
## [Day 5](https://drive.google.com/file/d/16MUxs8CUZatNJWwT_Is3sea_PZMnWstK/view?usp=sharing) - James Wooton
* Current Qubit have low fidelity , so are prone to error.
* For the near term with NISQ computers error mitigation will be useful, which in simple terms is calculating histograms were we know desired output (e.g. 0 or 1) and then extrapolate to other state histogram.
* One way of looking at error correction is with communication where if you have a binary signal communicated you want $p≪P_{\epsilon}$ where p is the probability of a yes instead of a no and $P_{\epsilon}$ is the maximum allowable error (i.e. how important it is that the message gets through)
* Many Physical Qubit for **few** Logical Qubit
* Repetition Code:
* Recquires you to send multiple copies of message
* Decoded by majority voting.
* Probability Of Messing Up(Almost) : $\frac{p}{1-p}^{d/2}$
* Repetition Code will recquire measurement which will destroy the superposition , so we need to extract different information from Qubit.
* Quantum Repetition Code:
* We take one Qubit as target for two CNOT and measure it , which will tell us if its surrounding Qubit are same or not as we take the surrounding Qubit as control. The measurement of the main Qubit will be same if no error occured , vice versa.
* It can only detect bit flip error
* $Z_{j}Z_{j+1}$ syndrome measurement
* 
* 
* Syndrome Measurement : Checking If all Qubits are doing what they are supposed to do.
* Syndrome measurement $\equiv$ measuring auxiliary qubits for parity among other pairs of qubits
* Surface Code:
* A square latice of Qubits
* The grid of qubits have an exponentially large set of valid permutations for both the $|0\rangle_{L}$and $∣1⟩_{L}$ states
* We are trying to apply even parity for |0$\rangle$ along a line(top to bottom)
* 
* We are trying to apply odd parity for |1$\rangle$ along a line(top to bottom)
* 
* We can change the basis of measurement by using H in Syndrome Measurement to detect Z(Phase) Error.
* What is special about surface codes is that errors that don't change parity don't have to be corrected because integrity is maintained; e.g. protected against all X, Z local errors (and Y because it is ~XZ)
---
## [Day 6](https://drive.google.com/file/d/1KOT65-PcyikdrdECmkHuG1Be0T8188hJ/view?usp=sharing) -Zlatko Minev
* Superconducting Dilution Fridge (15 mK)
* Atom have a quantized energy level.
* Potential Energy : $V\propto \frac {1}{r^{2}}$
* Energy level Anharmonic , i.e , the energy level are not equidistant .**We try to make use of lowest two levels , as they are at maximum distance apart**to use as a Qubit.

* We use a anharmonic oscillator in actuality
* Principal(Recquirements):
* Small Discipation
* Isolation from enviroment
* Low Temperature
* Nonlinearity
* Avoiding Vaccum Fluctuations
* Circuit Quantum Electrodynamics:
* Transmon Qubit

* $Q(t)=Cv(t)$ , C:Capacitance , Q:Charge , v:Voltage
* $\phi (t)=Li(t)$, $\phi$:Magnetic Inductance , L:Inductance , i:Current
* Energy (Capacitor):$\frac{1}{2}C\phi ^{2}$

* Conservation Of Charge : Kirchoff Current Law
* Voltage Across capacitor = Volatage across Inductor.($\phi _{C}=\phi _{L}=\phi$)
* $\hat {H}(Q,\phi) = \frac{Q^{2}}{2C}+\frac {\phi ^{2}}{2L}$
* $\hat {H}(a,a^{*}) = \frac{1}{2}(aa^{*}+a^{*}a)$, where a and a$^{*}$ are anhilation operator

* 
* 
* Fock State:
* 
* $a^{\dagger}a$ => Photon Count
* $aa^{\dagger}=1+a^{\dagger}a$
=>$\hat {H}=\frac{h\omega}{2}(2a^{\dagger}a)$
=>$\hat {H}=h\omega_{0}(a^{\dagger}a+1/2)$
* $Q_{ZPF}=\sqrt{\frac{h}{2Z}}$
* In the above $\hat{a}^\dagger$ is the creation operator and $\hat{a}$ is the annihilation operator (used to describe excitation and relaxation of states in the Fock basis)
* $\hat{a}^\dagger |n\rangle = \sqrt{n + 1} |n + 1\rangle$
* $\hat{a}|n\rangle = \sqrt{n} |n - 1\rangle$ with $\hat{a}|0\rangle= 0$(scalar; vacuum state)
---
## [Day 7](https://drive.google.com/file/d/1hDrIFv1Yymkq02xgxRGoNv7jkQcTzCdG/view?usp=sharing) -Zlatko Minev
* 
* Fock states are similar to computational basis states except that |0\rangle∣0⟩ represents 0 photons (but still has zero-point energy) and |1\rangle∣1⟩ represents 1 photon, etc.
* The Hamiltonian for the quantum harmonic oscillator becomes:
$\hat{H} \approx \frac{\hat{\Phi}^2}{2L} + \frac{\hat{Q}^2}{2C} - \frac{E_j}{4!}(\frac{\Phi}{\phi_0})^4$(the fourth order term is the anharmonicity)
* Josephson Junction:
* 
* Green Part is linear/Purple part is non-linear.
* 
* No rotation approximation
* 
* $p_{m}=\frac {Energy in Junction}{Inductive Energy}$
* Transmon Qubit:
* 
* 
* Rabi Rotation is reduced through Cavity
* The reflection of the transmission EMF defines the state of Qubit.
* 
*
---
## [Day 8](https://drive.google.com/file/d/1BR0U1GDeYCOCwdo1jQvux01xo6tKTmP6/view?usp=sharing) -Antonio Mezzacapo
* Molecular Hamiltonian

* Time Independent Hisenberg Equation $H|\phi \rangle=E_{0}|\phi \rangle$ , we want to find $E_{0}$
* $E_{0}=\langle \phi _{0}|H|\phi \rangle _{0}$
* Born - Oppenheimer Approximation : The Born-Oppenheimer Approximation is the assumption that the electronic motion and the nuclear motion in molecules can be separated.**The nucleous is assumed to be fixed while electron moves , so the repulsion due to repulsion in nucleous is just a energy shift.So we only need to deal with moving electron**
* Fermions(Electron)are indistuigable , opposite of Qubit.i.e you cannot diffrentiate the
* Anti symetric in nature.
* Fock Space of N orbital , “Fock” Space, is a linear combination of states with any number of particles.
* The Fock space of N orbitals consists of all the permutations at each level of orbitals. The 0 and N orbital levels are special in that there is only 1 way to organize particles in each of those cases. Otherwise, it is: $\begin{pmatrix}N \\ m\end{pmatrix} = \frac{N!}{m!(N-m)!}$

* Creation/Anhilation Operator:

* We can use creation/anhilation to map the states onto fock states.
* Freeze two electron to have to deal with two less Qubit
* Mapping Fermions to Qubit:
* Mapping between states
* One To One Mapping $|Fork States\rangle -> |Qubit States\rangle$
* Mapping $a^{\dagger},a$ is not possible for multiqubit state , but easy for one Qubit.

* Jordan Wiener Mapping

* Creation/Anhilation Matrix for Qubit

* Problem:The number of $\sigma _{x}$grows exponentialy because they are local.
* Parity Mapping:
* Qubit stores parity of the fermions(Whether its even/odd)


* JW Mapping and Parity Mapping is O(N) local
* Browser Ketoev mapping is O(log(N)) local
* Browser Ketoev mapping:
* 
* Variational Circuit
*  
* The proccess cycle for using VQE to find $E_{0}$

* Reference State:


* Suzuki Trotter decomposition:

* QMA Complete Problem
---
## [Day 9](https://drive.google.com/file/d/1kCyOAA3HfhvG574qBOtVX_m5QKiDKGiJ/view?usp=sharing) -Abhinav Kandala
* Short Depth Circuit helps in reducing error as less number of gates lead to less of propogation.
* Entangles Qubit cammot be factored into its indivisual qubit components.
* 
* Correspondense of a circuit diagram and actual hardware:

* Error in Hardware:
* Incoherent Error($T_{1}$):
* The Qubit decays from $|1\rangle -> |0 \rangle$
* $P(|1\rangle)=e^{-t/T_{1}}$
* Dephasing(T_{2}):
* How quickly qubit looses phase cooherence
* Coherence Budget: The maximum $T_{1},T_{2}(100*10^{-6})$sec that allows deciding the depth of circuit.
* Leakage Error:
* Transmon qubit are weakly anharmonic
* Can place limit of gate speed
* Coherent Error:
* Under/Over Rotation

* Measurement Error:
* The width gets reduced between $|0\rangle$and$|1\rangle$
* Quantum Chemisry(VQE):
* Given H(Hamiltonian) , we want to find $E_{n}$ , given that $E_{n}|\phi_{n}$.

* Symetry in tapering of qubit:

* Hardware limited Trial State Preperation:
* 
* The depth will depend on the coherence time.
* By using two $\frac{\pi}{2}$ pulse you can simulate any rotation.
* N(3d+2) is the number variational parameters you need to use for N Qubit and d Depth.
* Measuring the result og VQE circuit:



* Run Time Overhead:
* Number of energy estimation
* Number of Pauli string in Hamiltonian
* Number of Shot
* System Initialization
* Getting stuck in local Minima is a majour issue in classical optimization.
* Richardson Extrapolation Noise Reduction
* By switching the pulse wavelength we can change $T_{1} and T_{2}$
* By amplifying the error/noise we can negate the effect of noise.
* These work for multi shot algorithm , like VQE.nut not for single shot algo , like QPE.