2024 Problem Set 1
2024 Problem Set 1
In this first problem set we will go over some of the important concepts involved with
state preparation, measurement and tomography.
Submit everything as a single Jupyter notebook (including non-computational questions).
1. Qiskit measurement warm up: Prepare each qubit state either using initialize, or
reset followed by the appropriate single qubit gate function. Use the AerSimulator
as the backend as in the bootcamp tutorial.
(c) Prepare √1 (|0⟩ + |1⟩) and measure in the computational basis. Comment on
2
the discrepancy from the ideal result even though this is a “perfect” quantum
computation. What is the number of shots needed to obtain an (average) accuracy
of 99%, i.e the number of measured “0” or “1” outcomes is within 1% of the
expected number? 99.9%?
The end of a quantum a quantum computation always ends in measurement.
Comment on any implications of your results in (c) on quantum algorithm design.
(d) Design a circuit to effectively measure √1 (|0⟩ + |1⟩) in the σx basis (i.e along the
2
+x and −x directions on the Bloch sphere).
(e) Design a circuit which will always give a measurement outcome of +1 for an input
state defined by the Bloch vector ⃗v = √1 (0, 1, 1). You may only use the Rigetti
2
native gates which are RX(θ) with θ = ±π/2, ±π, and RZ(θ) with arbitrary θ.
2. Visualizing quantum states warmup: There are several ways to visualize the final
state. For the states below, plot both the Bloch vector and also the “cityscape”
of the density matrix. Be sure to add to your code from qiskit.visualization
import plot state city, plot bloch multivector. Both visualizations work for
(wave)vectors and density matrices. Cityscape is needed to visualize more than one
qubit.
2
(a) |0⟩
3. Bloching Time This is the first of a series of 4-5 problems designed to reinforce concepts
with real time feedback. ”Bloching Time” is attached to the end of the problem set, but
conceptualization-wise it is problem 3. Each problem comes with a support Jupyter
notebook.
(a) Single qubit tomography, ideal: Prepare the following states and plot both the
density matrix representation and Bloch sphere representation of the final state.
Use the AerSimulator as the backend. After preparing your circuit (which should
consist of a single qubit), perform tomography using the StateTomography()[1].
(e.g. see tutorial.) Plot both the Bloch vector and also the “cityscape” of the
density matrix.
i. |0⟩
ii. |1⟩
iii. √1 (|0⟩ + |1⟩)
2
(b) Single qubit tomography, qpu: IonQ cites this paper for their 11-qubit computer
performance which demonstrated 0.7% SPAM (state preparation and measure-
ment) errors.
i. Estimate the number of shots you need to detect SPAM errors with S/N of
10 assuming the 0.7% SPAM error rate.
ii. For state |0⟩, run the qiskit tomography code with the number of shots from
(i) using the ionq.simulator backend to check your results are reasonable.
iii. Run the resource estimation step to check that resources are reasonable.
Share your resource estimation on the discussion board for approval to move
3
to the next step. Because Azure can only send one circuit at the time to
estimate costs, estimate using a for loop.
iv. Run your code in (ii) on the ionq-qpu [2] for the input states |0⟩ and |1⟩. For
each state,
A. print the density matrix
B. Plot both the Bloch vector and also the cityscape visualization of the
density matrix.
C. Calculate the fidelity of the measured state with the ideal state.
v. Discuss your results including any deviations in both the length and angle of
the Bloch vector.
vi. Optional: Repeat the above experiment, however perform gates and/or mea-
surements on other qubits in the system in parallel to see if operating on
other gates affects the target qubit. [3]
5. Native gates
(a) In class we introduced the native gates on the IonQ and Rigetti simulators. What
are the native gates for another cloud-based quantum simulator (describe the
gates and name the simulator)? If you have some understanding of the differences
in the hardware, explain why the native gates are different.
(c) Decompose a CNOT circuit into the IonQ’s native gates (https://ionq.com/best-
practices). (Hint: We can decompose a CNOT circuit into RX, RY and Mølmer-
Sørenson gates.)
Currently, due to the high cost of quantum computing, users typically have little or
no control over any of the transpilation/compilation that will occur (unless utilizing
the native gates). In the above Tomography example we did not look at “interesting”
quantum states, i.e. superposition states, because transpilers will automatically col-
lapse gates adjacent which correspond to the identity matrix. One way to get around
this is to use quantum hardware native gates. Compilation of quantum algorithms is
an active area of development and research (even including its complexity!).
4
[1] Be sure to add to your code from qiskit experiments.library import StateTomography
and from qiskit.quantum info import DensityMatrix
[2] If the IonQ qpu is down, you can use either the Rigetti qpu or the Quantinuum Emulator.
Whichever machine you choose, first run the code on the free simulator to ensure your results
make sense!
[3] For a related work in the literature see Chen, Farahzad, Yoo and Wei, PRA 100, 052315, 2019.
Part 1: Bloching Time
Tommy Nguyen
January 9, 2024
Backstory
Kai-Mei and Mark have just purchased a new quantum clock to help their
graduate students learn the bloch sphere. To tell time, one has to read quantum
states. They’d better get used to it, or they’ll all be late for their meetings!
In the figure above, we are representing the state |+⟩ on our circle, since the
arrow points in this direction. This circumference is completely equivalent to
the blue one, shown below inside the Bloch sphere.
1
In Kai-Mei and Mark’s labs, the new way to tell the time is to read two
states in Bloch’s circumference. The state |0⟩ corresponds to 12h on a clock, |1⟩
would be equivalent to 6h, |+⟩ would be 9h, and so on. In this challenge we are
going to work with 2 qubits. The first one corresponds to the minute hand and
the second one to the hour. You will be given the time of the day as the input
and you will have to generate the quantum states equivalent to such time.
Challenge code
You must complete the ‘time‘ function that will take the hour and minutes as
an argument and generate the two-qubit state associated to the indicated time.
Input
The input will be two integers. The one corresponding to the hours will take
values from 1 to 12 and the one corresponding to the minutes will range from 0
to 59.
Output
The output will be the vector of amplitudes of the two-qubit state, measured in
the computational basis. You are only asked to complete the gates, we’ll handle
the rest. For the sake of this problem, the hour hand points directly at the
input number and doesn’t fall between any two numbers. Good luck!