Okay. So now, let's try to understand some specific unitary transformations on single
qubits. Some specific transformations that we'll use all the time. And, in fact,
it's, it's useful to, you know, the way they think about these unitary
transformations on single qubits as, as, is as quantum gates. So, I'm sure many of
you know about classical circuits where you have wires that carry bits of
information and then you have gates that transform these bits in someway. So, in
the quantum manual analog of that, we think of we think of a wire as carrying a
quantum bit. And then we have a gate that performs a unitary transformation on that,
on that qubit. And the output is carried on the output wire. And that's, that's the
output qubit after the unitary transformation has been performed on it.
Later in the course, we'll, we'll think about quantum circuits, where we have
many, many wires carrying many cubits. And then we'll have gates which, which act on
one or two qubits, on multiple qubits. And the cubits get transformed along the way.
Okay, but for now, we are just thinking about single qubits, and how they get
transformed as, as quantum gates are applied to them. Okay. So, so the first
gate that we'll consider, which is a particularly simple one, is a bit flip.
So, what the bit flip does is, it's given by this transformation X here. And now,
of, of course we, we'd want to check that X is a unitary transformation. So, what we
want to do is look at what's X dagger. But now, since X is real, of course and, and
it's symmetric, when you do the conjugate transpose, you'll just get back X itself.
And in fact, you can even check that x^2 , X, X dagger = X dagger X Well, it's, it's
just identity. So, it's, it is in fact a unitary transformation. And, okay, so,
what does, what does x do? If you start off in the zero state, then you, x0 is,
is the one state. And if you start in one, then you, you end up in the zero
state. And so, it's a bit flip. But, of course, you might start, the qubit might
start in a superpos ition of zero and one. And so, if you apply X to this
superposition, then zero and one swap places. So, you end up in, well, the
amplitude of zero is now alpha one, and the amplitude of one is alpha zero because
zero and one, swap positions. Here's another gate that that's, that's
interesting. It called the phase flip gate. It's given by this transformation Z
and once again, Z dagger is equal to Z. And so Z times Z, Z, Z dagger is just Z^2
which is the identity. So, this is another unitary transformation. And what it does
is it, it leaves the zero state alone, but applies a phase of -one to the one state.
Now, of course, an overall phase is never, never, you know, it's, it's irrelevant.
Well, what this means is that if you start in the superposition of zero and one, then
the relative phases of these two get changed by the Z gate. And so you, end up
in alpha 0,0 - alpha 1,1. Okay. It's, it's simple to think about this geometrically.
So, the bit flip, one way you can think about it is, that, it's a reflection of
this picture, the 0,1, about the 45-degree line, okay, about this 45 degree access.
But now, if you were living in 3-dimensional space, then you could also
think about it as a rotation. A 180 degree or a pi rotation about this 45 degree
axis. Because what you would do is, you would, you would rotate about this axis
and zero would, let's say, come off the plane and one would go under the plane and
they'd keep rotating until they'd be in the orthogonal plane. And then, they'd
keep rotating until they, they switch places when you, when you go all the way
around. But now, remember, we are working in not the 2-dimensional real space but we
are working in a complex 2-dimensional space. And so, what happens is in this
complex 2-dimensional space, you actually have enough room to do this rotation about
this 45 degree axis. You have these, you know, the imaginary directions where you
can actually do this rotation. And so, so X is really a rotation, a pi rotation
around this 45-degree axis. Similarly, for the phas e flip, well, the phase flip,
what does it do. Well, if you, if you were to draw a zero and one here, then what it
does is, it leaves the, the zero axis alone but it flips one to -one. And so,
it's a 180 degree, well, you could think of it as a reflection about this, this,
this, the, the zero vector or again, in the complex plane, you can think of it as,
it's a rotation through 180 degrees or pi about this axis, about the axis of the
x-axis. Here's another way to think about, about the phase flip. So, what does the
phase flip do to the plus state? Well, remember the plus state is one / square
root two zero + one / square root two one. And so what it does is, it leaves zero
alone, but it applies a phase of -one to one. And that' exactly the minus state.
And similarly, Z, when you applied it to the minus state, gives you plus. And so,
what it's doing is, if you look at the plus and minus states, then it's swapping
these two. Now, that's still, this 180 degree rotation about the, about the zero
axis. Okay. So, now, let's look at the third gate, which is called the Hadamard
gate, or the Hadamard transform. This is one of the most basic quantum gates. And
what it is, is it's given by this transformation, which, in which all the
entries are one / square root two, except the lower right entry, which is -one /
square root two. So, once again, H dagger is equal to H. You take the conjugate and
then transform. You get back the same matrix and you can verify that H^2 is the
identity, H, H dagger is the identity. So, it's a unitary transformation. And now,
let's see what happens if you start with the zero state and apply this gate to it.
Well, if you start with zero, you get the first column, which is one / square root
2,0 + one / square root 2,1, which is a plus state. And if you apply H to one, get
the second column, which is one / square root 2,0 - one / square root 2,1, which is
the minus state. And similarly, H of plus is zero and H of minus is one. Now, if you
look at this a little more closely when you apply H to zero, well, you get an
equal superposition of zero and one. So, if you were to measure after applying H to
zero, you would see zero and one with equal probability. And similarly if you
applied H to one, and then measure, you'd see zero and one with equal probability.
So, it seems as though the information about whether you started with zero or one
is lost, when you, when you, when you apply the Hadamard transform. But
actually, it's not. The information is all put into the sine here, whether the phase
is plus or minus. And in fact, the way we know that the information is not lost is
because when we apply the Hadamard gate twice, we get back to the, the, the bit
that we started from. Okay. So, you know, we saw how, how to think about the,
geometrically think about the bit flip, the gate, the X gate and the Z gate. Now,
let's look at the Hadamard gate and try to understand what it looks like
geometrically. Well, so, remember, what the, what the Hadamard gate does is it, it
swaps between zero and plus, and it swaps one and minus. And so, one way you can
understand it is, if you take this axis which bisects zero and plus, so this angle
will now be pi by eight. Then what, what the Hadamard gate, you can think of it as
is a, is a reflection about this axis, the pi by eight axis. But again, the right way
to think about it in the complex 2-dimensional space is as a rotation
through pi by eight, through 180 degrees of pi, about this pi by eight axis. So,
it's a rotation about this axis where, where everything is rotating by pi. Okay,
so finally, let's think about the following question. So, suppose that you
wanted to implement a phase flip gate. So, suppose I wanted to implement the phase
gate or Z. But suppose that I happen to have no phase flip gates around. But I had
a big flip gate and a Hadamard gate. Would I be able to implement a phase flip gate?
Well, here's a way of doing it. So, remember what the phase flip does. So, if
you, if you, if you write it out, what Z does is, if you give it as input, the plus
state. Then it outputs minus, and if you give it as input minus, then it outputs
plus. And if I can design some gate which, which transforms plus to minus, minus, and
minus to plus, then it must be the phase gate. Okay, so how do we, how do we write
out, how do we create a, a gate that transforms plus to minus and minus to plus
which swaps plus and minus. Well, what we can do, if you are not given Z, is we can
first start by transforming plus 2,0 and -2,1. We can do that by applying a
Hadamard gate. Okay. Now that we've done a Hadamard gate, we can, of course, apply an
x gate, and swap zero with one, and one with zero, alright? So if, if you now
apply an x gate, then zero gets transformed to one and one gets
transformed to zero. And now, if we apply Hadamard again, what, what happens? Well
if you apply Hadamard again, we transform one to minus, and zero to plus. Okay. So,
what, what, what is, what is this sequence doing for us? It's transforming, if you
start with a plus state, then our output is a minor state. And if you start with a
minor state, output is a plus state, which is exactly what we wanted. So, what we can
say is that Z = HXH. Okay? In fact, here's another way to, to picture it. Okay. So
what, what this is, you know, what this diagram is showing you is that, what the
Hadamard does is it swaps zero and plus. It swaps one and minus. X swaps between
zero and one. Z swaps between plus and minus. And so, if you wanted to perform Z,
where you want to swap these two, another way you can do that is perform HXH. If you
want to perform X, another way to achieve that is you, you do HZH. Okay, what does
this correspond to in terms of linear algebra? Well, what you're really doing is
we are saying that Z, the transformation Z is the same transformation as X if you, if
you, if you do the transformation in the Hadamard basis. So, this is really basis
stage. What we're really saying is that if we perform the Hadamard transform, then we
perform X and now we perform the inverse of the Hadamard transform to move back to
our original basis then we get, that's, that's the Z transformation, But of
course, remember that H inverse = H. And so, so, of course, we can write this as Z
= HXH.