Quantum Simulator 101 Background
In the previous installation of this series, I mostly focused on the code and glossed over most of the mathematical and physical background. In this post I will go over more of the background behind quantum computing with the intention to give an intuitive understanding of the concepts. Hopefully, this will make the following blog posts make more sense than they would otherwise.
Qubits
The basis of quantum computing is qubits. Just as normal computers operate on bits, quantum computers operate on qubits. Normal bits can only be a zero or a one. However, a qubit can be in a superposition of zero and one. What this means physically is that when you measure a qubit there’s a probability that you’ll measure a zero and a probability that you’ll measure a one. The theory behind superpositions is slightly more complicated than that. A qubit, q can be written as
The interesting thing is that α and β are complex numbers. This has very interesting implications because a probability, p, can only be 0≤p≤1. But α and β can be negative, or have imaginary parts. Clearly, these constants are not probabilities. They are probability amplitudes and can be converted to probabilities by multiplying the amplitude with its complex conjugate. The difference between probabilities and probability amplitudes is critical and is one of the keys things that makes quantum computing different from normal computing and probabilistic algorithms. Because probability amplitudes can be negative they can cancel-out, either partially or completely. This is of vital importance is many quantum algorithms.
The state of a number of qubits is a unit vector in a complex vector space. A single qubit is a 2-dimensional vector with the basis vectors
The Bloch Sphere
Qubits are commonly represented graphically through use a sphere called the Bloch sphere. On the Bloch sphere the north pole is
- How close a qubit is to the poles indicates how likely it’ll measure as a zero or a one
- Operations on qubits can be thought of as rotations of the Bloch sphere along different axes.
Phase
If, from a quantum state
Though the later can be written as
Entanglement
Entanglement is one of the most misunderstood and mystified quantum mechanical phenomena. I think quantum entanglement can best be introduced by showing an example of an entangled state before going into the mathematical background. Consider the state
There are two possible outcomes for this state with equal probability: 00 and 11. Imagine that you have one qubit and a friend (located a large distance away) holds the other. If you measure your qubit and get a zero, then you know that your friend’s qubit will be a zero and vice-versa. When explained this way, quantum entanglement doesn’t seem so strange. After all, if there are two possible sandwiches in bags, one chicken and one turkey, then if you pick a bag and get chicken then you know that the other is turkey. Naturally, it stands to question whether the qubits where ever in a superposition in the first place. Maybe the qubits were actually just in the state
Now, the mathematical background: qubits are entangled with each other when their state cannot be written as a product of single qubit states. Consider the state
expanding out, we get
We now have:
There is no solution and so
Linear Operators and Quantum Gates
Classical computers use logic gates to perform operations on bits. Quantum computers use quantum gates to perform operations on qubits. Quantum gates are linear operators that operator on quantum states. Linearity means that given a linear operator A,
Any linear operator can be expressed as a matrix. In particular, quantum gates are expressed as unitary matrices. Unitary matrices have two important properties: they conserve probability and they are invertible. This means that all quantum computations are reservable. An interesting sidenote: in theory, reservable computations can be performed without spending any energy. This applies to all computations, not just quantum ones.
Because quantum gates are linear operators, we only have to think about how they act on the basis vectors to understand them. I’m going to talk about a few single qubit quantum gates just to give a feel of what they do
- X gate: the quantum version of a NOT gate. Maps
and - Z gate: flips the sign of the ∣∣1⟩ coefficient, same thing as a phase shift of π. Maps
and - Hadamard gate: Maps
How quantum logic gates act on basis vectors can be thought off as the quantum equivalent of truth tables for normal logic gates.
Two and three qubit gates are common as well, but I will save those for a later post.
Conclusion
The goal of this post is not to make you an expert in these topics, but just introduce them. Don’t worry if they don’t make complete sense. I’m a big believer in hands-on learning and hope that just being familiar with them will help in the next posts in this series.