# Getting started with the IBM Q Experience

We are now in an age when you can use a quantum computer from the comfort of your own home. All you need to start your quantum journey is the IBM Q Experience.

In this guide, I’ll show you how to set up a simple experiment. Specifically, I’ll show you how to set up the first puzzle in the game Hello Quantum.

**Hello Quantum**

*A puzzle game designed to teach you the basic principles of quantum computing.*helloquantum.mybluemix.net

To go to the IBM Q Experience, all you need to do is click here. This takes you to a section known as the composer, which should look like the image below.

The composer is where you write your quantum programs. By default, it starts you off with the five qubits of a real quantum processor, known as ibmqx4. But let’s instead focus on something a bit simpler. Let’s set up a composer for just two qubits.

To do this, we first click on the ‘New’ button at the top right. Then we need to choose a name. In this example I’ll set up the very first puzzle in *Hello Quantum*, so I’ll name it after that.

The next job is to choose whether to work one of the real devices, or whether to run simulations of something different. We want the freedom that the latter gives us, so we click on ‘Custom Topology’ at the bottom.

Finally we need to change the number of qubits and bits that will be used. In *Hello Quantum* we are looking at processes where two qubits get turned into two bits, and so we need two of both. Once that’s done, we click ‘Set Topology’ at the bottom.

Now we have our composer to play with.

The boxes on the right represent different operations that we can do to our qubits. All we need to do is drag and drop them onto the lines. To set up the initial state of the first puzzle, we need to drag and X over to qubit 1.

And that’s the job done! Now let’s see if it did what we expected.

The first puzzle of Hello Quantum looks like the image below. The bottom circle for the qubit on the left is white, which means it outputs a `1`

with certainty. The bottom circle for the right qubit is black, which means it is certainly a `0`

.

The way we get the outputs for the bottom circles is using the measurement gate. This can be found by scrolling down in the gates section on the right.

To look at the bottom circle of both, we just drag the measurement gate over to both lines. When we do this, it’ll ask what name we’ll give to the resulting bit. Just press ‘OK’, because the default choices are the best ones for us.

Once both gates are in place, it’s time to get the results. Do this by clicking ‘simulate’.

If you haven’t signed in yet, this is where you’ll have to do so. You can set up a account just for the IBM Q Experience, or sign in with your existing social media accounts.

Once all the admin is done, you’ll see the results screen. This presents your results in the form of a histogram.

In this case, there is only one possible result. By looking underneath the bar, we can see that this is the result `10`

, which means a result of `1`

for the left qubit and `0`

for the right one. Exactly as expected!

Now let’s check out the top circles. For this we need to change questions that we ask the qubits.

Now we get a histogram with a bit more going on.

There are now four possible results: `00`

, `01`

, `10`

and `11`

. The simulator runs the process 100 times and finds that `11 `

comes out 25% of the time, `10 `

comes out 23% of the time, and so on.

If you run this yourself, you’ll almost certainly find different numbers. They should actually all come out with the same probability of 25%. But since we use only a finite number of samples, we’ll always see statistical anomalies like this.

In any case, we are seeing both qubits randomly giving an answer of 0 or 1. And that’s also exactly what we expect for the first puzzle of *Hello Quantum*.

Now let’s do another example. We’ll set up the initial state of Level 4 - Puzzle 1.

The easiest way to do this is to first make the *target* state*,* and then work backwards to the initial state*.*

The target state has a black top circle for the left qubit and a white top circle for the right qubit. If you have played *Hello Quantum* and read the ‘Learn More’ section, or if you have read this article, it will hopefully be clear that this can be set up as in the image below.

To get from this to the initial state of Level 4 — Puzzle 1, all we need is a CZ. To get one, first tick the ‘Advanced’ check box in the gates section, and then scroll down. You’ll find the CZ under ‘subroutines’. All we have to do is drag it out.

The subroutines are gates that you can make yourself, and the CZ is provided as an example. Because of this, it doesn’t get its own custom-made symbol. Instead it just gets the generic symbol for subroutines.

This is where the ‘a’ and ‘b’ come in. Subroutines for two qubits will usually do different things on each qubit, and so need the ‘a’ and ‘b’ to keep track of which qubit is which. But for the case of the CZ, they could actually be left out. So no need to worry about them too much.

If you want to run jobs on a real device, you won’t be able to use any subroutines. But don’t worry, there’s still a way to get the CZ.

The trick is to use a gate that looks a bit like a CZ. It is known as the CNOT.

One of the main differences between the CNOT and the CZ is that it is not symmetric: we have to be careful about which way around we point it. The qubit that gets the little dot will play a different role than the one with the big dot.

To reverse the roles of the qubits, we simply implement the gate the other way up.

Either way, the qubit with the little do is referred to as the *control*, and the one with the big dot is the *target*.

In this article, we gave three different explanations as to how a CZ works. There are similarly three stories we can tell about the effects of a CNOT. But typically we just focus on one: the CNOT either does nothing to the target qubit, or does an X gate to it, depending on what the target is doing.

This is almost exactly the same as our explanations of the CZ. The only different is that it is an X that might be applied, rather than a Z. And since we know how to turn an X into a Z, we can turn a CNOT into a CZ. All we need is a couple of H gates.

Using this you can do all the CZ gates you want, on any device you like.

### Hello Quantum Levels

To get you started, we’ve prepared the initial states for all of the *Hello Quantum* puzzles. Just check out the links below.