import sympy as sp from sympy.vector import CoordSys3D from chapter_4 import Ry, theta, Z
Set up some variables:
a, b = sp.symbols('a b', real=True) # usage for a,b or alpha,beta in the book c, s = sp.symbols('c s', real=True) # usage for cosine and sine
Show that the unitary operator corresponding to the phase shift in the Grover iteration is
Recall that the phase shift operator in Grover's algorithm does the following to the standard basis states:
Since
Let
where
First of all we note that
Hence
QED.
Show that in the
where
Recall that
Moreover
This is consistent with the formula for
By definition of
Note that this is the Pauli-Z matrix. Let
Note that
To show the claim only a short calculation is left. Let us do it with the help of sympy
:
Inv_psi = sp.simplify(Ry * Z * Ry.H) # Ry = Ry(theta) Orac = Z assert Ry.subs(theta, 2*theta) == Inv_psi * Orac "PASSED"
PASSED
Another way to see this (without much calculation) is to note that
Give explicit steps for the quantum search algorithm, for the case of multiple solutions
(
The difference to the special case
We assume that
This formula comes from exercise 6.3. In the solution of that exercise we showed that
Here
Hence
(for
Apply
Apply
Show that the augmented oracle
According to the book we have to implement
Recall that the techniques of chapter 4 require to decompose
The key to see this is the fact that the oracle
It is not hard to see that
accomplishes exactly that. Here
In the framework of (classical) reversible computation as sketched in chapter 3.2.5 in the book we need at least two applications of the oracle.
Before we prove this let us first show a classical reversible algorithm which uses two applications of the oracle:
The second application of the oracle is needed to uncompute the garbage from the auxiliary
register. An intuitive way to see the necessity of the second application is to look at
the information present in the registers. In case of
Let us give a (hopefully) more rigorous proof. Assume to the contrary that it was possible
with just one application of the oracle and an additional
In the second step the
After the oracle step for a certain
Now let us simulate the above circuit on a larger circuit with four zones. A zone is
just a group of registers. The first zone is a read-only zone containing
Let us denote by
Consider the circuit which acts as follows:
Now let us see how we can extract
Add zone three to zone two (using bit-wise addition):
Note that
CNOT
controlled
by the fourth zone):
We have managed to extract a bit of information about
Verify that the gates in the dotted box in the second figure of Box 6.1 perform the
conditional phase shift operation
The circuit in the dotted region implements the following operator
Recall that the controlled Z
-gate acts as follows on the standard basis:
The X
-gate just exchanges the roles of
Up to a factor of
Verify that the circuits shown in Figures 6.4 and 6.5 implement the operations
There is a typo in the rotation matrix. The matrix should be
The minus-sign is missing in the figures of the circuits.
Since
Hence
On the other hand this is exactly what the circuit
(
QED.
In the same way as in the first part we see that
Again this is exactly what the circuit does. Let us first consider the case
For the case
Suppose the simulation step is performed to an accuracy
From equation (6.23) we know that the simulation time is
This must be
Let
The first of the three terms is the unimportant global phase. The second and the third are
rotations around
such that:
and
QED.
Show that by choosing
To not obscure the proof by too much technicalities I only prove the result for large
enough
From the proof of exercise 6.9 we know that
and
Also recall that
From the Taylor expansion
Now consider the axis of rotation. Below with
The squared norm of the RHS is
From the original formula for
and
Hence
and therefore
To enable a 100% probability this number must be an integer. The standard case with
Let us use sympy
to do the boring calculations. First let us define r1
of
N = CoordSys3D('N') z = N.k psi = 2*a*b*N.i + (a**2 - b**2)*N.k r_formula_rhs = s*c*(psi + z) + s**2 * psi.cross(z) r1 = b*c*N.i - b*s*N.j + a*c*N.k
Here we check that our formula for
norm2_r1 = r1.dot(r1).subs(b**2, 1 - a**2).subs(c**2, 1 - s**2) assert r_formula_rhs.subs(b**2, 1 - a**2) == 2*a*s * r1 assert sp.simplify(norm2_r1) == 1 - a**2 * s**2 "PASSED"
PASSED
Guess a Hamiltonian with which one may solve the continuous time search problem in the
case where the search problem has
My Ansatz looks as follows
where
and we let
In particular we arrive at the same formula for the Hamiltonian and formula (6.23) which
states that the corresponding unitary group rotates (the still arbitrary)
Thus after time
Essentially the only thing which differs is the value of
Let us finally investigate the implications for the performance of an approximation
similar to the one in the book. It is easiest to just follow the proof of exercise
6.10. For simplicity we restrict our short analysis to the case
The angle
Hence
The same reasoning as in exercise 6.10 allows us to estimate the angle
Hence
Suppose
Let
Note that the term involving the identity
where
First of all note that the two summands of
On the other hand from the first part we already know that the exponential of
Consider a classical algorithm for the counting problem which samples uniformly and
independently
Let us denote by
According to the exercise statement the random variables
The mean value of the
Hence, by linearity
For the second equality we use that due to independence
The exercise does not really ask for this but we do it anyway. For reasons to become clear
at the end we consider the accuracy
Choosing
Hence
We assume that
Assume
holds for all
Note that
Let
Recall that in our analysis we only consider asymptotic estimates for
Let us define
Let us assume that there is a special sequence of values for
for
This is a contradiction! Hence such a special sequence does not exist. Thus
Prove that any classical counting algorithm with probability at least
The exercise is a little bit vague in my opinion - but that is OK. If we speak about probabilities there must be a probability distribution somewhere. The exercise doesn't explicitly define one. Sometimes the distribution is given implicitly. In this case I think there are at least two options:
I solved the exercise for both interpretations.
For a given
As we are interested in the asymptotics of
Of course, a concrete algorithm might not actually separate steps 2 and 3 but it is always
possible to change the algorithm so that it behaves like that by essentially running it
twice: the first time we just remember the
The
As the algorithms are supposed to be arbitrary they might in particular be deterministic
(meaning that they compute a function mapping oracles to integers). In that case it
wouldn't even make sense to speak about a probability of
One possible distribution is the uniform distribution over all
Assuming a uniform distribution over all possible
We show now that in that case the exercise statement is wrong (at least for sufficiently
large
Return
N/2
is accurate within This statement follows from the central limit theorem. Let us proof it directly - just for fun (it is not difficult).
Let us abbreviate
A straightforward calculation using Stirling's formula
Here we set
Observe that
This implies that the probability distribution of
Let us investigate a different class of probability distributions.
Let
and such that oracles having the same number
The previous distribution does satisfy the symmetry condition but not the part about the
For these distributions one can readily see that conditioned on
Let us write
Without loss of generality we assume that
Let
By assumptions we have
For other expressions the "positive probability zone" might be slightly extendend to the left or right (or both). This comes in handy next since it avoids "index overflow". Let
Clearly the corresponding events imply the failure of the algorithm (accuracy is too
bad). Hence
Recall that we have to show
Our goal is to show that under this assumption
Let
(i.e.
is the same for all
To prove
uniformly with respect to
A straightforward calculation using Stirling's formula
Observe that at
Compare this with the normal distribution. We essentially proved the central limit theorem in a special case.
Recall that
Let us offer an interpretation which is analogous to exercise 6.13. Let again consider an
algorithm as sketched in the previous interpretation. But now we assume more
specifically that the
In this case we can consider individual oracles and need not consider probability
distributions over them. The
We note again that we consider a sequence of algorithms (as we are interested in the
asymptotics
First of all we note that if
Without loss of generality we may assume that
Let
so that
Observe that if
By definition of the
Let
and for any combination
Let
Since
for a suitably chosen
Let
Then
By the condition in the lemma involving
The LHS is bounded by
Use the Cauchy–Schwarz inequality to show that for any normalized state vector
Let
Moreover by the Cauchy-Schwarz inequality
Using this while doing a summation of the first observation yields the claim.
Suppose we merely require that the probability of an error being made is less than
Below we sketch the main steps of the proof as it is presented in the book. For this exercise the only relevant modification happens at step 5. Let the notation be as in the book:
with
be the success probability for a given value of
This can be proved using
Follows by induction from 1 and
Follows from the triangle inequality and the Cauchy-Schwarz inequality.
This follows from the Cauchy-Schwarz inequality (see exercise 6.15).
Since this is the crucial step for this exercise we give a detailed proof below. (Under
the stronger assumption that
The claim (that
As in the main text we may assume that
Using
Note that this inequality is (essentially) sharp since equality holds if half of the
Suppose the search problem has
We closely follow the structure of the proof of exercise 6.16 (which in turn follows the proof from the book). Without loss of generality we may assume that
Otherwise
Note that there are unique normalized states
Note that the success probability (which is assumed to be at least
Here the summation ranges over all
This is just a short calculation using the Cauchy-Schwarz inequality (in the second to last step):
QED.
Note that here the bound on
From the relation between
Now the assumption on the success probability
Prove that the minimum degree polynomial representing a Boolean function
Any multi-linear polynomial representing
where the sum ranges over all
Let
This (essentially) implies the claim. QED.
Also note that
Show that OR
.
This is obvious. Probably one way to make it even more obvious is to note that
This is precisely the behaviour of the OR
function. QED.
Show that OR
function from the output of a quantum circuit which computes OR
with zero error.
OR
corresponds to the search problem
whether
First of all note that
Hence
Let us briefly recall how an algorithm for the zero-error case works. First a number
To actually return something we have to measure at least some of the qubits. Without loss
of generality we may assume that all yes
, no
, and inconclusive
. We may assume that at least
Let
be the final state right before measurement. From the book we already know that each
This is the probability of returning no
(meaning that the algorithm claims that
Clearly this is a real polynomial of degree at most OR
. Using the fact that
Robert Beals and Harry Buhrman and Richard Cleve and Michele Mosca and Ronald de Wolf (1998). Quantum Lower Bounds by Polynomials.