Quantum Computing for Students of Computer Science : The Qubit

Vinayak Sharma
SyntechX
Published in
10 min readJun 16, 2020

--

Representation of Quantum Spin
Representation of Quantum Spin , Source : https://singularityhub.com/wp-content/uploads/2019/03/IBM-quantum-machine-learning-nature-art-square-Computing-1068x601.jpg

Quantum Computing is a term that is more prominent in tech news nowadays with companies such as IBM, Google, Microsoft and alike investing their resources in the field. However, the subject is still incredibly daunting at the first glance and hence misunderstood by many.

Quantum Computing promises to transform nearly all sectors, specially those that leverage parallel processing like Machine Learning and more specifically “Deep Learning”.

While the name might make it sound incredibly difficult, the topic is far more approachable than one might think. The increasing levels of abstraction allow you to jump into the basics of Quantum Computing(QC) with a surprisingly attainable understanding of Quantum Physics. If you are a student of Machine Learning with an understanding of vector algebra and probability, it becomes even easier.

“Our machine performed the target computation in 200 seconds, and from measurements in our experiment we determined that it would take the world’s fastest supercomputer 10,000 years to produce a similar output.” — Google AI Blog

The monumental accomplishments of researchers such as those at Google demonstrate the groundbreaking nature of the technology. This means that getting started in the field can be instrumental for many computer scientists. The aim of this series is to get you acquainted with the very basics of QC with a little bit of code. Hopefully, it serves as a “gentle” introduction for those struggling to find a place to start.

This series will be broadly split into a progression of 4 articles:

  1. The Qubit
  2. Quantum System and Gates
  3. Applications of Quantum Computers
  4. Intro to code (Qiskit and Cirq)

*However, this is subject to change and this article will be edited to reflect and changes to this structure

Before we start, I recommend to read this series in chunks at a time to avoid burnout and confusion.

Introduction:

“If you are not completely confused by quantum mechanics, you do not understand it” — John Wheeler

https://media.giphy.com/media/cvOaZzK5USNoY/giphy.gif

Many people are disheartened by hearing famous scientists make daunting statements about the great difficulty of Quantum Mechanics. This is understandable, and depending on how you’re approaching the subject, it can be an exaggeration or an understatement. Here is the cold hard truth — the physics of Quantum Mechanics can get seemingly bizarre and challenge our common sense.

Here is the good news. If you are approaching the subject as a computer scientist, you don’t have to approach these parts at all. Our work involves only the specific effects and properties of the quantum world that lead to exponential speed ups in computation. Additionally, we require only a highly abstracted understanding of those principles.

Here are the main ones you have to know :

Quantum Superposition:

Schrödinger’s cat
asdSchrödinger’s cat | Source : https://media.giphy.com/media/XbC8Uy0rEhdTtF6lVa/source.mov

What is it?

Schrödinger’s cat, a now famous thought experiment by Austrian-Irish physicist -Erwin Rudolf Josef Alexander Schrödinger, is the prime tool to explain the concept. While the cat is inside the box, we cannot know if it is dead or alive. This implies that we must consider the state of the cat to be defined by a probability function of “Dead” and “Alive”.

Probability is the keyword here as it is important to understand the distinction between “probability” and “reality”. While the cat in reality must be in only one of the states of “Dead” or “Alive”, since we cannot be sure of which one it is, we consider it as being in both. In the quantum world however, the particles actually exist in both states.

So what does that mean for us and how does it provide an advantage over classical computing?

It means that a system of qubits checks all values derived from their resulting combinations. That means that for qubits we would need to compute ’n’ steps compared to the 2^(n-1) +2 for classical bits. Taking the example of a simple search tree :

Search Tree looking for the elements 01 and 11

Classical Approach

When using a brute force search, a classical computer would have to be in every state which means 2² + 2 = 6 states. To carry out search, our classical computer would need to take every one of those states and check against the condition. This means at least 6 operations.

Quantum Approach

Since a qubit exists in a superpostition, we require only 2 operations as every level of the tree is checked. This is a result of the fact that our quantum boolean conditions operate on an entire superposition and not just a single state. Therefore, every possible value of the qubit system is checked simultaneously providing the exponential speedup compared to classical computers.

Bit v/s Qubit

States in a Qubit:

An important factor that must be clarified when it comes to Quantum Computing is the concept of ‘States’. In a classical computer, ‘0’ represents the ‘OFF’ state and ‘1’ represents ‘ON’. This is inherently representative of the flow of electricity that powers classical computation. Quantum states are different and slightly more confusing.

A quantum state is any possible state in which a quantum mechanical system can be.

This is very important as our ‘0’ and ‘1’ states in a QC are very much Quantum Mechanical states. Hence, they follow all the rules of Quantum Mechanics.

Furthermore, the labels of ‘0’ and ‘1’ are entirely arbitrary. We can call the states ‘+’ and ‘-’ or ‘up’ and ‘down’, these are equally valid. We use ‘0’ and ‘1’ for the convenience of computer scientists.

The labels of ‘0’ and ‘1’ are entirely arbitrary.

*This is an incredibly important concept and useful tool later on.

Basis States:

The reference states (similar to x,y,z in a coordinate system) are known as ‘Basis States’ . For a Quantum Computer, we have 2 main basis states — |0⟩ and |1⟩. Every basis state is represented by a column vector :

Basis states of |0⟩ and |1⟩

Basis states play a very important role in quantum computing -

All qubit states can be represented as a sum of their basis states.

This is similar to how any point in a coordinate system can be represented as (x,y,z).

