QTech-qplaylearn

QUEST

Q|Cards> online

The game introduces and teaches basic notions of quantum computing to everyone, no previous experience in quantum is needed!

Like in the tabletop Q|Cards> game, the goal of a match is to maximise the probability that, at the end of each round, your qubit will be flipped from 0 to 1. In order to win, you need to understand what a qubit is, how to manipulate it, and why we are speaking about probabilities at all!

1

Mermaid Tutorial

Let’s start with the main character of the story: the qubit.

In technical terms, a qubit is the fundamental unit of quantum information and is the quantum analogue of what a bit is, in the classical world. While conventional computers function by manipulating and storing bits, quantum computers manipulate and store quantum bits or, in short, qubits. Just like a bit, a qubit is characterised by its state. Remarkably, whereas the state of a bit is a number (0 or 1), the state of a qubit is a vector. To understand what this means, explore the QUEST entries about quantum state, qubit and superposition.

One way in which qubits are similar to bits is that we don’t really need to specify what the qubit actually is, physically. Its state can be stored by an electron, or a photon or an atom, or even encoded into something stranger, like an exotic particle or state of matter, something far beyond our everyday experience. For the purpose of this game, the physical entity doesn't matter and you should not worry about it, no more than you should worry about what type of capacitor stores the bits inside your computer’s RAM. You don’t really need to care about bits and capacitors and RAM to enjoy playing on your computer!

Programmers in particular don’t care how bits are stored. Rather, they can think of a bit in purely abstract terms, as having a state that is either 0 or 1. Similarly, it’s okay for us to think about a qubit as an abstract mathematical object, and as having a state represented by a vector, more specifically by a 2-dimensional one.

What does this mean? How should we think about quantum states?

It’s time to meet it (drumroll please!): ladies and gentlemen, here is the star of our show, the qubit-mermaid Alice!

02-Alice-25

When she sits comfortably upright on the ball, we say that her state corresponds to 1.

When she's reversed and upside down, we say that her state corresponds to 0.

02-Alice-25-copy

In a sense, these two situations are similar to the classical bits 0 and 1, meaning that they are well-defined configurations. But here is where quantum fun comes into play: since a qubit’s state is a vector, the states of Alice can be summed. For instance, against all intuition, she can be in this configuration here below:

04-Alice-27

This is what physicists call a superposition of 0 and 1. Conversely to the previous configurations, this is a very delicate and peculiar state, even if it’s a perfectly legitimate one in the quantum realm. The superposition is a sort of superpower that Alice has. But the catch is that whenever we inspect her state, that is, we perform a measurement, she loses this superpower!

If we inspect Alice’s state while she tranquilly sits on top of the ball, and we measure whether she sits upwards or upside-down, we’ll find that her state is always 1 (or upwards), 100% of the time. The same happens when she’s sitting upside-down: if we inspect her state, we’ll find her state to be 0, 100% of the time. In this sense we can say that 1 and 0 are “stable” states: a measurement doesn’t disturb mermaid Alice if she’s in either the 0 or 1 states. However, if Alice is in a (equally balanced) quantum superposition, our measurement has an effect: the superpower is lost, we end up with a 1 or a 0 with a 50% chance of each! Performing multiple measurements we get 0 around 50% of the time, and 1 around 50% of the time. In other words, if we inspect her state, we force the poor mermaid to be upward or downward, she can no longer stay in a superposition.

There are a few other states Alice can be in:

06-Alice-31

When she sits comfortably on the ball, but faces backwards, we say that Alice’s state corresponds to -1.

If instead she is upside down and facing backwards, we say that her state corresponds to -0.

06-Alice-31-copy

Being backward or frontward is a way of representing something that physicists call “phase.” But when it comes to measurements, phase doesn’t make a whole lot of difference at this point. When Alice sits upright and backwards, inspecting her state via a measurement still leaves us with a 1, 100% of the time. This also applies to Alice sitting upside down but backwards: 0 is obtained, 100% of the time. This is exactly the same as what we saw for the 1 and the 0 states. In general, we cannot distinguish if she’s frontward or backward.

