In quantum computing unitary operators are known as gates. For example, we have already seen a few 1-qubit gates such as the Pauli-X and Hadamard gates. Other gates include the Pauli-Z gate
which has no effect on the 0-qubit state
>
|
|
>
|
|
or the Pauli Y gate
which flips the qubit while introducing an imaginary phase
>
|
|
or the most general 1-qubit gate, known as the U (universal) gate that depends on 3 angles that we keep symbolic
>
|
|
| (2.6) |
which generates the following general rotated state
>
|
|
| (2.7) |
Each of these gates is unitary. A unitary operator or matrix has the following identity:
For example,
>
|
|
or
>
|
|
| (2.9) |
| (2.10) |
Because the gates are unitary, we can always undo any rotation with an application of the Hermitian transpose of the gate
>
|
|
| (2.12) |
>
|
|
| (2.13) |
But after using the Hermitian transpose, we return to the original state
>
|
|
| (2.14) |
What happened? Let's try simplifying
>
|
|
We can also examine 2-qubit gates.
For example, the CNOT gate is
| (2.16) |
This gate examines the first qubit. If the first qubit is 1, then it flips the second qubit; otherwise, it applies the identity operator.
Let's try it!
First, we prepare an initial state with two qubits.
>
|
|
Applying the CNOT gate
>
|
|
does nothing because the first qubit is in the 0 state.
Let's first apply the Pauli-X gate to the first qubit
>
|
|
Now applying the CNOT gate
>
|
|
flips the second qubit from 0 to 1.
Let's try this again by applying the U gate to the first qubit
>
|
|
| (2.21) |
Now applying the CNOT gate,
>
|
|
| (2.22) |
we observe that the component of the state with the first qubit in 0 does not change while the component of the state with the first qubit in 1 has its second qubit flipped from 0 to 1.
Like the 1-qubit gates, the CNOT gate is unitary, which we can check
>
|
|
| (2.23) |
Other 2-qubit gates include:
The controlled X gate:
The controlled Hadamard gate:
| (2.25) |
The SWAP gate:
| (2.26) |
As the name implies, the SWAP gate exchanges the states of two qubits.
For example, let us apply the U gate to qubit 1
>
|
|
| (2.27) |
and then the SWAP gate
>
|
|
| (2.28) |
Notice that the states of the first and second qubits were swapped.
We can undo the SWAP via its transpose (note that SWAP is real)
>
|
|
| (2.29) |
The SWAP gate can be expressed in terms of the CNOT gate
>
|
|
| (2.30) |
In fact, the 1-qubit U gate and the 2-qubit CNOT form a universal set of quantum gates in that any quantum state can be prepared from them.