In the previous article we got to grips with the fundamental behaviour of qubits by reviewing the historical account of regular bits. Qubits and Bits share a fundamental property: they are both two-state systems and the previous article focused on this, explaining that the bright minds of centuries past had figured out how to perform mathematical operations on pretty much any physical thing with two states.

A tremendous achievement.

But qubits are also two-state systems, so in exactly the same way for bits, they also store data and we can perform operations on them. The difference is that they also exhibit quantum properties.

But what is a quantum property? And how do we express them on paper?

Describing a quantum property requires the use of

Qubits Require Complex Numbers

Let’s think about why we need complex numbers to describe qubits. Essentially it boils down to the fact that rotation in the Euclidean plane using real numbers reduces to simple multiplication using complex numbers.


Multiplication is much, much easier to do than trigonometry, so the equations of quantum mechanics look and feel much simpler using complex numbers.

If you are not comfortable with complex numbers, fear not, I will try to reference them sparingly in what follows. If anything, just imagine complex numbers as pairs of real numbers that might describe a point on a map (e.g. latitude and longitude are both real numbers, the pair together describes a point on the Earth. That point is a complex number). In this example though, the longitude a is the real part of the complex number while the latitude b is the imaginary part – but these are simply labels, but it helps to be able to write down a complex number z as a coordinate (or ordered pair):

z = (a,b) = a+ib

where that plus sign is vector addition and i := \sqrt{-1} which is not a real number but is often referred to as an imaginary number.

Complex numbers are what you get if you extend the real line above and below to infinity.

Complex numbers hold more information than real numbers. This is important, and is often referred to as an object’s degrees of freedom.

For example, a complex number has an extra property called phase denoted \arg(z) for its alternative name argument. When the phase of a complex number is zero or any multiple of \pi radians then it has no imaginary component (because \sin\varphi will always be zero, and hence

z = r(\cos\varphi + i\sin\varphi)

will always reduce to z = r\cos\varphi + 0 . And this complex number becomes real.

So, complex numbers have an additional degree of freedom, or as I like to say:

Complex numbers (over real numbers) have extra pockets you can put things in…

If you look at the very definition of a complex number z on wikipedia you can see that it is just

 z = a\cdot 1 + b \cdot i

where a and b are real numbers. Thus, a complex number z is just a linear combination of real numbers given in terms of the basis \{1,i\}.

Now, look at the wikipedia definition of a pure qubit state:

 |\psi\rangle = \alpha|0\rangle + \beta |1\rangle

See the similarity!?

If qubits are necessarily linear combinations of some basis states \{|0\rangle,|1\rangle\}, then, by definition, we already have a mathematical object that looks exactly like that! The complex number. So we might as well use them!

Wait…shouldn’t there be four degrees of freedom? After all, each complex number \alpha and \beta has two degrees of freedom each, so surely their sum has four?

Well, no. Quantum Theory is also a theory of probability. Which means we have a this axiom which forces us to constraint our system with the following relation:

|\alpha|^2 + |\beta|^2 = 1

which is called the normalisation constraint, and it removes a degree of freedom. In other words, you can write both \alpha and \beta as a system of equations that depend on just 3 variables, namely \{\psi,\phi,\theta\} like so:

\displaystyle\alpha = e^{i\psi}\cos\frac{\theta}{2},\quad\quad\quad\quad \beta = e^{i(\psi+\phi)}\sin\frac{\theta}{2}

…the so-called Hopf coordinates.

OK, but that’s still three. How do we get to two?

Well, we have that global phase component of the qubit: e^{i\psi}, which has no physical observable consequences. So we just ignore it, leaving

\displaystyle\alpha = \cos\frac{\theta}{2},\quad\quad\quad\quad \beta = e^{i\phi}\sin\frac{\theta}{2}

and this only has 2 variables, namely \{\phi,\theta\}, and e^{i\phi} is the physically significant quantity known as the relative phase.

Since a qubit has 2 degrees of freedom, we can describe it using two coordinates in 2-dimensional space (a plane), hence the usefulness of using the Bloch Sphere to represent it:


But there is more to qubits than just looking like complex numbers…

Qubits Require Matrices

The reason why we need matrices is because of quantum logic gates and the fact that gates always have matrix representations. Furthermore, all binary Truth Tables (which we looked at in the previous article) can be expressed in the form of a square matrix known as a permutation matrix, putting even further emphasis on the need for using matrices.

So how do we go from

 |\psi\rangle = \alpha|0\rangle + \beta |1\rangle

to a matrix?

Well, easy. We just write those basis states as vectors:

 |0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad\quad\quad\quad |0\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}


Storing Binary Data Using Logic Gates

Recall from the first article the logic gates of classical bits. For convenience, they are:

  • NOT
  • AND & NAND
  • OR & NOR
  • XOR & XNOR

Using these logic gates one can store binary data. How? By building a flip-flop.

Take a pair of NOR logic gates and cross-couple them, now you’ve got yourself a so-called set-reset latch which can store either a 0 or a 1 on a bit indefinitely – which is why, sometimes, flip-flops are called bi-stable circuits: which are circuits that have no charge or discharge time due to the absence of capacitors.

