A simple circuit

Here is a simple quantum computing circuit:

There are two qubits (quantum bits), q[0] and q[1], and two classical bits, c[0] and c[1]. The latter will be used to store results of measuring the former.

Read the circuit left to right.

∣0⟩ is a qubit that will always have a measurement outcome of 0 (in the computational basis).

H is a Hadamard gate that puts that ∣0⟩ into a “superposition” (a sum) of both the “basis states” ∣0⟩ and ∣1⟩. The resulting superposition will collapse to either ∣0⟩ or ∣1⟩ with equal probability when measured (again, assuming the computational basis is used).

The next items on the circuit that look like little dials with cables attached denote measurement. Qubit q[0] is measured first and the result saved into c[0], then q[1] is measured and the result is saved into c[1]. The two qubits are unentangled, which means that measuring one has no effect on the other. (See this post for an example with entanglement.)

So basically this circuit is a fancy way to flip two coins, using quantum objects in superposition rather than metal discs. You can run it on a real quantum computer for free at IBM Quantum. I used such a circuit to decide what to do at the weekend, choosing randomly from four options. With \(n\) qubits you can do this for \(2^n\) options. It took about an hour to get the answer. There may be better things to do with quantum computers…