From “Hello World” to “Hello Quantum”

Art of Quantum
Art of Quantum
Published in
6 min readJan 15, 2019

Hey! Welcome to our first tutorial!

Today we’ll cover one of the fundamental concepts of quantum computing — Superposition and Entanglement.

Before we begin, we’d strongly recommend you watch this short video on the Quantum Double Slit experiment. This video was the reason why we developed such an interest in this field, and we’re sure it’ll amaze you too!

Superposition

Now that you’ve got a glimpse of quantum weirdness through the video, let’s see one more weird aspect — Superposition.

A classical computer — ones that all we use almost everyday — uses ‘bits’ as the fundamental unit to store data. These ‘bits’ can only ever take one of two values — 0 or 1.

On the quantum side of things, we refer to these ‘quantum bits’ as ‘qubits’. The cool fact about qubits however is that they can take a value of 0 or 1, or — wait for it — BOTH 0 and 1 at the same time! We call this intermediate state as Quantum Superposition.

In fact, this is the state every qubit is in, until we decide to measure it. Yes, I say until we try to measure it, because the very act of measuring the value of the qubit makes it ‘collapse’ into one of the two values 0 or 1. We can never see a qubit in its superposition state (think Schrödinger’s Cat?).

Here’s a little illustration to highlight the difference between a classical bit and a qubit, and another to give you a visual of what superposition is like:

Classical vs Quantum Bit
Quantum Superposition

You may have wondered what the symbols |0⟩ and |1⟩ in the qubit image meant? These are nothing but the notations we use to represent the value of a qubit, and are known as Bra-Ket notations. (|0⟩ +|1⟩)/2 represents the ‘intermediate’ or superposition value of the qubit, which is a combination of the |0⟩ and |1⟩ state.

Entanglement

Now that we’ve understood what superposition is, let’s move on to entanglement.

Quantum entanglement is a quantum mechanical phenomenon in which the quantum states of two or more objects have to be described with reference to each other, even though the individual objects may be spatially separated.

Did that line get you overwhelmed? 😝 Don’t worry, we’re here to simplify it for you. Let’s understand this concept through an example:

Consider two unbiased coins A and B. Coin A is tossed and suppose it reads as heads. Now, can you surely predict what will coin B read when it is tossed? Hehe… probably not. (Although you may be correct with 50% probability).

Instead, if we consider two ‘entangled’ coins A and B, and say coin A is tossed and reads as heads. Now, in this case, we can be 100% certain that coin B will also read as heads. There is no chance of coin B reading as tails. Either both A and B will read heads or both will read as tails.

Thus, in the same fashion, two entangled qubits, when measured, will either both have a value of 0, or both will have a value of 1. Thus, we may get our ouputs as 00 or 11 only, with a 0% chance of getting 01 or 10. This is the idea behind quantum entanglement. Sounds cool, doesn’t it?

Let’s take one more example to get this concept crystal clear —

Let’s our systems can have two objects that we’ll call c-ons. The “c” is meant to suggest “classical,” but if you’d prefer to have something specific and pleasant in mind, you can think of our c-ons as cakes. Our c-ons come in two shapes, square or circular, which we identify as their possible states. Then the four possible joint states, for two c-ons, are (square, square), (square, circle), (circle, square), (circle, circle). The following tables show two examples of what the probabilities could be for finding the system in each of those four states.

We say that the c-ons are “Independent” if knowledge of the state of one of them does not give useful information about the state of the other. Our first table has this property. If the first c-on (or cake) is square, we’re still in the dark about the shape of the second. Similarly, the shape of the second does not reveal anything useful about the shape of the first.

On the other hand, we say our two c-ons are Entangled when information about one improves our knowledge of the other. Our second table demonstrates extreme entanglement. In that case, whenever the first c-on is circular, we know the second is circular too. And when the first c-on is square, so is the second. Knowing the shape of one, we can infer the shape of the other with certainty.

It’s time for Code!

Okay that’s enough theory for now, lets now see how we ourselves can entangle two qubits through code! We’ll be using the Qiskit toolkit to write our Python code, which we can run on either a simulator or even on a real Quantum Computer within an IBM lab!

In the above code, you must have wondered what the Hadamard and the C-Not gates were, and what they do?

The Hadamard gate is simply a gate which when applied to a qubit, puts it in a superposition state.

The C-Not gate, takes two parameters — the first is called the control bit, and the second is the target bit. What it does is it reads the value of the control bit, and if it is |0⟩, then the gate leaves the target bit untouched, whereas if the control bit’s value is |1⟩, then the C-Not gate will flip the target bit.

This way, our entanglement circuit is basically comprised of a qubit in superposition state, whose value is a combination of |0⟩ and |1⟩, and this qubit is used as the control bit of the C-Not gate, with the target qubit being another available qubit. Since theres a 50–50 chance of our qubit having a value |0⟩ or |1⟩, thus there’s a 50–50 chance of whether the target qubit gets flipped.

This procedure is what ‘entangles’ our two qubits so that they will always read the same value when measured, no matter how physically close together or far apart they are located.

Conclusion

So that was your introduction to the world of quantum weirdness, and we hope it intrigued you just as much as it fascinated us! If you have anything you’d like to ask us, or have any feedback regarding something we need to work on to improve our posts, feel free to reach out to us at artofquantum@gmail.com, or find us on twitter as @ArtOfQuantum!

This sums up our first post on Quantum Entanglement. We really hope you enjoyed it and come back for more tutorials like these coming up soon!

--

--