# What is a qubit?

What is a "qubit"? Google tells me that it's another term for a "quantum bit". What is a "quantum bit" physically? How is it "quantum"? What purpose does it serve in quantum computing?

Note: I'd prefer an explanation that is easily understood by laypeople; terms specific to quantum computing should preferably be explained, in relatively simple terms.

• To those who wish to answer this question: It would be great if you point out the difference between classical and quantum probabilities in your answers. That is, how is a quantum state like $\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$ different from a coin which when tossed in the air has a $50-50$ chance of turning out to be heads or tails. Why can't we say that a classical coin is a "qubit" or call a set of classical coins a system of qubits? – Sanchayan Dutta Jun 18 '18 at 16:26
• Possible duplicate of What is the difference between a qubit and classical bit? – MEE Jun 19 '18 at 16:16
• When you write "easily understood by laypeople", just how "lay" are we talking? Can one assume they know about Huygen's principle? About complex numbers? About vector spaces? About momentum? About differential equations? About boolean logic? This seems to me a very vague constraint. I expect that there is a set of mathematical prerequisites, without which any description of 'a qubit' would amount to some vaguely technical sounding words which fail to actually convey anything in a convincing way. – Niel de Beaudrap Jun 19 '18 at 17:07
• @Mithrandir: the shortest convincing description of 'a qubit' that I could give to a somewhat mathematically engaged but otherwise typical 15 year old would involve at least a one hour tutorial in physics about the double-slit experiment, the Stern-Gerlach experiment, and/or the Mach-Zehnder experiment. I'd be tempted to introduce vectors at the very least to talk about coordinates on the Bloch sphere. Precisely how I'd go about it would require careful thought and planning, and laying down some physics education to explain what 'quantumness' even consists of. It's no small task IMO. – Niel de Beaudrap Jun 19 '18 at 21:02

This is a good question and in my view gets at the heart of a qubit. Like the comment by @Blue, it's not that it can be an equal superposition as this is the same as a classical probability distribution. It is that it can have negative signs.

Take this example. Imagine you have a bit in the $0$ state and represent it as vector $\begin{bmatrix}1 \\0 \end{bmatrix}$ and then you apply a coin flipping operation which can be represented by a stochastic matrix $\begin{bmatrix}0.5 & 0.5 \\0.5 & 0.5 \end{bmatrix}$ this will make a classical mixture $\begin{bmatrix}0.5 \\0.5 \end{bmatrix}$. If you apply this twice it will still be a classical mixture $\begin{bmatrix}0.5 \\0.5 \end{bmatrix}$.

Now lets go to the quantum case and start with a qubit in the $0$ state which again is represented by $\begin{bmatrix}1 \\0 \end{bmatrix}$. In quantum, operations are represented by a unitary matrix which has the property $U^\dagger U = I$. The simplest unitary to represent the action of a quantum coin flip is the Hadamard matrix $\begin{bmatrix}\sqrt{0.5} & \sqrt{0.5} \\\sqrt{0.5} & -\sqrt{0.5} \end{bmatrix}$ where the first column is defined so that after one operation it makes the state $|+\rangle =\begin{bmatrix}\sqrt{0.5} \\\sqrt{0.5} \end{bmatrix}$, then the second column must be $\begin{bmatrix}\sqrt{0.5} & a \\\sqrt{0.5} & b \end{bmatrix}$ where $|a|^2 = 1/2$, $|b|^2 = 1/2$ and $ab^* = -1/2$. A solution to this is $a =\sqrt(0.5)$ and $b=-a$.

Now lets do the same experiment. Applying it once gives $\begin{bmatrix}\sqrt{0.5} \\\sqrt{0.5} \end{bmatrix}$ and if we measured (in the standard basis) we would get half the time 0 and the other 1 (recall in quantum Born rule is $P(i) = |\langle i|\psi\rangle|^2$ and why we need all the square roots). So it is like the above and has a random outcome.

Lets apply it twice. Now we would get $\begin{bmatrix} 0.5+0.5 \\0.5-0.5\end{bmatrix}$. The negative sign cancels the probability of observing the 1 outcome and a physicist we refer to this as interference. It is these negative numbers that we get in quantum states which cannot be explained by probability theory where the vectors must remain positive and real.