Alice can have more fun when it comes to playing with superpositions; there are several possible configurations to discover such as:

12-33

or

12-33-copy

Yet, similar to the 1, -1, 0 and -0, states we described, there’s not much difference among all the superpositions we have seen so far. If we try to inspect any of these superposition states via a measurement, we will always destroy Alice's superpower, and will obtain a 1 or a 0, 50% of the time each. This means Alice is forced by our measurement to end upsitting upright or upside down.

Despite this apparent fragility when exposed to measurements, her superposition’s superpower can be very helpful! Being upside down is surely funny, but after a while it may become rather uncomfortable for her. So it's good to know how to help the mermaid flip to a normal upward sitting position. Therefore, if we manage to put Alice in a superposition, at least she has 50% probability of sitting comfortably upwards after the measurement - no matter if she faces frontwards or backwards.

In order to deepen your understanding about what is actually happening when we perform a measurement on a quantum system, go to the entry on QUEST about quantum measurement.

Now, it’s all very well that we want to help Alice sit comfortably, but how do we achieve this? How can we possibly communicate with a qubit-mermaid? And how can we manipulate her state?

We can help our mermaid out by means of something called “quantum gates”.

Quantum Gates

A quantum gate is simply a way of manipulating information, that is, the quantum state of a qubit or a collection of qubits. Like classical gates in conventional computers, quantum gates are the basic building blocks of quantum computation. The differences between quantum and classical gates may seem innocuous, almost trivial at first sight. But in those differences lies the power of quantum computation, and the possibility for quantum computers to be largely superior to classical computers in performing certain tasks.

Going back to our qubit-mermaid scenario, imagine the gates asactions that affect Alice’s state. Let’s take a look at the tools we have at our disposal to manipulate how she sits, in order to make her flip.

X gate: flips Alice, i.e., interchanges 0 and 1

pic1
pic2

Y gate: similar to the X gate - but additionally rotates her to face backward when she starts upright. Mathematically, there's an imaginary unit that comes into play.

Screenshot-2021-07-23-at-15.11.38
Screenshot-2021-07-23-at-15.15.01

Note on the 'imaginary unit’: there’s no need to delve into this concept here. However, if you’re curious, please check what complex numbers are. The only thing worth noticing at this point is that, as you can see, when Alice starts sitting upward, she ends up reversed backward, but, as we learnt, it’s not a big deal.

Z gate: rotates the 1, while the 0 is left undisturbed

Screenshot-2021-07-23-at-15.32.36

Hadamard gate: makes a superposition

Screenshot-2021-07-23-at-15.39.20
Screenshot-2021-07-23-at-15.47.19

Since the superposition is a quantum superpower, this gate is totally quantum (without a classical analogue); it introduces purely quantum effects.

Identity gate: adds some noise

This is a peculiar gate, in the sense that it doesn’t directly change the qubit-mermaid’s state; its only effect is to possibly add some noise. This means our manipulation of the qubit-mermaid’s states may be disturbed by adding some extra randomness when we measure them.

Screenshot-2021-07-23-at-15.54.04

Nevertheless, since most of the time this gate is innocuous, it can provide a valid strategy when we don’t want to modify the actions already played, but have to throw a card to comply with the rules of the game.

Thus far, we’ve only talked about Alice, but she’s not alone in the quantum realm! The quantum realm is actually full of qubits-merfolks, and for some extra quantum fun we need at least two of them to tango.

Therefore, let us introduce you to qubit-merman Bob. Just like Alice, he prefers to sit comfortably upright on his ball even though his state is a vector, and even though, like Alice, he can be pushed into several possible (super)positions. Let’s quickly go through all of Bob’s possible configurations.

01-Bob-45

