# Equivalence relationship of the quantum logic gates

Here we mainly analyze the equivalent relationship between some quantum logic gates, such as Pauli $-X, -Y, -Z$, Hadamard, $R_x, R_y, R_z$.

## Bit-flip operator

We have already known that Pauli-$X$ is the bit-reverse operator, its matrix representation can be derived by the projective Dirac symbols:

$X=|0\rangle\langle1|+|1\rangle\langle0|=\left[\begin{array}{ll}{0} & {1} \ {1} & {0}\end{array}\right].$

Does it equal to $R_y(\pi)$? $R_y(\pi)$ makes the states rotating by $y$-axis, on the $xz$-plane, with $\theta=\pi$. In this view, they are equivalent! However, things get different when the input state is a superposition state, such as $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$, when $R_y$ and $X$ gates are applied respectively,

$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle) \stackrel{R_y}{\longrightarrow} \frac{1}{\sqrt{2}}(-|0\rangle+|1\rangle),$

$\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle) \stackrel{X}{\longrightarrow} \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle).$

Obviously, the relative phase of $|1\rangle$ are different, this is interesting, although both of them have a bit flip function, however, they differ by a relative phase $\pi$, according to the matrix of $R_y(\theta)$,

$R_y(\theta)=\cos\frac{\theta}{2}I-i\sin\frac{\theta}{2}Y=\left[\begin{array}{cc}{\cos \frac{\theta}{2}} & {-\sin \frac{\theta}{2}} \ {\sin \frac{\theta}{2}} & {\cos \frac{\theta}{2}}\end{array}\right],$

when $\theta=\pi$, acctualy, $R_y(\pi)$ equals to $-iY$, instead of $X$, besides, $R_y(\theta)$ cannot equal to $X$ whatever $\theta$ is. In one word, the equivalence is,

$R_y(\pi)=-iY = -|0\rangle\langle1|+|1\rangle\langle0|$.

And this differs from $X$ gate by a relative phase $\pi$.

## Hadamard gates and global phase

Hadamard gates can be presented by projective Dirac symbols,

Hadamard gates can be presented by projective Dirac symbols,

$H=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)\langle0|+\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)\langle1|=\frac{1}{\sqrt{2}}\left[\begin{array}{ll}{1} & {1} \ {1} & {-1}\end{array}\right].$

Does it equal to $R_y(\pi/2)$?

$R_y(\pi/2)=\frac{1}{\sqrt{2}}\left[\begin{array}{ll}{1} & {-1} \ {1} & {1}\end{array}\right].$

When the input is $|0\rangle$, the result is $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$, it’s ok; when the input is $|1\rangle$, the result is $\frac{1}{\sqrt{2}}(-|0\rangle+|1\rangle)$, it’s not ok, it differs from the result of $H$ gate by a global phase $\pi$.

Why it is a global phase? This deserves carefully thinking. Let us take a look into the $xz$-plane of the Bloch sphere,

This is truly interesting because the state on negative real $x$-axis is $\frac{1}{\sqrt{2}}(|1\rangle-|0\rangle)$, according to the rotation matrix, and it differs from $\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$ by a global phase, although they are equivalent for measurement, but they may be totally different in the further computation, for example,

when a $CZ$ gate is applied, the results are different. The global phase $\pi$ is the key point, we cannot ignore it in this case. However, $H$ gate equals to $(X+Z)/\sqrt{2}$, this is from the perspective of Pauli operator, what about the perspective of rotation operator? in fact, Hadamard gate can also be expressed by two rotation operators ($yz$-decomposition):

$H=R_z(\pi)R_y(\pi/2).$

So where does the state $\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$ locate on Bloch sphere? It also locates in the same position as $\frac{1}{\sqrt{2}}(|1\rangle-|0\rangle)$, but the Bloch sphere cannot presents the global phase, so they look the same. Here, $R_z(\pi)$ plays a key role to flip the global phase,

$R_z(\pi)=\left[\begin{array}{ll}{-1} & {0} \ {0} & {-1}\end{array}\right].$

Interesting, qubit $|1\rangle$ rotates by axis-$z$, but it is parallel to axis-$z$! How should we understand this operation, and what is the physical image? In fact, in the quantum optics regime, the global phase can be shown when we do interference with another coherent beam from the same source. Suppose we use a beam splitter, one beam is $-|\Psi\rangle$ and other one is $|\Psi\rangle$, hence,

$|\Psi\rangle_A = (-|\Psi\rangle)_r+|\Psi\rangle_t=|\Psi\rangle+|\Psi\rangle=2|\Psi\rangle,$

$|\Psi\rangle_B = (-|\Psi\rangle)_t+|\Psi\rangle_r=-|\Psi\rangle+|\Psi\rangle=0.$

