寫個修課的作業。

有錯再麻煩指正。

⭐: 與解答有出入,待確認。

To U3 gate

本章節作業目標是把常見的 single qubit gate 轉換成用 U3 表達。

$U3(\theta, \phi, \lambda) = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

NOT $X$ ⭐

$X = {\small\begin{pmatrix}0 & 1\\1 & 0\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

$\Rightarrow \cos(\frac{\theta}{2}) = 0$

$\Rightarrow \theta = \pi, \theta \in [0, \pi] \Rightarrow \sin(\frac{\theta}{2}) = 1$

$\Rightarrow e^{i\phi} = 1, -e^{i\lambda} = 1 \Rightarrow \phi = 0, \lambda = \pi$

$\therefore X = U3(\pi, 0, \pi)$

Hadamard $H$

$H = {\small\begin{pmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}}\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

$\Rightarrow \cos(\frac{\pi}{4}) = \frac{1}{\sqrt{2}}$

$\Rightarrow \theta = \frac{\pi}{2} \Rightarrow \sin(\frac{\theta}{2}) = \frac{1}{\sqrt{2}}$

$\Rightarrow e^{i\phi} = 1, -e^{i\lambda} = 1 \Rightarrow \phi = 0, \lambda = \pi$

$\therefore H = U3(\frac{\pi}{2}, 0, \pi)$

$Z$

$Z = {\small\begin{pmatrix}1 & 0\\0 & -1\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

$\Rightarrow \cos(\frac{\theta}{2}) = 1$

$\Rightarrow \theta = 0 \Rightarrow \sin(\frac{\theta}{2}) = 0$

$\Rightarrow e^{i(\lambda+\phi)} = -1 \Rightarrow \lambda+\phi = \pi$

$\therefore Z = U3(0, \phi, \lambda), \lambda+\phi = \pi$

$Y$

$Y = {\small\begin{pmatrix}0 & -i\\i & 0\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

$\Rightarrow \cos(\frac{\theta}{2}) = 0$

$\Rightarrow \theta = \pi \Rightarrow \sin(\frac{\theta}{2}) = 1$

$\Rightarrow e^{i\phi} = \cos(\phi)+i\sin(\phi) = i, -e^{i\lambda} = -(\cos(\lambda)+i\sin(\lambda)) = -i$

$\Rightarrow \phi = \frac{\pi}{2}, \lambda = \frac{\pi}{2}$

$\therefore Y = U3(\pi, \frac{\pi}{2}, \frac{\pi}{2})$

$S$

$S = {\small\begin{pmatrix}1 & 0\\0 & i\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

同 Z gate, $\theta = 0$

$\Rightarrow e^{i(\lambda+\phi)} = i \Rightarrow \lambda+\phi = \frac{\pi}{2}$

$\therefore S = U3(0, \phi, \lambda), \lambda+\phi = \frac{\pi}{2}$

$S^\dagger$

$S^\dagger = {\small\begin{pmatrix}1 & 0\\0 & -i\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

同 Z gate, $\theta = 0$

$\Rightarrow e^{i(\lambda+\phi)} = -i \Rightarrow \lambda+\phi = \frac{3\pi}{2}$

$\therefore S^\dagger = U3(0, \phi, \lambda), \lambda+\phi = \frac{3\pi}{2}$

$T$

$T = {\small\begin{pmatrix}1 & 0\\0 & \frac{1+i}{\sqrt{2}}\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

同 Z gate, $\theta = 0$

$\Rightarrow e^{i(\lambda+\phi)} = \cos(\lambda+\phi) +i\sin(\lambda+\phi) = \frac{1}{\sqrt{2}} + i\frac{1}{\sqrt{2}} \Rightarrow \lambda+\phi = \frac{\pi}{4}$

$\therefore T = U3(0, \phi, \lambda), \lambda+\phi = \frac{\pi}{4}$

$T^\dagger$

$T^\dagger = {\small\begin{pmatrix}1 & 0\\0 & \frac{1-i}{\sqrt{2}}\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

同 Z gate, $\theta = 0$

$\Rightarrow e^{i(\lambda+\phi)} = \cos(\lambda+\phi) + i\sin(\lambda+\phi) = \frac{1}{\sqrt{2}} + i\frac{-1}{\sqrt{2}} \Rightarrow \lambda+\phi = \frac{7\pi}{4}$

$\therefore T^\dagger = U3(0, \phi, \lambda), \lambda+\phi = \frac{7\pi}{4}$

Identity ⭐

$ID = {\small\begin{pmatrix}1 & 0\\0 & 1\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

同 Z gate, $\theta = 0$

$\Rightarrow e^{i(\lambda+\phi)} = \cos(\lambda+\phi) + i\sin(\lambda+\phi) = 1 \Rightarrow \lambda+\phi = 0$

$\therefore ID = U3(0, \phi, \lambda), \lambda+\phi = 0$

$U1(\lambda)$

$U1(\lambda) = {\small\begin{pmatrix}1 & 0\\0 & e^{i\lambda}\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

同 Z gate, $\theta = 0$

$\Rightarrow e^{i(\lambda+\phi)} = \cos(\lambda+\phi) + i\sin(\lambda+\phi) = e^{i\lambda} \Rightarrow \phi = 0$

$\therefore U1(\lambda) = U3(0, 0, \lambda)$

$U2(\phi, \lambda)$

$U2(\phi, \lambda) = {\small\begin{pmatrix}\frac{1}{\sqrt{2}} & -\frac{e^{i\lambda}}{\sqrt{2}}\\ \frac{e^{i\phi}}{\sqrt{2}} & \frac{e^{i(\lambda+\phi)}}{\sqrt{2}}\end{pmatrix}} = {\small\begin{pmatrix}\cos(\frac{\theta}{2}) & -e^{i\lambda}\sin(\frac{\theta}{2})\\ e^{i\phi}\sin(\frac{\theta}{2}) & e^{i(\lambda+\phi)}\cos(\frac{\theta}{2})\end{pmatrix}}$

$\Rightarrow \cos(\frac{\pi}{4}) = \frac{1}{\sqrt{2}}$

$\Rightarrow \theta = \frac{\pi}{2} \Rightarrow \sin(\frac{\theta}{2}) = \frac{1}{\sqrt{2}}$

$\therefore U2(\phi, \lambda) = U3(\frac{\pi}{2}, \phi, \lambda)$

References

  • ⊛ Back to top
  • ⊛ Go to bottom