There are other flip-flops too, for example:

  • Set-Reset NOR Latch
  • Complement Set-Reset NAND Latch
  • Set-Reset AND-OR Latch
  • JK (Toggle) Latch

and there’s more.

If you arrange multiple flip-flops in parallel and you’ve got yourself a register. When a system is capable of performing flip-flops we say that the system has memory.

The point is: logic gates can store binary data – and the question is:

Can qubits store data?


But we need qubit gates.

Gates for Qubits

Logic gates for qubits are unitary matrices.


Because for any time interval over which we are trying to realise a particular transformation (i.e. perform an experiment, or just crunch some numbers) we must use the Schrödinger equation (why? because we are working in quantum theory). This equation, necessarily involves Hamiltonians which, are required to be Hermitian (or self-adjoint) to yield real-world results. This condition of Hermiticity implies that the transformation is unitary.

Because there are more degrees of freedom in a qubit (namely 2, instead of 1 for a classical bit) a quantum logic gate is not only a unitary matrix, it is also a square matrix of size 2^n \times 2^n. Right, they’re massive. But that have to be huge because qubits hold a lot of information, so each piece of information in a qubit must get acted on by this matrix.

When you act on a 2^n-dimensional vector (a qubit) by a 2^n\times 2^n-dimensional matrix (a qgate) you get a 2^n-dimensional vector back (thanks linear algebra). The entries of this vector are called the amplitudes, and they are represented by greek letters, say \alpha. Here is an example of an output vector after begin operated on by a quantum logic gate:

\displaystyle \begin{pmatrix}\alpha_0 \\ \alpha_1 \\ \vdots \\ \alpha_{n-1} \end{pmatrix}

But this can always be represented in terms of the standard basis:

\displaystyle \begin{pmatrix}\alpha_0 \\ \alpha_1 \\ \vdots \\ \alpha_{n-1} \end{pmatrix} = \alpha_0 \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix} + \alpha_1 \begin{pmatrix} 0 \\ 1 \\ \vdots \\ 0 \end{pmatrix}+\cdots+\alpha_{n-1} \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 1 \end{pmatrix}

The Linear Shift of the QFT

We have used the Quantum Fourier Transform (QFT) before in this article here. Let’s now see the raw power of the qubit by performing a QFT on it.

In N dimension, a qubit is an N-dimensional column vector:

\displaystyle \begin{pmatrix}\alpha_0 \\ \alpha_1 \\ \vdots \\ \alpha_{n-1} \end{pmatrix}

Then linear algebra states that the matrix multiplication of a matrix A and a column vector x is another column vector whose entries are given by

\displaystyle Ax = \begin{pmatrix} a_{00}x_0 + \cdots + a_{0(N-1)} x_{(N-1)} \\ a_{10}x_0 + \cdots + a_{1(N-1)} x_{(N-1)} \\ \vdots \\ a_{(N-1)0}x_0 + \cdots + a_{(N-1)(N-1)} x_{N-1} \end{pmatrix}

The QFT is a quantum gate, thus, it is a unitary matrix.

\textsf{QFT}_N := \frac{1}{\sqrt{M}} \begin{pmatrix} 1 & 1 & \cdots & 1 \\ 1 & \omega & \cdots & \omega^{N-1} \\ 1 & \omega^2 & \cdots & \omega^{N-1} \\ \vdots & \vdots & \ddots & \vdots \\ 1 & \omega^{N-1} & \cdots & \omega^{(N-1)(N-1)}\end{pmatrix}

We can apply the unitary QFT on it via matrix multiplication on the basis representation:

\displaystyle \textsf{QFT}_N \begin{pmatrix}\alpha_0 \\ \alpha_1 \\ \vdots \\ \alpha_{n-1} \end{pmatrix} = \textsf{QFT}_N\left(\alpha_0 \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix} + \alpha_1 \begin{pmatrix} 0 \\ 1 \\ \vdots \\ 0 \end{pmatrix}+\cdots+\alpha_{n-1} \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 1 \end{pmatrix}\right)

Let’s do the first multiplication:

\displaystyle \textsf{QFT}_N \left(\alpha_0 \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix} = \beta_0 \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix}


A computer contains a bunch of physical components, such as gears and cams in mechanical computers, relays and switches in classical computers, and transistors in modern computers. In the mechanical computer the physical state is the rotational orientation of the gears, in the classical computer it is the binary on or off state of the relay, and in the modern computer it is the current and voltage in the transistor.

Physical interactions between these components, causing them to change their state, achieves computation. In the modern computer, data (voltages and current) from memory circuits is transferred to the central processing unit (CPU) where they interact with logic gates (such as AND and OR) implemented in series and parallel, producing new voltages and new currents (a.k.a. the output) which can then be stored back in memory circuits and, ultimately, read (or measured) by the user.



[2] Nielsen, N. & Chuang, I. L. – Quantum Computation and Quantum Information, Cambridge University Press, (2010).