Hence, the global phase can be revealed. However, the global phase is meaningless for the beam itself, no equipment can measure it without a coherent beam. But In the quantum circuit, the global phase is significant, because when the two qubits are coherent, the global phase may be revealed by some coherent multi-qubit operator such and controlled-$U$.

In other words, for a single qubit, its global phase is meaningless because it does not determine any inner physical states, however, when this qubit is in a system, its global phase may imply the relationship between itself and the rest part of the system. So, the “global” is also “relative”.

Finally, we show how to construct a Hadamard gate using single bit rotation gate:

$H = R_Z(\frac{\pi}{2})R_X(\frac{\pi}{2})R_Z(\frac{\pi}{2}) = R_X(\frac{\pi}{2})R_Z(\frac{\pi}{2})R_X(\frac{\pi}{2})$

$= R_Z(-\frac{\pi}{2})R_X(-\frac{\pi}{2})R_Z(-\frac{\pi}{2}) = R_X(-\frac{\pi}{2})R_Z(-\frac{\pi}{2})R_X(-\frac{\pi}{2})$

## Phase gates and the rotation gates

We know that the $\pi/8$ phase gate, also known as $T$ gate can be written as

$T = \left[\begin{array}{ll}{1} & {0} \ {0} & {\exp(i\pi/4)}\end{array}\right].$

$T$ gate keeps the eigenstate $|0\rangle$ unchanged, and modify the phase of eigenstate $|1\rangle$ by timing $\exp(i\pi/4)$,

$|0\rangle \rightarrow |0\rangle, |1\rangle \rightarrow e^{i\pi/4}|1\rangle.$

Sure the $\pi/2$ phase gate, i.e., $S$ gate can be written as

$S = \left[\begin{array}{ll}{1} & {0} \ {0} & {i}\end{array}\right] = \left[\begin{array}{ll}{1} & {0} \ {0} & {e^{i\pi/4}}\end{array}\right]^2$

However, the question is what is the relationship between those two phase gates and the rotation gates?

However, we may not represent a phase gate only by a rotation operator, it equals to a $Z-$rotation gate times a global phase gate,

$T=\exp(i\pi/8) \left[\begin{array}{ll}{e^{-i\pi/8}} & {} \ {} & {e^{i\pi/8}}\end{array}\right]=\exp(i\pi/8)R_z(\pi/4),$

$S=\exp(i\pi/4) \left[\begin{array}{ll}{e^{-i\pi/4}} & {} \ {} & {e^{i\pi/4}}\end{array}\right]=\exp(i\pi/4) R_z(\pi/2).$

## Basic Pauli operator and rotation operator

We are quite clear about the three Pauli operator,

$X=\left(\begin{array}{cc}{0} & {1} \ {1} & {0}\end{array}\right);Y=\left(\begin{array}{cc}{0} & {-i} \ {i} & {0}\end{array}\right);Z=\left(\begin{array}{cc}{1} & {0} \ {0} & {-1}\end{array}\right).$

And we also know that the rotation operators are

$\begin{array}{l}{R_{x}(\theta) \equiv e^{-i \theta X / 2}=\cos \frac{\theta}{2} I-i \sin \frac{\theta}{2} X=\left[\begin{array}{cc}{\cos \frac{\theta}{2}} & {-i \sin \frac{\theta}{2}} \ {-i \sin \frac{\theta}{2}} & {\cos \frac{\theta}{2}}\end{array}\right]} \ {R_{y}(\theta) \equiv e^{-i \theta Y / 2}=\cos \frac{\theta}{2} I-i \sin \frac{\theta}{2} Y=\left[\begin{array}{cc}{\cos \frac{\theta}{2}} & {-\sin \frac{\theta}{2}} \ {\sin \frac{\theta}{2}} & {\cos \frac{\theta}{2}}\end{array}\right]} \ {R_{z}(\theta)} {\equiv e^{-i \theta Z / 2}=\cos \frac{\theta}{2} I-i \sin \frac{\theta}{2} Z=\left[\begin{array}{cc}{e^{-i \theta / 2}} & {0} \ {0} & {e^{i \theta / 2}}\end{array}\right]}\end{array}$

Here, although the rotation operators are formed by the identities and the Pauli operators, we cannot write Pauli matrix just by a rotation operator, let’s take the $Z$ gate for example, in $R_z(\theta)$, when $theta=\pi$, $R_z(\pi) = -i\sin\frac{\pi}{2}Z = -iZ$, it causes a global phase $e^{i3\pi/2}$. How can we derive and obtain this result?

Because the rotation operator equals to the exponentiated Pauli operator, e.g., $R_z(\theta)=e^{-i\theta Z/2}$,

## Magical SWAP gate and its extension

