5.4.1 Circuits with multiple gates
Single-qubit gates and two-qubit gates can be combined in a structured sequence to give a quantum circuit containing multiple quantum gates. Consider as an example the circuit shown in Figure 11, which depicts a sequence of gates acting on two qubits, labelled
and
. Remember that each qubit enters its circuit from the left; first, a Hadamard gate is applied to qubit
. Then a CNOT is applied to
and
, where the control C is
and the target T is
. Finally, a NOT gate is applied to
.

The circuit in Figure 11 is a sequence of operations applied to qubits and can be analysed using the methods already introduced, with extra subscripts labelling the single-qubit gates and operations so that the qubit each operation is acting on is clear. Thus
acts only on the qubit
, leaving
unchanged. Therefore, using
as a sample input the calculation becomes:

Now
acts only on
, so

This means that

Next comes the effect of the CNOT gate, courtesy of
and gives

Finally, observe that
acts on
only, so flip
of each ket in the superposition:

OpenLearn - Introduction to quantum computing
Except for third party materials and otherwise, this content is made available under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 Licence, full copyright detail can be found in the acknowledgements section. Please see full copyright statement for details.