Home Algorithms Commercialization Data Science Information Theories Quantum Theories Lab Linear Algebra
<< QASM U Operators Derivation PDF Quantum Logic Gates - 2 >>

$\require{cancel} \newcommand{\Ket}[1]{\left|{#1}\right\rangle} \newcommand{\Bra}[1]{\left\langle{#1}\right|} \newcommand{\Braket}[1]{\left\langle{#1}\right\rangle} \newcommand{\Rsr}[1]{\frac{1}{\sqrt{#1}}} \newcommand{\RSR}[1]{1/\sqrt{#1}} \newcommand{\Verti}{\rvert} \newcommand{\HAT}[1]{\hat{\,#1~}} \DeclareMathOperator{\Tr}{Tr}$

Quantum Logic Gates

First created in July 2018

Basics


For the general form of states on the Bloch Sphere

$\Ket{\psi}=\cos\frac{\theta}{2}\Ket0+e^{i\phi}\sin\frac{\theta}{2}\Ket1$,

in order to keep the coefficient of $\Ket0$ real and non-negative, we may need to include a global phase shift factor of unit length.

$\displaystyle X\Ket{\psi}\cdot e^{-i\phi}= \begin{bmatrix} e^{i\phi}\sin\frac{\theta}{2}\\ \cos\frac{\theta}{2} \end{bmatrix} \cdot e^{-i\phi}= \begin{bmatrix} \sin\frac{\theta}{2}\\ e^{-i\phi}\cos\frac{\theta}{2} \end{bmatrix}\\ =\begin{bmatrix} \cos\frac{\pi-\theta}{2}\\ e^{i(2\pi-\phi)}\sin\frac{\pi-\theta}{2} \end{bmatrix} =\cos\frac{\pi-\theta}{2}\Ket0+e^{i(2\pi-\phi)}\sin\frac{\pi-\theta}{2}\Ket1 .$

A rotation of $\pi$ about the $X$-axis:$\quad\quad\theta'=\pi-\theta~~$ and $~~\phi'=2\pi-\phi~$.


The adjoint of an operator ($O^\dagger$) is its conjugate transpose.

  1. Unitary: $U^\dagger=U^{-1}$.\quad $U$ preserves the vector length.\quad A scaler analogy: ${\bar{u}=\frac{1}{u}}$ means ${|u|^2=\bar{u}u=1}$.

  2. Hermitiian (self-adjoint): $H^\dagger=H$.\quad $H$ has real diagonal and eigenvalues.\quad A scaler analogy: $\bar{h}=h$ means $h$ is real.

  3. Involutory (self-inverse): $M^{-1}=M$ (i.e. $M^2=I$, or $M^{2n}=I$).\quad A scaler analogy: $\frac{1}{m}=m$ means $m^2=1$ or $m=\sqrt{1}$.

Buy 2 get 1 free -- Any two of the above three properties imply the remaning one.

Operators satisfying all three properties: $I, X, Y, Z, H, $ SWAP and their corresponding controlled gates.


$O=[a_{ij}]=\sum_{i,j}a_{ij}\Ket{i}\Bra{j}$ -- sends $\Ket{k}$ to $\sum_i a_{ik}\Ket{i}$.

Operations

Pauli Gates

The three Pauli Gates correspond to rotation of $\pi$ about the three axes.

$X= \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} ,\quad Y= \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} ,\quad Z= \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} .$

Let $\quad \Ket{\psi}=\alpha\Ket0+\beta\Ket1= \begin{bmatrix} \alpha\\ \beta \end{bmatrix} .$

$\displaystyle X\Ket{\psi}= \begin{bmatrix} \beta\\ \alpha \end{bmatrix} ,\quad Y\Ket{\psi}= \begin{bmatrix} -i\beta\\ i\alpha \end{bmatrix} ,\quad Z\Ket{\psi}= \begin{bmatrix} \alpha\\ -\beta \end{bmatrix} .$


$X^2=Y^2=Z^2=-iXYZ=I.~~~ XYZ=iI,\\ XY=-YX=iZ,~~ YZ=-ZY=iX,~~ ZX=-XZ=iY .$

Some text avoids phase in $Y$, having

$Y'= \begin{bmatrix} 0 & 1\\ -1 & 0 \end{bmatrix} =iY=ZX,~~ Y=-iY'.~~ XY'Z=-I~~, Y'^2=-I .$

The symmetry goes: $AB=iC,~~ABC=iI,~~AB=-BA$ (anticommute).\quad The same does not apply to $Y'$.

$H= \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1\\ 1 & -1 \end{bmatrix} =\frac{1}{\sqrt{2}}(Z+X) ,~~~ H^2=\frac{1}{2}(Z^2+ZX+XZ+X^2)=\frac{1}{2}(2I)=I .$


$\displaystyle Y\Ket{\psi}\cdot ie^{-i\phi}= \begin{bmatrix} -ie^{i\phi}\sin\frac{\theta}{2}\\ i\cos\frac{\theta}{2} \end{bmatrix} \cdot ie^{-i\phi}= \begin{bmatrix} \sin\frac{\theta}{2}\\ -e^{-i\phi}\cos\frac{\theta}{2} \end{bmatrix}\\ =\begin{bmatrix} \cos\frac{\pi-\theta}{2}\\ e^{i(\pi-\phi)}\sin\frac{\pi-\theta}{2} \end{bmatrix} =\cos\frac{\pi-\theta}{2}\Ket0+e^{i(\pi-\phi)}\sin\frac{\pi-\theta}{2}\Ket1 .$

