Chapter 7
Coding Two-Qubit Algorithms in Qiskit
Two heads are better than one, not because either is infallible, but because they are unlikely to go wrong in the same direction.
— C.S. Lewis
In the last couple of chapters, we have studied quite a number of algorithms and protocols that work on two-qubit systems. It is thus time for us to learn how to use Qiskit to construct and run circuits that act on two qubits.
We will start with some simple examples that will illustrate how to work with two qubits in Qiskit. As you will soon see, adding a new qubit to the mix won’t change things that much. The only difference will be our having to keep track of which qubit we are applying gates to, and the introduction of two-qubit gates such as the CNOT gate.
Then, we will move on to implement some of the protocols that we have already discussed from a theoretical point of view, including superdense coding, the CHSH game, and Deutsch’s algorithm.
The topics that we will...