On TikTok there is a dog named Noodle. Now each day Noodle either wakes up with bones
as seen here, where he has enough strength to stand, or with no bones where he flops
back down onto the bed. Noodle has become kind of a guiding force for the daily mood of the
internet. On a bones day people are encouraged to get out of bed and make the most of their day,
maybe take a risk or try something new, whereas a no bones day might be the time to take it easy
and think a little bit about self-care. So what does this have to do with quantum computing?
Well almost nothing but I did notice that the chance of a bones to a no bone day does seem
to be about 50 50. That's the same chance that a qubit in an even superposition of states 0 and 1
would have of being measured in either state. I recently found out that quantum
computing is actually further ahead than where I thought it was and in fact right
now anyone can submit code to be run on a real quantum computer so to figure out how to do that
I set out to ask a real quantum computer 'Bones or no bones?' The answer might come from some
point of deep intrinsic truth about our universe or maybe it's just pretty close to truly random.
This video is sponsored by Qiskit which is IBM's open source quantum computing software.
With Qiskit we can use the python coding language to actually program circuits and algorithms for
a quantum computer. IBM also give access to the hardware having already built quite a few quantum
computers. These are currently only relatively small and used for experimental purposes.
IBM recently unveiled their largest one to have 127 qubits but we're still away
off from these quantum systems being large enough to outperform the classical computers.
IBM have made their smaller five qubit quantum computers free for anyone to use you just have
to submit your code through the IBM quantum lab but before I could run my little experiment I
first had to learn just enough about qubits, quantum circuits and programming with Qiskit
to actually write my program and I'll quickly fill you in on what I've learned.
All right so it's important to know what we're dealing with here.
In classical computing information is stored using bits and these can either be zero
or one, they're binary and they're like tiny little switches.
Now bits all act independently of each other and we can manipulate bits using logic gates.
There are quite a few different kinds of logic gates but for example
one of them is the NOT gate. The NOT gate can be drawn like this and it would turn a
zero into a one or a one into a zero. Now when we're dealing with quantum computing we're dealing
with something called the qubit and these are just quantum bits. We can represent qubits as an arrow
pointing on the surface of a sphere. Let's see if I can draw a sphere in here.
I'll actually draw a couple.
All right so if we have say an arrow pointing on our sphere and if that arrow is pointing
straight up well that qubit would be in the zero state and if the arrow was pointing straight down
then that qubit would be in the one state. But the arrow can also point anywhere else on the sphere.
Our arrow could point to the side like this and this qubit is in a superposition of the zero and
one states. Now when you measure a qubit you do still only get out a zero or a one as the result
and that's because measurement collapses the superposition. If you were to keep measuring the
same qubit again and again you would get the same result. It is only before measurement takes place
that a qubit is able to exist in multiple states at once which gives it the ability to do things
that classical bits can't. That means if you've got a program that's working with qubits you'll
try to keep measurement to the last step in the process. If we were to measure this superposition
here we would find that because the arrow is pointing halfway between the zero and one that
there would be a fifty percent chance of returning a zero upon measurement and a fifty percent chance
of getting a one. If instead the arrow had been pointing maybe more towards the zero that might
have given an eighty percent chance of a zero, twenty percent chance of one. And likewise down
here this arrow might have given eighty percent chance for one, twenty percent chance of a zero.
But physically how do you make a qubit? Well there are actually several types. It's just any
two-state quantum system such as the spin of an electron or the polarization of a single photon.
IBM uses superconducting transmon cubits which are a superconducting material
on a silicon chip arranged so that there is an artificial atom with quantized energy levels
and then kept extremely cold in a ground state of zero.
Radiation can be applied to excite the qubit to the one state or to enter a superposition.
I spent some time on the Qiskit online textbook learning the absolute basics and I'm pretty happy
that I've managed to get some working code. I've just written it on the IBM quantum lab server
so you don't even need to download anything if you don't want to. My code starts with importing
everything we need and then I also got it to print a list of the available hardware that I can run
the code on. It lists the five qubit quantum computers I can use as well as some simulators
which make more sense when you're just testing the code. This little code here is setting up
my circuit it's actually fairly simple and there's a diagram here of what's going on.
q is my one qubit and all qubits start initialized at 0 which is their ground state but I want it
to be in a 50/50 superposition so i've applied a quantum logic gate that is the H symbol here. It
is the Hadamard gate. Now when it comes to quantum logic gates there are some that are similar to
their classical counterparts. For example there is a quantum NOT gate and it's represented as an
X like the classical NOT gate that we looked at. This one has the ability to turn a zero
into a one or a one into a zero. It essentially flips the sign and we can even see how this is
represented physically with our sphere. If inside our sphere we set up some axes so maybe a y there,
an x, and up and down to be z, then you can actually see where the quantum NOT gate gets its
symbol the X from. It actually flips the arrow over the x axis. So if we had a qubit that was
say a zero, meaning that the arrow was pointing straight up, then if it was to be flipped across
the x-axis it would come out looking like a one. Likewise there are some quantum logic gates called
y and z that flip it over those axes too. But the H gate that we want to use in our circuit
is kind of unique to the quantum world. After passing through an H gate, a qubit that started as
zero will have a fifty percent chance of being zero and a fifty percent chance of being one.
But the H gate isn't just a randomizer, for example if you were to pass a qubit through
two H gates one after the other it would basically undo the effect and you would get back whatever
value you started with and that's not behavior you would expect from something that's just
randomizing the results. Something else is going on here. What the H gate is actually doing is
applying a rotation around the line between the x and the z axes so this line in here.
Now you might be able to see that if an arrow had been pointing straight up representing zero
then flipping it over this line would put it here halfway between zero and one meaning it has fifty
percent chance of being measured as zero and fifty percent chance of being measured as one.
Then if you were here and you did another rotation back around the same axis
so you've applied your second H gate well you would actually end up back where you started,
back at zero and so you can see why two H gates do undo the effect.
The last component in my circuit is a measurement to collapse the superposition.
I'm first going to run the code on the simulator. I've set shots equal to 1 which means we're
going to run this one time and we'll get one result out of our qubit. It'll either be a 0
and in that case it'll be a no bones day or we'll get a 1 which will be
a bones day. So running this now it prints out that the result 1 was obtained one time and that
makes it a bones day. Running it again we see that 0 was now returned as the result. But let's
increase the number of shots so that we have more than one result. I can increase it to a hundred.
This time it says that the result 1 was returned 45 times and 0 was returned 55 times so we're
getting close to a 50/50 split but we're not quite there yet. And just to see what happens let's go
for a hundred thousand shots, all right getting even closer to 50/50 here. I think we can be
pretty confident that this code is getting us into that superposition that we want. Now I think we're
ready to run it on the real quantum computer. We can come on to the Quantum Lab dashboard
and see all of the quantum computers and whether they're online and what their queues look like.
We will need to join the end of the queue for whatever job we want to run so hopefully we can
find something where the queue is pretty short. These are actually their large machines, the 127
cubit one up there in Washington, but we're going to want to use the smaller five qubit machines.
In fact what we're doing only needs one qubit really. Looking here the machine in Bagota has
the smallest queue with only seven pending jobs so what we'll do is we'll copy that
name take it to our code and tell it that that's the back end we wish to use.
Let's just do it with one shot because we want to find out what kind of day we're going to have
and if we run this it will send it off to the quantum computer.
I can check up on it in this tab here which are all the jobs that i've sent. It says an estimated
time of two minutes till completion but for you after the edit that might be a lot shorter.
And we've got our result, it's a bones day! It took 2 minutes and 21 seconds to get the
result. You can see here it says that a 1 was measured with 100% probability and my
code returned that it is a bones day. That's wonderful news for all. Do something amazing,
go learn quantum computing, maybe work on that side project or write some new year's resolutions.
Just so you know, whenever this video reaches you is when your bones day applies
so even if you're watching this in the future it applies to you too. We can send another request
off with more shots maybe try 10 000 this time just to check our distributions. When running
things on these real quantum computers, noise is also something that you usually have to take into
account. I think for us since this is so simple and just with one qubit it doesn't really apply
but more complicated programs would really have to consider noise in their results. Our result is
in in six minutes 39 seconds to say that 0 was returned 53% of the time, 1, 46% of the time.
Mine is a pretty trivial use but there are lots more of those more complicated algorithms
on Qiskit that you can use and that actually take advantage of the quantum abilities. For me this
is just a really cool way to learn but it can also be practical if you're actually wanting a
career somewhere in quantum computing. Here is a current active job listing from IBM quantum,
it's for a Qiskit researcher. You can see some of the responsibilities here. It may be no surprise
to see that in required experience they want you to have done some research projects already
using Qiskit. They also want you to have working knowledge of quantum computing
and at least a master's degree. If working on quantum computers in this kind of way is something
you think you'd like to do then learning something like Qiskit is really going to help you get there.
Make the most of your bones day maybe commit to learning a skill like this
or applying for a new job. Thanks for watching this video and thanks to my
Patreon supporters. A special thanks to today's Patreon cats of the day Stinky and Sprinkles.