A rotation of $\pi$ about the $Y$-axis:$\quad\quad\theta'=\pi-\theta~~$ and $~~\phi'=\pi-\phi$\quad (or $\phi'=3\pi-\phi$ when $\phi>\pi$, to keep $\phi'\in[0,2\pi)$).


$\displaystyle Z\Ket{\psi}= \begin{bmatrix} \cos\frac{\theta}{2}\\ -e^{i\phi}\sin\frac{\theta}{2} \end{bmatrix} =\begin{bmatrix} \cos\frac{\theta}{2}\\ e^{i(\pi+\phi)}\sin\frac{\theta}{2} \end{bmatrix} =\cos\frac{\theta}{2}\Ket0+e^{i(\pi+\phi)}\sin\frac{\theta}{2}\Ket1 .$

A rotation of $\pi$ about the $Z$-axis:$\quad\quad\theta'=\theta~~$ and $~~\phi'=\pi+\phi$\quad (or $\phi'=-\pi+\phi$ when $\phi\ge\pi$, to keep $\phi'\in[0,2\pi)$).


These are how the Pauli operations look in algebraic form:

$\displaystyle X\Ket{\psi}\cdot e^{-i\phi} =\left(\cos\frac{\theta}{2}\Ket1+e^{i\phi}\sin\frac{\theta}{2}\Ket0\right)\cdot e^{-i\phi} =\sin\frac{\theta}{2}\Ket0+e^{i(2\pi-\phi)}\cos\frac{\theta}{2}\Ket1\\ =\cos\frac{\pi-\theta}{2}\Ket0+e^{i(2\pi-\phi)}\sin\frac{\pi-\theta}{2}\Ket1 .$

$\displaystyle Y\Ket{\psi}\cdot ie^{-i\phi} =\left(i\cos\frac{\theta}{2}\Ket1-ie^{i\phi}\sin\frac{\theta}{2}\Ket0\right)\cdot ie^{-i\phi} =\sin\frac{\theta}{2}\Ket0-e^{-i\phi}\cos\frac{\theta}{2}\Ket1\\ =\cos\frac{\pi-\theta}{2}\Ket0+e^{i(\pi-\phi)}\sin\frac{\pi-\theta}{2}\Ket1 .$

$\displaystyle Z\Ket{\psi} =\cos\frac{\theta}{2}\Ket0-e^{i\phi}\sin\frac{\theta}{2}\Ket1 =\cos\frac{\theta}{2}\Ket0+e^{i(\pi+\phi)}\sin\frac{\theta}{2}\Ket1 .$

Control-U Gate

Note: An entangled multi-qubit system (those that cannot be factorised) needs to be considered as a whole. Even when a single qubit in the system is operated on, a multi-qubit operator is required: $I\otimes I\otimes\ldots\otimes U\otimes\ldots\otimes I$. This is applicable for unentangled system as well if you do not want to factorise the qubit to operate on.

$C_{NOT}=cX=\wedge X=\Ket0\Bra0\otimes I+\Ket1\Bra1\otimes X =\begin{bmatrix} I & [0]\\ [0] & X \end{bmatrix} =\begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0 \end{bmatrix} .$


Generally, $C(U)=cU=\wedge U=\Ket0\Bra0\otimes I+\Ket1\Bra1\otimes U =\begin{bmatrix} I & [0]\\ [0] & U \end{bmatrix} .$

$(cU)^2=I\Leftrightarrow U^2=I.\qquad \text{Proof:}~~ (cU)^2 =(\Ket0\Bra0\otimes I+\Ket1\Bra1\otimes U)~(\Ket0\Bra0\otimes I+\Ket1\Bra1\otimes U)\\ =(\Ket0\Bra0\otimes I)~(\Ket0\Bra0\otimes I) +(\Ket0\Bra0\otimes I)~(\Ket1\Bra1\otimes U) +(\Ket1\Bra1\otimes U)~(\Ket0\Bra0\otimes I) +(\Ket1\Bra1\otimes U)~(\Ket1\Bra1\otimes U) =(\Ket0\Bra0\otimes I)+(\Ket1\Bra1\otimes U^2) .$

It follows that $(cX)^2=(cY)^2=(cZ)^2=I$.


The control qubit in a $cU$ operation should not be consider unaffected, as they often are. Yes, when all input to the $cU$ are standard basis vectors, the control qubit is not affected, but the "good time" stops there. Even in unentangled system, a control qubit in superposition is affected when the $cU$ is operated on a standard basis vector.
e.g. $cX\left(\frac{1}{\sqrt{2}}(\Ket0+\Ket1,\Ket0\right) =\frac{1}{\sqrt{2}}\left(\Ket{00}+\Ket{11}\right) .$


Let $\Ket{\psi}=a_{00}\Ket{00}+a_{01}\Ket{01}+a_{10}\Ket{10}+a_{11}\Ket{11}.$

While $(H\otimes I)^2\Ket{\psi}=\Ket{\psi},\qquad (H\otimes I)(cX)(H\otimes I)\Ket{\psi} =\begin{bmatrix} I+X & I-X\\ I-X & I+X \end{bmatrix}$

$=(a_{00}+a_{01}+a_{10}-a_{11})\Ket{00} +(a_{00}+a_{01}-a_{10}+a_{11})\Ket{01}\\ +(a_{00}-a_{01}+a_{10}+a_{11})\Ket{10} +(-a_{00}+a_{01}+a_{10}+a_{11})\Ket{11} ,$

which is entangled.

 

<< QASM U Operators Derivation Top Quantum Logic Gates - 2 >>