 Hello everybody. Thank you for coming here. So my name is Conrad Gavda and I will be giving introduction to quantum computers. Alternative introduction because I believe the quantum computers are explained either for children from kindergarten, which is okay, or for scientists, which is also okay. We need something for us, for programmers. And so my name is Conrad. I live in Warsaw, Poland. On daily basis, I'm a cloud evangelist for Orange, which is a telco company, but also has its public cloud based in Poland. So in fact, if you open its web page, it's in Polish. You'll see my face somewhere there on that page. But besides being cloud evangelist, I'm also a Python developer and a trainer. And I'm also a host of a podcast, but it's also in Polish. So I'll not talk much about that. Let's jump into this vast topic of quantum computers, which have enormous power and quite peculiar limitations. So I try to explain quantum computers to one of my colleagues. And when I've done all the talking, he finally said, okay, so in fact, they're like analog computers. And he was quite right. This is quite reasonable opinion. And let's try digging it just from that point, because analog computer or rather analog calculators, calculation devices were known for centuries. In 19th century, 19th century, Lord Kelvin created differential analyzer. That was a machine that was able to do analog computations. The inputs, for example, were the positions of the wheels. And he used to sum them up just by using a rope. And then later on, he also introduced multiplication. He was able to multiply two analog values. So in this case, the carrier of information, the analog output, is just how much of the rope is sticking out of the machine. That's an analog variable here. When I was preparing for this very session, I'd done a bit of research and I found this guy, Leonardo Torres Quevedo. Have you heard anybody heard of him? No. Well, he was born in this area, studied in Bilbao, and then designed or even invented many wonderful things, also including his own algebraic machines, so analog computers. Do check him out, a wonderful, wonderful person. And he even done some early electronics. But then the electronics got more advanced. And we've got analog computers that were electronic devices. And this one is a photo from Technology Museum in Warsaw. So here, the information would be carried by a voltage on a wire. So you had an electrical wire and the voltage could be zero, some maximum, like five volts, for example, and anything in between. And in fact, I would like to point out that that's a real advantage of those computers that on a single carrier of information, you had any state you would like between the zero and the maximum, I could say infinite number of states, but that wouldn't be really physically correct. So those are analog computers. And we'll come back to them in a minute. In the meantime, people also decided, okay, let's go digital even before electronics. And sooner or later, the idea of bits came out. So as you know, bits could be zero or one. So on the same wire, we just discard any state that is between zero and maximum. And we either pull it down or pull it up. And how do we today play with this information on a very basic level? We use gates, logical gates. And you see the symbols here. So each of those has inputs and output. It senses the voltage that is on each input and it produces voltage zero or those five volts, for example, on its output. And people figure out that you could build quite advanced things out of those gates. So for example, you put in such a schematic and you're able to add two numbers, four bits numbers. Or you can do even more and that's arithmetic logic unit. So it could do several different mathematical operations. You just tell them which ones using those control bits. And I would like to point perhaps two things or at least one. One thing is that this is stateless. This has no memory. Any change on the inputs is reflected on the output. So no memory here. But people also invented that, well, we can create some kind of memory. We just need four gates. We connect them like that. And we have a piece that can remember one bit of information. So that's a basic register. Okay. So we have the arithmetic unit. We have memory. We can build a computer. So now, ladies and gentlemen, in several seconds I explain you how computers today are working. So, okay, maybe not computers but processors. So basically in the processor you've got registers which store the bits that are remembered and some combinational logic like something like this arithmetic unit. And so what goes inside is that the bits of information are kept in the registers just like rabbits in the cages. And from time to time when there is a new instruction to be processed, they're led free to go through the combinational logic, perhaps change the state, and they come back to the registers. So that's more or less how the processor works. I promise I'll explain that in several seconds. I think I've done a great job. So, okay. Thank you. Thank you. We can finish now. Okay. No, that was the things we already know in the classical computing. Now, I've talked about bits. Let's talk about quantum bits, so qubits. But one big warning side here. If we're entering the world of quantum physics, quantum computations, we, as humans, have some kind of intuition. If I throw a stone, I know more or less what will happen. And it works well on lower sizes like I take a grain of sand, and my intuition works well. It works well for bacteria and things we see under the microscope. But once we get smaller into size of individual items and so on, some effects starts to be visible that are completely contrary to our intuition. So if you dig into that field, sooner or later you'll get to things that are completely not intuitive, and there is no, there may be some metaphors, but none of them will be 100% correct. You just need to take it for granted that it works that way. Okay. So if one bit stores zero or one, one quantum bit, stores an information about probability of measuring zero or one. Of course, my introduction is alternative. So I neglect some of very important things that you get from other introductions, but I think I'll show the point better for, that is better digested by programmers. So if you have a qubit, it's like with analog computers, but you have zero chances for measuring one, so 100% chances for measuring zero, and 100% chances for measuring one. And you could be anywhere in between those states. So this is the story about the Schrodinger's cat that he could be into dead or alive at the same time. By the way, Schrodinger came with this main metaphor to show how crazy is the idea of superposition, which is the physical phenomena, but that stands behind that. So scientists like to show the state of a single qubit using such a graph. So you have zero in the fancy brackets on top, one with fancy brackets in the bottom, and you use a dot or a point to show what's the current state of this qubit. So if the dot is here, that's zero. So you're sure to measure zero out of that. If it's here, it's one. You're sure to measure one. And it could be somewhere in between. So how to read that one? It's quite close to zero, so there are quite high chances for measuring zero and quite low chances for measuring one. So you could imagine a slider, so that this qubit inside is a slider that holds some analog value. Or a different way of showing probabilities is this bar chart, chances for zero, chances for one. These are not quite probabilities, but they're something similar. I'll come back to this in a moment. There is also another dimension, for some reason it's a sphere, not a slider, because those values can be complex numbers, but for my speech today, we'll just put that away. We don't need that. So if you decide to dig deeper into quantum computers later on, you'll get a new variable for three. Okay. So if we have four registers, A, B, C, and D, it's like having four sliders between zero and one. So okay, we've got quantum computer, which is in fact analog computer. People done that in 19th century. And moreover, those qubits store, let's say, this analog information, and you can manipulate that. You can do operations on that. But at the end, if you would like to have a readout, you need to do a measurement. And this comes to reading zero or one. So this is why I'm talking about probabilities and so on, because they store some analog value. But in the end, if you'd like to have a readout, you do the measurement, you only get a single bit out of qubit. So it's quite a bottleneck. You have a vast analog area, but then quite a narrow escape when you only read zeros and ones. So that's not, doesn't look that good. But here is the fun part. Let's imagine we have those four registers. And the question is what are the chances, what is the probability of measuring some value, like 004. So A, B, and C are zeros, D is one. So typically, we would think about it like it's a probability of measuring that, that, that, and you just multiply them, like they're independent events. And you could write down all the table of which probability is for measuring what state. Like here is measuring 0011 on the consecutive outputs. Well, so that's not the case. In quantum, in quantum computers, by using the physical phenomena called entanglement, you end up with possibility of having different probability, different chances for each of the measured state. So here is the place when it's not that intuitive. Let me just tell you that if you have four quantum registers, so four qubits, you end up with 16 analog variables that you can play with. And now, now could, it could be a wow moment. If you realize that, okay, with four qubits, you've got 16 variables. With 10, you get 1000 and so on. With 266, you get an amount of analog variables that is roughly the number of atoms in the known universe. So that escalates quickly. Okay, so that's great power. But with a great power comes not only great responsibility, but in this case also great limitations. One of them is this bottle neck, so you can only measure one bit per qubit. So if you have this number of atoms in the universe for each of them, analog variable, then you only, and you can do computations on that, but that's what you can read out of that is only 266 bits. The other one is quite obvious. If those variables are probabilities, the probabilities need to sum up to one. Well, that's obvious. The other painful thing is that you have quite a non-obvious set of operations that you can do. They're quite limited and quite peculiar. For sure, there need to be reversible operations. What does it mean? If you have register A, you could not just say set register A to one or copy a value of register B into A, because you lose information what was in A. You cannot just reproduce it. Instead, what's possible is for programmers writing something like XOR equals B, or just swapping values of A and B. That's one of the cases when you have a great power, but also great limitations. I would like to summarize the things that I already conveyed to you. We have some kind of machine, a quantum computer. It exposes to us the programmers qubits, quantum registers. Out of that, we know that we can measure different states out of that, and each state has its own probability. We know that they don't need to be independent events. In fact, we could draw any shape here as long as the probability sum up to one. This is what I already have told. Now, the engineer scientists figured out that probabilities are not the most convenient way to work with those qubits. There is something in between this free space that is more convenient. This is probability amplitudes. They're also called state vectors that will appear later on in the slides. What's the relation between those probability amplitudes and probabilities itself? As simple as that, you take absolute value of amplitude, square it, and you get the probability. You could say amplitudes are something like square roots of the probabilities. There are also complex numbers. We're not touching upon that, but because of this squaring in absolute value, well, one thing appears, they could be also negative, and we will use that. They can have minus values. This is a great advantage. This advantage is that they do not sum up to one. They squares sum up to one, so it's not that easy to keep track which what should be the sum, but you'll see that later on. We know how to store the information, what is the information, now how to play with that. Let me tell you a story. Long time ago, there was a group of great pioneers that were inventing quantum computers, and they thought for classical information, we've got bits and gates. Here we will have quantum bits, so we will use for them quantum gates. Perhaps that was not the best idea for naming, but it caught on, and people are using that. If you're talking about something that's going to run on a quantum computer, most probably you will see a circuit made out of quantum gates, so those squares are those funny figures like that, are quantum gates. It works like that that on the left we have inputs, on the right we have outputs, and each of those lines is one qubit, like one register, so they'll always be straight on that schematic. It's quite like musical stuff for nodes, but instead of writing nodes, you write gates here. Why do I say that's perhaps not the most accurate naming? Well, in fact, in most implementations, the qubit stands in place. It's some physical thing that is always in the same place, and we only apply some operations to that, so that's not the thing you do with gates. You put information through gates, and here it's like throwing the gates at the rabbit of information. I mean, I hope the rabbit likes those gates. Okay, so this is my point about gates. In fact, it doesn't work like gates. In fact, this is like applying some operations, a bit like running instructions on a processor. Okay, and what are those gates? There are some examples of the most commonly used gates, scientists love to use on matrices. So everywhere there will be matrices, and if you decide to go deeper into that, you will go into them. For my speech, I'll skip them, and let's go through some examples. And that might be a bit quicker. My goal here is not to explain every simple gate just to give you a feeling of what's the kind of play here. So x gate is something like not operation. If you get qubit set totally for zero, you would set it for one. If it's one, it's zero. If you get 10 chances for one, you get 90% chances for one. So using a slider, it would be something like mirroring it. But sliders, they're good for probability, quite poor for showing amplitudes. For probability amplitudes, let's stick with this bar chart. So you just swap the probabilities of zero and one. If you have a set of multiple qubits, in this case, there were both zero. We applied not x gate. This one is still zero. This one is set to one, as simple as that. And here is the question of naming. How do we name this state? Because we would like to give it a binary name like one zero or zero one. This is something we will read out of that. So which bar chart is correct for this output? And in different frameworks, they use different notation. In Qiskit, that we'll be using, for example, further on, the latter is correct. So this digit represents the measure, something we measure on the qubit zero. And the next qubits are written on the left side of that. Okay. So that was quite a simple, just that the initial state was quite simple. Let me show something fancy. So this is a, on this schematic, we have a black box that sets amplitudes like that. It have no special sense. They just look good for showing examples, as for me. So let's apply this gate for qubit zero. What do we get as an output? We get amplitudes like that. What happened here? Those bars were swapped and those bars were swapped because the qubit one, so this measurement, if it's zero, it stays zero, if it's one, it stays one. But we swapped the probabilities regarding the other qubit that has the gate applied. If, on the other hand, we applied on qubit one, what happens is we get that. So also the bars are swapped, but different ones because now we're playing with the qubit number one. And what happens if we apply this gate to both of qubits? Well, you could follow the arrows and what you get in the end is something like that. So in fact, applying not to all of the qubits in our set just makes a mirror. So we had this growing shape, now we have this falling shape. So, okay, that was the not gate or the x, probably x gate. Let's go to some more advanced one, Hadamard gate, which scientists love this one. From zero, you get to 50% chances, so equal chances for zero one. For one, you also get to that state. So wait a minute, I said that those operations need to be reversible, how on the earth that's reversible? What do you get out of 50%? Well, here the magic is that you come to zero, if you go to zero, if you came from zero, you go to one, if you came here from one. How that's possible? Well, I mentioned there is some kind of trick and let's see it on those charts, on those ball charts. So if we have 100% set for zero, you will get equal chances. That could be expected. We just get that multiplied by one by square root of two and that one, which is zero, multiplied by one by square root of two. Why this square root? Because normally, with probabilities, you would multiply by half. Here we have amplitudes, they will get squared, so we need to do like square root of half. That's square root of half. And for this amplitude, we get square root of zero and here is the trick, minus square root of the amplitude of one. Here it was zero, no problem. But here, if we take the 100% chances for one, we get that. So this is simple and that one, it gets square root of half times zero and minus square root of half times one. So both states give you 100% chances for either state. And don't believe me, that's reversible. Check it by yourself. So get this state, use the same instructions, that's always the same operation and you'll get zero. Get that, use the same operations and you'll get one. Okay, how it works, we have several qubits. So let's apply this to the qubit zero. So it's quite similar than that I've shown on the not operator. I mean, you imply this in parts. So here, because the qubit one stays calm, nothing happens. So if qubit one was zero and zero, it stays zero, only the qubit zero would possibly change here. So we apply this arrows with this multiplications on that part and separately on that part. Okay, let's speed up a gate that uses two qubit qubits and in fact, this is the one that could produce entanglement because you could not mix probabilities of two qubits with only one qubit gate. So it is called control not, it has control and target qubits. And it's something like applying the not gate, the x gate, but only if the control qubit would be measured zero. And it's hard to explain on the qubits itself, it's easy to explain using those bar charts and amplitudes because okay, so we have our initial state and we applied that gate, control bit is bit number one, qubit. Control qubit is qubit number one and the target qubit is qubit zero. So what happens is we have like half of the not operator. Here in those states, qubit one is set to zero would be measured zero, speaking correctly. So nothing happens. In those states, qubit one would be measured as one. So this is when the not gate would be applied as simple as that. Okay, so there are many more gates, but you know more or less how the gates know, how the gates work and how we write code for that. There are many frameworks. I guess most of them use Python, not all of them, but most of them. And you use it like that. So you create an object and you apply gates to that one by one. So in fact, it's something that you just write a set of simple operations that will be applied. For me, it just reminds about assembly language. Here is where there's the place when you have registers and you apply very simple operations. So in fact, using, for example, Python is great because you have many helpers, four loops, and so on. You can draw images. But it's quite similar to writing assembly language. And in fact, there is, under the hood, there is a quantum assembly also in Qiskit. And it looks quite similar to the code we write. We got many helpers, but it's quite similar. The other fact I would like to tell you is that every quantum program we write, you could draw a schematic out of that, a quantum circuit. And every quantum circuit could be expressed as a matrix. Every. And the size of matrix doesn't depend on number of gates. It only depends on number of qubits. Or exactly, number of states. Well, that means for three qubits, we have eight by eight matrix. And for 10 qubits, we'd have thousand by thousand matrix. And so on. But mathematicians are great for showing infinite matrices. So that's you'll definitely meet if you're digging into that subject. So one of my key takeaways here is that the code you would write using some frameworks, or the assembly language for quantum computers, or the gates on the circuit, or a matrix can reflect the same code, the same behavior. They're interchangeable. They think that is a bit aside as a graph of amplitudes, because that's only an example of for given inputs. But for me, it's quite useful example. And I would like to see that as a driving wheel and the road that you see. You take quite representative example and play with the gates or with a code or whatever to manipulate this example to get the results that you would like to be measured. Okay. So what are quantum computers today? There are present. There are reality. Most of them are universal gate based quantum processing units. There are other types, but I'll not focus on them. And they're a bit like digital cameras. I mean, the number of pixels or here the number of qubits is really important. But not only that. One of things is the number of the number of possible entangled qubits. So in some quantum processing units, you could entangle everything. In others, you could not so you cannot get the number of the atoms of the universe from 266 qubits. And the other things, like in the cameras, is noise or errors. And there are a lot. There is a large problem with that yet. And people fight with that on the level of algorithms. The simplest way is to run your algorithm several times and you see what are the typical answers that they should be correct. The other one is that some physical devices introduced inside physical qubits, which those have a lot of errors. And they're also logical qubits. There's less of them, but they have less errors and you can do computations on them. And also I've got a question. Why do you build quantum computers? We've got the equations. Can you just simulate them? And the answer is it's like the fake grass on the stadium. To some extent, you can use that, but there is a line when there's not possible. I'll use the image from AWS. It's already three years old. It might have shifted a bit, but only a bit. The shape is correct for sure. So this gray area, this is number of qubits. This is error rate. This gray area is something we can simulate today. So we can simulate tens of qubits, but not hundreds of qubits. And the orange area is the place that we know if we have quantum computers that can do that, that many qubits with that little errors will change the world. There are already algorithms good for that. We're looking for less demanding algorithms and building better quantum computers. Okay. And speaking about building the computers and AWS, so there are several services, cloud services available today that you could use and make use of physical quantum computers. So one of them is in the Amazon's cloud and when you open the bracket service, you'll have the list of them and also their availability. The top three ones are in fact Amazon's simulators. And when I took the screenshot, the other ones were not available because they have shops, they have their opening hours. If you open details of each of them, you'll see it's small, I know here. But there are opening hours of that computer, number of qubits, and also you can open the architecture. So here are 25 qubits and you could entangle all of them. So that's good. That's great. But there's also quantum computer with 79 qubits, much more. But you can entangle only that pairs. That's much more tricky. But for some users, it just may be great. Okay. I promised, I will show how to do that, how to use that service. So basically, you need to have AWS account. You need to have it set up on your computer so that you can use command line and I'll skip that part. I think there are too many tutorials for that. Then you need to enable the service on the website and it's just a matter of clicking several boxes. You can download the slide later on and check what to click. There are five clicks you need to do. And then the fun part, so writing the actual code. So I'll be using Qiskit, so I need to install some Python libraries and that's that pre-recorded demo. I have no courage of showing that live. And then, and you'll get the code in the slides, not the videos, you'll get the code. So I do the imports and I create an object that will represent my circuit. And that will be in a circuit with three qubits. Now I get, I put a Hadamard guide gate, so H on qubit number zero. And then I'll put control not for the pairs of qubits. So qubits number two and three will be, qubits number one or two, will be controlled by qubits number zero. And let's just draw this circuit to know how it looks like. So this is all on my computer so far. I use the plotting library to show the circuit. Let's launch that. And that's how the circuit looks like. Yeah, one Hadamard and two controlled not. Okay. Let's try to simulate the circuit. And for the beginnings, I'll simulate that on my local machine, but using Amazon's library. For the sake of time, I'll scroll a little bit. And I order 1000 of simulations to be run just to have some statistical results. And then let's draw the histogram. So this will show you not the probabilities, not the amplitudes, but how many states were measured, how many measurements came out with that state and how many with that state. So only the measured states are shown, all zeroes and all ones. And you see the numbers, how many times this was measured. Okay. So let's go forward with that. And let's use Amazon's infrastructure so I make sure I'm on a proper region. And instead of local simulator, I'll use a device. For the sake of time, I'll scroll that. So I'm using a backend and which backend to use. So I go to the list of devices and I copy the name of the simulator. So this is SV1. I insert that. Okay, let's use that. And in the end, I've got quite similar bars there. Now I've changed that name to fast with clicking. Okay, so, okay, we've got, I've closed the results for the simulator. And I copied the name of the real actual hardware that is a quantum computer. I paste that and run the same with less computations. And I'll skip forward. You know what happens at timeout happens. Because you need to wait several hours, for example, on that computer. But I'll print the name of the job and later on in the next video. In the next video, I can check that all after several hours. It was completed. So I just tell my circuit to retrieve the measurements and use that idea, the idea that I copied before, run the program. And that was, that's the real output. And what's interesting, you could see that there are errors. That there are errors in there. And there are states that should not happen just because of errors. But most of the measurements are those two correct states. So one final takeaway I would like to give, because I know we're short of time, is what's the future of quantum computers? Because once they get bigger with qubits and better with errors, they'll be great for breaking encryptions, for optimizing problems, solving equations, perhaps for artificial intelligence. Many people think so, but it's not 100% theoretically proven that they were useful. But we think so. And if you think about those three areas, for me, it is something like graphic cards. I mean, GPUs are perfect for that. And my image for how the future of quantum computers will look like is that there will be something like GPUs. How many of you write code for CUDA or other GPU frameworks directly? Yeah, we've got one person. Great for you. But that's a niche thing. So my guess is that writing code for quantum computers will be a task for few. But the few that will do that will change the world. Thank you very much.