Extending this to n qubits gives you a theory that has an exponential that we can't find efficient ways to simulate.

This is not just my view. I have seen it shown in the talks by Scott Aaronson and I think its best to say quantum is like “Probability theory with Minus Signs” (this is a quote by Scott).

I am attaching the slides I like to give for explaining quantum (if it is not standard to have slides in an answer I am happy to write the math out to get across the concepts)

• I see in the other question people dont understand what i mean by interference. I'm new to stack exchange but not quantum so how do you want me to fill in more details. Either edit above or post another comment. – Jay Gambetta Jun 24 '18 at 16:34
• ok @blue i just edit above and you can edit how you like. – Jay Gambetta Jun 24 '18 at 18:27
• Thanks for the edit! Can you please mention the source of the slides? – Sanchayan Dutta Jun 24 '18 at 18:32
• How do i do that. The source is me except the one i remade from seeing Scott talk. – Jay Gambetta Jun 24 '18 at 18:34
• @JayGambetta I meant this slide: i.stack.imgur.com/rvoOJ.png in your answer. Can you add the source from where you got it? – Sanchayan Dutta Jun 24 '18 at 18:35

I'll probably be expanding this more (!) and adding pictures and links as I have time, but here's my first shot at this.

## Mostly math-free explanation

### A special coin

Let's begin by thinking about normal bits. Imagine this normal bit is a coin, that we can flip to be heads or tails. We'll call heads equivalent to "1" and tails "0". Now imagine instead of just flipping this coin, we can rotate it - 45${}^\circ$ above horizontal, 50$^\circ$ above horizontal, 10$^\circ$ below horizontal, whatever - these are all states. This opens up a huge new possibility of states - I could encode the whole works of Shakespeare into this one coin this way.

But what's the catch? No such thing as a free lunch, as the saying goes. When I actually look at the coin, to see what state it's in, it becomes either heads or tails, based on probability - a good way to look at it is if it's closer to heads, it's more likely to become heads when looked at, and vice versa, though there's a chance the close-to-heads coin could become tails when looked at.

Further, once I look at this special coin, any information that was in it before can't be accessed again. If I look at my Shakespeare coin, I just get heads or tails, and when I look away, it still is whatever I saw when I looked at it - it doesn't magically revert to Shakespeare coin. I should note here that you might think, as Blue points out in the comments, that

Given the huge advancement in modern day technology there's nothing stopping me from monitoring the exact orientation of a coin tossed in air as it falls. I don't necessarily need to "look into it" i.e. stop it and check whether it has fallen as "heads" or "tails".

This "monitoring" counts as measurement. There is no way to see the inbetween state of this coin. None, nada, zilch. This is a bit different from a normal coin, isn't it?

So encoding all the works of Shakespeare in our coin is theoretically possible but we can never truly access that information, so not very useful.

Nice little mathematical curiosity we've got here, but how could we actually do anything with this?

### The problem with classical mechanics

Well, let's take a step back a minute here and switch to another tack. If I throw a ball to you and you catch it, we can basically model that ball's motion exactly (given all parameters). We can analyze its trajectory with Newton's laws, figure out its movement through the air using fluid mechanics (unless there's turbulence), and so forth.

So let's set us up a little experiment. I've got a wall with two slits in it and another wall behind that wall. I set up one of those tennis-ball-thrower things in the front and let it start throwing tennis balls. In the meantime, I'm at the back wall marking where all our tennis balls end up. When I mark this, there are clear "humps" in the data right behind the two slits, as you might expect.

Now, I switch our tennis-ball-thrower to something that shoots out really tiny particles. Maybe I've got a laser and we're looking where the photons look up. Maybe I've got an electron gun. Whatever, we're looking at where these sub-atomic particles end up again. This time, we don't get the two humps, we get an interference pattern.

Does that look familiar to you at all? Imagine you drop two pebbles in a pond right next to each other. Look familiar now? The ripples in a pond interfere with each other. There are spots where they cancel out and spots where they swell bigger, making beautiful patterns. Now, we're seeing an interference pattern shooting particles. These particles must have wave-like behavior. So maybe we were wrong all along. (This is called the double slit experiment.)Sorry, electrons are waves, not particles.

