3 Single-qubit states and gates
This chapter covers
- Single-qubit quantum states and introducing state tables
- Basic single-qubit quantum gates and single-qubit quantum circuits
- Simulating single-qubit quantum systems in Python
In this chapter, we look at the state of a single-qubit system with programmatic and visual representations. We also cover how a qubit can be used as a computational tool. In the next chapter, we will generalize these concepts to any number of qubits.
The simplest representation of a quantum state in code is a list of complex numbers. This list is often called a state vector. We will use state tables like the ones introduced in chapter 2 to visualize quantum states.
This chapter also introduces the basics of applying programming instructions, called quantum gates, to a single-qubit system and combining them into a quantum circuit. We will look at some ways to visualize gates and circuits. Finally, we will examine a few simple single-qubit circuits with practical applications. Figure 3.1 shows the structure of the concepts introduced in this chapter.
Figure 3.1 A dependency diagram of concepts introduced in this chapter

Note The source code, examples, and exercise answers can be found on the book’s website (www.manning.com/books/building-quantum-software-with-python) and in the book’s companion repository (https://github.com/learnqc/code).