Bruna Shinohara de Mendonça
7 min readApr 19, 2021

How to learn quantum physics by programming a real quantum computer

Did you know that it is possible to program a quantum computer from the confort of your home? Did you also know that you don’t need to know quantum before you start? Come with me and Qiskit, we’ll show you!

What a crazy title! But how can such a thing be?

So, Qiskit is an IBM platform based on the Python language for programming quantum computers. The cool thing is that we can use what is called IBM’s own backends [1], which can be as many quantum computer simulators as real units, to learn about quantum computing (with the Qiskit Textbook) or to run your own circuits [2] . It is interesting to know Python beforehand, but Python is a relatively simple language and should not scare you!

This text is not intended to delve deeper into the themes, but rather to be an informal guide for self-study, explaining some possible ways to understand quantum computing, depending on your background on the topic. Of course, if you want, we can delve into that in other texts! But for now, let’s:

1 — Start with computing principles

Suitable for: those who want to understand more about traditional computing before starting.

As promised, we don’t need to start by knowing quantum! It is ideal to start with a summary of traditional computing (also called “classical”). What are bits? Why are they for computing? How to manipulate them to do what we want?

From here we can start to dig through Qiskit! In the section “The Atoms of Computation” [3], we are already introduced to the first lines of code. If you are not familiar with this, just remember to click on “run” to import whatever is needed from Qiskit, otherwise you will get error messages in all other codes.

Here, we will understand how our mathematics is based on the decimal system (powers of 10), while computing is a binary system (powers of 2). Click on the example of the number 9213 and use the binary conversion program to make it clear!

In computing, we encode everything with bits, which can have two values: “zero” or “one”. But, to do something useful, we need to be able to do operations with it, just like in traditional mathematics (add, subtract, etc.). This is possible through logic gates, a name borrowed from classical computing. We call it that because operations with these gates are logical operations: with two possible values ​​(one or zero, true or false, yes or no), we have a result. Do we want zeroes becoming ones, for example? We have a logic gate for that.

Having enough gates, we can put them in sequence in what we call the “quantum circuit” and perform any operation! Some operations are so important that we need to talk about them specifically. Qiskit now explains how an operation called “CNOT” — the equivalent of the XOR operation in traditional computing, is necessary for us to be able to perform the sum operation in the binary system. Basic, but crucial!

2 — Finally: quantum physics!

Suitable for: anyone who wants to understand how quantum physics transforms computing.

We already understand what the bit is (don’t you understand? Take a turn around to the previous section or take a look at the references!). We now need to understand its quantum version, the qubit. What is special about it, since we can do fantastic things, like watching gifs of pets or reading this text, with normal computing?

The draw of the qubit is to use the property of quantum physics called “superposition”. Roughly speaking, instead of just having the “zero” and “one” possibilities, we can now have both at the same time, at least before we do a measurement! If you’ve heard of Schrodinger’s Cat experiment, this should sound familiar. In fact, Schrodinger’s mental experiment was about overlap.

Here at Qiskit, however, we will see the idea of ​​measurement in a more concrete way: this will enter as part of the quantum circuit. This is all introduced in “Representing Qubit States”[4]. There’s no way out here, you have to face some math, but trust me, it’s worth it :)

3 — Cool, what else can you learn?

Some suggestions:

The teleportation phenomenon is the basis of communication through quantum media and also helps to understand how quantum phenomena are still there, despite the measurement. The chapter is very self-contained, so I believe it is a good phenomenon to explore right away! See the Quantum Teleportation section [6].

Remember how I commented on how quantum computing can make certain calculations faster? Well, the most commonly used cryptography today involves “prime factorization”, which is the decomposition of a number into multiplication of numbers that are prime. Why is this a security process? Because there is no fast algorithm for this factoring. This makes the process time consuming for very large numbers. In more technical terms, it is a “NP” type problem (easy to test an answer, difficult to find a timely solution) [7]. With quantum computing, however, it is anticipated that this type of process will be done in a much shorter time and this type of encryption can go into disuse. Do you want to learn about it? Shor’s Algorithm [8]

Quantum cryptography to the rescue! While the quantum computer could eventually be used to break cryptography as it is today, there is also an area of ​​physics called “quantum cryptography”. In this model, it is only necessary that the sender and recipient of the message have previously combined the sequence of decoding the qubits. In addition, it would be possible to detect whether someone is intercepting an encrypted message, since an espionage attempt would necessarily modify the message that the original recipient would receive. Want to understand it better? Quantum Key Distribution [9]

Cool, but where’s my quantum computer?

Okay, I promised, I will deliver. How to run things is explained in Quantum Teleportation. Section 5.1 and 5.2, and can be extended to other accounts. For a real computer, you must have an IBM Quantum Experience account (free!).

After logging into your account, notice these lines of code. Explaining quickly, this part of the code will find out which of the IBM computers you can use. This is my list:

On this other line, the code will request the computer with the lowest job queue to make your account.

The job_exp function will contain this information and use it to run the program, in the following code.

Calling the function, we achieved the result with quantum hardware!

And why surf this quantum wave?

Quantum computing is an area that has received increasing attention (i.e.: investment!) from large companies like Google, IBM, Microsoft, Amazon to startups, governments and individual investors [11, 12]. No wonder: a quantum computer, in theory, would allow the resolution of several problems that were hitherto computationally costly, such as the simulation of molecules, the resolution of complicated optimization problems and the much-feared cryptographic breakdown [13].

However, much remains to be improved. A common problem that the most diverse systems of quantum computing is the need for very low temperatures to have the quantum characteristics necessary for computing. The methodology for correcting errors caused by temperature and other aspects is still a very active area of ​​study. It is also necessary to find ways to increase the scale of existing computers, which for the time being cannot solve most of the problems of interest because they are limited by the number of qubits [14].

Many compare the state of quantum computing today with the beginning of classical computing, in the sense that much remains to be discovered. It is a very unique historical moment for this technology, why not try to be part of it? :)

References

[1] https://medium.com/qiskit/qiskit-backends-what-they-are-and-how-to-work-with-them-fb66b3bd0463

[2] https://qiskit.org/textbook/preface.html

[3] https://qiskit.org/textbook/ch-states/atoms-computation.html

[4] https://qiskit.org/textbook/ch-states/representing-qubit-states.html

[5] https://qiskit.org/textbook/ch-states/case-for-quantum.html

[6] https://qiskit.org/textbook/ch-algorithms/teleportation.html

[7]https://brasil.elpais.com/brasil/2017/05/19/tecnologia/1495202801_698394.html

[8] https://qiskit.org/textbook/ch-algorithms/shor.html

[9] https://qiskit.org/textbook/ch-algorithms/quantum-key-distribution.html

[10] https://medium.com/qiskit/qiskit-in-my-language-is-qiskit-73d4626a99d3

[11]https://physicsworld.com/a/mapping-the-commercial-landscape-for-quantum-technologies/

[12] https://www.protocol.com/manuals/quantum-computing/vc-investments-bullish-quantum-computing-coronavirus

[13] P. W. Shor, “Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer,”SIAM review, vol. 41, no. 2, pp. 303–332, 1999.

[14] Preskill, John. “Quantum Computing in the NISQ era and beyond.” Quantum 2 (2018): 79.