Except...they're particles too. When you look at cathode rays (streams of electrons in vacuum tubes), the behavior there clearly shows electrons are a particle. To quote wikipedia:

Like a wave, cathode rays travel in straight lines, and produce a shadow when obstructed by objects. Ernest Rutherford demonstrated that rays could pass through thin metal foils, behavior expected of a particle. These conflicting properties caused disruptions when trying to classify it as a wave or particle [...] The debate was resolved when an electric field was used to deflect the rays by J. J. Thomson. This was evidence that the beams were composed of particles because scientists knew it was impossible to deflect electromagnetic waves with an electric field.

So...they're both. Or rather, they're something completely different. That's one of several puzzles physicists saw at the beginning of the twentieth century. If you want to look at some of the others, look at blackbody radiation or the photoelectric effect.

### What fixed the problem - quantum mechanics

These problems lead us to realize that the laws that allow us to calculate the motion of that ball we're tossing back and forth just don't work on a really small scale. So a new set of laws were developed. These laws were called quantum mechanics after one of the major ideas behind them - the existence of fundamental packets of energy, called quanta.

The idea is that I can't just give you .00000000000000000000000000 plus a bunch more zeroes 1 Joules of energy - there is a minimum possible amount of energy I can give you. It's like, in currency systems, I can give you a dollar or a penny, but (in American money, anyway) I can't give you a "half-penny". Doesn't exist. Energy (and other values) can be like that in certain situations. (Not all situations, and this can occur in classical mechanics sometimes - see also this; thanks to Blue for pointing this out.)

So anyway, we got this new set of laws, quantum mechanics. And the development of those laws is complete, though not completely correct (see quantum field theories, quantum gravity) but the history of their development is kind of interesting. There was this guy, Schrodinger, of cat-killing (maybe?) fame, who came up with the wave equation formulation of quantum mechanics. And this was preferred by a lot of physicists preferred this, because it was sort of similar to the classical way of calculating things - integrals and hamiltonians and so forth.

Another guy, Heisenberg, came up with another totally different way of calculating the state of a particle quantum-mechanically, which is called matrix mechanics. Yet another guy, Dirac, proved that the matrix mechanical and wave equation formulations were equal.

So now, we must switch tacks again - what are matrices, and their friend vectors?

### Vectors and matrices - or, some hopefully painless linear algebra

Vectors are, at their simplest, arrows. I mean, they're on a coordinate plane, and they're math-y, but they're arrows. (Or you could take the programmer view and call them lists of numbers.) They're quantities that have a magnitude and a direction. So once we have this idea of vectors...what might we use them for? Well, maybe I have an acceleration. I'm accelerating to the right at 1 m/s$^2$, for example. That could be represented by a vector. How long that arrow is represents how quickly I am accelerating, the arrow would be pointing right along the x-axis, and by convention, the arrow's tail would be situated at the origin. We notate a vector by writing something like [2, 3] which would notate a vector with its tail at the origin and its point at (2, 3).

So we have these vectors. What sorts of math can I do with them? How can I manipulate a vector? I can multiply vectors by a normal number, like 3 or 2 (these are called scalars), to stretch it, shrink it (if a fraction), or flip it (if negative). I can add or subtract vectors pretty easily - if I have a vector (2, 3) + (4, 2) that equals (6, 5). There's also stuff called dot products and cross products that we won't get into here - if interested in any of this, look up 3blue1brown's linear algebra series, which is very accessible, actually teaches you how to do it, and is a fabulous way to learn about this stuff.

Now let's say I have one coordinate system, that my vector is in, and then I want to move that vector to a new coordinate system. I can use something called a matrix to do that. Basically we can define in our system two vectors, called $\hat{i}$ and $\hat{j}$, read i-hat and j-hat (we're doing all this in two dimensions in the real plane; you can have higher dimension vectors with complex numbers ($\sqrt{-1} = i$) as well but we're ignoring them for simplicity), which are vectors that are one unit in the x direction and one unit in the y direction - that is, (0, 1) and (1, 0).

