Quantum Software Master Class - Midterm Solutions
Quantum Software Master Class - Midterm Solutions
Quantum Software Master Class - Midterm Solutions
16 February
February 4, 2019
Pauli operators
X X
1 = |0ih0| + |1ih1| = |aiha|, X = |0ih1| + |1ih0| = |1 − aiha|,
X X
Y = −i|0ih1| + i|1ih0| = −i (−1)a |aih1 − a|, Z = |0ih0| − |1ih1| = (−1)a |aiha|
Solution: Denote the if statement by → and the ’only if’ by ←. Prove → first: if U is unitary,
then W = P1 ⊗ U + P0 ⊗ 1 should also be. Take Hermitian conjugate W †
W † = P1† ⊗ U † + P0† ⊗ 1† = P1 ⊗ U −1 + P0 ⊗ 1
W † W = P1 ⊗ U −1 + P0 ⊗ 1
P1 ⊗ U + P0 ⊗ 1 =
| {z } | {z } | {z } | {z }
denote ã b a b
where one should remember that (A1 ⊗ B1 )(A2 ⊗ B2 ) = (A1 A2 ) ⊗ (B1 B2 ) so since P0 P1 = P1 P0 =
1 2 2
4 (1 − Z ) = 0 and P0,1 = P0,1 , one gets
1
Lets now prove ←. If W is unitary, the above expression for W † W equals 1 ⊗ 1, but one has U †
instead of U −1 in W †
W † W = P1 ⊗ U † + P0 ⊗ 1 P1 ⊗ U + P0 ⊗ 1 = 1 ⊗ 1
| {z } | {z } | {z } | {z }
ã b a b
= ãa + bb = P1 ⊗ (U † U ) + P0 ⊗ 1 = 1 ⊗ 1
and so
P1 ⊗ (U † U ) = 1 ⊗ 1 − P0 ⊗ 1 = (1 − P0 ) ⊗ 1 = P1 ⊗ 1
so finally U † U = 1.
Comment: Let us remind the reader where does the algebraic definition of unitary operators comes
from. The operator of interest W = P1 ⊗ U + P0 ⊗ 1 acts on (complex vector) space M = C2 × C2 ,
which is simply M ' C4 , so now a vector |vi ≡ vi in M is carrying one (complex) index. The fact
that an operator W (automorphism W : M → M is unitary is the same as (if and only if) it
preserves the scalar products which are introduced in the following way
X
hu|vi = ūi vi
i
Solution: Denote the if statement by → and the only if statement by ←. Let’s make use of
the following fact: (AB)† = B † A† . If we denote element-wise complex conjugate of A by Ā, then
† †
(B † A† )ij = Bik Akj = B̄ki Ājk = Ājk B̄ki = Ajk Bki = (AB)Tij = (AB)†
So now to prove → just take a Hermitian conjugate of A† B † = B † A† to get BA = AB. Same works
for the ←. A philosophical interpretation of this fact is the following: taking Hermitian conjugate
of observables (Hermitian operators) reverts time for them. But this should not break the fact of
their mutual observability [A, B] = 0.
2
Solution: In the power series for the exponent
∞
−iθP
X (−iθ)k
e = Pk
k!
k=0
Solution: If an exponent of operator exp(A) is defined as a formal power series, and the sine sin(A)
and the cosine cos(A) are also, then Euler’s identity holds (formally):
where cos only has even powers of A that by A2 = 1 turn into 1, and sin has only odd powers
starting from A1 , so A can be taken out as a common multiple, ans A2 = 1 would turn all the
resting even powers to 1, so one gets the desired answer.
Problem
√ 5. (1) Show that√the corresponding eigenvectors of the Pauli matrices X, Y, Z are
2 |±i = |0i ± |1i and 2 |y± i = |0i ± i · |1i and |ji for j = 0, 1.
(?) Find an eigenbasis for these same operators which can not be factorized using the tensor
product. (In quantum theory, these basis states are called, entangled.)
Solution: See the solution of Problem 21 for the eigensystems of X and Y . As for Z, computational
basis is the eigenbasis for it already.
Now by definition of tensor product of operators and vector spaces
of Y ⊗ Y
{|y+ i , |y− i} ⊗ {|y+ i , |y− i} = {|y+ y+ i , |y+ y− i , |y− y+ i , |y− y− i}
and of Z ⊗ Z accordingly, just combining the basis vectors. The span of these tensor products of
eigenspaces is clearly all the 22 -dimensional vector-space.
3
The non-decomposable basis for X ⊗ X, Y ⊗ Y and Z ⊗ Z will arise in Problem 23 and is called
Bell’s basis.
Φ = √1 |00i + |11i , Φ− = √1 |00i − |11i ,
+
2 2
Ψ = √1 |01i + |10i , Ψ− = √1 |01i − |10i .
+
2 2
And the eigenvalues are
|Φ+ i |Φ− i |Ψ+ i |Ψ− i
X ⊗X +1 −1 +1 −1
Y ⊗Y −1 +1 +1 −1
Z ⊗Z +1 +1 −1 −1
Notice that if one adds a row of (1, 1, 1, 1) to the table (eigenvalues of 1 ⊗ 1), the rank of the
resulting matrix is 4, which it should be.
Problem 6. Show that for Pa2 = Pa , Pa has eigenvalues 0, 1. Show that for Z 2 = 1, Z has
eigenvalues 0, 1. Consider det(Z − λ1) = λ2 − 1 = 0 and det(P − λ1) = λ(λ − 1) = 0. By
substituting λ 7→ Pa (or Z) and sending scalars c to c1, show explicitly that Pa and Z satisfy
their own characteristic equation.
Solution: First consider the (operator) identity Pa2 = Pa . On the eigen-subspace spanned by
eigenvector |λi it gives λ2 = λ a quadratic equation with only two roots λ1,2 = 0, 1. Same approach
works for Z 2 = 1 providing λ1,2 = −1, 1.
The fact that both Pa and Z satisfy their own characteristic equations follows directly from the
identities, but another explanation (if desired) is that Hamilton-Caley theorem for 2 × 2 matrices
states that any matrix A satisfies
A2 − Tr(A) A + det(A) 1 = 0
.
Problem 7. Express h∧ = ∆(P001 + P011 + P101 + P110 ) over the basis 1, Z, ⊗ . Note in
general that transitioning between these two bases will not increase locality.
Solution: Let’s try to solve it in a manner a bit wiser than just substituting P0 = 21 (1 + Z) and
P1 = 12 (1 − Z) and opening the brackets to get a huge ton of terms. Notice that the expression
we’re working with
h = P001 + P011 + P101 + P110
is missing four terms (of 23 = 8 totally possible) to be a full tensor-power
X
h= Pijk − (P100 + P000 + P111 + P010 )
i,j,k=0,1
where
X
Pijk = (P0 + P1 ) ⊗ (P0 + P1 ) ⊗ (P0 + P1 ) = 1 ⊗ 1 ⊗ 1
i,j,k=0,1
4
and the rest gives
(P100 + P000 + P010 ) + P111 = (P10 + P00 + P01 ) ⊗ P0 + P111
= 1 ⊗ 1 ⊗ P0 + (−P110 + P111 ) = 1 ⊗ 1 ⊗ P0 + P1 ⊗ P1 ⊗ (P0 − P1 = Z)
| {z }
so we finally have
h = 1 ⊗ 1 ⊗ 1 − 1 ⊗ 1 ⊗ P0 + P1 ⊗ P1 ⊗ Z
so substituting the expressions for P0 and P1 here one has not as many terms, so this gets bearable.
Problem 8. (AND penalty). Derive a series of inequalities (equalities) and find a solu-
tion providing integer values for a, b, c, d such that h∧ in (4) has a zero eigenspace given as
span{|x1 x2 x3 i | x3 = x1 x2 } and all other eigenspaces are > 1.
Problem 9. Develop a two-body penalty function that performs the copy operation. In other
words, develop the penalty function such that the low-energy subspace is in span{|000i , |111i}.
Solution: Our function should penalize any of the three spins being different from the rest, so
making it two-body interactions (or clauses including two variables only) one arrives to three terms
each making the two interacting spins being equal, so
X
E(x1 , x2 , x3 ) = − (OR(xi , xj ) − AND(xi , xj ))
3 pairs
and that
− x1 x2 x3 = min z(−x1 + x2 + x3 ) − x1 x2 − x1 x3 + x1 (6)
z∈B
Solution: Let us consider all possible options for x1 , x2 , x3 and z Boolean values, keeping in mind
that both sides of the expression
−x1 x2 x3 = min z(−x1 + x2 + x3 )
z∈B
| {z }
call this RHS
are symmetric with respect to (x1 , x2 , x3 ), so one only cares about the the total number of, say,
1 values, but not their order. See the table
5
# of 1s among x1,2,3 −x1 x2 x3 value RHS(z = 0) RHS(z = 1) RHS
0 0 0 2 0
1 0 0 1 0
2 0 0 0 0
3 -1 0 -1 -1
And to prove the second identity
it is helpful to notice that its RHS (it was for right-hand-side) is symmetric with respect to x2 ↔ x3 ,
and to take x1 out of brackets for the not-in-min terms to get x1 (1 − x2 − x3 ) so the corresponding
table gives
x1 value # of 1s among x2,3 −x1 x2 x3 value RHS(z = 0) RHS(z = 1) RHS
0 0 0 0 0 0
0 1 0 0 1 0
0 2 0 0 2 0
1 0 0 1 0 0
1 1 0 0 0 0
1 2 -1 -1 0 -1
derive a formula for the eigenvalues of a state in terms of the Boolean variables in the general
6
bit string |x1 , x2 , . . . , xl i.
Problem 13. Physical systems at thermal equilibrium are said to be described by a Gibbs
state
−βH
def e
ρβ = (9)
Z
P
where the Hamiltonian H = i Ci is a sum over projectors onto 3SAT clauses and the partition
function is
Z = tr{e−βH }
def
(10)
Let |ii denote (possibly degenerate) lowest eigenstates of H. We label these possibly degen-
erate states by letting i range from 1 upto d. Call λmin the lowest eigenvector of H.
Show that
d
1 X D −βH E
lim ie (i) = 1 (11)
β→∞ Z
i=1
and hence establish that in infinite time, sampling a thermal system can solve SAT instances
with probability one.
P
Solution: Since 3SAT Hamiltonian H = i Ci is classical (and thus is a diagonal matrix), the
state X
e−βH = e−βEj |ji
j
is a (from a quantum perspective) a pure state (just a vector), the scalar products give
d D
X E Xd X
ie−βH = e−βEj hi|ji = d · e−βEmin
i=1 i=1 j
7
since the eigenvectors are chosen orthonormal hi|ji = δij . And the limit of interest is
d · e−βH X
lim = 1+ e−β(Ej −Emin ) = 1
β→∞ Z
Ej >Emin
. The physical intuition behind this is that evolution (Hamiltonian being the generator of the
evolution) of a physical system in imaginary time t → it ≡ β (aka Wick rotation) takes it to the
ground state (or ground states), but for so the system should have interaction within. For 3SAT on
a connected graph this holds true.
Problem 14. Show that the complex numbers C form a complex Euclidean space.
Solution: By definition of addition on complex numbers, they form a vector space, so one needs
to ensure that the metric d : C × C → R satisfies metric axioms: non-negativity, identity on
indiscernibles, symmetry and triangle inequality. Standard metric, induced by norm in complex
numbers, called modulus p
z = a + ib → |z| = a2 + b2
is given by
d(z1 , z2 ) = |z1 − z2 |
which gives for z1 = x1 + iy1 , z2 = x2 + iy2
p
d(z1 , z2 ) = (x1 − x2 )2 + (y1 − y2 )2
which is standard Euclidean metric on a plane (2-dimensional Euclidean space) that is known to
satisfy these axioms for 3000 years or so.
Problem 15. (Z2 symmetry). Consider the tunable two-body Ising Hamiltonian acting on n
spins as X
H= Jij Zi Zj (12)
i<j
Nn
Using the identity that XZX = −Z or otherwise, for X̃ = l=0 Xl show that
h i
X̃, H = 0 (13)
and hence establish that the definition of |0i, |1i is entirely arbitrary with respect to H.
Solution: This is indeed a more formal expression of the total-flip-symmetry argument. First of all
notice that the operators in H act as Z on i-th and j-th spins and as identity on others, so formally
speaking
i−1 n
! !
O O
Zi = 1 ⊗Z ⊗ 1
k=1 k=i+1
and so the ij-th term of the Hamiltonian in the [X̃, H] expression gives (omit Jij )
X̃Zi Zj − Zi Zj X̃
8
which we now multiply by X̃ keeping in mind that X 2 = −1, and so get
X̃Zi Zj X̃ + Zi Zj
and now taking X̃ through the 1-s of not i-th or j-th spins gives −1 acting on them and Zi and Zj
turn into −Zi and Zj , so one gets
−Zi Zj + Zi Zj = 0
vanishes if and only if such a disjoint partition exists. Here si is a spin variable ∈ ±1.
Solution: This problem is one of many NP-problems, embedding of which is discussed in the well-
recommended article arxiv.org/abs/1302.5843. The explanation is quite clear: if such a partition
exists, there exists an assignment (degenerate by a flip si → −si of all spins) si that takes H to
zero, and since the values of H are nonnegative, this is the lowest-energy state. If this expression
never vanishes, (by this we are proving the ”only if” part, the
vanishes ← exists
since if A ← B, then ¬A → ¬B) then the sum in brackets
X
ni s i
i
is never zero (for any of 2N assignments), which means there is no such assignment. The Hamiltonian
is a square of this sum not only to satisfy non-negativity, but also to be some quadratic (Ising-form)
expression in si .
Problem 17. Using the result from Problem 7, let H∧ (Z1 , Z2 , Z3 ) be the penalty Hamiltonian
applying the AND gate. Show that NAND can be recovered by calculating H∧ (Z1 , Z2 , X3 Z3 X3 ).
Solution: Have a look at the truth tables of AND and NAND
X1 X2 X3 X1 X2 X3
0 0 0 0 0 1
AND: 0 1 0 NAND: 0 1 1
1 0 0 1 0 1
1 1 1 1 1 0
this is to make sure that NAND is really the negation of AND. Now if spin number 3 is the ’answer’-
bit, one simply needs to flip it. If a state vector is acted on with an operator Z, to flip one needs
to make a linear transform
Z → X −1 ZX
since X is a linear transform of the state space corresponding to a spin flip. As far as X 2 = 1, X −1
can be chosen to simply be X.
9
Problem 18. Let H = H † , H 2 = 1. Show that each such H gives rise to a self-adjoint
projector—and conversely—hence establish a bijection between self-adjoint unitary maps and
projectors.
Problem 19. Building on the results from Problem 18, let M be the invertible map taking
projectors to self-adjoint unitaries. Show that for orthogonal projectors Pi , Pj , with corre-
sponding unitary maps M (Pi ), M (Pj ) the composition (?) of self-adjoint unitaries is given by
the negated sum of projectors under the image of M viz. M (Pi ) ? M (Pj ) = −M (Pi + Pj ) and
hence show that [M (Pi ), M (Pj )] = 0 taken with respect to the defined ? product.
M± (P ) = ±(2P − 1)
Now whichever option is chosen, the composition defined in the following way
equals zero.
Problem 20. (Rank-1 projectors ?). Show that a non-trivial operator P is a Schmidt rank-1
projector if and only if it can be written as |ψihψ|.
Solution: Again, start with the (if) → statement. So if P is a rank-1 projector, it can be SVD-
decomposed to σ|uihv| with σ just a number, since its rank-1. So projector property gives
hu|vi = 1
and thus |ui = |vi and thus (denoting it |Ψi) P = |ψihψ|. The ← obviously holds true P 2 = P
holds for P = |ψihψ|.
10
Problem 21. By using Dirac notation (i) find eigenvalues and eigenvectors of Y, Z. (ii) Show
that
[σi , σj ] = 2iijk σk
where is the Levi-Civita symbol, σ1 = X, σ2 = Y and σ3 = Z. (iii) Show that iσ1 σ2 σ3 = 1.
with the corresponding eigenvalues being ±1. Now for Y one gets in a similar fashion
Problem 22. Provide iff statements defining conditions on the aij terms for the operator
X
aij |iihj| (15)
i,j∈{0,1}
Solution: From linear algebra we know that for A to be Hermitian it should satisfy A† = ĀT = A,
so āij = aji . Projector property A2 = A gives
X
aik akj = ai0 a0i + ai1 a1i = aij
k
Show that @ |ψ1 i , |ψ2 i ∈ C2 for the Bell state to be expressed as |Φ± i = |ψ1 ψ2 i as well as |Ψ± i.
The states |Φ± i are therefore called entangled.
11
Solution: One possible (quite straightforward way) to show this is a contrario: introduce such two
vectors + +
φ ⊗ φ = φ+ |0i + φ+ |1i ⊗ φ+ |0i + φ+ |1i = Φ+
1 2 10 11 20 21
that can’t be possibly satisfied. Same works for all other Bell states.
Problem 24. (Bell basis). Using the right hand side equations,
X X
σ0 = |aiha|, σ1 = |1 − aiha|,
X X
σ2 = i (−1)a |aih1 − a|, σ3 = (−1)a |aiha|.
defines the Bell states (which defines an orthonormal basis in C2 ⊗ C2 . Here σi indexes the
Pauli matrices.
hl| σi σ0 σ1 σ2 σ3
h0| h0| h1| −i h1| + h0|
h1| h1| h0| +i h0| − h1|
to see the correspondence
Φ+ Ψ+ Ψ− Φ−
σ0 σ1 σ2 σ3
12