Quantum gates
Single qubit gates
Classical computer circuits consist of wires and logic gates.
Suppose we define a matrix X ro represent the quantum NOT
gate as follows:
If the quantum state \alpha|0\rangle + \beta|1\rangle is written in a vector notation as
with teh top entry corresponding to teh amplitude for |0\rangle and the bottom entry the amplitude for |1\rangle, then the corresponding output from the quantum NOT
gate is
So we know that quantum gates on a single qubit can be described by 2-2 matrices. The appropriate condition on the matirx representing the gate is taht the matrix U describing the single qubit be unitary, that is, U^{\dagger}U = I, where U^{\dagger} is an adjoint of U (obtained by transponsing and then complex conjugating U), and I is the 2-2 identity matrix. For example, X^{\dagger}X = I. And this is the only constrain on quantum gates.
Z gate
The Z gate
We can clearly see that Z gate flips the sign of the state |1\rangle. Given
where
by Euler's formula. We can tell that Z gates rotate the state along Z axis on XY-plane (\phi) with \pi degrees in a Bloch shpere.
Hadamard gate
It turns a |0\rangle into (|0\rangle + |1\rangle)/\sqrt{2} (first column of H), 'halfway' bewteen |0\rangle and |1\rangle, and it turns |0\rangle into (|0\rangle - |1\rangle)/\sqrt{2} (second column of H), which is also 'halfway' bewteen |0\rangle and |1\rangle. The Hadamard gate is one of the most useful quantum gates, it turns out that single qubit gates correspond to ratations and reflections of the sphere. The Hadamard operation is just a roatation of the spohere about the y axis by \pi/2, followed by a rotation about x axis by \pi.
An arbitrary singel qubit unitary gate can be decompsed as a product of rotations
and a gate being rotation about the z axis.
together with a (global) phase shift - a constand multiplier of the form e^{i\alpha}. We don't need to be able to do these gates for arbitrary \alpha, \beta, \gamma but can build arbitrarily good approximations to such gates using only certain special fixed values of \alpha, \beta and \gamma. An arbitrary 2\times 2 unitary matrix may be decomposed as
where \alpha, \beta, \gamma and \gamma are real-valued. Notice that the second matrix is just an ordinary rotation. It turns out that the first and last matrices can also be understood as rotations in a different plane.
CNOT gate
A controlled-NOT gate, also called CNOT gate, which has two input qubits, known as the control and target qubit, respectively. The action of the gate can be summarized as
where \oplus is addition modulo two. The results of a two-qubit input can be
in a matrix format
Of course, CNOT
gate is also a unitary matrix where U^{\dagger}_{CNOT}U_{CNOT} = I. However, in a sense the CNOT
and single qubit gates are the prototypes for all other gates because of the following remarkable universality result: Any multiple qubit logic gate may be composed from CNOT
and single qubit gates.
SWAP gate
The SWAP gate swaps the states of the two qubits. To see that this circuit accomplishes the swap operation, note that the sequence of gates has the following sequence of effects on a computational basis state
where all additions are done modulo 2. Mathematically, the SWAP gate's action on a quantum state is
The matrix fomat is
The SWAP gate is extremely useful in hardware settings; if two qubits are not physically connected, we can simply swap one of those qubits with another that is physically connected to the other qubit. The SWAP gate may also appear as a necessary part in building the quantum Fourier transform or in other routines such as the SWAP test.
Toffoli Gate
Basic
we can write the vector representation for 2 qubits as
Unitary Matrices
From the quantum mechanics, the only matrics that we can use are the unitary matrices, which are the matrices U such that: $$ U^{\dagger}U = UU^{\dagger} = I, $$ where I is the identity matrix and u^{\dagger} is the adjoint of U, that is, the matrix obtained by transposing U and replaing each element by its complex conjugate. This means that any unitary matrix U is invertible and its inverse is given by U^\dagger. in quantum mechanics, the operations represented by these matrices are called quantum gates.
Hadamard Gate
The Hadamard gate is a single-qubit operation that maps the basis state \lvert 0 \rangle to \frac{\lvert 0 \rangle + \lvert 1 \rangle}{\sqrt{2}} and \lvert 1 \rangle to \frac{\lvert 0 \rangle - \lvert 1 \rangle}{\sqrt{2}}, which creates an equal superposition of the basis states.
if we apply H gate on a qubits in state \lvert 0 \rangle and \lvert 1 \rangle, we have:
which is called mplus state and it is denoted as \lvert+\rangle; and
which is called minus state and it is denoted as \lvert-\rangle.
Pauli-X gate
The pauli-X gate is a single-qubis rotation through \pi radians around the X-axis. X gate is also called NOT
gate, since it performs like a NOT
gate in classical digital circuits. Here's why:
Apply X gate to \lvert 0 \rangle and \lvert 1 \rangle, we have:
Pauli-Y gate
The Pauli-Y gate is a single-qubit rotation through π radians around the y-axis.
Pauli-Z gate
The Pauli-Z gate is a single-qubit rotation through π radians around the z-axis.
What if we apply an H gate, then an X gate and, finally, another H gate. we have:
and we have the following properties for when we apply Z on \lvert 0 \rangle and \lvert 1 \rangle:
S gates
S gate is given by:
T gates
T gate is also called as a \pi/8 gate. T gate is given by:
You may wonder why T gate is called the \pi/8 gate when it is \pi/4 that apperas in the definition. The reason is that the gate has historically often been referred to as the \pi/8 gate, simply because up to an unimportant global phase T is equal to a gate which has \text{exp}(\pm i\pi/8) appearing on its diagonals
Here are useful algebraic facts to keep in mind are
Controlled-X (CNOT) Gate
CNOT gate: The value of the second qubit is flipped if and only if the value of the first qubit is 1.
Matrix Representation of the CNOT Gate In the computational basis \{\lvert 00 \rangle,\lvert 01 \rangle, \lvert 10 \rangle, \lvert 11 \rangle\}, the CONT gate is represented as a 4x4 matrix:
- The first qubit is the control qubit.
- The second qubit is the target qubit.
And, if we apply CNOT
gate on the element of the two-qubit computational basis, we can get,
Controlled-Y (CY) Gate
Controlled-Z (CZ) Gate
Controlled-H (CH) Gate
Rotation operatos
The Pauli matrices give rise to three useful classes of unitary matrices when they are exponentiated, the rotation operaots about x,y, and z axes, defined by the equations:
Theorem 4.1 (Z-Y decomposition for a single qubit)
suppose U is a unitary operation on a single qubit. Then there exist real numbers \alpha, \beta, \gamma, and \delta such that $$ U = e^{i\alpha}R_{z}(\beta)R_{y}(\gamma)R_{z}(\delta). $$ Since U is unitary, the rows and columns of U are orthonormal, from which it folow that there exist real numbers \alpha, \beta, \gamma, and \delta such that $$ U = \begin{bmatrix} e^{i(\alpha - \beta)/2-\delta/2}\text{cos}\frac{\gamma}{2} & -e^{i(\alpha - \beta)/2+\delta/2}\text{sin}\frac{\gamma}{2} \ e^{i(\alpha + \beta)/2-\delta/2}\text{sin}\frac{\gamma}{2} & -e^{i(\alpha + \beta)/2+\delta/2}\text{cos}\frac{\gamma}{2} \end{bmatrix} $$
Exercises
Exercises 4.4
Express the Hadamard gate H as a product of R_x and R_z rotations and e^{i\phi} for some \phi
Exercises 4.8
An arbitrary single qubit unitary operator can be written in the form
please find values for \alpha, \theta, and \widehat{n} giving the Hadamard gate H.
References
[1] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th Anniversary Ed., Cambridge: Cambridge University Press, 2010.