- Welcome everyone to day
two of this Quantum School.
Today as I mentioned yesterday
we're gonna talk about
the Deutsch-Jozsa algorithm
and about Grover's algorithm.
In both cases I will first
give you a lot of theory,
go pretty much into it.
So it's gonna be math heavy.
I hope you all.
No one is overwhelmed by that.
And then after that,
I will show you with Qiskit
how to implement these circuits
yeah, algorithms.
So I stop my video now
to hopefully improve the
Oh,
okay.
So as I mentioned first
we're gonna talk about
the Deutsch-Jozsa algorithm.
And what we start with is with oracles.
So I will first give you,
introduce you to the concept of oracles.
So for a lot of Quantum
algorithms actually,
we assume that we have
access to some oracles
Where this oracle can be just
some kind of physical device.
We can think of it as a black box.
So we cannot look inside,
but it somehow performs what we want.
Or some parts of what we want
and we can pass some queries to it,
and then it returns some answers.
So the goal then is that
given such an oracle,
we want to determine some
property of this oracle
And ideally we what we
try is to try to minimize
the number of queries that
we have to the oracle.
So those are some of the-
it might sound like cheating, okay.
We have Quantum algorithms
and we just have some
oracle that can, some can
perform any tasks we want.
And with those we can.
So with our quantum algorithms
and some problems much faster
than classical problems.
And I agree this sounds
very weird however,
to give you an idea of what such an
oracle for example could look like,
I'd like to use the
example of a phone book,
which is not okay.
I will go more into that later.
So as a phone book
you can think of the oracle
as a phone book where
if I give you the name of someone,
you can check with the phone numbers.
However if I want you
to know the phone number
and I wanna figure out
what is the name that
belongs to that phone number
since your phone number,
phone book is sorted by
names and not by numbers.
It's really hard to,
you cannot just quickly tell me
which name this number belongs to.
However, if I now ask the oracle,
"Hey oracle is this name
that corresponds to this phone number?"
And oracle can quickly
check and say yes or no.
So this phone book example
is an example that is
used a lot to illustrate
how oracles work.
And I like to give this illustration.
However, one should note that
the example of the phone book
is something that is not feasible
because if we wanted to
create an oracle that acts
like such a phone book,
then we would need to
first give this oracle,
all the numbers and connect
it to all the names.
So we would just,
the oracle itself would
first need to read and
all everything, the whole database
before it could actually
help us with anything.
And then of course this would be cheating
because then we cannot say we're
much faster without algorithm
because we would first
need to create the oracle,
which is too complicated
to this is not faster than
just directly solving the
problem without the oracle.
But what one could instead
use as a piece of oracle
is if our oracle solves
some satisfiability problem.
So or in general if we
have some constraints
that we give to the oracle
and we ask it,
can be this and this and
this and this constraint
be all satisfied at the same time?
And then the oracle can say, can,
it should be some constraints
that the oracle can
more or less easily check.
And then I can tell us, "Yes, it's true."
Or "No, I cannot say it does not satisfy
all at the same time."
So an example for us would be Sudoku.
We can give, we can then
run some algorithms and
give our oracle and input of different
combinations of numbers and ask it, "Okay,
does it satisfy the fact that
we have at Mo have each number
exactly once in every
row and in every column
and in every box.
And then the oracle if it says, "yes,"
we know that we have a solution.
If it says "no",
well that is the wrong solution.
But so this would be an example
that is actually feasible
well feasible in a phone book,
but the phone book isn't just,
an illustrative way to explain
what that works with us.
So let's see what on a classical computer.
If we think of an oracle.
I mean, it's just some function that
has some input and some output.
This function could have
any input with string.
So you were one to the power n.
So that means an input
string that has n bits.
And then the output string
could be any bit string zero at one.
So zeroes are ones with power m.
So we could have any string
as output that has m bits
but could be different from n.
However on a quantum computer,
We learned yesterday
that everything has to be
unitary and reversible.
So also the oracle needs to be reversible.
So if I have X as an input,
the way I'm then constructing
it is I have x and qubits,
then I have my oracle which I call O f,
which I'm convinced the function f
and then what we learned yesterday is
in order to be reversible
first of all we want to
output X again.
And then we went to output all function.
That's a bits f of X.
So if we now have m qubits as input
as or if we have n qubits as output,
so here on the bottom,
qubits power m then we
also need to have n qubits,
additional inputs,
additional qubits as inputs,
which you call the intellect qubits.
And then as outputs we will get,
we can get Y plus f and the
easiest case we just put in
zero so we get put an X and zeros,
and then we get out X and f of X.
However the input can,
does not have to be X.
It can also be some
qubits Y that can even
be in superposition.
So this is the way we would in general
then construct the oracle.
If it goes from n to m qubits.
Now what we call O f is a bit oracle,
And it can be seen as a unitary.
As a unitary bit
which performs the map
If we apply it, we apply O f to X and Y.
And then the output is
X and Y plus f of X,
just as a reminder,
this Y does plus with a circle around it
means that we have the
addition modular two,
So we add the two bits and if it's food,
we pick a modular two so
we take it to zero again.
Good, so in the algorithm we
said, we will look at today.
And also the next days,
we actually never consider
more than one output.
That's a function that we
will always look at will be
the oracle function will always be from
an arbitrary bit string on n
bits to one single output bit.
So the single output for
example, would be okay, yes.
This is the element
that we're looking for,
or no, this is not the element
that we're looking for.
And if we have such a function then we can
not only construct our bit oracle,
but we can use the bit
oracle and construct
what we would call the face oracle, Uf
so we have again X as input.
And then the second input,
Y I told you we could
choose to be in any state
in this case now we choose
because now Y is only one qubit
and we choose it to be the minus state.
So we learned yesterday,
this has state one of us
grow to zero minus one,
And we input those into our oracle.
And then the output that
we get somewhat prem and
yeah, the output is Uf times X.
And I will show you in a second way,
because actually what we can
do is people then call this box
our oracle Uf.
So the reason we do that,
why we just consider that one
input bit and one output and
do not consider Y and Y prime
is because let's have a look
at the action of the oracle
on X and Y.
So what we can write,
If we apply Of to X and Y we
can write it as two parts.
So we have Of applied to X
and zero minus Of applied to
X and Y.
This we can not just insert the Y state.
Now this we can write as X,
because we just learned
here about the oracle,
the bit oracle, it gives us
outputs, X and Y plus f of X.
So it will give us X and zero plus f of X
minus X and one plus f of X.
And now f of X can only
be either zero or one.
So we can look at the
two cases separately.
Let's start with the first
with f if f of X zero.
Then we get X and the
first part zero plus f of X
if X is zero we just get zero.
What if and then in the
second term we just get one,
which is exactly X and Y
what's the case if f of X equals zero?
And then in the case
where f of X equals one,
we look at X and then the first one,
the first term now we have
zero plus f of X equals one.
So we get one
minus and here we have
one plus one which is two
but two modular two is zero again.
So we get one minus zero,
which we can write as minus X times Y.
And now this is something that I found
very confusing in the beginning
for me having this
minus now in front here.
I thought that's weird, why
would I put the Y to the
very front?
Now the reason is
this whole thing the way
we do it with the Y is
actually it's not that the minus sign is
on any of the two Ys,
but we always have to
look at the total state.
We cannot say, okay,
we cannot really completely
split our different,
the states have different qubits,
but in this case we would have
to say, okay the minus one,
we have to look at the
mathematical expression
and mathematically if we write
X times minus the state Y
and this is the same as if
we have minus X, times Y.
And so this also the same as
if we have minus X times Y
so this is all the same, I
know it seems very confusing.
Just believe me, that this is true
if quantum mechanics is true.
So in this case, yeah
we can just get the
minus out to the front.
And then what we can write
now is we can write it as
minus one to the power
f of X times X and Y
as a general form of our
application of applying the oracle.
What we see now though, is
this expression minus one.
So if we look what the oracle,
I think on X and Y
gives us minus one to the
power f of X times X and Y.
This is actually independent of Y.
So the- we put in Y and we get
out Y we don't really need Y.
So we do need it to
construct its own experiment
when we actually wanna
implement this function,
we do need the Y.
However, if we just
mathematically now wanna
say, okay, we're playing an oracle.
We do not every time
need to write down the Y
but we just write down your f
and your f that includes this insular bit.
It's like qubit this is so,
this qubit Y here is our insular qubit.
And if we write Uf then in
theory always has this like qubit
but for the future we would
just write X and then Uf
and then the output Uf times X.
So Uf is what we call the face oracle
cause before oracle Of gave us the bits,
it outputs f of X in the second qubit.
However now we will
just get a face instead.
So the method performs is Uf applied to X
will give us minus one to
the power f of X that's X,
and now for X we can also
inputs some superposition
so then the face actually
is very important.
Maybe I would now be ready
for a group of questions,
are there already questions?
Oh yeah, they are.
- [Speaker] Oh yeah we've got
tons of questions already.
I was looking at the top one here which is
what is the difference between
correlation and attainment?
That one seems to have a good
10 comments explaining the answer.
So I think we can mark that one answered.
That'll stay in the
answered section by the way.
So for everyone that
has that same question.
When you click on the, Ask a
Question button at the bottom,
there should be a little
Tab that says answered.
You can click on that
and see those answered
questions already there.
But the next one looks like
here is the Q sphere unique.
It seems different states can
share the same Q sphere plot.
- [Elisa] Well it's not,
it's not exactly the same because,
okay I mean, it's on
the topic of yesterday,
but I can answer that as well of course.
So if we have the Q sphere here
and we have the states one zero, zero,
I told you that they would
be on these parallels,
but now I honestly
don't exactly know where
exactly these states are,
but we would have for
example, here we would have
the state one zero, zero,
and here we might have 010
and here we might have 001,
which means that the first plot where
the first one that has mentioned here,
which is 01, this one,
this one would actually then have this,
have some block up here.
And another block here
like this while the other one that is 010,
plus 001
would have one block here
and the other block here,
of course in rich colors each time.
But yeah, I mean, it's basically
the same if you rotate it,
but we don't rotate it.
It Q sphere as defined
in a specific way where
like the state of the back
is a different state from
the state in the front.
I hope this answers the question.
- [Speaker] Cool, that's good for now.
And let's, we'll keep moving
with the lecture for now.
And then if anyone has more
questions about today's lecture,
feel free to drop them in there and
remember to upload to the top one.
I see some people saying,
"Can we restrict them
today's lecture only?"
I hear ya.
So I'm saying help uploading
the best questions for today,
and then we'll get
those as soon as we can.
So the power is yours
all right, thank you, back to Elisa.
- [ Instructor] Okay.
So the next thing that we need
in order to then start with
the Deutsch-Jozsa algorithm
is we need to look at how the hadamard bit
learned about that
yesterday X on n qubits,
how we can write.
There's a nice way to write
down it's action on n qubits.
So let's recall from yesterday
that if the hadamard
if you apply the hadamard
bit to the state zero,
we get the state plus
just given by one or less
grade of two, zero plus one.
And if we apply the hadamard
gate to the state one,
we will get the state minus,
which is also equals if the position
with a minus sign though.
Zero minus one.
So if we restrict ourselves
for X to be the input,
but X to be either zero or
one what'd we can write is
if we have X and then we
applied the hadamard gate.
And then we get an output Y
and this output Y can be written as
one over square root of
two in general zero plus
minus one to the power X times one.
Okay so this would be in
the case of zero we get
just zero plus one in
the case of one we get
zero minus one.
Now we can re-write that again,
which might seem stupid now
but you will see why we're doing that,
two one over square root of two
minus one to the power
zero times X times zero
plus minus one to the power
of one times X plus one.
That's just the same as before.
I'm just adding this weird
zero times X plus one times X.
The reason I'm doing that
is because I wanna write it as a sum,
so that it's clear.
So I sum over K and zero and one
minus one to the power K
times X times the state K.
So this is just
a weird way to re-write the
action of the hadamard gate
on the states zero and one.
The reason I'm doing this is because
now I wanna generalize it for n qubits.
So for the n basis states
so of all the states 0 1
the power ends up all the
bit strings that we have.
So if we have our input X
again which is in this case now
X, zero X one,
and so on to the X and minus one.
And then we apply a hadamard
gate on all of them,
Let me get our outputs, Y zero, Y one
Y and minus one, which is
in total, if it's string Y.
So, which is H, we write it like this
because you learn if we
have multiple states,
we put a tensive product between them.
And if they're not up on us,
that's why one hadamard gate
on each different qubit.
Then I write it age to the
tens up product power n.
I applied to X.
And now what I claim what
we can write in this case,
which is a generalization
of the form we had before.
And one could show for example,
with induction to this holds.
And I hope you can
believe me that it's true.
Given what you saw before,
you can write it as some of-
first of all now we have a
different normalization factor
because we don't have
two different states,
but we actually have a
superposition of all two to the n,
bit strings.
So we need to write one over
square root of two to the n.
Then we sum over all these
two to the n bit strings,
which is this K and
zero one to the power n
minus one to the power
K times X and then oops.
And then all states K and here K times X
on part that's what I have in
the power is the inner product
of K and X.
So if I have zero, zero and
one zero it would be just zero in yet,
but I wish we actually had an example.
So the reason we can see that
this maybe also makes sense is
because we know that every
way I know all of the outputs,
because every X I was either zero or one.
So all Ys either plus or minus.
Which means that they're always
in a superposition of
zero and one each outcome.
So the total state Y must
be in a superposition.
Of all possible two to the n bit strings.
And maybe just to give you an example of,
so you understand how this formula
is calculated especially
with the in a product.
I think in a production either
this K tens X might be a bit confusing.
So for example if I have
this as input state,
the state zero one,
so I have one qubits
state and the other one,
and the one state and they
apply the hadamard both of them.
Then my state Y is given
according to this formula,
it's given by one over square root of one,
one to the square root
of two to the power two
times and now I have four terms
and summing of all the
positive of its strings,
the first one is K equal to zero zero.
So I'd take zero, zero
here and a product with X,
X less zero one, times K 10 zero, zero,
plus then I have the second
term minus one to the power,
let's say zero one times zero one,
until we get case now there were one.
Then we have K equal to one zero,
and we have K equal to one one.
And if we now simplify this,
we can see okay this one over
square root of two to the
power two it's just one half.
Then here are the inner product.
This one gives us zero
because you have zero times
zero plus zero times one.
So we have minus one to the
power zero is just plus one.
And the second term,
we actually get a minus
sign minus zero one.
And we get minus one, zero plus one zero,
because we have one plan
zero plus your times one.
And my answer we get again
a minus one minus one one.
And this is actually
also what we would expect
if we think about, if we
just calculated regularly,
we would see that here the
first one is the state plus.
And the second one is the state minus.
And if we multiply it
states plus and minus,
we get executive as well.
So yeah,
maybe I can quickly do another question
before we start with
Deutsch-Jozsa algorithm,
because then gonna do it all at once.
Is there maybe one question?
- [Speaker] Yeah I think
we have one question here,
how do you determine relative
phases for a multiparty system
with no component in the
North pole direction?
Is that relevant to what
we're talking about right now?
I'm sorry if it's not.
- [Elisa] No, that's also
for the, for yesterday.
- [Speaker] All right so we're
gonna skip that one for now.
And we're gonna move on to
one right down here.
We have seen yesterday teleportation,
but since we need to send
measures from Alice to Bob,
can we call the global process?
Oh, no, I'm sorry.
That one.
Yep.
How about this one?
Why does the oracle need to be reversible?
- [Elisa] The oracle because
we learned yesterday that
quantum mechanics is always unitary.
So yes, it is related to unitarity.
We learned that every
or there's actually a
postulate of quantum mechanics
that every possible evolution
that you can consider
is always unitary.
So if we have the oracle and
we didn't have the oracle,
but we, if you look at the
oracle, it also must be unitary.
And if it's unitary,
it is immediately also reversible
that implies that, yes.
- [Speaker] Great, okay.
Thank you and once again,
everyone remember your uploaded questions
are the ones that we see first.
So please upload the ones that
are most relevant to today.
- [Elisa] Okay,
so let's go then to the
Deutsch-Jozsa algorithm.
So to my knowledge,
the Deutsch-Jozsa algorithm
is the first quantum
algorithm that showed how
the good advantage that we
can have when we're using
superposition and quantum computing.
This is why it's so famous
even though it might not have
a very practical application.
Plus it's also its very easy to understand
compared to more sophisticated algorithms.
So in this case, we are given a function f
Which takes us input and let's
put a bit string of in bits.
And then it outputs either zero or one.
And this function is
realized by an oracle,
But we are promised that the oracle
it is either constant,
Constant means in this case that
all inputs maps to the same output.
So either or inputs mech to zero,
and it just I'll put
zero every single time
or maps all have to one and
it outputs one every time.
But if the function is
constant it means that
no matter what input,
we would always get the same output.
So in the other,
so we know that the oracle is
either constant or balanced
and balanced means that
the number of inputs
that map to zero
is exactly half of the inputs
and the other half maps to one.
So we know either we get
zero with half of the input
for half of the inputs we get zero
and half of the inputs we get one,
or we always get the same output.
This is what it promised by the oracle.
And now our goal is
to determine which case we have.
So where the f
is constant or balanced.
Now let's look at the
classical solution first,
If we want to figure out
what the solution is,
we would need to ask the oracle once.
Then we get one output,
but then we have no idea whether
it's constant or balance.
We can ask the oracle twice
and if we get two different outputs
we immediately know that it's balanced
but cannot be constant.
However, we might also
get twice the same output
in which case we don't know yet
whether it's actually constant or balanced
because you might just be unlucky
or whatever it is that
it's actually balanced
but then we just
get a couple of times
still the same output.
So we would need to ask it again.
And we might need to ask it then and total
up to any half over one and
N over two plus ones times.
So if we get twice the
output we need to ask again.
And so on.
And then at most, actually
which always happens in the case
where it's constant,
we cannot know whether
it's constant or not.
If we just get half of the
time for half of the inputs
the same output we could have been,
just could have been by accident,
just that we chose those hot inputs
that mapped to the same approach
even though it's a balanced function.
So to make sure that we're actually right,
we would need to ask n over two plus one
where capital N is two to the power N.
So N over two is two to the
N minus one plus one queries.
Where N is now the number of input bits
and capital N is two to the N and this is
the number of realizable bit strings.
So maybe to give you just
a demonstrated example,
if we think of a coin
and I tell you this coin
you wanna figure out
whether the coin is fair.
And I tell you, okay, in this
case because we have only two
and for the input bits, I could say, okay,
only have two to be in different
ways to throw the coin.
The question is, is the quite fair?
So either the half of the
time to get the same output
and get one output on the
other half of the ways to get
the other output,
or you would always just get one output.
I mean, that's a very
simplified version, but
yeah, that's something
if one could think of,
but yeah, let's see what
the quantum solution is.
In the quantum case,
we only meet one query in either case.
And to see how that works,
I'm gonna give you the
Deutsch-Jozsa circuit.
So we start as always with all
the qubits in the state zero.
Okay we have n qubits.
Then we apply on each
of them hadamard gate
what I told you yesterday
almost always we start
by applying hadamard gate to
all qubits in the beginning
to get the superposition of all states
then we apply our oracle function Uf,
then we have again hadamard
gates on all qubits.
And in the end we measure
in this Y one basis,
it doesn't say anything else.
It's always a measurement
in this Y one basis.
And when we measure we get
some classic output bits,
Y0, Y1 and so on to Y and minus one,
which I call all together Y.
And now the claim is
That if the total outcome Y
Equals the zero bit string.
So the bit string that has just n zero.
So every single outcome would be zero.
Then we know that f is constant
For any other output
we know that f is balanced
And now I'll go with
you through the proof.
Hope it doesn't get too
mathematical enough.
So we're gonna check how the state evolve
during the quantum circuits.
So we look at how the state
after each step looks like.
So, let's start with here.
We have our state besides zero
now state zero.
It's just the zero bit string,
because all qubits are
initially in state zero.
We can also write that at
zero, zero to the power n
okay, that was easy.
Now the next step,
the next step is when we
apply all the hadamard gates.
So then we get the state side one,
which is hadamard gates and all
in qubits applied to a state
size zero.
And now we look at what we just learned.
We use the hadamard gates,
the expression for the
hadamard gate on in qubits.
So what we had here is one.
So we have one over square
root of two to the n
and the sum overall possible
bit strings and qubits.
Then we have minus one to
the power X times size zero,
and here we have X.
But so now what we know
is that here the size zero
is actually just this
zero bit string, right?
That's what we just looked at.
So in a product will always be zero,
which means that this sector
will always be plus one,
but we can just write
one over the square root of two to the n
and then the equal sickle
position or two to the n bits,
bit strings.
Good, so we can go to the next step.
And the next step we apply our oracle
and we get the state side two.
So upside two is,
well you need the F the
pledge to the state.
So one,
and now, as we know
that this is all linear,
we can write it as we can get this term.
We can put the unitary inside the summer.
So just as we headed here
at the end of example one,
we read the sum of all the
strings but then Uf times X,
and now Uf applied on X
we'll learn whether that's a face oracle
will give us minus one
to the power f of X,
times X.
Okay, now we have the
last gate, the last step,
side three.
Here what we again applied hadamard gates
towards state side two.
So we have our normalization factor.
Then the sum of all states
minus one to the power f of X,
we use again the narrative to
get the hadamard gate in here.
Like this,
We can re- write that X, f of X
And at the same time again
but now we re-write the hadamard gate.
You replace it with another
sum just as we did it before
some oval all possible bit strings
minus one to the power
and this time though,
there was something called
the index K, which we some,
if to take K times X
and then our states are
K and not X anymore.
And now I can actually
change the order of the sums.
So we get the sum over
the case, that brunch
and the other terms we have
twice this one of square root of
Oh sorry,
you actually should already remove this
factor because we have
twice one over square root to two to the n
so I can remove the square root.
And so not just changing the
sums and rewrite it a bit
because we have these
two minus one factors,
minus one to the power f of
X and minus one to the power,
K times X,
which we can combine two minus
one to the power f of X plus
K times X
and then times the K.
And this I just define,
I define this part here,
not to be just a variable at Ck.
So the shorter version I can write it as
some overall K
Ck times K
and the Ck we have to find by that,
but we then use this again to calculate.
So our final state, state 3
just before the measurement
is given by this form of formula.
It's a sum of all possible states K
with different prefectures Ck.
No, we do the measurement on all qubits
And the question is
what's our approachability
to measure this zero string?
Cause my claim was that if
we measured the zero string,
we had a constant function
and otherwise a balanced function.
So let's see what the
probability actually is now.
And now we remember from
yesterday, the one rule,
the probability to get
the outcome all zeros
by the born rule is
given by the projection
of our final state, side
three onto the zero stage.
I'll take it in a product.
And the absolute way is that squared.
And now if I replace the side three,
was that formula that I just wrote before
I get the sum of OK, Ck and
then the inner product of
the syrup is string and that string K.
However now what we also learned is that,
I mean, all the different bits strings,
they all a fog and all to each other.
So this inner product
is actually only one
only one if K equals
the bit zero bit string
and if K equals any other bit
string then a product is zero,
because then they're all falling off.
So instead of summing of all K
we just need to take four
K that zero bit string.
So we just get,
C the quick efficiency
C for the bit string
and then episode while you're squared,
this would be the probability.
And now we would just need to
look again at how we define the C
and determine this probability
is co-efficiency C for the K
equals equaling the zero
string and then we're done.
So we have four CK, one
over two to the power n,
times the sum overall X,
all that two to the n bit strings.
Now we have minus one to the
power f of X plus K times X,
however, K is the zero string.
So no matter what X is,
if we multiplied with zero bit string,
then a product would always be zero.
So we don't need to consider
that and just leave that away.
So we just have minus
one to the power f of X
and then squared.
And now let's look at
what the sum gives us.
We basically have three different cases.
We have the case where f
of X is constantly zero.
If we always, if f of X is constantly
output the zero bit string,
and we've always have
minus zero bit, sorry,
then we will always get
minus one to the power zero.
So we just get one for
each of the two to the n
possible inputs.
So we will get two plus
two to the power n.
If f of X is constantly one,
then each time we would get a minus sign.
So we will get minus two to the power n.
And if f of X is balanced.
Then we will get for half of
the terms we would get zero.
So yeah, we will get
zero which means minus one to
the power zero is a plus one
for the other half we will get
this term will be minus one.
So they will all cancel out
and we will get exactly zero.
So summarizing that we can say,
if we then take multiplied
with one over two to the n
and square it take the absolute way you,
then we get for the case
where f of X is balanced
is constant.
So one of the two first cases
we get in both cases exactly one
while in the case where
f of X is balanced,
we just get zero.
Well this is exactly what I clicked
because what'd, we look, we
just determined the probability
after I apply the whole circuit,
I determined the probability
to measure the zero bit string.
And I said, okay, if f of
X is constant, then my,
the probability to measure the
zero bit string equals one.
So I would definitely measure it.
While if f of X is balanced,
the probability to measure
the zero bit string is zero.
So my claim, that's exactly the claim.
And we can see that with
one cheery of the oracle
and measurement on all the
qubits we will immediately get
the, sorry, the answer to all questions.
Now maybe she would give you
a very quickly and intuitive
way to understand Deutsch-Jozsa well
is if we look at the
circuits for what happens for
if in the case where f of X is constant.
Well we know that we
then have the oracle Uf,
which applies minus one to the power X
and to the power f of X.
So in the case where f of X is just zero,
our oracle would not do anything at all,
because it would just apply that face,
multiply with one plus one.
So we will not have any change at all.
And the effect of the oracle,
it will not be any effect with oracle.
So in that case we can
basically cancel out the oracle.
And then we see we have zero,
hadamard gate, hadamard gate,
We know that two hadamard gates.
Also cancel each other out.
Hadamard gate and hadamard
gate equals identity.
So we have just zero and then
of course the final state,
will again be zero.
So it's clear that you would
measure the zero string.
In the case where it's
constant but outputs one,
we have- it's very similar
because we will always
get the minus one face,
which means that our total state
would just get a global
phase of minus one.
But it's built on
yesterday the global face
does not have any impact at
all and no physical meaning.
So if we just multiply it with our
oracle function Uf,
if we just multiply
everything with minus one,
and then it has no FX and
so it'd be again have just
basically to hadamard gates.
We go to the plus states,
then we go back to the zero states.
And then in the end we will
also measure the zero state.
Well if we have a balanced function,
the Orca Uf will have some effect.
It will change our state somehow.
So if we then apply the
hadamard gates again,
we will end up in a different state.
Yeah, that's just to give you some idea of
intuitive understanding
of how the Deutsch-Jozsa
algorithm dot works
and actually think now it
would be good time for break.
But before that I will answer
maybe one or two more questions.
Then we can have a 10 minute break.
- [Instructor] Top three questions here
are all pretty similar
in what they're asking.
They're kinda asking how
do we do this in real life?
So the first question is,
how do we implement an oracle physically?
The next question is,
how do we come up with
algorithms with oracles
since we can't build oracles in reality?
So could you just talk
about that really quickly?
- [Elisa] Yes, so we can
build oracles in reality,
just not for example the textbook one,
sorry, the phone book
book one way I mentioned,
Oh, we could have a
phone book as an oracle.
That's something that we can not vote,
but for example we can
vote a function that just
checks, whether some constraints
are satisfied or not.
Like the Sudoku that I made or just,
there's also this nice example that
where I'm organizing a party and I have
some people that I want to invite,
but then I can not invite
person A and person B together,
but I can only invite person B and C too
at the same time or none of them.
And then you have like different customer.
You can make different constraints,
you can form them into a Boolean function.
And then you can basically give
your oracle the input of, okay, the input.
If A is coming, B is
not coming, C is coming,
is that a possible solution or not?
So you have, you just need sub constraints
that can be through a one.
And then every time you
can put in all these,
the oracle can then just check.
Yes it satisfies the constraints
and no it does not
satisfy the constraints.
So it is possible to implement it.
We will actually also,
when we know implement our,
we will implement our
oracle with Qiskit as well.
You will see how we're
doing it there I mean,
that's maybe a different
thing from how it was one
would physically do it,
but yeah, of course,
but of course it's a
big question in general,
how to create the oracles, yes.
It's not a way for a lot of things,
applications it's not clear
how one would do it but
for example these
satisfiability problems one can
either the, or it's feasible
to write them as oracles.
