I’m currently most of the way through Michael Nielsen’s YouTube lecture series “Quantum Computing for the Determined”. I highly recommend it to anyone who, like me, has heard a lot of handwavy pop-science takes on “quantum computing” but has yet to learn what it actually is. (Heck, I own a copy of Scott Aaronson’s Quantum Computing Since Democritus that I’m pretty sure I read, about five years ago, but clearly none of it stuck.)
Michael Nielsen’s lectures spend a lot of time working through the arithmetic of each example, which is a bit tedious (just like math class!) but I think it’s a good idea, because repetition reinforces the “muscle memory” of working with this stuff.
Here’s my own pop-sci regurgitation of what I’ve learned. First of all, by “computing” here we just mean “quantum circuits,” which is basically a linear-algebra-heavy analogue of the logic gates you might remember from somewhere-before-you-started-taking-CS-courses. So if there’s a quantum-computing analogue of C++ — or C — or machine code — it’s very, very far above where we are right now. (To have machine code, you must first have a machine! And it takes thousands of classical logic gates to make something on the order of a Z80 or Intel 4004 CPU. Even more confusingly, the actually measurable metric is transistor count; sometimes it takes many transistors to implement a single primitive gate, but on the other hand, sometimes just a few transistors can implement functionality that would take many more steps to express in terms of primitive gates.)
Classical logic gates can be strung together into “circuits.” The bits of string in between the gates are called “wires,” and each “wire” conceptually carries either a or a . For example, if the two wires coming into an OR gate are carrying and respectively, then the output wire will carry a . (We don’t allow loops, by the way. Everything flows one direction — from left to right.)
It’s very tempting to slip into thinking of the labels and as two points on a number line… like if you went just a little bit further along you’d come to , you know? But that’s not how it works. Not in classical and not in quantum either. The labels and are simply arbitrary names, unrelated to the plain old number-line numbers and .
So in quantum-circuit-world, we have the exact same deal; except that now instead of our wires carrying precisely or (one bit), we’ll have each wire carry a pair of complex numbers (one qubit). That is, where a classical wire carries
a quantum wire will carry
This is commonly known as a “superposition” of and , but as far as I can tell, there’s no sense in which the wire spookily carries “both values at once”; it merely carries a linear combination of the two labels. This combination can be completely summed up in a little column vector:
This is where all the labels start feeling unnecessarily confusing to me, by the way. At the very “top” level, we might say that a given wire happens to be carrying “.” By that we mean that it’s carrying the linear combination … which really means . Notice that a quantum wire might equally well be carrying a.k.a. or even a.k.a. . These are all distinct and distinguishable values.
Quantum gates work similarly to classical gates, just in a more “continuous” fashion. So, there’s a quantum version of the NOT gate that transforms an input into the output .
The next leap is that when you have multiple parallel wires, you generally can’t assume their values are independent. You can’t say “wire has value and wire has value ”; or at least if you do, that’s not necessarily the whole story. You really have to say something like “The system-of-wires has value ,” which combination can be summed up completely in a little column vector:
This column vector has entries. For three wires , it would have eight entries. For four wires , it would have 16 entries. Remember, this is what’s needed just to fully describe the state that is being carried on these wires — just a snapshot of a cut across the circuit diagram. The state of classical wires is summed up in integer coefficients; the state of quantum wires is summed up in complex coefficients.
Or, to put it another way, the state of classical wires can be expressed as a -entry column vector; but because the coefficients must be integers, it follows that only one of the entries will be and all the rest will be . So we can compress that whole vector into basically a single number between zero and — the index of that single non-zero entry.
Quantum logic gates with multiple input wires must have the same number of output wires, and can always be expressed as matrix multiplications. There’s a quantum version of the XOR gate, called the “controlled NOT” gate, that transforms a pair of input wires
So for example say we have two initially independent wires and . I’m using coefficients with no imaginary parts for simplicity’s sake, but I threw in a minus sign just to remind you that these are arbitrary complex numbers, not “probabilities” or anything like that. So the state of our two-wire system can be summed up by the column vector
And then when we feed those two wires through our “controlled NOT” gate, the gate will exchange the lower two values in the column vector, meaning that the values of our two output wires can be summed up by the column vector
This state is a linear composition mainly of and , with only very-small-magnitude amounts of and thrown in. Our two wires’ values have become entangled in an interesting way.
This has been “Arthur tries to explain quantum circuits based on having watched a single YouTube video series.” If you’re intrigued by this stuff, I highly recommend that you go watch Michael Nielsen’s “Quantum Computing for the Determined.”