We all know about the SWAP gate which exchange the quantum states of two qubits, however, some interesting extensions of SWAP gate we do not know exactly. According to ref. [1, 2], we review the extensions of SWAP gate.

First of all, we review the SWAP gate, in the path encoded optics circuits, the SWAP gate can be achieved easily by exchange the optical pulses of two paths, in this way, no entanglement generated.

## iSWAP gate

To the first, we talk about is the $iSWAP$ gate, which can be written as the product of a $SWAP$ gate and a controlled-$Z$ gate,

It is quite simple, and its transformation is,

$|00\rangle \rightarrow |00\rangle, |01\rangle \rightarrow i|10\rangle, |10\rangle\rightarrow i|01\rangle, |11\rangle \rightarrow |11\rangle.$

it is easy to understand that, a phase $\pi/2$ is induced when the exchange takes place. Now the question, what can an iSWAP do? What is the advantage?

## Sqrt of SWAP gate

Another hero is the square root of SWAP gate, $\sqrt{SWAP}$, this may be the most important gate, because any multi-qubit gate can be constructed by this gate with single-qubit gates , just like CNOT gate and phase gate (CZ). Besides, it is somehow a natural operation by using Heisenberg Hamiltonian after a time $\tau = pi/2 \approx 1.57$ , hence, in some physical realization, $\sqrt{SWAP}$ gate is the first choice [4, 5, 6, 7].

$\sqrt{SWAP}$ gate switches the two qubits but stops in the mid-way, this behavior cannot be achieved in any classical manner. A square-root-of-SWAP gate can be expressed by a matrix,

In such a way, a quantum superposition state is generated by the square-root-of-SWAP gate when the input state is $|01\rangle$ pr $|10\rangle$, and remains $|00\rangle$ and $|11\rangle$ unchanged,

$|00\rangle \rightarrow |00\rangle, |11\rangle \rightarrow |11\rangle,$

$|01\rangle \rightarrow \frac{1-i}{2} |01\rangle + \frac{1+i}{2} |01\rangle$

$|10\rangle \rightarrow \frac{1+i}{2} |01\rangle + \frac{1-i}{2} |01\rangle$

We say $\sqrt{SWAP}$ is universal, but why? We should decompose this gate into the product of rotation gates and phase gates on two qubits, the expression is given by,

$\sqrt{SWAP}=e^{i\frac{\pi}{8}}e^{-i\frac{\pi}{8}(X\otimes X+Y\otimes Y+Z\otimes Z)},$

the first term $e^{i\frac{\pi}{8}}$ is the global phase, the second term indicates $\pi/4$ rotations in three directions by the three axes respectively. So how can we entangle the two qubits? Fisrt, we write this gate by matrices,

According to an important formula, I call it the matrix form of Eular formula,

$e^{iAx}=\cos(x)I+i\sin(x)A,$

where A is a matrix such that $A^2=I$.

We can we use $\sqrt{SWAP}$ to construct a CNOT gate ,

$U_{\mathrm{CNOT}}=H_{A} \sigma_{A}^{-1} \sigma_{B} U_{\sqrt{\mathrm{SWAP}}} \sigma_{A}^{2} U_{\sqrt{S W A P}} H_{A},$

where $\sigma$ is the combination of identity and Pauli $\sigma_z=e^{-iI\pi/4}e^{-i\sigma_z\pi/2}$

$\sigma = \left[\begin{array}{cc}{1} & {0} \ {0} & {-i}\end{array}\right]$

Here we use the circuit language and derive this formula,

firstly, we give the inverse matrix of $latex \sigma$,

 Bartkowiak M, Miranowicz A. Linear-optical implementations of the iSWAP and controlled-NOT gates based on conventional detectors. JOSA B. 2010 Nov 1;27(11):2369-77.

 Schuch N, Siewert J. Natural two-qubit gate for quantum computation using the XY interaction. Physical Review A. 2003 Mar 10;67(3):032301.

 Burkard G. Quantum physics: A spin solo. Nature. 2006 Aug;442(7104):749.

 Heule R, Bruder C, Burgarth D, Stojanović VM. Controlling qubit arrays with anisotropic XXZ Heisenberg interaction by acting on a single qubit. The European Physical Journal D. 2011 Jun 1;63(1):41-6.

 Burkard G, Loss D, DiVincenzo DP, Smolin JA. Physical optimization of quantum error correction circuits. Physical Review B. 1999 Oct 15;60(16):11404.

 Eckert K, Mompart J, Yi XX, Schliemann J, Bruß D, Birkl G, Lewenstein M. Quantum computing in optical microtraps based on the motional states of neutral atoms. Physical Review A. 2002 Oct 23;66(4):042317.

 Franson JD, Jacobs BC, Pittman TB. Quantum computing using single photons and the Zeno effect. Physical Review A. 2004 Dec 1;70(6):062302.