Then we see where i-hat and j-hat end up in our new coordinate system. In the first column of our matrix, we write the new coordinates of i-hat and in the second column the new coordinates of j-hat. We can now multiply this matrix by any vector and get that vector in the new coordinate system. The reason this works is because you can rewrite vectors as what are called linear combinations. This means that we can rewrite say, (2, 3) as 2*(1, 0) + 3*(0, 1) - that is, 2*i-hat + 3*j-hat. When we use a matrix, we're effectively re-multiplying those scalars by the "new" i-hat and j-hat. Again, if interested, see 3blue1brown's videos. These matrices are used a lot in many fields, but this is where the name matrix mechanics comes from.

### Tying it all together

Now matrices can represent rotations of the coordinate plain, or stretching or shrinking the coordinate plane or a bunch of other things. But some of this behavior...sounds kind of familiar, doesn't it? Our little special coin sounds kind of like it. We have this rotation idea. What if we represent the horizontal state by i-hat, and the vertical by j-hat, and describe what the rotation of our coin is using linear combinations? That works, and makes our system much easier to describe. So our little coin can be described using linear algebra.

What else can be described linear algebra and has weird probabilities and measurement? Quantum mechanics. (In particular, this idea of linear combinations becomes the idea called a superposition, which is where the whole idea, oversimplified to the point it's not really correct, of "two states at the same time" comes from.) So these special coins can be quantum mechanical objects. What sorts of things are quantum mechanical objects?

• photons
• superconductors
• electron energy states in an atom

Anything, in other words, that has the discrete energy (quanta) behavior, but also can act like a wave - they can interfere with one another and so forth.

So we have these special quantum mechanical coins. What should we call them? They store an information state like bits...but they're quantum. They're qubits. And now what do we do? We manipulate the information stored in them with matrices (ahem, gates). We measure to get results. In short, we compute.

Now, we know that we cannot encode infinite amounts of information in a qubit and still access it (see the notes on our "shakespeare coin"), so what then is the advantage of a qubit? It comes in the fact that those extra bits of information can affect all the other qubits (it's that superposition/linear combination idea again), which affects the probability, which then affects your answer - but it's very difficult to use, which is why there are so few quantum algorithms.

### The special coin versus the normal coin - or, what makes a qubit different?

So...we have this qubit. But Blue brings up a great point.

how is a quantum state like $\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle$ different from a coin which when tossed in the air has a 50−50 chance of turning out to be heads or tails. Why can't we say that a classical coin is a "qubit" or call a set of classical coins a system of qubits?

There are several differences - the way that measurement works (see the fourth paragraph), this whole superposition idea - but the defining difference (Mithrandir24601 pointed this out in chat, and I agree) is the violation of the Bell inequalities.

Let's take another tack. Back when quantum mechanics was being developed, there was a big debate. It started between Einstein and Bohr. When Schrodinger's wave theory was developed, it was clear that quantum mechanics would be a probabilistic theory. Bohr published a paper about this probabilistic worldview, which he concluded saying

Here the whole problem of determinism comes up. From the standpoint of our quantum mechanics there is no quantity which in any individual case causally fixes the consequence of the collision; but also experimentally we have so far no reason to believe that there are some inner properties of the atom which conditions a definite outcome for the collision. Ought we to hope later to discover such properties ... and determine them in individual cases? Or ought we to believe that the agreement of theory and experiment—as to the impossibility of prescribing conditions for a causal evolution—is a pre-established harmony founded on the nonexistence of such conditions? I myself am inclined to give up determinism in the world of atoms. But that is a philosophical question for which physical arguments alone are not decisive.

The idea of determinism has been around for a while. Perhaps one of the more famous quotes on the subject is from Laplace, who said

An intellect which at a certain moment would know all forces that set nature in motion, and all positions of all items of which nature is composed, if this intellect were also vast enough to submit these data to analysis, it would embrace in a single formula the movements of the greatest bodies of the universe and those of the tiniest atom; for such an intellect nothing would be uncertain and the future just like the past would be present before its eyes.

The idea of determinism is that if you know all there is to know about a current state, and apply the physical laws we have, you can figure out (effectively) the future. However, quantum mechanics decimates this idea with probability. "I myself am inclined to give up determinism in the world of atoms." This is a huge deal!

Albert Einstein's famous response:

Quantum mechanics is very worthy of regard. But an inner voice tells me that this is not yet the right track. The theory yields much, but it hardly brings us closer to the Old One's secrets. I, in any case, am convinced that He does not play dice.

(Bohr's response was apparently "Stop telling God what to do", but anyway.)

For a while, there was debate. Hidden variable theories came up, where it wasn't just probability - there was a way the particle "knew" what it was going to be when measured; it wasn't all up to chance. And then, there was the Bell inequality. To quote Wikipedia,

In its simplest form, Bell's theorem states

No physical theory of local hidden variables can ever reproduce all of the predictions of quantum mechanics.

And it provided a way to experimentally check this. It's true - it is pure probability. This is no classical behavior. It is all chance, chance that affects other chances through superposition, and then "collapses" to a single state upon measurement (if you follow the Copenhagen interpretation). So to summarize: firstly, measurement is fundamentally different in quantum mechanics, and secondly, that quantum mechanics is not deterministic. Both of these points mean that any quantum system, including a qubit, is going to be fundamentally different from any classical system.

## A small disclaimer

As xkcd wisely points out, any analogy is an approximation. This answer isn't formal at all, and there's a heck of a lot more to this stuff. I'm hoping to add to this answer with a slightly more formal (though still not completely formal) description, but please keep this in mind.

## Resources

• Nielsen and Chuang, Quantum Computing and Quantum Information. The bible of quantum computing.

• 3blue1brown's linear algebra and calculus courses are great for the math.

• Michael Nielsen (yeah, the guy who coauthored the textbook above) has a video series called Quantum Computing for the Determined. 10/10 would recommend.

• quirk is a great little simulator of a quantum computer that you can play around with.

• I wrote some blog posts on this subject a while back (if you don't mind reading my writing, which isn't very good) that can be found here which attempts to start from the basics and work on up.

• Really great answer! – user820789 Jun 20 '18 at 1:24

A qubit is a two-dimensional quantum system, and the quantum generalization of a bit. Like bits, qubits can be in the states 0 and 1. In quantum notation, we write these as $|0\rangle$ and $|1\rangle$. They can also be in superposition states such as

$$|\psi_0 \rangle = \alpha |0\rangle + \beta |1\rangle$$

Here $\alpha$ and $\beta$ are complex numbers in general. But for this answer, I'll just assume they are normal real numbers. The name I've given this state, $|\psi_0 \rangle$, is just for convenience. It has no deeper meaning.

Extracting an output from a qubit is done by a process known as measurement. The most common measurement is what we call the $Z$ measurement. This means just asking the qubit whether it is 0 or 1. If it is in a superposition state, such as the one above, the output will be random. You'll get 0 with probability $\alpha^2$ and 1 with probability $\alpha^2$ (so clearly these numbers need to satisfy ($\alpha^2+\beta^2=1$).

This might make it seem that superpositions are just random number generators, but that isn't the case. For every $\alpha |0\rangle + \beta |1\rangle$ , we can construct the following state

$$|\psi_1 \rangle = \beta |0\rangle - \alpha |1\rangle$$

This is as different to $|\psi_0\rangle$ as $|0\rangle$ is to $|1\rangle$. We call it a state that is orthogonal to $|\psi_0\rangle$.

With this we can define an alternative measurement that looks at whether our qubit is $|\psi_0\rangle$ or $|\psi_1\rangle$. For this measurement, it is the $|\psi_0\rangle$ and $|\psi_1\rangle$ states that give us definite answers. For other states, such as $|0\rangle$ and $|1\rangle$, we'd get random outputs. This is because they can be thought of as superpositions of $|\psi_0\rangle$ and $|\psi_1\rangle$.

So, trying to summarize a little, qubits are objects that we can use to store a bit. We usually do this in the states $|0\rangle$ and $|1 \rangle$, but in fact, we could choose to do it in any of the infinite possible pairs of orthogonal states. If we want to get the bit out again with certainty, we have to measure according to the encoding we used. Otherwise, there will always be a degree of randomness. For more detail on all this, you can check out a blog post I once wrote.

To start getting interesting things happing, we need more than one qubit. Since $n$ bits can be made into $2^n$ different bit strings, there is an exponentially large number of orthogonal states that can be included in our superpositions of $n$ qubits. This is the space in which we can do all the tricks of quantum computation.

But as for how that works, I'll have to refer you to the rest of the questions and answers in this Stack Exchange.

What is a "quantum bit" physically? How is it "quantum"?

First let me give examples of classical bits:

• In a CPU: low voltage = 0, high voltage = 1
• In a hard drive: North magnet = 0, South magnet = 1
• In a barcode on your library card: Thin bar = 0, Thick bar = 1
• In a DVD: Absence of a deep microscopic pit on the disk = 0, Presence = 1

In every case you can have something in between:

• If "low voltage" is 0 mV, and "high voltage" is 1 mV, you can have a medium voltage of 0.5 mV
• You can have a magnet polarized in any direction, such as North-West
• You can have lines in a barcode that are of any width
• You can have pits of various depths on the surface of a DVD

In quantum mechanics things can only exist in "packages" called "quanta". The singular of "quanta" is "quantum". This means for the barcode example, if the thin line was one "quantum", the thick line can be two times the size of the thin line (two quanta), but it cannot be 1.5 times the thickness of the thin line. If you look at your library card you will notice that you can draw lines that are of thickness 1.5 times the size of the thin lines if you want to, which is one reason why barcode bits are not qubits.

There do exist some things in which the laws of quantum mechanics do not permit anything between the 0 and the 1, some examples are below:

• spin of an electron: It's either up (0) or down (1), but cannot be in between.
• energy level of an electron: 1st level is 0, 2nd level is 1, there is no such thing as 1.5th level

I have given you two examples of what a qubit can be physically: spin of an electron, or energy level of an electron.

What purpose does it serve in quantum computing?

The reason why the qubit examples I gave come in quanta are because they exist as solutions to something called the Schrödinger Equation. Two solutions to the Schrödinger equation (the 0 solution, and the 1 solution) can exist at the same time. So we can have 0 and 1 at the same time. If we have two qubits, each can be in 0 and 1 at the same time, so collectively we can have 00, 01, 10, and 11 (4 states) at the same time. If we have 3 qubits, each of them can be in 0 and 1 at the same time, so we can have 000, 001, 010, 011, 100, 101, 110, 111 (8 states) at the same time. Notice that for $n$ qubits we can have $2^n$ states at the same time. That is one of the reasons why quantum computers are more powerful than classical computers.

All we observe in quantum technologies (photons, atoms, etc) are bits (either a 0 or a 1).

At the essence, no one really knows what a quantum bit is. Some people say it's an object that is "both" 0 and 1; others say it's about things to do with parallel universes; but physicists don't know what it is, and have come up with interpretations that are not proven.

The reason for this "confusion" is due to two factors:

(1) One can get remarkable tasks accomplished which cannot be explained by thinking of the quantum technology in terms of normal bits. So there must be some extra element involved which we label "quantum" bit. But here's the critical piece: this extra "quantum" element cannot be directly detected; all we observe are normal bits when we "look" at the system.

(2) One way to "see" this extra "quantum" stuff is through maths. Hence a valid description of a qubit is mathematical, and every translation of that is an interpretation that has not yet been proven.

In summary, no one knows what quantum bits are. We know there's something more than bits in quantum technologies, which we label as "quantum" bit. And so far, the only valid (yet unsatisfying) description is mathematical.

Hope that helps.

A qubit (quantum bit) is a quantum system that can be fully described by ("lives in") a 2-dimensional complex vector space.

However, much more than that is required to do computations. There needs to exist two orthogonal basis vectors in that vector space, call them $|0\rangle$ and $|1\rangle$, that are stable in the sense that you can set the system very precisely to $|0\rangle$ or to $|1\rangle$, and it will stay there for a long time. This is easier said than done because unless noise is reduced somehow, it will cause the state to drift gradually so that it contains a component along both the $|0\rangle$ and $|1\rangle$ dimensions.

To do computations, you must also be able to induce a "complete" set of operations acting on one or two qubits. When you are not inducing an operation, qubits should not interact with each other. Unless interaction with the environment is suppressed, qubits will interact with each other.

A classical bit, by the way, is much simpler than a qubit. It's a system that can be described by a boolean variable