Like for Alice, when Bob sits upright, we say his state corresponds to 1, and when he is upside down, his state corresponds to 0. Tthese are stable states, in the sense that if we try to inspect them, we obtain 1 or 0, respectively, 100% of the times, and Bob is not disturbed by our measurement.

01-Bob-45-copy
03-Bob_01-47

When Bob exerts his superpower by being is in a superposition, the measurement effect is instead disruptive. Bob is forced to be only upward or downward after itthe inspection, with 50% probability for each of the two cases

That is, when we perform measurements on Bob’s superposition, we’ll get a 0 half of the time, and a 1 half of the time.

Qubit-merfolks are playful and they like to prank each other. When they dance together, they sneakily try to flip their partners so that they’re the only ones sitting upright.

In Q|Cards> each player helps a qubit-merperson to play pranks on the other qubit-merpeople. In order to do so, not only are the above- mentioned single qubit gates required, but some special quantum gates that work on two-qubit-merpeople are needed as well!. The cards that depict these special gates act on two different characters at the same time.

In order for a computation to take place, we generally need some way for qubits to interact with one another. If you want to learn more about the fundamental role played by interactions into the quantum realm, jump to the QUEST’s entries about entanglement and wave-like behaviour.

Two-qubit Gates: gates that involve two-qubit-merpersons at once

SWAP gate: exchanges the two merpersons states

Therefore, if the merpeople are both upward or downward, nothing happens; if they are in opposite states they get swapped. For instance, we can have such situation:

Screenshot-2021-07-23-at-16.42.12

and the other way around, where Alice is initially upside down and Bob upright.

CNOT gate: controlled version of the X Gate

This is a controlled version of the X Gate. The actions are two on two different merpeople: one merperson acts like a control and decides what happens to the the other one, that is indeed the target on which the X Gate is operated. Suppose Alice is the control, and Bob is the target. If Alice is in the state 1, the state of Bob is flipped. If Alice’s state is 0, Bob’s state doesn’t change.

Screenshot-2021-07-26-at-12.45.54
Screenshot-2021-07-26-at-12.50.41
Screenshot-2021-07-26-at-12.53.31
Screenshot-2021-07-26-at-12.59.04

Entangling gates

It is interesting to note that at the core of quantum computing lies these two-qubit gates, particularly the CNOT. Let’s focus a little more on the CNOT before we proceed.

The CNOT per sé is a classical gate, in the sense that there isn’t any quantum superpower emerging from its direct action on the two qubit- merpersons. Nevertheless, it can be combined with single-qubit gates to do non-classical things.

Take a look at this scenario involving Alice and Bob.

Screenshot-2021-07-26-at-13.04.47

This Hadamard + CNOT combination is the start of many quantum algorithms, that is, a sequence of operations comprised of quantum gates that does a particular task. In Q|Cards>, this is what you are doing: composing sequence of gates to perform quantum algorithms.

In this particular example, Alice is in a superposition after the Hadamard gate acts on her. Her superposition state then acts as a control in the CNOT involving Bob as the target in this manner: the 1 of Alice’s superposition makes Bob flip, whereas the 0 of her superposition leaves Bob downward.

What we are left with is something that is wonderful... and crazily quantum indeed!

You may have noticed that some branches appear to have sprouted from the combined actions of the Hadamard and CNOT gates, that act as a sort of bond between Alice and Bob. Once this branch connection is established, we can no longer manipulate Alice’s state without affecting Bob’s state, and vice-versa.

Physicists call these bonded configurations “entangled states.” What we have here is perhaps the strongest quantum superpower that the qubit-merfolks can show: entanglement. In fact, Alice and Bob are so strongly correlated that we cannot consider them individually any more — they need to be regarded as a whole! In other words, we must consider their compound state to be unique, precisely the way we consider individual merpersons’ states. We cannot investigate the state of Alice without disturbing Bob, and vice-versa.

