> For the complete documentation index, see [llms.txt](https://lewisla.gitbook.io/learning-quantum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lewisla.gitbook.io/learning-quantum/qubits/quantum-bits.md).

# Quantum Bits

## Quantum Information

In the section about [*quantum mechanics*](/learning-quantum/physics/quantum-mechanics.md), we talked about the idea of [*superposition*](/learning-quantum/physics/quantum-mechanics.md#superposition), where more than one [*state*](/learning-quantum/physics/classical-mechanics.md#state) is overlapped over top of each other. The system is in [*multiple distinguishable states*](/learning-quantum/physics/quantum-mechanics.md#distinguishable-states) at the same time - the information is *superimposed.* We don't know what going on in there, we can only talk in [*probabilities* ](/learning-quantum/physics/quantum-mechanics.md#probability)- what state are we likely to see if we measure (or observe) the system at a particular moment?

### The Single Qubit System

A single quantum bit is the basic unit of quantum computation, but it's also the smallest (non-trivial) quantum system. Unlike a classical system, where a single bit can't do much at all, in the quantum system the individual bits can be used to do work alone [*(Nielsen, M. - p. 13)*](/learning-quantum/qubits/qubits-summary/qubit-references.md#the-idea-of-a-quantum-bit).

### Distinguishable States

Like a classical bit, the quantum bit has two observable states - 0 and 1. The difference here is very simple. In the quantum system, we have the potential for superposition. A quantum bit can be 1 *and* 0, at the *same time*. We measure this in between zone by talking about the [*probability* ](/learning-quantum/physics/quantum-mechanics.md#probability)of finding the qubit in a particular state *when we measure* it.

If you recall our discussion of [*vector spaces*](/learning-quantum/linear-algebra/space-dimension-and-span.md#space), the dimension of a system is defined by the number of [*basis*](/learning-quantum/linear-algebra/space-dimension-and-span.md#basis) vectors we have. So a single qubit system has *two basis vectors* - a 0 vector and a 1 vector.&#x20;

This means that a single qubit system defines a *plane.* The combinations of those two basis vectors all live together on this plane. The vectors that live on the plane represent all the possible answers we can get to using a single qubit.

## Notation

### General Vector

A single qubit is represented as a 2-dimensional [*quantum vector*](/learning-quantum/physics/quantum-mechanics.md#quantum-vectors). Recall that a quantum vector has as many dimensions as there are distinguishable states, so it makes sense that a single qubit vector has 2 elements. Like any quantum vector, we represent a qubit in an unknown state like this:

$$
|\psi\rangle
$$

### Specific States

The two basis vectors, which represent the pure "0" state and the pure "1" state respectively, are represented like this:

$$
|0\rangle = \begin{bmatrix}1\0\end{bmatrix}, |1\rangle=\begin{bmatrix}0\1\end{bmatrix}
$$

Note here that the elements of this column vector represent the particular state a qubit is in. The first element tells us if a qubit exists in the *first* state (which is 0), and the second element tells us if a qubit exists in the *second* state (which is 1). As we add more qubits to the system, we offer more qubits and more combinations of states, and more elements.

### Multiple Bits

As our system gets more complex and begins to contain more numbers, we can expand on this:

$$
|00\rangle=\begin{bmatrix}1\0\0\0\end{bmatrix},|01\rangle=\begin{bmatrix}0\1\0\0\end{bmatrix},|10\rangle=\begin{bmatrix}0\0\1\0\end{bmatrix},|11\rangle=\begin{bmatrix}0\0\0\1\end{bmatrix}
$$

{% hint style="success" %}
For multi-qubit systems like this, we order qubits from right to left. So the rightmost qubit $$|0\textcolor{red}1\rangle$$ is the *first*, and the leftmost qubit is the *last* $$|\textcolor{red}{0}1\rangle$$.
{% endhint %}

You can imagine that if we have a whole bunch of qubits, this could get very confusing very quickly. So we might use the decimal version of these binary numbers streamline things:

$$
|0\rangle=\begin{bmatrix}1\0\0\0\end{bmatrix},|1\rangle=\begin{bmatrix}0\1\0\0\end{bmatrix},|2\rangle=\begin{bmatrix}0\0\1\0\end{bmatrix},|3\rangle=\begin{bmatrix}0\0\0\1\end{bmatrix}
$$

{% hint style="info" %}
[Binary number review](https://www.khanacademy.org/math/algebra-home/alg-intro-to-algebra/algebra-alternate-number-bases/v/number-systems-introduction)
{% endhint %}

### Combinations of the Basis Vectors

Going back to our earlier discussion of $$|0\rangle$$ and $$|1\rangle$$ as our basis vectors, this means that all of the possible measurements for $$|\psi\rangle$$ are represented by a [*linear combination*](/learning-quantum/linear-algebra/vector-relationships.md#linear-combinations) of our basis vectors [*(Nielsen, M. - p. 13)*](/learning-quantum/qubits/qubits-summary/qubit-references.md#a-linear-combination-of-our-basis-vectors)*:*

$$
|\psi\rangle = a|0\rangle + b|1\rangle
$$

Where $$a$$ and $$b$$ are [*complex numbers*](/learning-quantum/physics/quantum-mechanics.md#complex-numbers).

{% hint style="success" %}
Recall that the[ *inner product* ](/learning-quantum/linear-algebra/basics.md#inner-product)of our quantum vectors [*must equal 1*](/learning-quantum/physics/quantum-mechanics.md#notation), to allow for reversibility of operations: $$\langle \psi|\psi\rangle = 1$$
{% endhint %}

## Measuring Qubits

When we measure our quantum bit, the information [*collapses*](/learning-quantum/physics/quantum-mechanics.md#superposition) into one state or the other. That means that this linear combination of states...

$$
|\psi\rangle = a|0\rangle + b|1\rangle
$$

...is a superposition of multiple possible states. We can solve this superposition two different ways - as a wave form, with the [*Schrodinger equation*](/learning-quantum/physics/quantum-mechanics.md#schrodingers-equation), or by literally looking at it.

{% hint style="success" %}
When we measure our qubit (and it collapses into one state or the other), we store the result in a classical bit. That means that measuring $$|0\rangle \rightarrow 0$$ and $$|1\rangle \rightarrow 1$$.
{% endhint %}

### The Probability of States

What will we get? It depends on what *kind* of superposition it is - that is to say it depends on the [*probabilities*](/learning-quantum/physics/quantum-mechanics.md#probability) of arriving at each state.

The probability of getting any *particular* stat&#x65;*,* added to the probability of getting any other *particular* state has to add up to 1, but as long as that true the *distribution* could be anything [*(Nielsen, M. - p. 13)*](/learning-quantum/qubits/qubits-summary/qubit-references.md#the-probability-of-measuring-a-qubit-in-a-particular-state)*:*

$$
\langle\psi|\psi\rangle=\text{prob}|0\rangle+\text{prob}|1\rangle=1
$$

That is to say that we may be 50% likely to see $$|0\rangle$$ and 50% likely to see $$|1\rangle$$. The probability *distribution* then looks like this:

![A graph showing an even probability distribution](/files/-M4Pwr_gyQUNB4b86Iwr)

The sum of the probabilities of finding the qubit in all possible states is therefore:

$$
50% + 50% = 100%
$$

Or:

$$
0.5+0.5=1
$$

### Quantum Results

Results from a classical system come in as a simple answer - for example, if we have two bits a and b:

$$
a = 0, b = 1
$$

And we *add* them together:

$$
a + b = 1
$$

This is the long and short of it, the answer is 1. I know the whole state of the system from top to bottom - I could measure it once, or ten thousand times, and I would always get the same answer.

Quantum systems are different - the state of the system is measured in probabilities. Thus, each time I measure it, I may get a different answer. The system may [*collapse* ](/learning-quantum/physics/quantum-mechanics.md#superposition)into a different state. Therefore, I can't measure just once. If I do, I won't see the whole picture. The result that I'm looking for isn't a simple number. It's a [*probability distribution*](/learning-quantum/qubits/quantum-bits.md#the-probability-of-states)*.*

This also means we need to run our calculations multiple times - as many times as we can get away with in fact. This way we'll get as close as possible to the real truth of the system.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lewisla.gitbook.io/learning-quantum/qubits/quantum-bits.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
