mod01lec09 - Quantum Gates and Circuits - Part 2
Summary
TLDRThis lecture delves into the intricacies of quantum computing, focusing on multiple qubit gates that transform multipartite quantum states, akin to classical logic gates but with reversibility. It introduces the CNOT gate, pivotal for conditional transformations, and explores other gates like Control Y, Control Z, and the Phase gate. The Hadamard gate's role in creating superpositions is highlighted, essential for exponential state space computations. The lecture also covers universal gates, circuit identities, and the ability to synthesize unsupported gates using available ones, concluding with a foundation for further exploration into entanglement and quantum algorithms.
Takeaways
- π§βπ¬ A multiple qubit gate is a generalization of a single qubit gate, capable of transforming multipartite quantum states, similar to how a single qubit gate transforms individual qubits.
- π Multiple qubit gates can be represented as taking n qubits as inputs and producing n qubits as outputs, which aids in simplifying computations.
- π The concept of reversibility in quantum gates is crucial; given the output qubits, the input qubits can be recovered, a property stemming from the unitary nature of quantum mechanics.
- 𧬠The CNOT (Control NOT) gate is a significant two-qubit gate, analogous to the XOR gate in classical computing, flipping the state of one qubit based on the state of another.
- π The CNOT gate, along with other controlled gates like the Control Y and Control Z, manipulates qubits based on the state of control qubits, showcasing conditional transformations.
- π The Hadamard gate is instrumental in creating superpositions, allowing for the generation of a 2^n-dimensional state space from an n-qubit state, which is vital for quantum algorithms.
- π Universality in quantum computing refers to the ability of a set of gates to perform any possible quantum transformation, with the Hadamard and T gates, or the Hadamard and phase gates, being examples of universal sets.
- π Circuit identities allow for the creation of complex gates from simpler ones, leveraging the properties of gates like the Hadamard to simulate other transformations, such as the CZ gate from CX gates.
- π The Swap gate is an example of a simple circuit identity that can be decomposed into a sequence of CNOT gates, demonstrating how to manipulate qubits to achieve specific state transformations.
- π The lecture series progresses from basic quantum computing concepts to more advanced topics like entanglement and interference, eventually leading to practical programming on quantum computers.
Q & A
What is a multiple qubit gate and how does it differ from a single qubit gate?
-A multiple qubit gate is a generalization of a single qubit gate, capable of transforming a multipartite quantum state. Unlike a single qubit gate, which operates on one qubit, a multiple qubit gate takes multiple qubits as inputs and produces multiple qubits as outputs, enabling more complex transformations.
What is the significance of the reversibility property in multi-qubit gates?
-Reversibility in multi-qubit gates is significant because it allows the recovery of input qubits from the output qubits, given the transformation function. This is possible due to the unitary nature of quantum mechanics, where the conjugate transpose (dagger) of a matrix representing the gate is its inverse, ensuring that the gate and its inverse can be used to transform states back and forth.
Can you explain the CNOT gate and its function in quantum computing?
-The CNOT gate, also known as the control-NOT or CX gate, is a two-qubit gate that performs a conditional bit flip on the second qubit based on the state of the first qubit (control qubit). If the control qubit is 1, it applies an X gate (bit flip) to the second qubit; if the control qubit is 0, it leaves the second qubit unchanged. This gate is fundamental in quantum computing for creating entanglement and performing conditional operations.
How does the Hadamard gate contribute to creating a superposition state?
-The Hadamard gate is instrumental in creating superposition states by applying a transformation to qubits that puts them into a state where each possible state is equally probable. When applied to a multi-qubit state, it results in a superposition of all possible combinations of the qubits, allowing for operations on an exponentially large state space.
What is the role of the universal gate in quantum computing?
-In quantum computing, a universal gate or a set of gates is capable of performing any possible quantum transformation, meaning they can convert any input quantum state into any desired output state. This is analogous to universal gates in classical computing, such as NAND or NOR gates, which can be combined to perform any Boolean operation. Examples of universal sets in quantum computing include the Hadamard gate and the T gate, or the Hadamard gate and the phase gate.
How can the control-Z (CZ) gate be synthesized using gates available in typical quantum hardware?
-The control-Z (CZ) gate can be synthesized using a combination of a Hadamard gate and a CNOT gate. By applying a Hadamard gate to the target qubit, followed by a CNOT gate with the same qubit as both control and target, and then another Hadamard gate to the target qubit, one can effectively implement a CZ gate, which applies a phase shift conditioned on the control qubit being in state 1.
What is the significance of circuit identities in quantum computing?
-Circuit identities in quantum computing are crucial for deriving complex gate operations using simpler, natively supported gates. They allow for the construction of any desired quantum circuit using a limited set of basic gates, which is particularly important given hardware limitations in the types of transformations that can be directly applied.
Can you provide an example of how the SWAP gate can be decomposed into simpler gates?
-The SWAP gate, which exchanges the states of two qubits, can be decomposed into three CNOT gates. By applying CNOT gates in a specific sequence, one can effectively swap the states of two qubits without needing a dedicated SWAP gate, which may not be natively supported by all quantum hardware.
What is the purpose of applying a Hadamard gate to each qubit in a multi-qubit state?
-Applying a Hadamard gate to each qubit in a multi-qubit state is done to create a superposition of all possible states. This results in a state where each combination of the qubits (from all zeros to all ones) has an equal probability amplitude, allowing for parallelism in quantum computation and enabling algorithms to explore a large state space efficiently.
How does the concept of entanglement relate to the operations performed by multi-qubit gates?
-Entanglement is a quantum phenomenon where the state of one qubit becomes dependent on the state of another, even when separated by large distances. Multi-qubit gates, particularly those that perform conditional operations like the CNOT gate, are instrumental in creating and manipulating entangled states, which are essential for quantum algorithms and quantum computing's advantage over classical computing.
Outlines
𧲠Introduction to Multi-Qubit Gates
This paragraph introduces the concept of multi-qubit gates as an extension of single-qubit gates, which are crucial in transforming multipartite quantum states. It explains how these gates take multiple qubits as inputs and produce the same number of qubits as outputs, highlighting the ease of computation with this approach. The paragraph also delves into the property of reversibility inherent in multi-qubit gates due to the unitary nature of quantum mechanics, where the input state can be recovered from the output state, given the gate's function. The CNOT gate is introduced as an example, analogous to the XOR gate in classical computing, which flips the state of one qubit based on the state of another. The explanation includes the matrix representation of the CNOT gate and its action on qubit states, emphasizing its role in quantum computing circuits.
π Reversibility and Other Multi-Qubit Gates
The second paragraph expands on the reversibility of quantum gates, emphasizing that given the output qubits, the input qubits can be recovered, a principle stemming from the unitary nature of quantum mechanics. It then discusses other types of multi-qubit gates, such as the control-Y and control-Z gates, which behave similarly to the CNOT gate but act on different bases. The paragraph also introduces the phase gate, which shifts the phase of a two-qubit state based on the state of the control qubit, and the swap gate, which exchanges the states of two qubits. A three-qubit gate, the Toffoli gate (CCNOT), is also mentioned, which flips the third qubit if the first two qubits are in the state |11>. The Hadamard gate is highlighted for its ability to create a superposition of states, a fundamental operation in quantum algorithms, and its matrix representation is discussed.
π Universality in Quantum Gates
This section discusses the concept of universality in quantum computing, where a set of gates can be combined to perform any possible quantum transformation. It mentions the Hadamard and T gates, along with the CNOT gate, as examples of a universal set that can achieve any two-qubit transformation. The paragraph also touches on the idea that not all necessary gates may be natively supported by quantum hardware, leading to the need for circuit identities that allow the synthesis of non-native gates using native ones. The example of deriving the CZ gate from the CX gate using Hadamard gates is provided, showcasing how different gates can be combined to achieve the desired quantum operations.
π Circuit Identities and Quantum Computing Basics Conclusion
The final paragraph of the script covers circuit identities, which are essential for creating gates that may not be directly supported by quantum hardware. It uses the example of the swap gate to demonstrate how a sequence of CNOT gates can achieve the desired transformation. The paragraph concludes by summarizing the week's learnings, which include understanding qubits, single and multi-qubit states, quantum gates, and their applications in building quantum circuits and algorithms. It also provides a preview of upcoming topics, such as entanglement and interference, which are key to harnessing the full power of quantum computing, and hints at practical programming on quantum computers in future lectures.
Mindmap
Keywords
π‘Multiple qubit gate
π‘Reversibility
π‘CNOT gate
π‘Unitary
π‘Dirac notation
π‘Hadamard gate
π‘Superposition
π‘Universal gate set
π‘Circuit identities
π‘Entanglement
Highlights
A multiple qubit gate is a generalization of a single qubit gate, capable of transforming multipartite quantum states.
Multi-qubit gates can be viewed as taking n qubits as inputs and producing n qubits as outputs, facilitating computations.
Reversibility is a key property of multi-qubit gates, allowing input states to be recovered from outputs due to quantum mechanics' unitary nature.
The CNOT gate is introduced as the quantum equivalent of the classical XOR gate, with the ability to flip the state of one qubit based on another.
The CNOT gate's matrix representation and its action on the computational basis states are explained.
Controlled-Y and Controlled-Z gates are mentioned as variations of the CNOT gate, affecting the target qubit's state conditionally.
Phase gates are introduced, which shift the phase of a two-qubit state based on the state of the qubits.
Swap gates are discussed, which exchange the states of two qubits.
The Toffoli gate, or CCNOT gate, is explained as a three-qubit gate that flips the third qubit if the first two are in the state |11β©.
The Hadamard gate is highlighted for its role in creating superpositions of states, a fundamental operation in quantum algorithms.
The concept of universal gates in quantum computing is introduced, paralleling the role of universal gates in classical computing.
Circuit identities are discussed, showing how to derive non-native gates using combinations of native gates supported by hardware.
An example is given on how to synthesize a Controlled-Z gate using Hadamard and CNOT gates.
The Swap gate is also decomposed into a sequence of CNOT gates, demonstrating the flexibility in quantum circuit design.
The lecture concludes with a summary of the week's topics, including qubits, quantum gates, and their applications in circuits and algorithms.
An outlook for the next week's topics is provided, focusing on entanglement and interference, which are crucial for advanced quantum computing concepts.
Transcripts
[Music]
a multiple qubit gate is a
generalization of single qubit gate
it transforms a multiparted quantum
state just like a single qubit k
transforms a single qubit state so the
state q1 to qn
when you apply a multipartite uh
multiple qubit gate to it
converts it to a different and cubic
state q dash
1 to q dash
and this can be represented in a
different way
if you uh
take each part or each qubit of our
multicube state and
verify them individually and you feed
them to this particular gate
so we can
view this as a gate that takes n qubits
as inputs and produce n qubit as qubits
as outputs and more useful to look at it
this way because then we can do
computations
more easily as you see
in subsequent
slides and
there's another important problem uh
property that we get from a multi-qubit
gate which is called reversibility
and
remember we talked right in the
beginning of this week that this one of
the differences between quantum gauge
and
classical logic gates is that uh any
gate if when it takes in n inputs it
actually produces n outputs and not just
one output
and
the property of any such gate is that if
we know this function that's
transforming these n qubits
and we know the
output qubits
then the input qubits q1 up to qn can
actually be recovered from q1 dash to q
and dash so given the output we can
actually recover the input and that's
the reversibility principle
and why is this
this is because quantum theory and
quantum mechanics itself is unitary
which means that any matrix that
represents the gate is unitary so as you
have seen
it means that the conjugate transpose or
a dagger of any matrix must be its
inverse so a times a dagger must be the
identity matrix and what this means is
that any gate
that can be used to transform one
multipartite qubit state into another
the inverse of the gate can be used to
transform the output of uh the output
back to the input
so that comes intuitively from the
notion that
these gates are unitary let's take the
most uh prominent or the most
interesting two qubit uh
gate
called which is which which you call the
c naught gate
and this is the equivalent of the xor
gate in casual computing so if you
remember the xor gate or if you're
familiar with it what it means is you
take in two bits a and b and the output
is represented by a x or b what that
means is that
if both a and b are
different than the output
is one otherwise the output is
zero
so
the equivalent of the xor gate is the c
naught data as you just said
and what this will produce is given
qubits q1 and q2
it will produce outputs q1 and the
second output will be q1 absorbed with
q2
and the circuit representation of this
is as follows
uh we'll come back to the circuit again
but
the matrix that is going to transform
our two qubit state q1 q2 to this
particular qubit state is represented by
this matrix and because it's uh we have
a two qubit state uh the get that is
represented uh by the tensor product of
q1 and q2 is going to be four by one
matrix therefore we need a four by four
matrix to transform one four by one
matrix into another okay let's see how
that happens uh the c naught gate by the
way can also be represented in dirac
notation in in this form if we take the
states uh
0 0 they get 0 0 apply it to the bra 0 0
and then we add other other uh get brass
or outer products uh so this is uh can
be represented as a sum of various uh
outer products
so
let's apply the c naught to our zero
zero sheet okay let's assume q one is
zero q two zero
so our zero zero state
uh and we computed this earlier as the
tensor product of the state zero and
zero that ends up being one zero zero
zero so we apply this c naught matrix to
that which means you do a matrix
multiplication
and what we end up with is one zero zero
zero okay which means this is again
nothing but the zero zero so we apply
the c naught gate to zero zero it does
nothing to it it uh there's no
transformation
now
generally uh what will happen is
if we take the c naught gate uh
if you take if our inputs are of any of
these forms and this is the truth table
uh here are the outputs so for state 0 0
output is going to remain 0 0
if state 0 1 output is going to remain 0
1
for 1 0 it changes to 1 1 1 1 change to
1 0. what does this mean it means that
if our qubit q 1
is 0 then output remains the same
whereas for qubit q1 is 1 then the
output is going to flip 0 flips to 1 1
flips to 0.
and that's why we call
this a c naught gate or in longer form a
control not g or
in there's another term for it called
control x which means that
we are going to be uh applying an x gate
to the qubit q2 but controlled by what
the state of the qubit q1 is
okay
so
here we have a two qubit state and the
first qubit ends up being a control
qubit for the computation that is
happening on the second cube
that's how you should visualize it
so
based on the value of the control qubit
we are going to be computing a not or a
poly x transformation of qubit q2
and
the if the cube if the control cube it
happens to be zero
then
this does not do anything to change the
state of q two the controlled qubit is q
one is going to be flipping the state of
q two
we can also see that this gate is
reversible
if we have both q1 as well as q1 and xor
of q2
that means that we can get back q1 and
q2 if we are given q1 and q1 of q2 so
the reversibility property is maintained
as you can see here
let us look at a few other examples of
multicubic gates
now the c naught gate as you've seen is
also called the control x gate or the
control poly x gate similarly there are
also two cubic gates called control y
and control z
which preserves the strain of a qubit if
the control qubit is zero and transform
it in particular base if the control
qubit is one
another example as you can see here is
the phase gate and
it's represented by this two by two
matrix so it acts on a
bipartite state and it's going to shift
the phase of any uh two qubit state by
phi
uh only if that particular state uh
happens to be uh one one otherwise it
leaves the
the particular state intact
a swap state is another interesting one
which uh swaps two qubits what that
means is if you give the input state q
one q two what you get up what you get
as output is q to q1
and
here is an example of a three qubit
state therefore it requires an eight by
eight matrix for transformation and
this is related to the c naught and as
you can see it's also called the c c
naught that's the control control knot
so it flips our third qubit
only if both the first two bits are
both one so it uses uh the first two
cubes as control qubits and
transforms the third qubit
and the profile gate is a gate with
interesting properties and something
that is used
extensively in quantum computing
now let us see how we can generate a
superposition of a multiplied state and
here's where you see how the power of
quantum computing
emerges and this is the
gate that you see here is one that we'll
end up using in
almost all of the algorithms
in subsequent lectures
so
what we want to achieve here is given an
nq with state we want to produce a 2 by
n 2 2 to the power n state space okay
now we already saw that any n qubit
state can produce a 2 to the power n
state space but how do you produce a 2
to the power and state space that has
certain properties that then we can do
some computation of okay
so take the first qubit of our
multi-qubit state uh q1 and let's say we
apply add-on gate to that okay similarly
we apply a hadamard gate to the second
qubit or the second part of our enquiry
state and likewise we apply hadamard
gate up to the nth qubit okay on each
qubit of our
multiplied qubit state q1 up to qn we
apply a hadamard gate on each of the
qubits so naturally the outputs you're
going to get are the hadamard applied by
quite q one etc and uh for any qubit you
can use a hadamard transform to compute
what the output is
now
this can be taken
together as one gate and we can
represent this in this form uh this is
the direct form of the uh multi-state
hadamard gate and it can be represented
with this exponent and the tensor
product sine and exponent
so
what this gate is if in matrix or in
mathematical form it ends up being a 2
to the power n by 2 to the power n
matrix t
and we can get the actual matrix value
here by doing a tensor product of the
hadamard matrix with itself
uh n times and we are not going to go
into the details of the tensor product
of of how to do the tensor product two
different matrices but it is just a
generalization of the tensor product
that you saw
in in earlier slides where
we
computed the the tensor product of two
uh
single cats to produce another get
the hadamard uh our
end state hadamard gate can then be
applied to the
input multipatter state to produce the
final output
so let's take one example
so our hadamard or multi-state hadamard
gate can let's try to apply it to our
get
where each qubit is in the state 0.
so
the state 0
0 0
n times
when we take the tensor product we get a
matrix with 2 to the power n
rows and 1 column and
only the first row will have the value
zero remaining rows are going to have
the value or the first row will have the
value one and the remaining rows will
all have the value zero so if we apply
our
h let's call it s to the power n gate to
this particular uh
n qubit state
we end up getting and if we if you uh
uh
try this with
a 2 to the power n pi to the power n
matrix you can try it for smaller values
of n
you'll find that we get this particular
matrix you get a
matrix which also has 2 to the power and
rows but now the value in each row is
going to be 1 but the probability
amplitude is
what you can see here 1 by root over 2
to the power n which means that
what we end up with is a
is a superposition state
of all possible
where each
uh combination of uh our n qubits that
is if we set any of the qubits to their
one or the zero so we are going to get
we can get any of one of two to the
power n states right from zero zero zero
zero up to one one one one and
everything in between different
combinations zeros and ones so the state
we end up getting here is a state where
we get all of we have all of the total
power and states in superposition and
they all have uh equal probability
that's what we get here so from a state
that uh has uh just n possibilities or
uh because or rather it has just one
possibility because
all of our qubits are in state 0 we end
up getting a state which can uh which
when measured can lie in any of one of
two to the power n states and now we can
do a lot of user computation on this and
this is a property or that this sort of
hadamard transform you see is very
useful in algorithms where we want to do
fast computations on uh exponential size
state spaces and
get results
much faster than we would in an
equivalent algorithm that we could run
the bar on a classical computer the
property of universality may be already
familiar to you if you uh know how to
program on classical computers uh
what a universal gate is is a
single gate or a set of gates that
compute
any possible function that we would like
that is it can transform
any input state into any output state
through some combination of
those gates
in passive computing
we have if we take the set of case and
or not through any combinations of and
or not we can express any uh boolean
transformation that is we can convert
any boolean state to any other billing
state
the nand and the nor gates are by
themselves universal gates which means
that we can use we can apply uh
one or more nand gates to produce any
possible boolean transformation
similarly we can apply one or more nor
gauge to produce any boolean
transformation
this
the boolean transformation that we're
talking about here are converting one
logical expression
into into another
in quantum computing similarly
what we need
is the ability to convert
one point quantum state to another but
the the notion of universality stays
requires
the ability to convert any possible and
cubic state to any other possible and
and cubic state so
it's very useful to
have a set of gates that can allow
from which we can just pick and
use any particular combination of gates
to produce any transformation so uh
the sets that you see here are uh
candidate universal uh sets so if we
take the h gate and we take a gate
called the t gate which you are not
encountered here but
you may encounter it in subsequent
lectures and the c naught
the using any uh
one or more of these gates it turns out
that we can
affect any uh two qubit transformation
similarly uh the
the state hadamard the the set of gays
hadamard and toefl end up being another
uh universal set uh what this means in
uh quantum computing terms or
in uh linear algebraic terms is that
uh we want a set of gates that
from which we can pick some combination
of gates and implement any possible
unitary
matrix function
moving to circuit identities this is the
last topic we will cover in this lecture
note that not all important gates
that we need that are and that are going
to be useful to us in a quantum circuit
can be directly applied by hardware that
is hardware is limited by what kind of
transformations it can natively support
so if our hardware is limited to
supporting particular kind of
transformations or particular kinds of
gates
if we need a different kind of gate what
we would need is the ability to derive
those gates using combination of gates
that the hardware actually supports okay
so take for example the c naught gate
now
c not gate does a
conditional bit flip on the second qubit
based on the first control cable right
uh now consider the another gear that we
discussed briefly a couple of slides ago
the control z
now what this does is it applies the
polyz gate to the second qubit based on
what the state of the control qubit is
but does the condition face
in other words
now the c naught gate is something that
is often present in most commercial
hardware in commercial quantum computers
so for example in the ibm quantum
computer we can natively apply a c
naught or a csk but
uh the same uh quantum computer does not
natively support a control z gate it's
not directly available so what we need
is we need to derive an identity whereby
we can uh use uh
some combination of c naught gates and
other gates that are supposed supported
by the hardware to produce uh a c z gate
and we can it turns out we can actually
do this fairly simply at least for this
particular example uh
you know that we can use hadamard gauge
to switch between the x and the z basis
right from the x to z basis and back
what this means is that uh the hadamard
applied to state zero produces state phi
one ah produced state minus hadamard
applied to plus produces zero
and had multiplied to minus produces one
so we have learned this
earlier it turns out using matrix
multiplication
these two conditions that you these two
expressions that you see here they hold
what does this mean it means that if you
apply multiply the hadamard by the x and
again multiply the hadamard you end up
getting the z
and likewise if you multiply h by z by h
you get x okay and that's something you
can actually try out as an exercise if
you take the hadamard matrices and x
matrices and the z matrices that you've
already encountered in previous slides
and do the matrix multiplications to
verify for yourself
how can we
realize the c dead gate out of ex gates
using this particular identity
let's take a look at the circuit
uh the z gate
is the application of a hadamard gate
followed by an x-gate followed by a
hadamard right i'm going in the reverse
direction remember that
what this means is that
a z transformation can be produced by
applying a hadamard followed by an x
followed by another hadamard and
because it's a two qubit state we simply
going to be applying this transformation
to our second qubit which is what the
transformation uh usually works on
because our first qubit is just a
control cube okay
so the
uh
just by applying uh an edge followed by
c naught followed by an edge we can
realize uh zero key so if our hardware
supports both hadamard as well as c
naught we can synthesize a
uh or uh we can compose a c that state
another example let's take the swap gate
okay
state q and q two is uh converted to
state q to q1 okay
how can this be
a decomposition of
individual states
it turns out this is also fairly simple
and all we need is we need to apply
three c note gates in sequence to
produce this transformation okay and
we're not going to go on the map but you
can verify this yourself using uh the
tools that we already discussed in
previous slides
all right this brings us to the end of
uh this particular lecture as well as
this particular week so this is the
final module of the quantum computing
basics
uh you've learned all about qubits and
single and multiple qubit states you
learn about quantum gates and their wave
properties both for
single state transformations and
multiplier state transformations and
you've seen how to use them as building
blocks for
quantum circuits or algorithms
next week you will learn about the
concepts of
entanglement interference which are
slightly advanced topics but which are
which still follow from quantum
mechanical integrations and once we uh
learn how we can harness the power of
entanglement interference we will then
move on to practical programming where
you will learn
cascade as well as
how to program on
ibm frontend computers
Browse More Related Video
mod04lec24 - Fixing quantum errors with quantum tricks: A brief introduction to QEC - Part 2
mod03lec16 - Quantum Algorithms: Bernstein Vazirani Algorithm
mod03lec18 - Grover's algorithm Programming
How to program a quantum computer using Qiskit
AQA AβLevel Define problems using Boolean logic
81. OCR GCSE (J277) 2.4 Simple logic diagrams
5.0 / 5 (0 votes)