Quantum computing, Computing, Quantum mechanics, Qubit, Research Project with IBM Qiskit | Part 7: Single Qubit Gates 1 | Jay Shah
What are these, what are what are these gates and what they do? What is the mathematics behind them? What are the basic states? What is direct notations? All of that in this video, so let me just clear this first, so let me go to the biscuit documentation, so this is the textbook of biscuit that introduces you to some of the basic basic things from from basics, up to the advanced things. So what you can see here this is the x gate, so note that all the gates – you see, as you can see here, all these gates are actually denoted by a matrix. All of these gates have their own unique metrics that denote them, and i can minimize this so. Similarly, this x gate is denoted by this matrix. This 2 by 2 matrix two cross true matrix with these four entries uh. This denotes the x k so uh, initially, a cubit l is in this distance. This is called a cat 0, and this is just this vector so so this – and this is the same thing, but the way of writing is different. So this is how you write this vector in the direct notation. These are called direct notations, so this is called zero ket and this is called one graph. So this is the track expectations or the direct notations, as we say, and these actually, these zerocat and one cat form the basic states. This is the station the computational basis, so this is uh.
Think of it as a computational is on the z axis. You uh, you will see shortly, so let me just uh click this x and visualize, so it started here in zero cat that you saw here this vector and it should end up here according to this mathematics should end up here. So when you apply x gate, it transforms this zero cat into this one cat denoted by this direct notation. So this is also simple vector with two entries: zero one and the other one was one zero. This was zero k and this is one k and what happens is when you apply x, gate to zero cat. Initially, every qubit is in the zero okay in that state, uh in fiscal. So when you apply so when you just start your function, initial state is here this arrow. This is pointing here and when, as soon as you apply the x gate that transforms that vector into the 1k – and this is the driving mathematics, simple matrix multiplication, so only take away – is this matrix that it denotes and this operation? So you should ask me: what happens when i apply x to 1? It will be the converse, so let me just uh show it. Let me just close this and clear so when i apply x once we now know that it will transform the 0 or get state to 1k state. So let me apply this again and see what happens so i will visualize it applied and lets see what happens so previously.
It stopped here, but this time it wont and lets see where it goes and see. It gets back here to the initial position. So what it means it means that when you apply x to the zero cat, it transforms it the state to one cat and when you apply the x gate to one cat, it transforms it back to the zero okay, so thats, why we call it the uh? The bit flip game, so, if i show you flips the state of a qubit, and this is the command that you use for it just dot x, this circuit is the instance of quantum circuit class and we will see what is this class later in one of The videos, but we realize that this circuit just denotes the quantum circuit and we just apply xk, so this is the entire command that you use to apply x, gate and cascade. So lets close this, let me clear so we are back in the initial state now, and this is the symbolic skill that you can see, so you can see it here and as expected, so thats just what we saw. So let me apply y and let me visualize what happens so its going its going and it stops it stops on one but realize that the plane of rotation was different in the two cases. Let me show you again, so you can keep a watch this time. So when i apply x, see the plane, rotation is perpendicular to x, axis, display right and okay.
We are done so ill clear. It again ill apply, y and well visualize. This time we are moving in a plane perpendicular to the y axis. So whenever you apply a k x or y or z, the rotation happens in the plane, which is perpendicular to that axis. So again, well end it up in this one state. Let me uh, let us show, let me show you the mathematics that drives it y and z, so this is the matrix that denotes it. This is this denotes y, and this involves the z lets, keep z apart from for a moment, uh y gate uh is denoted by this, and it will also end up uh in the different uh in one kit, but you can see here. Let me just scroll a little up and see that theres the difference in this uh denoting this x gate. So this is how you express it in another format. It is the same matrix but being expressed differently and uh. If you see why there is a difference in the way of representing we have this, i here this is called relative phase. Well, see that – and you can think of this is a sort of reason that differs in uh differences, so you can see here. We dont have one we have minus. I and i, as we have complex entries here this i uh denotes the complex numbers. So ah complex number is a plus ib, so a denotes.
The real part, the real number and plus ib, is denoting the imaginary part. So b is the imaginary number, but both of them actually uh part of this state, so you can see x, was denoted by these all the real entries we had the 0 1 0 1 0 entries, but here we had complex entries minus i – and i so This can be thought of as a reason why the rotation was different and y x and y are not the same gates, so they uh end up. So, despite the end result was one get so again. Let me get back here lets see what happens when i apply this two times lets see one here. We know that that would happen again going up and it should be zero. So again we see that uh. The same thing happened: uh, it again got back to zero cat. What happened uh by applying uh xk twice, but the rotation was different and uh x and y are therefore not the same gates. Okay ill just close this clear this and you can see this exactly again. This is the difference right now. If i apply a z, the rotation should be perpendicular uh in a plane which is perpendicular to the z axis. So let me see if something happens, nothing happened. Why uh, because its not possible to move in uh in this plane, perpendicular to uh z axis, because this is the z axis that you are seeing, so we first need to get into the into this plane.
If you want to see z in the action so lets, uh keep z aside and talk about another gate. The h denoted here also known as the header margin, so hadamard gate is denoted by this matrix and when you apply to 0, it ends up in 12 plus 8. What is this we will see and when you apply it on one state, it will end up into this. So lets see what is this plus and minus 8 just a second. So initially our circuit is in the zero cat state. We know that so lets just apply this, then we should end up in the plus state plus k state. So this state that you can see here is called plus state and is actually a superposition of zero kit and one get so it half zero cat and half one cat, as you can see here right its in the midway of both the states and also realize That now we are, in this plane, z, plane the plane, which is perpendicular to z. So now, if i apply a z gear, something should happen for sure. So let me close this again. Let me clear this. I apply h. I applies that and now something should happen, so we know that it will end up in the plus state here. Nothing surprising lets see what happens next and now you see the rotation is happening. So this is this is how is that it works? So i hope you got a good visual understanding of these gates, so the rule of thumb or the takeaway is that the rotation will happen only if the state is in a plane which is perpendicular to that particular axis, and these gates just make a x y And z, rotate the vector, if its in obtained perpendicular to the respective axis by pi, radians, so 180 degree rotation, so applying twice, gives you 360 degree, rotation and thats.
Why you end up on the same uh thing where you start? So if you apply on zero, get you apply x twice you end up where you started and thats the reason, because a 360 degree degree rotation will definitely make you land where you started atmosphere, and what is this sphere basically that you might think this is a Block sphere – and this is a way of denoting uh the states of a qubit uh – we will go into details later, but think of it that this vector that you colored vector that you are seeing is just denoting a state. This is the state of the qubit right now so and it denotes how the transformation is taking place for that particular qubit. So i hope you like this video and in the next video we will see these remaining games – r, x, r y r, z, s, s d, t t d, and what do they mean? What do they do? What is their functions will see that in the coming video – and i hope you have understood what are x, y z and h gates, and how do they work? If you think you have not understood the mathematics deeply, so its okay ill ill be trying to come up with a series where we will just focus on the math. But here you know something like how these rotations happen and once you complete these series uh this series. First series: you will be having a tool that will help you to experiment uh.
You know so you can just freely visualize whatever you want on the block sphere and we will go into the details of quantum mechanics later after we complete this series, so so it will be uh. You will be able to visualize everything much more easily when we will talk about math and we i know we are. We have talked about math in this video as well the various metrics and uh. It was just simple, matrix multiplication, but we will so much more that uh into much more depth in the separate series on quantum mechanics where we will talk about the different phases and what are density matrices. You know what are the various of we will talk about. Various quantum algorithms and some interesting uh stuff, so i hope you stick to the channel in this series. You also come back for the other series, uh, so thats it for this video. I think this video is pretty long, so i hope you like this visual representation of all the single cubic gates.