QC Lec05
QC Lec05
1 Administrativa
• On homework 1, the book uses �1 , �2 , and �3 for �x , �y , and �z .
1
P. Shor – 18.435/2.111 Quantum Computation – Lecture 5 2
IN OUT
1
� ⎛
000 000
� 1 ⎜
� ⎜ 001 001
� 1 ⎜
� ⎜ 010 010
� 1 ⎜
� ⎜ or or 011 011
� 1 ⎜
� ⎜ 100 100
� 1 ⎜
� ⎜ 101 101
� 1 ⎝
110 111
1
111 110
This gate is universal: with ancillary input zeros, it can be used to compute any function.
• Classical resources: For efficiency and simplicity, we can use classical computations when
we want (but not directly on the quantum state space). We show later in the lecture that
this is not needed, but it can make describing problems much simpler.
• Suitable state space: The quantum portion of our state space is a 2 n -dimensional Hilbert
space which is the tensor product of n quantum bits. Product states of the form |x 0 ∈ ≤ |x1 ∈ ≤
· · · ≤ |xn ∈ with xi → {0, 1} are computational basis states of the computer.
• Ability to prepare states in the computational basis: We assume we can set our
quantum state space to any state of the computational basis in n steps.
• Ability to perform quantum gates: We can apply quantum gates to any set of our qubits
of fixed cardinality. Usually we say three or fewer qubits, but we could get away with only
two. Note that all of the quantum gates “operate” on the entire state space, but
A uniform family of quantum circuits is a set of circuits {C n } such that a classical Turing
machine can produce a description of C n on input n in time polynomial in the length of n.
U 3 V V V
does the trick where V 2 = U . It is straight forward to check, but we can do the matrix multiplication
for rigor. The matrix for the controlled controlled gate is
� ⎛
I
�
� I ⎜
⎜
� I ⎝
U
where the identity matrices are all 2 × 2. The two-bit gates are labeled A 1 through A5 . Their
actions are straight forward to determine, and their matrices can be read off by examination or a
little scratch work. They are:
� ⎛ � ⎛
I I
� V ⎜ � I ⎜
A1 = � ⎜ A2 = � � ⎜ = A4
� I ⎝ I ⎝
� V ⎛ � I ⎛
I I
� V† ⎜ � I ⎜
A3 = � ⎜ A5 = � ⎜
� I ⎝ � V ⎝
V† V
We can always take the square root of a unitary matrix (and the root will also be unitary), so
picking an appropriate V is always possible.
If U is the bit flip, the above construction makes a Toffoli gate. We can use this to compute
any computable function with our quantum computer (though we would then lose the hypothesized
time benefits of the quantum computer).
P. Shor – 18.435/2.111 Quantum Computation – Lecture 5 4
The row with � as the first element is the ith row and
u11
� = � ,
|u11 |2 + |ui1 |2
ui1
� = � .
|u11 |2 + |ui1 |2
It is easy to check that V1 † V1 = I so V1 U is also unitary. We can continue using similar V ’s to zero
out the rest of the first column at which point the matrix will be of the form
� ⎛
1 0 0 ···
� �
� 0 u22 u23 · · · ⎜
� ⎜
V2n −1 · · · V1 U = �
�
� .. ⎜
� 0 u32 . ⎜
.. ..
⎝
. .
The first row is in this form as the matrix is unitary. Now we can continue with matrices of the
form � ⎛
1 0 ···
� 0 �† 0 · · · �† · · · ⎜ ⎜
�
� 0 0 1 ··· ⎜
� ⎜
V1 = �� ... ... .. ⎜
� . ⎜
⎜
� 0 � ··· −� · · · ⎜
�
.. ..
⎝
..
. . .
to zero out the next layer of the matrix. Continuing in this form we will get the identity matrix.
The V matrices gates are permutations with some not gates and finally a controlled gate where all
but one of the bits are control bits, and the other bit can be operated on arbitrarily.
H �n
|x∈ = (−1)x·z |z ∈
z=0
We begin:
2⎠
n −1 ⎞ ⎟
1 |0∈ − |1∈
Apply H �(n+1) : |x∈ � .
2n/2 x=0
2
2⎠
n −1 ⎞ ⎟
1 f (x) |0∈ − |1∈
Apply Bb : |x∈ (−1) � .
2n/2 x=0
2
2 −1 2 −1
n n ⎞ ⎟
1 ⎠ ⎠ f (x)+x·z |0∈ − |1∈
Apply H �n ≤ In+1 : (−1) |z∈ � .
2n x=0 z=0 2
Now measure all bits in the |0∈, |1∈ basis. There are two possibilities. Exchange the order of
summations.
• If f (x) is constant, the dot product for z = 0 is uniformly 0 so the summation over x with z = 0
n vector is normalized, it must be (−1) f (0 ) |0∈�n (|0∈ −
n
produces
� a factor of 2 . Since the state
|1∈)/ 2. Thus we will measure |0∈ �n for the first n bits with certainty if f is constant.
• If f (x) is balanced, the x summation over |0∈ �n is negative on half the x and positive on the
other half and so cancels out: there is no probability of measuring |0∈ �n .