<aside> 🌭
Quantum circuit model:
It has the following properties:
No. of qubits in = No. of qubits out
Classical binary input information is coded in the state of the input qubits by
$$ 011\ldots 0 \leftrightarrow \ket{011\ldots 0 } $$
Classical output information must be extracted by measurement
Since measurement collapses the system the answer must be in high probability
📖 Definition: Quantum register: a series of qubits
</aside>
We define 2 general categories of gates:
💼 Case: for now lets consider a 1 Qubit system
🔀 Unitary gates:
$I$: the identity, it doesn't do any modification
$$ I=\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} $$
$X$: The NOT transformation, swaps from $\ket 0$ to $\ket 1$, known as Pauli spin matrix $\sigma_x$
$$ X=\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} $$
$Y$: Pauli spin matrix $\sigma _y$
$$ Y=\begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} $$
$Z$: Pauli spin matrix $\sigma _z$
$$ Z=\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} $$
$H$: The Hadamard transformation
$$ H=\frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} $$
$\Phi_\phi$: The transformation that maps $\ket 0$ to $\ket 0$ and $\ket 1$ to $e^{i\phi} \ket 1$
$$ \Phi=\begin{bmatrix} 1 & 0 \\ 0 & e^{i\phi} \end{bmatrix} $$
🗒️ Note: $I=\Phi_0$ and $Z=\Phi_\pi$
💃 Example: consider the following circuit
If we start with $\ket{0}$ we get
$$ \ket{0}\to \overbrace{\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}}^{H}\to \overbrace{\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ e^{i\theta} \end{pmatrix}}^{\Phi_\theta}\to \overbrace{e^{i\theta/2}\begin{pmatrix} \cos(\theta/2) \\ -i\sin(\theta/2) \end{pmatrix}}^{H}\to \overbrace{e^{i\theta/2}\begin{pmatrix} \cos(\theta/2) \\ e^{i\phi}\sin(\theta/2) \end{pmatrix}}^{\Phi_{\phi+\pi/2}} $$
💎 Conclusion: The transformation $\Phi_{\phi+\pi/2}H\Phi_\theta H$ rotates the basis $\{\ket{0} ,\ket{1}\}$ to the basis $\{ \ket{\theta,\phi},\ket{\Theta,\phi}^\perp \}$ where $\ket{\Theta,\phi}^\perp$ is perpendicular to $\ket{\Theta,\phi}$ and is up to a phase term
🗒️ Note: we can write the whole circuit as one matrix as follows
$$ \Phi_{\phi+\pi/2} H\Phi_\theta H=e^{i\theta/2} \begin{bmatrix} \cos (\theta /2 ) & -i\sin (\theta/2) \\ e^{i\phi} \sin (\theta/2) & ie^{i\phi} \cos (\theta/2) \end{bmatrix} $$
<aside> 🌭
Measurement gates: $M_B$ projection onto basis $B$. The state vector jumps to one or other element of $B$ with the usual probabilities. Normally $B$ is $\{ \ket0 ,\ket 1\}$
</aside>
💃 Example: another basis is the Hadamard basis $\{\ket{0_H},\ket{1_H}\}$
$$ \ket{0_H} =\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}= \frac{1}{\sqrt{2}} (\ket 0 + \ket 1 ) \qquad \ket{1_H} =\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix}= \frac{1}{\sqrt{2}} (\ket 0 - \ket 1 ) $$
💼 Case: lets now consider two Qubit gates
🔀 Unitary gates:
Identity, again we will always have this one
CNOT: the controlled not gate which does the following
$$ \begin{aligned} \ket{00}&\to \ket{00} \quad & \ket{01}&\to \ket{01} \\ \ket{10} &\to \ket{11} \quad & \ket{11} &\to \ket{10} \end{aligned} $$
We can write its general effect as $\ket{a,b}\to \ket{a,a\oplus b}$ where $\oplus$ is EXCLUSIVE OR on $a$ and $b$
If we choose a basis $Q\otimes Q =\{\ket{00},\ket{01},\ket{10},\ket{11}\}$ we can represent it as follows
$$ \text{CNOT}=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix} $$
🗒️ Note: we could have represented the $\bullet$ as $\circ$
SWAP: the swapping gate transforms the map as follows
$$ \begin{aligned} \ket{00}&\to \ket{00} \quad & \ket{01}&\to \ket{10} \\ \ket{10} &\to \ket{01} \quad & \ket{11} &\to \ket{11} \end{aligned} $$
C-U: The controlled-u gate where $U$ is a 1-qubit unitary gate transforms as follows
$$ \begin{aligned} \ket{00}&\to \ket{00} \quad & \ket{01}&\to \ket{01} \\ \ket{1}\ket{\psi} &\to \ket{0}\otimes U\ket{\psi} \end{aligned} $$
💃 Examples: C-X is simply CNOT and C-$\Phi_\phi$ is the controlled phase gate
$\rm M_B$: projection onto basis $B$ of subspace $S$
💃 Example: for the standard basis $Q\otimes Q =\{\ket{00},\ket{01},\ket{10},\ket{11}\}$ the subspace $S$ may be the whole of $Q\otimes Q$ such that $a_{00}\ket{00}+a_{01}\ket{01}+a_{10}\ket{10}+a_{11}\ket{11}$. here any basis vector is a possible outcome with probability $|a_{ij}|^2$ where $i,j\in\{0,1\}$