0% found this document useful (0 votes)
184 views12 pages

CS191 Midterm 1 Solutions: February 16th 7-9pm

This document contains solutions to problems on a CS191 midterm exam focusing on quantum computing concepts. It provides definitions and explanations of quantum gates like CNOT, X, Z, H, and tensor products of matrices. It also solves four multi-part problems involving manipulating qubit states using these gates, with Alice and Bob sharing an entangled state across different labs.

Uploaded by

hirmay sandesara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
184 views12 pages

CS191 Midterm 1 Solutions: February 16th 7-9pm

This document contains solutions to problems on a CS191 midterm exam focusing on quantum computing concepts. It provides definitions and explanations of quantum gates like CNOT, X, Z, H, and tensor products of matrices. It also solves four multi-part problems involving manipulating qubit states using these gates, with Alice and Bob sharing an entangled state across different labs.

Uploaded by

hirmay sandesara
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CS191 Midterm 1 Solutions

February 16th 7-9pm

Useful information.
 
1 0 0 0
0 1 0 0
Controlled not: CNOT = 
0

0 0 1
0 0 1 0
 
0 1
Bit flip: X =
1 0
 
1 0
Phase flip: Z =
0 −1
" #
√1 √1
Hadamard: H = 2 2
√1 − √12
2

Sign basis:
   
√1 (|0i √1
1 √1 (|0i √1
1
|+i = + |1i) = ; |−i = − |1i) =
2 2 1 2 2 −1
Bell basis:

|φ+ i = √12 (|00i + |11i)


|φ− i = √12 (|00i − |11i)
|ψ + i = √12 (|00i + |11i)
|ψ − i = √12 (|00i − |11i)
    
e f e f
a   b 
   
 
a b e f 
 g h g h 

Tensor Product of matrices:  ⊗ = 
    
c d g h 
 e f e f 

c   d 
g h g h

1
Problem 1. (35 points)

You may use X, Z, H and CNOT gates for Problem 1.

a. |ψi = αβ |00i − α2 |01i + β 2 |10i − αβ |11i


Write |ψi as a product state or prove that it is an entangled state.

Product state: (α |0i + β |1i) ⊗ (β |0i − α |1i)

b. You wish to create the state |ψi, but do not know α and β. Luckily you
have available an unbounded supply of qubits in state α |0i + β |1i, as well as
qubits in the state |0i. Draw a circuit that outputs state |ψi or prove that no
such circuit exists.

Start both qubits in the |ψi state, then apply an X and then a Z gate to the
second qubit.

2
c. This time you have available an unbounded number of qubits in the state
|0i, but only a single qubit in the state α |0i + β |1i. Draw a circuit that outputs
state |ψi or prove that no such circuit exists.

No such circuit can exist. Say there was a circuit that could do this. then
we could apply the Z and X gates to the second qubit of the output, and create
a clone of the α |0i + β |1i state. This is shown in the below diagram, where the
circuit in question is labeled as C:

This violates the no cloning theorem, so such a circuit may not exist.

d. You have an infinite supply of qubits in states |0i and α |0i + β |1i. Given
these possible inputs, draw a circuit that outputs the following state:

√1 α(α + β) |000i + √1 β(α + β) |010i + √1 α(α − β) |101i + √1 (α − β)β |111i.


2 2 2 2

We first notice that all states with 0 on the middle qubit have a leading α,
and all states with 1 on the middle qubit have a leading β. This tells us that
the overall state is actually a product state. Specifically, it is the product of
α |0i + β |1i on the middle qubit and
√1 (α + β) |00i + √1 (α − β) |11i
2 2

on the first and last qubits. This is clearly the result of the action of a CNOT
on the state
( √12 (α + β) |0i + √1 (α
2
− β) |1i) ⊗ |0i

This state is easily achieved by starting the first qubit as α |0i + β |1i and
applying a Hadamard gate. Overall, the total circuit looks like this:

3
4
Problem 2. (25 points)

Alice and Bob have somehow managed to get their three qubits into the state
α |000i + β |111i. The first two qubits are in Alice’s lab, while the third qubit
is in Bob’s lab. Alice performs a Bell measurement on her two qubits — i.e.
she applies the circuit from problem 3a to her qubits and measures to obtain
classical bits b1 and b2 .
a. What is the density matrix of Bob’s qubit after Alice completes her mea-
surement?

Alice applies the circuit from 3a to her two qubits, leaving the third unchanged.
The CNOT gate sends
(α |000i + β |111i) → α |000i + β |101i
notice that the middle qubit may only be 0, so we may factor it out. Then
excluding the middle qubit, the first and third qubits occupy the state:
α |00i + β |11i
. From here, the H gate is applied to the first qubit, which sends
α β
(α |00i + β |11i) → √
2
(|0i + |1i) |0i + √
2
(|0i − |1i) |1i

α α β β
= √
2
|00i + √
2
|10i + √
2
|01i − √
2
|11i

= √1 |0i (α |0i + β |1i) + √1 |1i (α |0i − β |1i)


2 2

Alice has a 12 chance of measuring b1 = b2 = 0, in which case Bob’s state will


be α |0i + β |1i. She also has a 21 chance of measuring b1 = 0, b2 = 0 in which
case Bob’s state will be α |0i − β |1i.
 ∗
αα α∗ β

The density matrix for α |0i + β |1i is  


∗ ∗
αβ ββ

αα∗ −α∗ β
 

and the density matrix for α |0i − β |1i is  


−αβ ∗ ββ ∗

So Bob’s total density matrix for the mixed state is then:


 ∗
αα α∗ β αα∗ −α∗ β
    2 
