0% found this document useful (0 votes)
55 views9 pages

Lo7tg: Quickreviey From Qubit A

The document discusses quantum phase estimation (QPE) and Shor's algorithm. QPE allows estimating the phase of an eigenvector of a unitary operator by performing quantum Fourier transform on the control register of a controlled unitary. Shor's algorithm uses QPE to find the period of a function, which can be used to factorize integers. An example demonstrates factorizing 15 using Shor's algorithm with a = 13 as the base.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views9 pages

Lo7tg: Quickreviey From Qubit A

The document discusses quantum phase estimation (QPE) and Shor's algorithm. QPE allows estimating the phase of an eigenvector of a unitary operator by performing quantum Fourier transform on the control register of a controlled unitary. Shor's algorithm uses QPE to find the period of a function, which can be used to factorize integers. An example demonstrates factorizing 15 using Shor's algorithm with a = 13 as the base.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Lecture 4 shores Algorithm II Factoring to period finding

Abe Asfaw
Quickreviey
Yesterday covered QFT and QPE
G QFT basis change from computational basisto Fourier basis

one qubit QFT is


simply A gate

computational Fourier basis


basis O
107 It
I
It
go from two poles of Block sphere to equatorial plane

quick demo
circuit implementation

1
wrote
Expezia
o

target
fine control

CROI 11 x e l1xj7
Eder ofqubits Hln 7
lo7tg
Form of QFT n qubits NE 2 Ise 124 sen

QFT Ise L
in
lo te Tp
x oxz sen
lo t e 117 se ooses and
o Iii sea Coo osei
212thse

lo t e 117 toe
from H gate
fromoUR0Tn fromUROTz
Circuit implements o o

Ise lost exp


xn
13
xn it
2tztixr.tn xJlD

Recall se Ge uz seu

2 x 2 Zzz1 Inn
Ise lost exp 22in a 117
frompUROTny four H gate
9
lazy lost expf sent
fifteen it 12 sea ID

to
define se 0K22g Rn

2n o 12 2221 Isen
then above is se and we have
j
d
Iaa lost exp 2I 117
i
z In
se
Isen to exp
000 Own
2 Quantum Phase Estimation

Objective given a unotary U and its eigenstateEigenvector 14,7


U 147 e 04147
can we find 0 4 Assume prepare147
can

Phase estimation allows us to convert phase information into


amplitudes that we can measure

QPE protocol
E'T 0147 2h0 where
given UI QPE gives
n is the number of qubits used to estimate O

n
youI lo'T
T.i
1 THE 1
EEEnys.no

U lol
4
Etiology to this point
up
have QFT in input
subtleties i notice the zito register
in the QPE protocol

2 notice that we are doing QFTt not QFT


need to carefully build Recall
ABC d BtAt
3 yesterday's lab solution i used U X gale in
Qiskit and did QPE to find X
cath
Qishit textbook shorts algo
see
chapter for QFT 1 implementation
4 referenceQuantum counting
ShorisAlgorithull
Problem already discussed that factorong a number
N pq
where
poq are prime and large is classically difficult
OCexpfc.nl3 lognJ43 using
best known methods

2 Quick primer on modular arithmetic

b 3 quotient 1 355
3
remainder 2 2

5 2 mod 3

x I 2 3 4 5 6 7 8 9
2e I 2 0 I 2 0 I 2 0 mod 3

notice see 0 mod 3 x is a multiple 3


of
see 1 mod 3 se is 1 1 some multipleof 3

generally
y mod _3kt
y for some KEZ
2e 3 se

also notice the periodicity of modular arithmetic


se modN means
yE o l 2 N
y
eg mod 3 1,2
se
y means
YE 0
2 Solution
gcdCa N L
begin algorithm
CD pick a coprime with N pq
if unsure checkquickly if coprime
2 find the r of the function a mod N
order
smallest r such that are 1 mod N
3 if r is even

a Ark mod N

if sett 0 mod N then

p g gcd att N gcd a t N

else find another a

3 Concrete example factoring 15


15 1111 4 bits
coprime pick a 13
see 0 I 2 3 4 5 7
6
13 mod 15 1 13 4 7 1 13 4 7
Smallest r o s t 1311cmod 15 is n 4
or 4
given
se E 134k mod 15 4 mod 15

sett 5 0 mod 15

4 I att 3 5
p g
4 Quantum circuit for factoring 15 subtleties later for now
I I I follow aloyg
g
1M l
I t

t
DH QTT l I
i
1 I e I i
1 c l i l
w p
1
10504 T f T i

To l iz f3 4 s 5

be Iw be lwtofa.CH
04107
04
fan Cx a Cmod N
step 0 107
iz z
04
step 1 H 410504 103

102,1 1174 1274 1 t 115,2 1074

step 2 1074 00130 mod15 t 112100131 mod15


I
t

O 2 Z we have
Ya 11741137g t 1274142 t 1374177g
I 102411 t

1441174 t 15741137g t 1674142 t 1774177g

1841174 t 19741137g t 110741474 t 11174177g

1124112 t 113741137g t 114741474 t 115741774


step 3 after measuring register let's say we measured 7
a

1374 t tha t 11174 11574701774


note the normalization
step 4 apply QFT on the.se register

Recall N I 2
ay
1
QFT Ise 127
if 2 e ly
g op 2
QFT Ee In
M
ly
foe
2
QFT 132 Eno e 34
y
38
IT y0
e ly

H
QFT'T 7 a
I IIE ly
Y
QFT 111 a Ezo e ly
5
t
QFT 115 a ta of ly

QFT Ise f Ezo expti y exp fi g texpfi Igy


exp f i's y ly
show computer demo

4 i 1474 4184 4 i 1127g


f a
4104 t

step 5 measure the foe register get 107 on 147 or 187 or 1127
with equalprobability of 14
Analyze measured result i meas results peak near
j Nyforsomejez
10 is trivial If we measure 103 restart X
147 j kn 4 r 4 if j L r 4 is even good
42 2
mod 15 4
see a mod N 13
5
set I j g od C sett N 5
se I 3 j g od se l N 3

18 8 r 2 and j I 4 and
j 16g or r
j 2
d
works like above
131 mod 15 2
set 1 3 3
ged Catt
N
se i I
J
1 partial
god se l N

4 and 3 works like above


1127 j 16g 12 f j

Looks like 3 4 results work and we are able to extract thefactors


successfully

demo of Vandersypen Steffen et al paper


showing how to factor 15 on a quantumcomputer

caveats need 2in qubits at the input register for Ise


instead of just n
with probability will be and
Iz r even

ark 11 to modN
How to implement
Ufa n

Recall famCse at mod N

se ER Jez Rn 2 be 2 Zzz t 20seu

fa n se A mod N
be 12 best 25hm
q2 mod N
22 a2
af Ma2 mod N

se ooo

Jez

Nu
n 2
m

91 at a'and
o o

depth is polynomial
in n

9
can see Shor's algo is QPE in disguise

Also see Qiskit textbook chapter for an exampleof modular

exponentiation implemented in Qiskit

You might also like