A general qubit state is described as :

Vector representation of a generic qubit state

An interesting property here is that α² represents the probability of |ψ⟩ being in state |0⟩ when ‘measured’ (more on this later) and β² the probability of |ψ⟩ being in state |1⟩ when ‘measured’. That also means that we can write :

Basis state representation of a generic qubit state

Note that when you solve this equation by representing the basis states in their vector forms, we get the vector representation of |ψ⟩.

The correlation between all of these different representations is integral to Quantum Computing and will be used many times.

Bloch Sphere:

This is the final way of representing a qubit that we’ll see in this article.

The Bloch Sphere is the geometric representation of state space for a 2 -level quantum system.

The Bloch Sphere is the geometric representation of state space for a 2 -level quantum system.

2D Slice of Bloch Sphere:

Bloch Sphere 2D slice

All possible states of a qubit exist on the surface of a Bloch Sphere and ever qubit is a vector within the sphere. The basis states of |0⟩ and |1⟩ only define a 2D slice of the sphere.

An interesting outcome of this is the fact that theoretically a single qubit can hold an infinite amount of data since there are infinite points on the perimeter of a circle.

3D Bloch Sphere:

The 3D Bloch Sphere adds the 2 additional basis states |+⟩ and |-⟩. These further expand the state space of the qubit and allow for even more information to be encoded.

Information Conversion Bottleneck:

“Theoretically a single qubit can hold an infinite amount of data”

This sounds too good to be true right?

Sadly, its not as straightforward as we might hope. While yes, a single qubit can have an infinite number of states, that information is only available to other quantum objects. Think about it like trying to shove a rabit into a roll of paper.

As a reward for getting this far into the article lemme save you the trouble of imagining it.

3D entity trying to enter 2D space

All our ‘infinite’ quantum information is like that rabbit and our classical world is the paper. Even if that information wants to be converted, it cannot exist in our macroscopic world. This is a result of one of the ‘weird’ quantum properties and the way dimensions work in Quantum Mechanics.

We cannot work purely on a quantum system and for practical reasons, convert our data back to classical states to process on classical systems.

Source : N. Cody Jones, Rodney Van Meter, Austin G. Fowler, Peter L. McMahon, Jungsang Kim, Thaddeus D. Ladd, and Yoshihisa Yamamoto / CC BY (https://creativecommons.org/licenses/by/3.0)

That’s why all near term quantum workflows use the QC as a ‘hardware accelerator’ similar to the way we use currently use a GPU.

This conversion between quantum and classical computers is the major cause of bottlenecks in the amount of information we can hold and process in a quantum computer.

A simple mathematical scenario is the ‘⌊ ⌋’ (floor) function —

⌊ x⌋ = Integral value of x∀ x ∈ ℝ

In this function there is technically an ‘infinite’ amount of information lost, as there are infinite decimal values between 2 integers. Example,

⌊ x⌋ = 2 x ∈ {2.1, 2.1222 , 2.3 , 2.7, 2.99545454543}

We see a similar issue when converting the quantum superposition states of qubits to classical bits. While the qubit has all values between |0⟩ and |1⟩ as described by its state |ψ⟩, our bit must be only one of ‘0’ or ‘1’.

This means that even though a qubit can have infinite states, when converted to classical bits, it can only represent a single bit of information.

Qubit Measurement:

Measurement operation on a qubit

So now that we understand that information needs to be converted between quantum and classical forms, the question is how. To go from ‘classical’ to ‘quantum’ we employ various encoding circuits. A topic I’ll address in a later article.

To go from ‘quantum’ to ‘classical’ we perform a ‘measurement’. In Quantum Mechanics we can define measurement as:

The testing or manipulation of a physical system in order to yield a numerical result.

This is where a major bottleneck occurs. The superposition state of a qubit ‘collapses’ or in simpler terms, it loses its ability to be in any state other than 1 or 0. This means all the information held in the state is condensed leading to an exponential loss of data — Similar to converting a Real number to an Integer.

One important aspect of the measurement process is that it alters the state of the quantum system: the effect of the measurement is that the new state is exactly the outcome of the measurement.

What this means is that when we measure, we actually destroy the superposition of the qubit. It’s not simply a matter of not being able to view the superposition, the act of measurement actually destroys it. This is known as ‘collapsing’

This means that for a given qubit state ⟩ :

Collapse of the superposition

Repeated Measurement:

Qubit

To get around the collapse of the superposition, we repeat a given calculation many times (ideally at least as many times as the number of possible outcomes) to reproduce the original superposition.

This process is incredibly similar to sampling in signal processing where we reproduce the original waveform by taking many readings over small intervals. The idea is that any outcome that is likely will be the outcome of measurements. Any outcome we do not see in a reasonable number of measurements is incredibly unlikely to occur.

Mirror States:

Mirror States

The term ‘mirror states’ is not a formal term and simply one I will be using to refer to a set of states that produce the exact same probability distribution when measured but are distinct from each other in quantum space.

For example:

Mirror States

Both the states have a 50% probability of being either a ‘0’ or a ‘1’. This means that upon measurement we cannot differentiate between them. However, when we see Quantum Gates and the evolution of systems, you’ll notice that both these states are entirely distinct and produce completely different evolutions.

Congrats, you made it through to the end.

That will be it for the first part of this series. I’ll leave it hear to avoid overloading you with too much information and allowing you to take some time to understand the concepts.

Feel free to connect with me on my LinkedIn account for any doubts about the subject or if you just wanna talk.

--

--