Computation, both classic and quantum, relies on taking an input and transforming it in the desired way to achieve a certain output. In quantum computing, this is done with quantum gates.
Quantum gates operate on a quantum register to change its state. Quantum gates can operate on one, two, or more qubit states. In this chapter, we covered quantum gates operating on one or two qubits. The set of gates presented in this chapter form a universal gate set; that is, with just a combination of these gates, we can perform any quantum computation.
The action of a quantum gate operating on a single qubit state moves the single qubit to a new position on the Bloch sphere. In this chapter, we learned about a number of single-qubit gates. The identity gate I leaves the qubit's position on the Bloch sphere unchanged. The Hadamard gate H rotates the initial qubit by 180 degrees around the x axis, then 90 degrees about the y axis. The Pauli gates (X, Y, and Z) rotate the qubit they act on by 180 degrees. The rotation of the X gate is about the x axis, the rotation of the Y gate is about the y axis, and the rotation of the Z gate is about the z axis. The phase gate (S), and the π/8 gate (T) are similar to the Z gate in that they all rotate the initial qubit about the z axis. Only the angle by which the qubit is rotated differs for each gate. For the S gate, that angle is 90 degrees and for the T gate that angle is 45 degrees, compared to 180 degrees for the Z gate. The gates S† and T† are identical in operation to the S and T gates, except their rotation is in the opposite direction.
The two-qubit CNOT gate generates entanglement through its operation on more than one qubit. This gate provides the quantum analogue of the classic XOR gate. The first qubit acts as a control qubit, and never changes as a result of the gate's operation. If this first qubit is |"1">, then a NOT operation is applied to the second qubit. If this first qubit is |"0">, then nothing is done to the second qubit.
With just the I, X, Y, Z, H, S, S†, T, T†, and CNOT gates, and a bit of understanding as to how they operate, we are armed to start programming for quantum computers.