Lecture 2

advertisement
Quantum Computing
(Fall 2013)
Instructor: Shengyu Zhang.
Lecture 2 Factoring and Abelian HSP
1. Factoring problem
Historical importance: one of the oldest computational problems.
Average-case hardness: not only hard on worst-case inputs, but also on average-case inputs.
Relation to RSA: If Factoring is easy, then RSA is insecure.
Best classical algorithms: 2O(√𝑛 log 𝑛) for 𝑛-bit numbers.
Shor’s quantum algorithm: 𝑂(𝑛3 ).
2. Quantum Fourier Transform (QFT)
Definition of QFT. In next class, we will define Fourier transform on general groups. Today,
we’ll only focus on a cyclic group: 𝑍𝑁 . (Sometimes it is written as 𝒁/𝑁𝒁.) Define πœ”π‘ =
𝑒 𝑖2πœ‹/𝑁 , a primitive 𝑁-th root of unity. For each π‘₯ ∈ 𝑍𝑁 , the QFT has the following effect on
the basis vector |π‘₯⟩:
|π‘₯⟩ →
1
π‘₯𝑦
∑ πœ”π‘ |𝑦⟩ =
√𝑁 𝑦∈𝑍
𝑁
1
∑ 𝑒 2πœ‹π‘–π‘₯𝑦/𝑁 |𝑦⟩.
√𝑁 𝑦∈𝑍
𝑁
In other words, the QFT is the following operator. 𝐹𝑍𝑁 =
form, it is
1
√𝑁
∑π‘₯,𝑦∈𝑍𝑁 πœ”π‘π‘₯𝑦 |𝑦⟩⟨π‘₯|. In matrix
Algorithm for QFT for π’πŸπ’ . (Note: the group is the cyclic group 𝑍𝑁 with 𝑁 = 2𝑛 , but not
π‘˜
(𝑍2 )×𝑛 ). Write both π‘₯ and 𝑦 by binary numbers, namely π‘₯ = ∑𝑛−1
π‘˜=0 2 π‘₯π‘˜ and 𝑦 =
𝑗
∑𝑛−1
𝑗=0 2 𝑦𝑗 . Then
The QFT can be implemented by the following circuit, where we use some controlled-π‘…π‘Ÿ ,
1
0
π‘Ÿ ). (We’ve learned controlled-NOT in the last class; the general
0 𝑒 2πœ‹π‘–/2
with π‘…π‘Ÿ = (
controlled-unitary operator is similar: Conditioned on the control bit being 1, do the unitary.)
We can see intuitively why this circuit works by verifying the first two qubits. For the top
qubit, one Hadamard gates makes the output |0⟩ + (−1)π‘₯0 |1⟩ = |0⟩ + 𝑒 2πœ‹π‘–π‘₯0 /2 |1⟩ = |𝑧𝑛−1 ⟩.
𝑠π‘₯
(Note that we used the fact that 𝑒 2πœ‹π‘–2
π‘˜
= 1 for all 𝑠 ≥ 0 and π‘₯π‘˜ ∈ {0,1}.) Now look at
the second qubit. After the Hadamard gate, it is |0⟩ + 𝑒 2πœ‹π‘–π‘₯1 /2 |1⟩. The controlled-𝑅2 gate
further puts a phase 𝑒 2πœ‹π‘–π‘₯0 /4 on |1⟩, thus the final output on this qubit is |0⟩ +
π‘₯1 π‘₯0
𝑒 2πœ‹π‘–( 2 + 4 ) |1⟩ = |𝑧𝑛−2 ⟩. Using the same way one can verify the rest qubits.
3. Tool – Phase Estimation
One important application of QFT on 𝑍𝑁 is Phase Estimation. Suppose that there is a unitary
operation π‘ˆ and we are given the ability of applying controlled-π‘ˆπ‘— operations for j =
2, 22 , 23 , … We are also given an eigenstate |𝑒⟩, which corresponds to an eigenvalue πœ‘π‘’ .
The task is to get an estimate of πœ‘π‘’ . (Recall the spectral decomposition of normal matrices.)
Here is a simple algorithm using QFT.
To get an intuition why the above algorithm is correct, consider the case that the eigenvalue has an
𝑛-bit binary representation. Then the inverse Fourier transform in Step 4 above will give exactly the
eigenvalue πœ‘π‘’ . (Recall the definition of Fourier transform: |πœ‘⟩ → ∑𝑦∈𝑍𝑁 𝑒2πœ‹π‘–πœ‘π‘— |𝑗⟩.)
4. Quantum algorithm for Factoring
First, Factoring is known to be equivalent to another problem called Order Finding. In Order
Finding, we are given two positive integers π‘₯ and 𝑁 that are co-prime to each other. We
want to find the smallest π‘Ÿ s.t. π‘₯ π‘Ÿ = 1 mod 𝑁. For example, when π‘₯ = 5 and 𝑁 = 21,
then it is not hard to verify that the powers of π‘₯ are 5, 4, 20, 16, 17, 1 (all mod 21), thus the
order is 6.
Algorithm for Order Finding. Consider the unitary matrix π‘ˆ|𝑦⟩ = |π‘₯𝑦 mod 𝑁⟩ for each
𝑦 ∈ [0, 𝑁 − 1]. Note that for different 𝑦’s, π‘ˆ|𝑦⟩’s are also different. (Suppose π‘₯𝑦1 ≡ π‘₯𝑦2 ,
then π‘₯(𝑦1 − 𝑦2 ) ≡ 0, impossible because π‘₯ is co-prime with 𝑁.) Thus π‘ˆ is indeed a
unitary matrix.
For each 𝑠 ∈ [0, π‘Ÿ − 1], consider state |𝑒𝑠 ⟩ =
1
√π‘Ÿ
−π‘ π‘˜ π‘˜
∑π‘Ÿ−1
π‘˜=0 πœ”π‘Ÿ |π‘₯ mod 𝑁⟩. It is actually an
eigenvector of π‘ˆ with respect to eigenvalue πœ”π‘Ÿπ‘  :
π‘ˆ|𝑒𝑠 ⟩ =
1
π‘Ÿ−1
∑ πœ”π‘Ÿ−π‘ π‘˜ |π‘₯ π‘˜+1 mod 𝑁⟩ =
√π‘Ÿ π‘˜=0
1
π‘Ÿ−1
−𝑠(π‘˜−1)
∑ πœ”π‘Ÿ
√π‘Ÿ π‘˜=0
|π‘₯ π‘˜ mod 𝑁⟩ = πœ”π‘Ÿπ‘  |𝑒𝑠 ⟩.
Thus we can run the Phase Estimation algorithm on |𝑒𝑠 ⟩ and we’ll get 𝑠/π‘Ÿ.
Some issues: We don’t have |𝑒𝑠 ⟩; after all it needs information of π‘Ÿ. But note that
1
π‘Ÿ−1
∑ |𝑒𝑠 ⟩ =
√π‘Ÿ 𝑠=0
1
π‘Ÿ−1
∑
1
π‘Ÿ−1
∑ πœ”π‘Ÿ−π‘ π‘˜ |π‘₯ π‘˜ mod 𝑁⟩ = |1⟩.
√π‘Ÿ 𝑠=0 √π‘Ÿ π‘˜=0
(For π‘˜ ≠ 0, ∑s πœ”π‘Ÿ−π‘ π‘˜ = 0.) So if we prepare |1⟩ and run the Phase Estimation algorithm,
then we will get
1
√π‘Ÿ
∑π‘Ÿ−1
𝑠=0 |𝑠/π‘Ÿ⟩|𝑒𝑠 ⟩. Measuring the first register gives 𝑠/π‘Ÿ. Using a simple
procedure called the continued fraction, one can get 𝑠′ and π‘Ÿ ′ s.t.
𝑠′
π‘Ÿ′
𝑠
= π‘Ÿ. π‘Ÿ ′ may not be π‘Ÿ,
but π‘Ÿ ′ is at least a factor of π‘Ÿ. Doing this a couple of times and get π‘Ÿ ′′ , π‘Ÿ ′′′ , … and take the
least common multiple of π‘Ÿ ′ , π‘Ÿ ′′ , π‘Ÿ ′′′ , … would give us π‘Ÿ. (Actually, a careful analysis shows
that most likely the least common multiple of π‘Ÿ ′ and π‘Ÿ ′′ is already π‘Ÿ.)
𝑗
Another issue is that in Phase Estimation, we need controlled-π‘ˆ 2 operations.
5. Hidden Subgroup Problem (HSP)
Definition of HSP. Order Finding and many other problems fall into the framework of Hidden
Subgroup Problem (HSP). In HSP, there is a function 𝑓: 𝐺 → 𝑆 on a group 𝐺, which contains a
subgroup 𝐻. 𝐻 partitions 𝐺 by (left) cosets. We have the promise that 𝑓 is constant on each coset,
and distinct on different cosets. The goal is to identify 𝐻 efficiently. In quantum algorithms, we can
access 𝑓 by controlled-𝑓 gates. In particular, we can make the following transform: |π‘₯⟩|0⟩ →
|π‘₯⟩|𝑓(π‘₯)⟩.
HSP for finite Abelian groups. Any finite Abelian group 𝐺 is isomorphic to 𝑍𝑛1 × β‹― ×
π‘π‘›π‘˜ . For each element π‘Ž = (π‘Ž1 , … , π‘Žπ‘˜ ) ∈ 𝑍𝑛1 × β‹― × π‘π‘›π‘˜ , define a character function
π‘Ž π‘₯1
πœ’π‘Ž : 𝐺 → 𝐢 by πœ’π‘Ž (π‘₯1 … π‘₯π‘˜ ) = πœ”π‘›11
1
√|𝐺|
π‘Ž π‘₯
… πœ”π‘›π‘˜π‘˜ π‘˜ |π‘Ž1 … π‘Žπ‘˜ ⟩, and define the QFT by |π‘₯⟩ →
∑π‘Ž πœ’π‘Ž (π‘₯)|π‘Ž⟩. It is easily checked that each πœ’π‘Ž is a homomorphism: πœ’π‘Ž (π‘₯𝑦) =
πœ’π‘Ž (π‘₯)πœ’π‘Ž (𝑦). The set of the πœ’π‘Ž ’s is denoted by 𝐺̂ , which is isomorphic to 𝐺 itself. One
property for 𝐺̂ is that any two distinct characters are orthogonal. In particular, if π‘Ž ≠
(0, … ,0), then ∑π‘₯∈𝐺 πœ’π‘Ž (π‘₯) = 0.
Algorithm.
1
√|𝐺|
∑π‘₯∈𝐺 |π‘₯⟩
query 𝑓
→
1
√|𝐺|
∑π‘₯∈𝐺|π‘₯⟩|𝑓(π‘₯)⟩
measure |𝑓(π‘₯)⟩
→
1
√|𝐻||𝐺|
π‘šπ‘’π‘Žπ‘ π‘’π‘Ÿπ‘’
→
1
√|𝐻|
QFT
→
// prepare a uniform superposition
∑𝑦∈𝐻|𝑠 + 𝑦⟩ for an unknown and random 𝑠 ∈ 𝐺
∑πœ’∈𝐺̂ ∑𝑦∈𝐻 πœ’(𝑠 + 𝑦)|πœ’⟩
a random πœ’ with πœ’(𝑦) = 1, ∀𝑦 ∈ 𝐻.
Do this for 𝑑 = 𝑂(log|𝐺|) times, and obtain πœ’1 , … , πœ’π‘‘ . For a character πœ’, define its
kernel as ker(πœ’) = {𝑔 ∈ 𝐺: πœ’(𝑔) = 1}, and it is easily seen that kernel is a subgroup of 𝐺.
Claim. For some 𝑇 = log 2 |𝐺|, it holds that 𝐻 = ⋂𝑖=1,…,𝑇 ker(πœ’π‘– ) with high probability.
Proof. First, there is a fact that 𝐻 ⊥ ≝ {πœ’: πœ’(𝑦) = 1, ∀𝑦 ∈ 𝐻} = {πœ’: 𝐻 ≤ ker(πœ’)} is a group
and it’s isomorphic to the quotient group 𝐺/𝐻. Thus |𝐻 ⊥ | = |𝐺|/|𝐻| . Similarly |𝐾𝑑 ⊥ | =
|𝐺|/|𝐾𝑑 |. Suppose that after 𝑑 times, 𝐾𝑑 = ⋂𝑑𝑖=1 ker(πœ’π‘– ) is still strictly larger than 𝐻. The
next iteration gives a random πœ’ ∈ 𝐻 ⊥ . Since 𝐾𝑑+1 ≤ 𝐾𝑑 , we know that
|𝐾𝑑+1 |
|𝐾𝑑 |
1
≤ 2 unless
𝐾𝑑+1 = 𝐾𝑑 . Since 𝐾𝑑+1 = 𝐾𝑑 ∩ ker(πœ’), it suffices to show that Pr⊥[𝐾𝑑 ⊆ ker(πœ’)] ≤ 1/2.
πœ’∈𝐻
Note that 𝐾𝑑 ⊆ ker(πœ’) means πœ’ ∈ 𝐾𝑑⊥ . Therefore,
|𝐾 ⊥ |
Pr⊥[𝐾𝑑 ⊆ ker(πœ’)] = |𝐻𝑑⊥ | =
πœ’∈𝐻
|𝐺|/|𝐾𝑑 |
|𝐺|/|𝐻|
=
|𝐻|/|𝐾𝑑 |. This ratio is at most 1/2 since we assumed that 𝐻 is a proper subgroup of 𝐾𝑑 .
Note
There are many explanations of Shor’s algorithm, see the wiki page. We basically followed [NC00],
Chapter 5 and [CvD10] Section III.
For the Hidden Subgroup Problem part, see [CvD10], Section IV-C.
Reference
[NC00] Michael Nielsen and Isaac Chuang, Quantum Computation and Quantum Information,
Cambridge University Press, 2000.
[CvD10] Andrew M. Childs and Wim van Dam, Quantum algorithms for algebraic problems, Reviews
of Modern Physics, Volume 82, January–March 2010.
Exercise
1. Verify that the QFT operator 𝐹𝑁 is unitary.
2. Write down the QFT for 𝑍2 , 𝑍3 , 𝑍4 , 𝑍5 .
3. Suppose 𝑁 = 2𝑛 . We want a uniform superposition
1
∑𝑁 |π‘₯⟩.
√𝑁 π‘₯=1
Prove that we can obtain it by
simply preparing 𝑛 qubits all in state |0⟩, and then applying a Hadamard gate on each qubit.
Download