HW 7 (Practice) - Quantum Algorithms 2
1: QFT
Consider the sequence of steps shown in Section 4 of the qiskit page on the Quantum
Fourier Transform: https://github.com/qiskit-community/qiskit-textbook/blob/main/content/ch-algorithms/quantum-fourier-transform.ipynb
a. Follow these steps explicitly for a 2-qubit system.
b. A two-qubit system can encode the numbers 0 to 3. For each of these find its Fourier
transform.
c. Is your result from the previous part consistent with the Bloch sphere animation at the
end of section 4 of the QFT qiskit textbook page? Explain. Since we only have three
qubits, which of the four spheres correspond to our three spheres (e.g. qubit 0 to 2 or
qubit 1 to 3, etc.).
For a 2-qubit system we can do the steps explicitly:
Encoding Numbers
Using our equation above, we can get our
Ket to Encode |
|
---|---|
Notice that we can construct the unitary matrix in this case: |
Intuition
Consider the following image:
In this case since we have only two qubits, then qubit 3 in the gif above corresponds to the qubit 1 (the most significant qubit) in our 2-qubit system. Qubit 1 in our 2-qubit system corresponds to qubit 2 in the animation above.
This is because, if you look at the table prior, when the most significant qubit is changing between
2: QPE
Consider the sequence of steps shown in Section 1.2 of the qiskit page on the Quantum
Phase Estimation: https://github.com/qiskit-community/qiskit-textbook/blob/main/content/ch-algorithms/quantum-phase-estimation.ipynb
a. Follow these steps explicitly for a system with two counting qubits and one ancilla qubit.
b. Build this circuit in IBMQ. According to the resulting probability distribution, what is
θ?
Explain.
A 2-qubit System
Consider running QPE for 2-qubits in our system (and still one ancilla qubit). Namely we want to find eigenvalues for the transformation
Where it's presumed that
Applying the unitary operations:
All the
For each
Recall from earlier in our table that
Giving:
Thus we get a peak at ket
An Example System
Using the example system above, we get the following probability distribution:
]>Notice the spike in probability at
3: Shor - period finding
We want to carry out Shor's algorithm to factor 15.
a. Only one of the following options for
Which one is it? Circle the correct one. For all others, what is the reason they don’t
work?
i.
ii.
iii.
b. Using a = (the correct result from part a.), follow the cycle (until you get back to |1>)
shown in the first paragraph of section 2 on this page (and in class).
https://github.com/qiskit-community/qiskit-textbook/blob/main/content/ch-algorithms/shor.ipynb
c. Based on your result from the previous part, what is the period of
Which to use?
Using
Using this, we can execute Shor's Algorithm by hand. We'll use:
What does this show?
This shows that since the power
4: Shor - factoring
Shor – factoring. Running a period finding algorithm, you found that with a choice of
a. Follow step 3 from lecture slide 33 to find two candidates for prime factors of
b. If
Finding Candidates
Given that
Clearly neither of these are prime (they are both even), so we need to find the
These are the factors that we need for