By now you know that any measurement destroys quantum superpowers, and entanglement is no exception. However, even though the entanglement superpower is destroyed upon inspection, the outcomes we get from Alice and Bob are correlated, no matter if we investigate Alice’s state, Bob’s state or both.

There are four particular configurations of the compound system Alice- Bob that are very special to physicists: Bell states. They represent the four maximally entangled states, which means they are extremely quantum, and have a variety of important roles to play in quantum algorithms. Pictorially, this is how they look like:

Screenshot-2021-07-26-at-13.10.20
Screenshot-2021-07-26-at-13.11.09

Let’s see what happens when we inspect one of these states. When we perform a measurement on Alice, her quantum superpowers are destroyed: the entanglement is lost, and Alice is forced to sit either upward or upside-down, all alone on her ball. What about Bob? Since the two merpeople were entangled before the measurement, Bob loses his quantum superpowers as well, and ends up sitting upward or upside- down on his ball all alone. But because of entanglement, their destiny is connected, and the states Alice and Bob end up in aren’t independent from one another.

If the branches were parallel prior to measurement, then the result is as follows: if Alice ends up in the 1 state, so does Bob. If Alice ends up in the 0 state, so does Bob. Therefore, both of them will end up sitting in the same orientation, upward in the first case, upside-down in the second one.

On the other hand, if the two branches were crossed prior to measurement, then Alice and Bob will end up with opposite orientations. This means, if Alice’s state is a 1, Bob’s state will be 0, and vice-versa: when one merperson is upward, the other one will be upside-down.

The same thing would happen if we were to investigate Bob’s state first, or if we try to investigate them simultaneously.

Entanglement is a feature that is uniquely quantum, with no classical analogue: it’s what really distinguishes the quantum world from the classical one. If you are curious to better understand why, jump to the QUEST entry entanglement.

Special tool: unitarity

It’s almost time for you to master the game! There are a few more tricks that you can use to compose the winning algorithm to enhance the probability that your qubit-mermaid is flipped at the end of the match, whereas the others are not.

All the actions that you can play, that is, all the gates that you can use, have a special feature: they are unitary. This means that if you consecutively play two identical gates on the same qubit-mermaid, they cancel each other out. This feature will come in handy when you want to neutralise the pranks played by the other players on your mermaid. You can verify this neat property for yourself! Think about what would happen to a qubit-mermaid when you apply the X gate twice. If applied correctly, the mermaid will return the state she was in before you applied them!

Notice that this isn’t some magic feature invented for the purpose of the game, this is a property of quantum gates. In some cases it is really
easy to verify the gate’s unitarity, while in some cases it is a bit more difficult. Nevertheless, the unitarity is what distinguishes a good gate.

Unitarity is a consequence of a very fundamental trademark of quantum computing (and of the quantum world in general). Input and output states of any algorithm need to be what is known as “normalised” in order to be legitimate quantum states. Unitary gates ensures that they are. For those of you who are familiar with vectors, a state vector is normalised when its length is equal to 1. In the context of qubit-merpeople, this means that all the merpeople have a fixed height, even though they can be in a variety of different states, no matter what happens during the quantum algorithm.

Measuring a qubit

Quantum computation works by manipulating a quantum state using a series of quantum gates. At the end of the computation one typically performs a measurement to read out the result of the computation. If it’s just one qubit we play with, then the result of the measurement will be a single classical bit, rather, a simple number that is either a 0 or a 1. If multiple qubits are involved, as is usually the case, then the measurement result comprises of multiple classical bits, a sequence of 0’s or 1’s. For instance, the result of a five qubit measurement can be 01101.

Remember that by playing with the qubit-merfolks by manipulating their states, you are essentially running a quantum algorithm, and are performing a quantum computation. The last step of your computation must necessarily be a measurement in order for you to obtain a result.

