9.4 Arithmetic
In section 2.5, we looked at the rudimentary ideas of doing binary addition via logic gates. We’ll revisit that but see how to do it using quantum gates. Like most such algorithms, researchers have published many papers on optimizing the circuits using methods such as the Quantum Fourier Transform, which we cover in section 10.1. algorithm$addition
Addition
I keep to a straightforward approach to help bridge the gap between classical and quantum versions. The gates we use are simple, and we replace bits with qubits. Instead of 0 and 1, we use |0⟩ and |1⟩, respectively. We call the data input qubits |x⟩ and | y⟩, and each is in the state |0⟩ or |1⟩ at any given time. We are essentially mimicking what we would do in the classical case.
If we do not worry about carry-in and carry-out qubits, our circuit looks like
where “⊕” is addition...