Quantum Computing Worksheet

advertisement
Comp3104 Quantum Computing Worksheet
[CBPrice Draft3.1 25th March 2012 20.00]
Purpose
(i) To understand some fundamental ideas in Quantum Mechanics, (ii) To learn the behaviour of quantum
gates, (iii) To appreciate the difference between quantum and classical gates, (iv) To construct some
quantum computing circuits and investigate these.
Files Required
The workshop will make use of the jQuantum simulator which is contained in the zipped folder on the
module web pages. Download this folder and unzip it to a suitable place (eg the Desktop). The simulator
program is jQuantum.jar (executable Java file). If you are working at home, then you will need the latest
“Java Runtime Environment” installed on your computer. Google this!
Reading
Please consult the document “IntroToQuantumComputing” provided on the module web-pages.
1. Quantum Mechanical Thinking
The Harvard psychologist Howard Gardner proposed (1983) that there are seven ways (“intelligences”) in
which we perceive and understand the world. Here I assign his “intelligences” with the following base states
of “quantum mechanical thinking”, summarised below.
State
|0⟩
|1⟩
|2⟩
|3⟩
|4⟩
|5⟩
|6⟩
|7⟩
|8⟩
Thinking (Gardner’s Intelligences)
Linguistic. You like writing texts and/or you like speaking to convey information
Logical-Maths. You like reasoning with maths or you like using logic in your thinking or chat
Visual-Spatial. You can mentally visualise objects and their relative locations in space
Body-Kinesthetic. Handling objects skilfully, having a sense of timing in action
Musical
Interpersonal Understanding others
Intrapersonal Understanding yourself. Self-reflexion
Naturalistic Working with plants and animals. Enjoying nature
Existential Thinking about things beyond what you can see. Abstract ideas. Big Bang. The gods
(1) Can you write down which of these you best feel can apply to you. Put them (just a few perhaps) in order
of significance.
(2) Now try to imagine some event or occurrence which has forced you to “collapse” into one of these base
states.
(3) Please email me your answer to this question, if you like. It will help with my research
c.price@worc.ac.uk
2. Quantum Mechanical Gates (Single qubit)
Let’s start off by looking at some single qubit gates.
2.1 The X-Gate
(1) Fire up jQuantum (double click on jQuantum.jar).
(2) Hit the green |𝜓0 ⟩ icon (top-left) to select the register size. Since we are dealing with single qubit gates
here, set the value of x-register to 1, and y-register to 0. Hit OK. Your screen should look like Fig.1 (a)
(3) Now select the X-Gate icon and you will get a dialogue box asking to select the input to the qubit. Select
1 and make sure the x-register is also selected. Now your screen should look like Fig.1(b)
(4) Familiarise yourself with the information on this screen. The input qubit is |0⟩, shown on the horizontal
line labelled “1”. The quantum register is showing the value of this qubit (red black). Remember the coding
for the register; black = 0, red = 1, blue = -1. So the quantum register is showing the vector (1 0)𝑇 which
corresponds to the qubit |0⟩.
(5) Now hit the top green arrow to single step through the gate. Note down what has happened to the
contents of the quantum register, how have the values changed? Which classical digital gate would change
the contents of each element of the register like this?
(6) Hit the bottom green arrow to return to the start of the computation. Then hit the Leftmost icon in the
“Circuit Design” icon group, which will allow you to change the value of the input qubit. This will bring up
a dialogue box. Click on the ket content to change the initial qubit state to |1⟩. Hit “OK”
(7) Now rerun the gate. Note down the initial register value. Look up the associated base qubit state. Note
down the final register value and look up the associated qubit state. What has happened to the contents of the
quantum register? Which classical digital gate would change the contents of each element of the register like
this?
2.2 The Hadamard Gate
(1) Fire up jQuantum (double click on jQuantum.jar).
(2) Hit the green |𝜓0 ⟩ icon (top-left) to select the register size. Since we are dealing with single qubit gates
here, set the value of x-register to 1, and y-register to 0. Hit OK.
(3) Now select the H-Gate icon and you will get a dialogue box asking to select the input to the qubit. Select
1 and make sure the x-register is also selected.
(4) Hit the Leftmost icon in the “Circuit Design” icon group, which will allow you to change the value of the
input qubit. This will bring up a dialogue box. Click on the ket content to change the initial qubit state to |1⟩.
Hit “OK” Now your screen should look like Fig.2(a)
(4) Now hit the single step arrow and your screen should look like Fig.2(b). Write down the register contents
as a vector (x y). This is a mix of the base states (0 1) and (1 0). Can you work out how much of these base
states are mixed to get your observed state (x y) ? In other words you are looking to solve
(x y) = something x (0 1) + somethingelse x (1 0)
trying to find what the somethings are. Now can you fill in the gaps (a and b) in the following expression
|𝜓⟩ = 𝑎|0⟩ + 𝑏|1⟩
(5) Hit the bottom green arrow to return to the start of the computation. Then hit the Leftmost icon in the
“Circuit Design” icon group, which will allow you to change the value of the input qubit. This will bring up
a dialogue box. Click on the ket content to change the initial qubit state to |0⟩. Hit “OK”. Now repeat step 4.
2.3 A Quantum Circuit The H-Gate followed by the X-Gate
(1) Add an X gate to the end of your H gate in the above exercise. Your screen should look like this
(2) Now hit the Leftmost icon in the “Circuit Design” icon group, which will allow you to change the value
of the input qubit. This will bring up a dialogue box. Click on the ket content to change the initial qubit state
to |1⟩. Hit “OK”.
(3) Single step through the H-gate and note down the colors of the register. Convert these to a vector (a b).
How single step through the X-gate and note down the colors of the output register. Again convert these to a
vector (c d).
(4) What has happened to the initial vector components a,b ? How have these changed to become c,d? How
does this show you that two operations have been performed by a single X-gate.
(5) Can you work out how much of these base states are mixed to get the state (a b)? Look back to how you
did this in the previous example part (4). Repeat for the state (c d).
2.4 The Measurement Gate.
(1) The mixed state output of the previous exercise should look something like this
1
(|0⟩ + |1⟩)
|𝑥⟩ =
√2
where each of the base states is multiplied by 1⁄√2. The probability of each state being measured when it is
2
sent through a measurement gate is just (1⁄√2) which is of course ½. That means that there is an equal
chance that the measurement will reveal the qubit to be in either of its base states.
(2) Add a measurement gate (M-Gate) to your circuit from the previous example, and run this circuit many
times (use the lower green arrows to run and reset). Note down how many times the final state is |0⟩ and
how many times it is |1⟩. Share your results to gather more data. Do you find a 50-50 split between the two
base states?
(3) Now add an extra measurement gate to your circuit. What’s its output? Why must this be so?
3. Multiple qubit gates
3.1 The Controlled Not gate
(1) Fire up jQuantum (double click on jQuantum.jar).
(2) Hit the green |𝜓0 ⟩ icon (top-left) to select the register size. Since we are dealing with 2-qubit gates here,
set the value of x-register to 2, and y-register to 0. Hit OK.
(3) Now select the controlled-NOT icon (third from the left in the “Circuit Design” icon group) and you will
get a dialogue box asking to select the input to the qubit. Hit OK.
(4) Hit the Leftmost icon in the “Circuit Design” icon group, which will allow you to change the value of the
input qubits. This will bring up a dialogue box. Click on the ket content to change the initial qubit state to
|00⟩. Hit “OK”. Make a note of this initial state and the x-register contents.
(5) Single step through the gate and make a note of the new x-register contents. Look up the new qubit state
(Appendix 2).
(6) Investigate all possible inputs and log their outputs. Construct a table as follows
Input State
|01⟩
Input Register
C T Output Register
(0 1 0 0)
1
0
(0 0 0 1)
Output State
|11⟩
(7) Look at the left cubit of the output state and compare this with both input cubits. What classical logic
function is this gate performing?
3.2 What does this circuit do?
Build and Investigate the following circuit. What does it do to the input qubits?
3.2 The Controlled Controlled NOT gate
Build and Investigate the following gate
(1) Complete the following table where the target qubit is 1, (there should be 4 entries). Note that the input
ket has the form |𝑇 𝐶1 𝐶2⟩
Input State
|100⟩
Input Register
(0 0 0 0 1 0 0 0)
T
1
C1
0
C2
0
Output Register
(0 0 0 0 1 0 0 0)
Output State
|100⟩
This is behaving like a classical gate. Which one?
(2) Now repeat the above for the four input states where T = 0. Which classical gate have you discovered
here.
4. Some Investigations of Theory
4.1 Reversibility
(1) All quantum gates must be reversible. This is a consequence of quantum theory. Let’s test this out for the
Hadamard H-Gate. Build the following quantum circuit to test reversibility.
(2) The output from the first H-Gate is being fed into the input of the second H-Gate. So if the H-Gate is
reversible then the final output should be the same as the input. Test this.
(3) You may wish to try this for the other quantum gates you know.
Download