We have already seen what a measurement can do: it disturbs the state of a qubit-mermaid or a qubit-merman. This applies to all quantum systems: the quantum measurement process generally disturbs the state of a quantum system. The result 0 or 1 corresponds to a measured qubit ending up in the state 0 or 1 respectively, no matter what state the qubit was in prior to measurement. Merpeople lose their quantum superpowers every time that a measurement is performed: superposition is destroyed, and entanglement as well.

At the end of it all, Alice and Bob are forced by our measurements to sit upward or upside-down, alone on their balls.

All this reflects the fact that the quantum state of any system, be it qubit-mermaid or some other, is not directly observable. Think about this for a moment, because it’s very different from our everyday lived experience. In our classical world, the more you use better diagnostic tools the more you learn. For instance, when there’s something wrong with your car, a mechanic can use diagnostic tools to learn about the internal state of the engine. Of course, there may be parts of the engine that would be impractical to access, but at the end of the day you’d be pretty miffed if the mechanic told you the laws of physics prohibited them from figuring out the internal state of the engine!

The opposite seems to happen in the quantum world. The rules over there are very different and the measurement process appear unintuitive and rather bizarre, even for most quantum experts out there. In order to grasp what may be considered the Holy Grail of quantum physics, check out the measurement entry on QUEST.

That’s well and good, but how do we apply what we know about measurements to Q|Cards>?

Let’s go back to our qubit-merpeople, who are relying on us to make them flip and finally sit comfortably on their balls. In terms of the measurement process, this means that each player’s goal per round is to get the outcome 1. And in the quantum realm, performing a measurement inexorably implies that we have to deal with probabilities.

Although it sounds a bit surprising, all we can do is indeed to get an outcome 0 or 1 with a certain probability. However, the probability itself is not a completely random thing, and can be indeed under our control. The goal is to build an algorithm that enhances the probability for our merperson to be flipped such that she sits upright. If you were to play the game alone, you would probably be able to find a way to flip your merperson from being downward to being upward with 100% probability. Namely, as the sole player, you would be sure about the result of the measurement. But when you have multiple players, and a party of qubit-merfolks, everything is funnier, but a bit trickier!

First of all, since the outcomes of quantum measurements are probabilistic, the same computation must be performed multiple times to build reliable statistics. This means the same algorithm, or sequence of gate operations, must be performed on the same qubit-merpeople (initially prepared on their balls downward, and then manipulated via the same gates, in the same order) multiple times.

After all, consider rolling a single standard 6-faced die. If you roll it just once, and the outcome is, say, a 5, you may wrongly conclude that dice always yield 5’s whenever they are rolled! This is obviously not true. Each face of a die has a probability of 1/6 of being obtained upon a roll. But how would you verify this? You would need to roll the die many times to build the statistics for your experiment, the more you roll, the better you will see that each face can be obtained approximately 17% of the time.

In Q|Cards>, once the algorithm is composed, what happens at the end of each round is the following: the game sends instructions to a real quantum device, and a simulation automatically starts to run in which the composed algorithm is repeated 1024 times. In this way the outcomes at the end of the game are obtained via a reliable experiment. The winner is thus declared by a real quantum device and they can rejoice with their mermaid or merman!

You may at this point be wondering: a real quantum device? What on earth does that even mean?

Real quantum computers haven’t been built yet, though scientists and engineers around the world are working hard to build them. This is what the media usually refers when speaking about the “quantum run” or the “ongoing quantum revolution.” What we do have access to are the ancestors of the quantum computer: quantum devices that can perform specific calculations. They have a limited number of qubits, which means there are a limited number of merpeople allowed at the mermaid party. These devices are physically located in big research or companies facilities around the world in the US, Europe, China, etc., but location doesn’t matter, because they can be accessed by anyone in the world, sitting at home! Instructions can be sent even via mobile, which is exactly what Q|Cards> makes use of.

Now that you know all about qubits, gates, quantum superpowers, measurements, and that you can access a quantum device wherever you are right now, what are you waiting for? It’s time to play!

Let’s have a mermaid party!

© QPlayLearn 2020