|α| 0
1  + 1 = 
2 2
∗ ∗ ∗ ∗ 2
αβ ββ −αβ ββ 0 |β|

5
b. For what value of p is Bob’s density matrix in part a the same as the density
matrix of the mixed state: |0i with probability p and |1i with probability 1 − p?

     
1 0 0 0 p 0
p  + (1 − p)  = 
0 0 0 1 0 1−p

See the corresponding density matrix in part a. You can see that p = |α|2 .

6
c. Alice calls up Bob to tell him b1 and b2 . What should Bob do to transform
his qubit into state α |0i + β |1i ?

b1 = 0: no gate
b1 = 1: Z gate

From part a we know b2 will always be 0. If b1 is 0, then Bob already has


the state α |0i + β |1i, so he applies no gate. In b1 is 1, we know Bob has the
state α |0i − β |1i, so he will apply the Z gate to reach the state α |0i + β |1i.

d. Can you reconcile your answers to part b with the fact that Bob ends up
with his qubit in the pure state α |0i + β |1i in part c?

Bob went from state with the same density matrix as that in b to his state
α |0i + β |1i. Bob could not have gone from the state in b to α |0i + β |1i with-
out knowing α and β, so this seems to imply a contraction. The resolution is
that the bit b1 Bob receives from Alice removes the probabilistic nature of his
mixed state. Since the density matrix only describes a probabilistic combination
of states, receiving b1 changes his density matrix to either that of α |0i + β |1i
or α |0i − β |1i.

7
Problem 3. (15 points)

a. Write out the unitary matrix corresponding to the following circuit:

(H ⊗ I)(CN OT ) =
    
1 0 1 0 1 0 0 0 1 0 0 1
    
    
0 1 0 1  0 1 0 0
 0 1 1 0
   
     
√1    = √1  
2 1 0 −1 0  −1
0 0 0 1
  2 1 0 0
  
    
    
0 1 0 −1 0 0 1 0  0 1 −1 0

b. Write out the unitary matrix corresponding to the following circuit:

(a) ⊗ Z =

8
 
1 0 0 0 0 0 1 0
 
 
0
 −1 0 0 0 0 0 −1

 
   
1 0 0 1 0
 0 1 0 1 0 0 0

   
     
0
 1 1 0
 1 0 0
 0 0 −1 0 −1 0 0

     
√1  ⊗  = √1  
2 1
 0 0 −1

0 −1  2 1
 0 0 0 0 0 −1 0

   
   
0 1 −1 0 0
 −1 0 0 0 0 0 1
 
 
0
 0 1 0 −1 0 0 0

 
 
0 0 0 −1 0 1 0 0

9
Problem 4: GHZ game (25 points)

a. The GHZ state is √12 (|000i + |111i). If you apply a Hadamard gate to
each of the three qubits, what is the resulting state?

H ⊗3 √12 (|000i + |111i)

= √1 (H ⊗3 |000i + H ⊗3 |111i)
2

= √1 (|+ + +i + |− − −i)
2

= √1 ( √1
(|000i + |011i + |101i + |110i + |100i + |010i + |111i + |001i)
2 2 2
1
+ 2√2 (|000i + |011i + |101i + |110i − |100i − |010i − |111i − |001i) )

= 12 (|000i + |011i + |101i + |110i)

Note that a measurement in the standard basis will always yield an even number
of 1s.

b. Now suppose you start with three qubits in the state |ψi = 12 (|000i − |011i −
|101i−|110i). Note that measuring this state in the standard basis always yields
an even number of 1’s. If you apply a Hadamard gate to the first two qubits of
|ψi, what is the resulting quantum state? If you now measure in the standard
basis, how many 1’s do you see?

(H ⊗ H ⊗ I) |ψi

= 12 (|+ + 0i − |+ − 1i − |− + 1i − |− − 0i)

= 12 ( 21 (|00i + |01i + |10i + |11i) |0i − 12 (|00i − |01i + |10i − |11i) |1i
− 21 (|00i + |01i − |10i − |11i) |1i − 12 (|00i − |01i − |10i + |11i) |0i) )

= 21 (|100i + |010i + |111i − |001i)

Measuring this state in the standard basis will always yield an odd numbers of
1s.

10
c. The GHZ game is like the CHSH game except that in the quantum case the
players succeed with probability 1 (rather than 0.85). It involves three players
A, B, C, who receive as input random bits x, y, z ∈ {0, 1} with the promise that
x ⊕ y ⊕ z = 0 (either all inputs are 0’s, or there are exactly two 1’s). As in
the CHSH game, they cannot communicate with each other. They each out-
put a bit a, b, c ∈ {0, 1}. If x=y=z=0 they win if they output an even number
of 1’s, and on the remaining inputs they win if they output an odd number of 1’s.

What quantum state should A,B,C share and how should each player act to
win with certainty? Hint: Use your result from part b.

The players should share the state from b between them. Each player should
use the following strategy:
If their input qubit is 0 apply no gate
If it is 1 apply the H gate.
then measure the qubit in the standard basis and output the result.

By the symmetry of the state in part b under permutation, applying H gates to


any two qubits and measuring will always yield an odd number of ones. Using
this strategy, the players will always output an odd number of 1s if x + y + z = 0
and an even number if x + y + z = 2, yielding 100% success.

d. How would classical players A, B and C win with probability 3/4?

Classically, the players could output 1 on all inputs. This would give an odd
number of 1s for any input, yielding success when x ⊕ y ⊕ z = 2 but failure when
x + y + z = 0. Since there is a 34 chance of inputs satisfying x + y + z = 2, this
yields a 34 success ratio.

11
e. (Extra Credit) Show that if A, B, C are limited to classical strategies,
then they cannot win with probability greater than 3/4.

12

You might also like