SlideShare a Scribd company logo
Quantum Computation 101
Outline
Combinatorial 101
• You have a bucket of blue balls (50%) and red balls (50%).
• Probability ?
• Uncertainty ?
Combinatorial 101
• You have blue human balls (50%) and red human balls (50%) to rip of.
Combinatorial 101
• You have blue human balls (50%) and red human balls (50%) to rip of.
• You also know that some balls
have longer sticks, some don’t.
Combinatorial 101
• You have blue human balls (50%) and red human balls (50%) to rip of.
• You also know that some balls
have longer sticks, some don’t.
• YOU HATE REDbull.
Combinatorial 101
• You have blue human balls (50%) and red human balls (50%) to rip of.
• You also know that some balls
have longer sticks, some don’t.
• YOU are OK with ASIAN.
• You have blue human balls (50%) and red human balls (50%) to rip of.
• You also know that some balls
have longer sticks, some don’t.
• ASIAN.
Combinatorial 101
• You encounter light beams.
Combinatorial 102
• You encounter light beams.
• You know some sweet physics.
Combinatorial 102
• You encounter light beams.
• You know some sweet physics…?
Combinatorial 102
• You encounter light beams.
• You know some sweat physics…..?
Combinatorial 102
Yeah, yeah….Wave…cosine….2#$@$#!#%@
• Two different model of uncertainty…How different?
• Observation affects the experimental outcome, aka the distribution.
Yeah, yeah….Wave…cosine….2#$@$#!#%@
• Two different model of uncertainty…How different?
• Observation affects the experimental outcome, aka the distribution.
• Wave particle duality.
• Intrinsic randomness vs classical randomness.
Outline
• A quantum intuition. (Observed !)
Physics_time[0]
Physics_time[-1]
Let’s get our hand dirty
• Quantum physics are stated as a series of three axioms.
• Axiom 1: An isolated quantum system has associated with a Hilbert space H.
The system is completely determined by a unit vector in H
• Ex: [1, 0], [0, 0, -i], [0.5,
3
2
] are all unit vectors in H.
• We can write [0.5,
3
2
] in a cocky way: 0.5 |0> +
3
2
|1>
• |0>, |1> are called base states.
Let’s get our hand dirty (Axiom 1)
• What is ‘state’ ?
• Can be anything that matters in the system !
• Ex: |0> : |1>:
• Ex: |0>: laser (inactivated) |1>: laser (activated) |2>: laser (emitted)
• Ex: |0>: False |1>: True
• Axiom 1: System can always be described by a vector. We view the
‘meaning’ of the vector basis as state.
• Ex: The state of a bit storage with quantum system can be described as
a|0> + b|1>, with |a|2+|b|2 = 1. We usually call it ‘qubit’.
• What about the ‘coefficient’ of the basis ? Later on this.
Let’s get our hand dirty (Axiom 1.5)
• Wait…what about a system to describe ( ) ?
• A ball can have two different state
• |0> : |1>:
• State of A ball can be described by a length two vector.
• w = [a, b] a.k.a a|0> + b|1>, with |a|2+|b|2 = 1.
• Two balls can have four different state
• |00>: |01>: |10>: |11>:
• State of two balls can be described by a length four vector.
• Composite system (Axiom 1.5)
• A composite quantum system has state space given by the tensor product of the
consistent quantum subsystem.
Let’s get our hand dirty (Axiom 1.5)
• Tensor product: Natural product of vectors
• w1 = a|0> + b|1>, w2 = c|0> + d|1>
• How to compute w1 ‘times’ w2 ?
• Phen Pei Lu, duh….
• w1⨂ w2 = (a|0> + b|1>) ⨂ (c|0> + d|1>)
= a c |0> ⨂ |0> + a d|0> ⨂ |1> + b c |1> ⨂ |0 > + b d |1> ⨂ |1 >
= ac |00 > + ad |01> + bc |10 > + bd |11>
• Properties of tensor product
• (w1⨂ w2 ) ∙ (w3⨂ w4 ) =(w1 ∙ w3)(w2 ∙ w4)
• Preserve axiom 1 !!
• Why tensor product ? -> More on this later.
Let’s get our hand dirty (Axiom 2)
• Axiom 2: A physical system evolves according to a linear unitary
transform.
• Unitary transform U: U*U = UU* = I
• Think of ‘*’ as transpose + conjugate.
• Ex: [0, i]* = [[-i], [0]]
• Property of ‘*’: (AB)* = B*A*
Let’s get our hand dirty (Axiom 2)
• Why unitary transform?
• Unitary transform U: U*U = UU* = I
• Preserve unit length of state after evolution ! (Axiom 1)
• Check it out:
• w is a state (column vector), from axiom 1 we have w* w = 1.
• Let w’ = U w, we see that w’* w’ = w* U*U w = w* w = 1.
• Why linear ? -> Schrodinger equation.
Let’s get our hand dirty (Axiom 2)
• Back to single qubit
• Reminder: qubit can be represented as [a, b] a.k.a a|0> + b|1>, with
|a|2+|b|2 = 1.
• Special case: a = 1 (Logic false) and b = 1 (Logic true)
• Unitary transform on single qubit (Quantum gates)
X
0 1
1 0
Y
0 −𝑖
𝑖 0
Z
1 0
0 −1
H
1
2
1
2
1
2
−
1
2
Let’s get our hand dirty (Axiom 2)
• Unitary transform on two qubits (Quantum gates)
• How to realize AND ?
• How to realize OR ??
• Wait… AND/OR are irreversible operations !
• Nature permits only unitary operation.
• Quantum gates are reversible !
AND
? ?
? ?
? ?
? ?
? ?
? ?
? ?
? ?
OR
? ?
? ?
? ?
? ?
? ?
? ?
? ?
? ?
Let’s get our hand dirty (Axiom 2)
• Unitary transform on two qubits (A smart way around)
• NAND gates are universal. -> Want to implement this.
• The Toffoli gate
• Quantum gate design trick 101: add an acilla bit and XOR it.
X
A
C
A
C ⨁(𝐴⋀𝐵)
BB
Let’s get our hand dirty (Axiom 3)
• So far we’ve talked about the deterministic part of quantum physics.
• Remember we’ve mentioned intrinsic randomness and experimental effect ?
• Axiom 3 (Verbally)
• The information you can get from a quantum state is through measurement.
• Each possible experimental outcomes is associated with an operator.
• Probability of obtaining an experimental outcome is determined by state and
the operator associated with that outcome.
• Quantum state, after the measurement, collapses to a state associated with
the experimental outcomes.
Let’s get our hand dirty (Axiom 3)
• Axiom 3 (Measurement)
• A quantum measurement is characterized by a collection of
operators.
• Operators: 𝑀 𝛼1
, 𝑀 𝛼2
, ⋯ 𝑀 𝛼 𝑘
.
• 𝛼1, 𝛼2, ⋯ 𝛼 𝑘 are indications of the outcomes.
• Operators obey completeness property: 𝑖=1
𝑘
𝑀 𝛼 𝑖
∗ 𝑀 𝛼 𝑖
= 𝐼
• Given state w, the probability P[X = 𝛼𝑖] = w*𝑀 𝛼 𝑖
∗ 𝑀 𝛼 𝑖
w
• After the measurement, quantum state collapses to:
𝑀 𝛼 𝑖
w
P[X = 𝛼 𝑖]
Let’s get our hand dirty (Axiom 3)
• What the heck are these operators ?
• Why completeness property: 𝑖=1
𝑘
𝑀 𝛼 𝑖
∗
𝑀 𝛼 𝑖
= 𝐼 ??
• Preserve outcome probability: 𝑖=1
𝑘
P[X = 𝛼𝑖] = 1
• Check it out: 𝑖=1
𝑘
P[X = 𝛼𝑖] = 𝑖=1
𝑘
w∗𝑀 𝛼 𝑖
∗ 𝑀 𝛼 𝑖
w
= w∗ 𝑖=1
𝑘
𝑀 𝛼 𝑖
∗ 𝑀 𝛼 𝑖
w
= w∗ w = 1 (Axiom 1)
• But… What ARE these operators ?
• Ex: w =
𝑎
𝑏
, 𝑀0 =
1 0
0 0
, 𝑀1 =
0 0
0 1
• Meaning of coefficients: Probability amplitude.
Let’s get our hand dirty (Axiom 1.5)
• Remember the natural tensor product ?
• w1 = a|0> + b|1>, w2 = c|0> + d|1>
• w1⨂ w2 = (a|0> + b|1>) ⨂ (c|0> + d|1>)
= ac |00 > + ad |01> + bc |10 > + bd |11>
• Remember Probability amplitude ?
• |a|2 : Probability of observing |0> with measurement {M0, M1} on w1 -> P[X1 = 0]
• |c|2 : Probability of observing |0> with measurement {M0, M1} on w2 -> P[X2 = 0]
• Probability of observing |0>|0> with measurement {…} on w1⨂ w2 ? -> P[X1 = 0] P[X2 = 0]
• Tensor product reveals the fact that two consistent quantum states are
independent !
• But not every 4-dim state can be written in tensor product.
• These states are called unseparable -> Quantum correlation.
Let’s get our hand dirty (Recap)
• Axiom 1: Everything (isolated) is a unit length vector.
• Axiom 1.5: Two things not quantum correlated (independent), write
them down as their tensor product.
• Axiom 2: Nature only permits unitary operations.
• Axiom 3: Information from the state can be accessed through
measurement, where the outcomes exhibits intrinsic randomness.
Outline
• A quantum intuition. (Observed !)
• Axiomize quantum physics. (Observed !)
• Break ?
• Applications : Sth you might raise your eyebrows.
• A quantum algorithm: Grover’s search.
• A quantum algorithm: Shor’s factorizing algorithm.
Quantum parallelism : Good stuff 
• Think about a state a1 |000> + a2 |001> +… a8 |111>
• Quiz 1: what are the meaning of [|000> … |111> ] ?
• Quiz 2: what are the meaning of [a1 … a8] ?
• Quiz 3: what are the permitted operations ?
• Now think about operation again.
• What does it mean to perform ‘flip the last bit’ on this state ?
• Operation on a state -> operation on all possible classical configurations.
• This is where quantum computation gain advantage from.
Quantum parallelism : Bad stuff ?
• Yey! Then why don’t we replace classical bits (or other computing
thiny) with quantum state ?
• At a first glance: classic : |0> or |1> ---> quantum : a|0> + b|1>
• More degree of freedom, parallelism…
• But…how to construct a state a|0> + b|1> ?
• Classical : How to construct a bit string 0001010100 -> stupid question.
• Classical (2) : Hey, here’s a bit string (in the memory), make a copy of it ->
stupid question again.
• Quantum: How to construct a state a|00> + b|10> -> stupid question ?
• Quantum (2): Hey, here’s a state, make a copy of it -> ????
Quantum parallelism: No-cloning theorem
• There is no universal unitary U that can clone a state, i.e., there’s no
unitary U such that for all |𝜑 > and ancilla |𝑎 >
𝑈|𝜑 > |𝑎 >= |𝜑 > |𝜑 >
Quantum teleportation
• We can’t CLONE a state by unitary transform
• Can we do something with measurement ?
• But wait…After measurement, the state collapses.
• So we shall ask: can we at least carry these measurement result to
somewhere and do something ?
• We CAN !
• The protocol is called quantum teleportation.
• Why teleportation -> Imagine transporting a person in a speed of light ?
Quantum teleportation
|𝜑 >1 = 𝑎 0 > +𝑏 1 >
|𝜑 >23 =
1
2
00 > +
1
2
11 >
H M
{|00>, |01>
|10>, |11>}
X Z
b1
b2
|𝜑 >3 = 𝑎 0 > +𝑏 1 >
Quantum superdense coding
• Hmm…It seems that each qubit need to be described in two bits…
• Can we reverse it -> send two classical bits by only one qubit ?
• WE CAN !
X Z
|𝜑 > 𝐴
|𝜑 > 𝐴𝐵 =
1
2
00 > +
1
2
11 >
𝑠𝑒𝑛𝑑
M (b1,b2)
b1 b2
Quantum might raise your eyebrow (Recap)
• Quantum parallelism
• No cloning theorem
• Application of quantum entanglement
• Quantum teleportation
• Quantum superdense coding
Outline
• A quantum intuition. (Observed !)
• Axiomize quantum physics. (Observed !)
• Applications : Sth you might raise your eyebrows. (Observed !)
• A quantum algorithm: Grover’s search.
• A quantum algorithm: Shor’s factorizing algorithm.
Quantum algorithm
• Remember quantum parallelism ?
• This insights leads to development quantum algorithms !
• Currently most famous quantum algorithms (based on parallelism)
• Grover’s search.
• Shor’s factorization algorithm.
• HHL (Harrow, Hassidim, Lloyd) linear equations solver.
• Let’s jump into it.
Black box search problem
• The problem is simple: Find the red ball
• Permitted operation: Take out and check.
• Imagine there’s only 1 red ball out of N balls.
• Classical algorithm ? O(N).
• Why does this problem matter ?
• Find a assignment for SAT problem.
• Find a element in a array equals to xxx
• Find maximum value/ minimum value/ … etc
Black box search problem: Needle in haystack
• General formulation: we have a function f: {0,1}n -> {0, 1}, want to find the
assignment x∈ {0,1}n such that f(x) = 1.
• Total number of possibility: 2n
• Classical algorithm:
• Choose (sample) one solution, ex: x = |01>
• Compute f, store the value, verify |01>|f(x)>.
• Classical object only permit one check at a time !
• Quantum algorithm:
• Construct a uniform state: |𝜑 > = |𝑠 >=
1
2
|00 > +
1
2
01 > +
1
2
10 > +
1
2
|11 >
• Verify it, …… f(| 𝜑 > ) =?????
Quantum search algorithm (1)
• We want to take advantage of quantum parallelism.
• i.e. we want to have by some operation:
|𝜑 > |0 >→
1
2
|00 > |𝑓(00) > +
1
2
|10 > |𝑓(10) > +
1
2
|01 > |𝑓(01) > +
1
2
|11 > |𝑓(11) >
• Why do we want it -> We compute f for all possible input in just 1 operation !
• Is this operation possible -> Yes ! It’s unitary !
• Remember the ancilla trick mentioned in the Tofolli gate slide ?
X
A A
BB
C⨁(𝐴⋀𝐵)C
Quantum search algorithm (1)
• We want to take advantage of quantum parallelism.
• i.e. we want to have by some operation:
|𝜑 > |0 >→
1
2
|00 > |𝑓(00) > +
1
2
|10 > |𝑓(10) > +
1
2
|01 > |𝑓(01) > +
1
2
|11 > |𝑓(11) >
• Why do we want it -> We compute f for all possible input in just 1 operation !
• Is this operation possible -> Yes ! It’s unitary !
• Remember the ancilla trick mentioned in the Tofolli gate slide ?
X
A A
BB
f
C⨁(𝐴⋀𝐵)C
Quantum search algorithm (1)
• We want to take advantage of quantum parallelism.
• i.e. we want to have by some operation:
|𝜑 > |0 >→
1
2
|00 > |𝑓(00) > +
1
2
|10 > |𝑓(10) > +
1
2
|01 > |𝑓(01) > +
1
2
|11 > |𝑓(11) >
• Why do we want it -> We compute f for all possible input in just 1 operation !
• Is this operation possible -> Yes ! It’s unitary !
• Remember the ancilla trick mentioned in the Tofolli gate slide ?
X
A A
BB
f
C⨁𝑓(𝐴, 𝐵)C
Quantum search algorithm (1)
• We want to take advantage of quantum parallelism.
• i.e. we want to have by some operation:
|𝜑 > |0 >→
1
2
|00 > |𝑓(00) > +
1
2
|10 > |𝑓(10) > +
1
2
|01 > |𝑓(01) > +
1
2
|11 > |𝑓(11) >
• Why do we want it -> We compute f for all possible input in just 1 operation !
• Is this operation possible -> Yes ! It’s unitary !
• Remember the ancilla trick mentioned in the Tofolli gate slide ?
X
A A
BB
f
0⨁𝑓(𝐴, 𝐵)0
Quantum search algorithm (1)
• We want to take advantage of quantum parallelism.
• i.e. we want to have by some operation:
|𝜑 > |0 >→
1
2
|00 > |𝑓(00) > +
1
2
|10 > |𝑓(10) > +
1
2
|01 > |𝑓(01) > +
1
2
|11 > |𝑓(11) >
• Why do we want it -> We compute f for all possible input in just 1 operation !
• Is this operation possible -> Yes ! It’s unitary !
• Remember the ancilla trick mentioned in the Tofolli gate slide ?
• Quantum boolean gate.
X
A A
BB
f
0⨁𝑓(𝐴, 𝐵)
Uf
0
Quantum search algorithm (2)
• What’s next ?
• We have: 1
2
|00 > |𝑓(00) > +
1
2
|10 > |𝑓(10) > +
1
2
|01 > |𝑓(01) > +
1
2
|11 > |𝑓(11) >
• Remember the meaning of the coefficient ? -> Square is the probability.
• How to sample a x -> Measurement !
• Wait…Nothing change ! Only have ¼ probability to get the search target !
• If only…we can do something to the state
• Make the coefficient of our target to be one!
• Need to construct unitary transformation…
• Grover’s idea: Rotate the state !
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥
|00 >
|00 >⊥
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
|00 >
|00 >⊥
|𝜑 >= |00 >
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥
|00 >
|00 >⊥
𝜃 = 30
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
|00 >
|00 >⊥
|𝜑 > = −
1
4
|00 > +
3
4
|00 >⊥
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
• Only two steps are enough !
|00 >
|00 >⊥
|𝜑 >= |00 >
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
• Only two steps are enough !
• Done with N=4 example. Consider N to be very large…
𝜃 ≈
1
𝑁
|𝑡𝑎𝑟𝑔𝑒𝑡 >⊥
|𝑡𝑎𝑟𝑔𝑒𝑡 >
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
• Only two steps are enough !
• Done with N=4 example. Consider N to be very large…
𝜃 ≈
3
𝑁
|𝑡𝑎𝑟𝑔𝑒𝑡 >⊥
|𝑡𝑎𝑟𝑔𝑒𝑡 >
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
• Only two steps are enough !
• Done with N=4 example. Consider N to be very large…
𝜃 ≈
5
𝑁
|𝑡𝑎𝑟𝑔𝑒𝑡 >⊥
|𝑡𝑎𝑟𝑔𝑒𝑡 >
Quantum search algorithm (3)
• Suppose |00> is the answer, let’s revisit what we have…
• |𝜑 >=
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >=
1
4
|00 > +
3
4
|00 >⊥
• Only two steps are enough !
• Done with N=4 example. Consider N to be very large…
𝜃 ≈
2𝑘 + 1
𝑁
=
𝜋
2
𝑘 = Ο( 𝑁)
Quadratic speedup !!!
|𝑡𝑎𝑟𝑔𝑒𝑡 >⊥
|𝑡𝑎𝑟𝑔𝑒𝑡 >
Quantum search algorithm
• Let’s implement each iteration
• How to flip the sign only at the target spot ?
• The ancilla trick ver 2.0
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥ → −
1
4
|00 > +
3
4
|00 >⊥
X
A A
BB Uf
C C⨁𝑓(𝐴, 𝐵)
Quantum search algorithm
• Let’s implement each iteration
• How to flip the sign only at the target spot ?
• The ancilla trick ver 2.0
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥ → −
1
4
|00 > +
3
4
|00 >⊥
X
A A
BB Uf
C
1
2
|0 > −
1
2
|1 > =
|0 >=
|0 >=
Quantum search algorithm
• Let’s implement each iteration
• How to flip the sign only at the target spot ?
• The ancilla trick ver 2.0
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥ → −
1
4
|00 > +
3
4
|00 >⊥
X
A A
BB Uf
C
1
2
|0 > −
1
2
|1 > =
|0 >=
|0 >=
C⨁𝑓(0,0)
Quantum search algorithm
• Let’s implement each iteration
• How to flip the sign only at the target spot ?
• The ancilla trick ver 2.0
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥ → −
1
4
|00 > +
3
4
|00 >⊥
X
A A
BB Uf
C
1
2
|0 > −
1
2
|1 > =
|0 >=
|0 >=
-C
Quantum search algorithm
• Let’s implement each iteration
• How to flip the sign only at the target spot ?
• The ancilla trick ver 2.0
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥ → −
1
4
|00 > +
3
4
|00 >⊥
X
A A
BB Uf
C
1
2
|0 > −
1
2
|1 > =
|0 >=
|0 >=
-C
𝑈𝑓 |𝜑 > |𝐶 > =
1
4
𝑈𝑓 |00 > |𝐶 > +
3
4
𝑈𝑓 |00 >⊥|𝐶 > = −
1
4
|00 > |𝐶 > +
3
4
|00 >⊥|𝐶 >
Quantum search algorithm
• Let’s implement each iteration
• How to flip the sign only at the target spot ?
• The ancilla trick ver 2.0
• Discard the ancilla bit, we get what we want !!
|𝜑 >=
1
4
|00 > +
3
4
|00 >⊥ → −
1
4
|00 > +
3
4
|00 >⊥
X
A A
BB Uf
C
1
2
|0 > −
1
2
|1 > =
|0 >=
|0 >=
-C
𝑈𝑓 |𝜑 > |𝐶 > =
1
4
𝑈𝑓 |00 > |𝐶 > +
3
4
𝑈𝑓 |00 >⊥|𝐶 > = −
1
4
|00 > |𝐶 > +
3
4
|00 >⊥|𝐶 >
Quantum search algorithm
• How to flip the state with respect to the uniform state |s> ?
• Uniform state |𝑠 > = 𝑖=1
𝑁 1
𝑁
|𝑖 >
• I’ll give you the expression of this operation A: (Note: N=2n)
𝐴 = 2 𝑠 >< 𝑠 − 𝐼 = 𝐻⨂𝑛
2 0 >< 0 − 𝐼 𝐻⨂𝑛
𝐻⨂2
𝑍
𝐻⨂2
Grover’s search
• Step 1: Initialize |𝜑 > with a uniform state n qubits such that N=2n
• Step 2: (iteration) For k in range ( 𝑁):
• |𝜑′ > |𝐶 > = 𝐺 |𝜑 > |𝐶 >
• Step 3: Measure the state
• Obtain final outcome.
𝐻⨂2
𝑍
𝐻⨂2
Uf
Grover’s search: Recap
• Query complexity: 𝑁 𝑣𝑠 𝑁
• How many functional call do we need ?
• Again: Quantum parallelism !
Uf
c
Grover’s search: Further reading
• Can you think of a quantum algorithm that find maximum in a list ?
• Can you initialize with arbitrary quantum state?
• Interesting References:
• Amplitude amplification : Boost up a quantum algo only need O(
1
𝛿
)
repetition.
• Grover search is optimal !
• Quantum walk via reflection between subspace.
Outline
• A quantum intuition. (Observed !)
• Axiomize quantum physics. (Observed !)
• Applications : Sth you might raise your eyebrows. (Observed !)
• A quantum algorithm: Grover’s search. (Observed !)
• A quantum algorithm: Shor’s factorizing algorithm.
Recap: Quantum Boolean circuit
• What’s the critical step in Grover’s search ?
• Quantum parallelism for sure…
• A smart way to extract the output of the function ! -> Encode to amplitude
• We’ve considered binary output…
• What if the function takes more than 2 outcome?
• E.g. |𝜑 > = 00 >→ 𝑐 𝑓 0,0 00 >
• What shall this c be ?
• A natural extension: Phase encoding!
X
A A
BB Uf
C
1
2
|0 > −
1
2
|1 > =
|0 >=
|0 >=
𝐶⨁𝑓 𝐴, 𝐵
= −𝐶
Phase encoding
• Let’s apply a two-outcome function to a uniform state
• Example of such function: Indicator function of the search problem
• The phase encoding (What we want)
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >→ −
1
2
|00 > +
1
2
|10 > +
1
2
|01 > +
1
2
|11 >
• How do we do that: We pick a ancilla C =
1
2
|0 > −
1
2
|1 > -> Eigenvector !
• Let’s apply a four-outcome function to a uniform state.
• Example of such function: f(a,b) = (2*a + b) mod 4
• The phase encoding (What we want)
1
2
00 > +
1
2
10 > +
1
2
01 > +
1
2
11 >→ 𝑒
2𝜋𝑖 𝑓 0,0
4
1
2
00 > +𝑒
2𝜋𝑖 𝑓 1,0
4
1
2
10 > +𝑒
2𝜋𝑖 𝑓 0,1
4
1
2
01 > +𝑒
2𝜋𝑖 𝑓 1,1
4
1
2
11 >
• How do we do that: We pick a ancilla C = 𝑘=1
4 𝑒2𝜋𝑖𝑘/4
4
|𝑘 > -> Eigenvector !
Quantum period finding
• What’s next -> How to use the encoding
• In search problem, we use the encoding to ‘squeeze’ the quantum state.
• Introduce a new problem: Find the period of the function f
• Period: f(x) = f(x ⨁ r). Find r.
• Why important -> You’ll see, hehehee..
• E.g. f(x) = f(x ⨁ 4 )
|𝜑 > = 𝑒
2𝜋𝑖 ∗ 0
4
1
2
00 > +𝑒
2𝜋𝑖 ∗ 1
4
1
2
10 > +𝑒
2𝜋𝑖 ∗ 2
4
1
2
01 > +𝑒
2𝜋𝑖 ∗3
4
1
2
11 >
• How to extract ‘4’ ? -> Inverse Fourier transform !!
Quantum Fourier transform
• Trust me : Discrete Fourier transform is unitary.
• Trust me: Quantum Fourier transform can be done in O((logN)2) gates.
• Trust me:
|𝜑 > = 𝑒
2𝜋𝑖 ∗ 0
4
1
2
00 > +𝑒
2𝜋𝑖 ∗ 1
4
1
2
10 > +𝑒
2𝜋𝑖 ∗ 2
4
1
2
01 > +𝑒
2𝜋𝑖 ∗3
4
1
2
11 >→ |01 >
Quantum period finding (Details)
• In general case…
• We know 0 < r < 2L
• But we don’t know how to construct C -> wait…wha…?
• Actually, we can ‘solve’ it !
• Here’s the sketch of the actual algorithm
• Step 1: construct a uniform state with (L + log(
1
𝜀
)) qubits : |s>
• Step 2: Apply quantum Boolean circuit Uf to |s>|0> : Uf |s>|0>
• Step 3: Apply QIFT to the first register.
• Step 4: Measure the first register, and do continuous fraction algorithm to find r.
Quantum period finding (Complexity)
• Query complexity: 1 !!
• Other operation: O(L2), with 0 < r < 2L
• Time to Shor up !
Quantum order finding
• Definition: let x < N and (x, N) are coprime. The order of x modulo N is
defined to be the least positive integer r, such that
𝑥 𝑟
≡ 1 𝑚𝑜𝑑 𝑁
• Property: 𝑟 ≤ 𝑁
• Property: the function f(k) = xk mod N is periodic with period r !!
• How to find the order-> Quantum period finding. The end.
• Query: 1
• Gate complexity: O(log 2 (N))
Two lemmas I haven’t thought through yet
Lemma 1: (How to find non-trivial factor)
Suppose N is an L bit composite number, and x is an non trivial solution to
P1 : 𝑥2 ≡ 1 𝑚𝑜𝑑 𝑁,
which means 𝑥 ≠ 1 𝑚𝑜𝑑 𝑁 nor 𝑥 ≠ 𝑁 − 1 ≡ −1 𝑚𝑜𝑑 𝑁 . Then, at least one of
gcd(x-1 ,N), gcd(x+1, N) is a non-trivial factor of N that can be computed in O(L3)
Lemma 2: (It’s really likely to find such ‘x’)
Suppose 𝑁 = 𝑝1
𝛼1
𝑝2
𝛼2
⋯ 𝑝 𝑚
𝛼 𝑚
and let x be chosen uniformly at random from
the set {0<t<N, (t,N) is coprime}. Let r be the order of x modulo N, then
Pr 𝑟 𝑖𝑠 𝑒𝑣𝑒𝑛 𝑎𝑛𝑑 𝑥
𝑟
2 𝑖𝑠 𝑛𝑜𝑛𝑡𝑟𝑖𝑣𝑖𝑎𝑙 𝑡𝑜 𝑃1 ≥ 1 −
1
2 𝑚
Shor’s factoring algorithm (Find a nontrivial
factor)
• Input: a composite number N
• Step 1: Randomly sample 0<x<N, check if gcd(x,N)>1
• If so, you are lucky -> return gcd(x,N).
• If not, don’t panic, quantum has your back -> go to step 2.
• Step 2: Apply quantum order finding algorithm to x.
• Check 𝑟 𝑖𝑠 𝑒𝑣𝑒𝑛 𝑎𝑛𝑑 𝑥
𝑟
2 𝑖𝑠 𝑛𝑜𝑛𝑡𝑟𝑖𝑣𝑖𝑎𝑙 𝑡𝑜 𝑃1. If so, compute gcd(xr/2-1 ,N),
gcd(xr/2+1, N) , test if one of them is a non-trivial factor. Output it.
• If not, 雖小。 But that’s fine-> run the algo again !
• Performance: O(log3 N) with O(1) success probability.
Offline.
• A quantum intuition. (Observed !)
• Axiomize quantum physics. (Observed !)
• Applications : Sth you might raise your eyebrows. (Observed !)
• A quantum algorithm: Grover’s search. (Observed !)
• A quantum algorithm: Shor’s factorizing algorithm. (Observed !)
Recommended reference
• Quantum computation bible -> Nielsen & Chuang, quantum
computation and quantum information.
• Linear algebraic reference -> The theory of quantum information,
Waltrous.
• Quantum tale -> Alice in quantumland.

More Related Content

PPT
2 backlash simulation
PDF
Achieve asymptotic stability using Lyapunov's second method
PDF
Lyapunov-type inequalities for a fractional q, -difference equation involvin...
PDF
Discrete control2 converted
PDF
Solution to schrodinger equation with dirac comb potential
PPTX
Deep learning study 2
PDF
Some Dynamical Behaviours of a Two Dimensional Nonlinear Map
PDF
Generalized Carleson Operator and Convergence of Walsh Type Wavelet Packet Ex...
2 backlash simulation
Achieve asymptotic stability using Lyapunov's second method
Lyapunov-type inequalities for a fractional q, -difference equation involvin...
Discrete control2 converted
Solution to schrodinger equation with dirac comb potential
Deep learning study 2
Some Dynamical Behaviours of a Two Dimensional Nonlinear Map
Generalized Carleson Operator and Convergence of Walsh Type Wavelet Packet Ex...

Similar to Quantum Computation 101 (Almost) (20)

PPT
Introduction to Quantum Computing & Quantum Information Theory
PPT
2007 001-motivation-to-quantum-computing
PPTX
A short introduction to Quantum Computing and Quantum Cryptography
PPTX
quantum computing Fundamentals and Applicaiton
PPT
CAP06.ppt quantum physic for students in
PDF
Quantum Computing 101, Part 1 - Hello Quantum World
PPT
1542 inner products
PDF
Quantum Cryptography
PPTX
Quantum Computation.pptx
PDF
Module 2- Mathematical Formulation-Completed .pdf
PPTX
Quantum computing - A Compilation of Concepts
PPTX
Ahsan 10X Engineering Talk (Quantum Computing).pptx
PDF
Grovers Algorithm
PPTX
Quantum Computation Introduction
PDF
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
PDF
Quantum Computation and the Stabilizer Formalism for Error Correction
PPTX
Quantum computing
PDF
ML Reading Group (Intro to Quantum Computation)
PDF
Week3 ap3421 2019_part1
PDF
Quantum computing meghaditya
Introduction to Quantum Computing & Quantum Information Theory
2007 001-motivation-to-quantum-computing
A short introduction to Quantum Computing and Quantum Cryptography
quantum computing Fundamentals and Applicaiton
CAP06.ppt quantum physic for students in
Quantum Computing 101, Part 1 - Hello Quantum World
1542 inner products
Quantum Cryptography
Quantum Computation.pptx
Module 2- Mathematical Formulation-Completed .pdf
Quantum computing - A Compilation of Concepts
Ahsan 10X Engineering Talk (Quantum Computing).pptx
Grovers Algorithm
Quantum Computation Introduction
HiPEAC'19 Tutorial on Quantum algorithms using QX - 2019-01-23
Quantum Computation and the Stabilizer Formalism for Error Correction
Quantum computing
ML Reading Group (Intro to Quantum Computation)
Week3 ap3421 2019_part1
Quantum computing meghaditya
Ad

Recently uploaded (20)

PDF
bbec55_b34400a7914c42429908233dbd381773.pdf
PDF
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PDF
Sciences of Europe No 170 (2025)
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
2Systematics of Living Organisms t-.pptx
PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPT
POSITIONING IN OPERATION THEATRE ROOM.ppt
PDF
Biophysics 2.pdffffffffffffffffffffffffff
PPTX
Introduction to Cardiovascular system_structure and functions-1
PDF
AlphaEarth Foundations and the Satellite Embedding dataset
PPTX
Cell Membrane: Structure, Composition & Functions
PPTX
TOTAL hIP ARTHROPLASTY Presentation.pptx
PPTX
Microbiology with diagram medical studies .pptx
PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PPTX
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
PPTX
Comparative Structure of Integument in Vertebrates.pptx
PDF
The scientific heritage No 166 (166) (2025)
PPTX
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
PPTX
Classification Systems_TAXONOMY_SCIENCE8.pptx
bbec55_b34400a7914c42429908233dbd381773.pdf
SEHH2274 Organic Chemistry Notes 1 Structure and Bonding.pdf
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
Sciences of Europe No 170 (2025)
ECG_Course_Presentation د.محمد صقران ppt
2Systematics of Living Organisms t-.pptx
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
POSITIONING IN OPERATION THEATRE ROOM.ppt
Biophysics 2.pdffffffffffffffffffffffffff
Introduction to Cardiovascular system_structure and functions-1
AlphaEarth Foundations and the Satellite Embedding dataset
Cell Membrane: Structure, Composition & Functions
TOTAL hIP ARTHROPLASTY Presentation.pptx
Microbiology with diagram medical studies .pptx
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
GEN. BIO 1 - CELL TYPES & CELL MODIFICATIONS
Comparative Structure of Integument in Vertebrates.pptx
The scientific heritage No 166 (166) (2025)
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
Classification Systems_TAXONOMY_SCIENCE8.pptx
Ad

Quantum Computation 101 (Almost)

  • 3. Combinatorial 101 • You have a bucket of blue balls (50%) and red balls (50%). • Probability ? • Uncertainty ?
  • 4. Combinatorial 101 • You have blue human balls (50%) and red human balls (50%) to rip of.
  • 5. Combinatorial 101 • You have blue human balls (50%) and red human balls (50%) to rip of. • You also know that some balls have longer sticks, some don’t.
  • 6. Combinatorial 101 • You have blue human balls (50%) and red human balls (50%) to rip of. • You also know that some balls have longer sticks, some don’t. • YOU HATE REDbull.
  • 7. Combinatorial 101 • You have blue human balls (50%) and red human balls (50%) to rip of. • You also know that some balls have longer sticks, some don’t. • YOU are OK with ASIAN.
  • 8. • You have blue human balls (50%) and red human balls (50%) to rip of. • You also know that some balls have longer sticks, some don’t. • ASIAN. Combinatorial 101
  • 9. • You encounter light beams. Combinatorial 102
  • 10. • You encounter light beams. • You know some sweet physics. Combinatorial 102
  • 11. • You encounter light beams. • You know some sweet physics…? Combinatorial 102
  • 12. • You encounter light beams. • You know some sweat physics…..? Combinatorial 102
  • 13. Yeah, yeah….Wave…cosine….2#$@$#!#%@ • Two different model of uncertainty…How different? • Observation affects the experimental outcome, aka the distribution.
  • 14. Yeah, yeah….Wave…cosine….2#$@$#!#%@ • Two different model of uncertainty…How different? • Observation affects the experimental outcome, aka the distribution. • Wave particle duality. • Intrinsic randomness vs classical randomness.
  • 15. Outline • A quantum intuition. (Observed !)
  • 18. Let’s get our hand dirty • Quantum physics are stated as a series of three axioms. • Axiom 1: An isolated quantum system has associated with a Hilbert space H. The system is completely determined by a unit vector in H • Ex: [1, 0], [0, 0, -i], [0.5, 3 2 ] are all unit vectors in H. • We can write [0.5, 3 2 ] in a cocky way: 0.5 |0> + 3 2 |1> • |0>, |1> are called base states.
  • 19. Let’s get our hand dirty (Axiom 1) • What is ‘state’ ? • Can be anything that matters in the system ! • Ex: |0> : |1>: • Ex: |0>: laser (inactivated) |1>: laser (activated) |2>: laser (emitted) • Ex: |0>: False |1>: True • Axiom 1: System can always be described by a vector. We view the ‘meaning’ of the vector basis as state. • Ex: The state of a bit storage with quantum system can be described as a|0> + b|1>, with |a|2+|b|2 = 1. We usually call it ‘qubit’. • What about the ‘coefficient’ of the basis ? Later on this.
  • 20. Let’s get our hand dirty (Axiom 1.5) • Wait…what about a system to describe ( ) ? • A ball can have two different state • |0> : |1>: • State of A ball can be described by a length two vector. • w = [a, b] a.k.a a|0> + b|1>, with |a|2+|b|2 = 1. • Two balls can have four different state • |00>: |01>: |10>: |11>: • State of two balls can be described by a length four vector. • Composite system (Axiom 1.5) • A composite quantum system has state space given by the tensor product of the consistent quantum subsystem.
  • 21. Let’s get our hand dirty (Axiom 1.5) • Tensor product: Natural product of vectors • w1 = a|0> + b|1>, w2 = c|0> + d|1> • How to compute w1 ‘times’ w2 ? • Phen Pei Lu, duh…. • w1⨂ w2 = (a|0> + b|1>) ⨂ (c|0> + d|1>) = a c |0> ⨂ |0> + a d|0> ⨂ |1> + b c |1> ⨂ |0 > + b d |1> ⨂ |1 > = ac |00 > + ad |01> + bc |10 > + bd |11> • Properties of tensor product • (w1⨂ w2 ) ∙ (w3⨂ w4 ) =(w1 ∙ w3)(w2 ∙ w4) • Preserve axiom 1 !! • Why tensor product ? -> More on this later.
  • 22. Let’s get our hand dirty (Axiom 2) • Axiom 2: A physical system evolves according to a linear unitary transform. • Unitary transform U: U*U = UU* = I • Think of ‘*’ as transpose + conjugate. • Ex: [0, i]* = [[-i], [0]] • Property of ‘*’: (AB)* = B*A*
  • 23. Let’s get our hand dirty (Axiom 2) • Why unitary transform? • Unitary transform U: U*U = UU* = I • Preserve unit length of state after evolution ! (Axiom 1) • Check it out: • w is a state (column vector), from axiom 1 we have w* w = 1. • Let w’ = U w, we see that w’* w’ = w* U*U w = w* w = 1. • Why linear ? -> Schrodinger equation.
  • 24. Let’s get our hand dirty (Axiom 2) • Back to single qubit • Reminder: qubit can be represented as [a, b] a.k.a a|0> + b|1>, with |a|2+|b|2 = 1. • Special case: a = 1 (Logic false) and b = 1 (Logic true) • Unitary transform on single qubit (Quantum gates) X 0 1 1 0 Y 0 −𝑖 𝑖 0 Z 1 0 0 −1 H 1 2 1 2 1 2 − 1 2
  • 25. Let’s get our hand dirty (Axiom 2) • Unitary transform on two qubits (Quantum gates) • How to realize AND ? • How to realize OR ?? • Wait… AND/OR are irreversible operations ! • Nature permits only unitary operation. • Quantum gates are reversible ! AND ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OR ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
  • 26. Let’s get our hand dirty (Axiom 2) • Unitary transform on two qubits (A smart way around) • NAND gates are universal. -> Want to implement this. • The Toffoli gate • Quantum gate design trick 101: add an acilla bit and XOR it. X A C A C ⨁(𝐴⋀𝐵) BB
  • 27. Let’s get our hand dirty (Axiom 3) • So far we’ve talked about the deterministic part of quantum physics. • Remember we’ve mentioned intrinsic randomness and experimental effect ? • Axiom 3 (Verbally) • The information you can get from a quantum state is through measurement. • Each possible experimental outcomes is associated with an operator. • Probability of obtaining an experimental outcome is determined by state and the operator associated with that outcome. • Quantum state, after the measurement, collapses to a state associated with the experimental outcomes.
  • 28. Let’s get our hand dirty (Axiom 3) • Axiom 3 (Measurement) • A quantum measurement is characterized by a collection of operators. • Operators: 𝑀 𝛼1 , 𝑀 𝛼2 , ⋯ 𝑀 𝛼 𝑘 . • 𝛼1, 𝛼2, ⋯ 𝛼 𝑘 are indications of the outcomes. • Operators obey completeness property: 𝑖=1 𝑘 𝑀 𝛼 𝑖 ∗ 𝑀 𝛼 𝑖 = 𝐼 • Given state w, the probability P[X = 𝛼𝑖] = w*𝑀 𝛼 𝑖 ∗ 𝑀 𝛼 𝑖 w • After the measurement, quantum state collapses to: 𝑀 𝛼 𝑖 w P[X = 𝛼 𝑖]
  • 29. Let’s get our hand dirty (Axiom 3) • What the heck are these operators ? • Why completeness property: 𝑖=1 𝑘 𝑀 𝛼 𝑖 ∗ 𝑀 𝛼 𝑖 = 𝐼 ?? • Preserve outcome probability: 𝑖=1 𝑘 P[X = 𝛼𝑖] = 1 • Check it out: 𝑖=1 𝑘 P[X = 𝛼𝑖] = 𝑖=1 𝑘 w∗𝑀 𝛼 𝑖 ∗ 𝑀 𝛼 𝑖 w = w∗ 𝑖=1 𝑘 𝑀 𝛼 𝑖 ∗ 𝑀 𝛼 𝑖 w = w∗ w = 1 (Axiom 1) • But… What ARE these operators ? • Ex: w = 𝑎 𝑏 , 𝑀0 = 1 0 0 0 , 𝑀1 = 0 0 0 1 • Meaning of coefficients: Probability amplitude.
  • 30. Let’s get our hand dirty (Axiom 1.5) • Remember the natural tensor product ? • w1 = a|0> + b|1>, w2 = c|0> + d|1> • w1⨂ w2 = (a|0> + b|1>) ⨂ (c|0> + d|1>) = ac |00 > + ad |01> + bc |10 > + bd |11> • Remember Probability amplitude ? • |a|2 : Probability of observing |0> with measurement {M0, M1} on w1 -> P[X1 = 0] • |c|2 : Probability of observing |0> with measurement {M0, M1} on w2 -> P[X2 = 0] • Probability of observing |0>|0> with measurement {…} on w1⨂ w2 ? -> P[X1 = 0] P[X2 = 0] • Tensor product reveals the fact that two consistent quantum states are independent ! • But not every 4-dim state can be written in tensor product. • These states are called unseparable -> Quantum correlation.
  • 31. Let’s get our hand dirty (Recap) • Axiom 1: Everything (isolated) is a unit length vector. • Axiom 1.5: Two things not quantum correlated (independent), write them down as their tensor product. • Axiom 2: Nature only permits unitary operations. • Axiom 3: Information from the state can be accessed through measurement, where the outcomes exhibits intrinsic randomness.
  • 32. Outline • A quantum intuition. (Observed !) • Axiomize quantum physics. (Observed !) • Break ? • Applications : Sth you might raise your eyebrows. • A quantum algorithm: Grover’s search. • A quantum algorithm: Shor’s factorizing algorithm.
  • 33. Quantum parallelism : Good stuff  • Think about a state a1 |000> + a2 |001> +… a8 |111> • Quiz 1: what are the meaning of [|000> … |111> ] ? • Quiz 2: what are the meaning of [a1 … a8] ? • Quiz 3: what are the permitted operations ? • Now think about operation again. • What does it mean to perform ‘flip the last bit’ on this state ? • Operation on a state -> operation on all possible classical configurations. • This is where quantum computation gain advantage from.
  • 34. Quantum parallelism : Bad stuff ? • Yey! Then why don’t we replace classical bits (or other computing thiny) with quantum state ? • At a first glance: classic : |0> or |1> ---> quantum : a|0> + b|1> • More degree of freedom, parallelism… • But…how to construct a state a|0> + b|1> ? • Classical : How to construct a bit string 0001010100 -> stupid question. • Classical (2) : Hey, here’s a bit string (in the memory), make a copy of it -> stupid question again. • Quantum: How to construct a state a|00> + b|10> -> stupid question ? • Quantum (2): Hey, here’s a state, make a copy of it -> ????
  • 35. Quantum parallelism: No-cloning theorem • There is no universal unitary U that can clone a state, i.e., there’s no unitary U such that for all |𝜑 > and ancilla |𝑎 > 𝑈|𝜑 > |𝑎 >= |𝜑 > |𝜑 >
  • 36. Quantum teleportation • We can’t CLONE a state by unitary transform • Can we do something with measurement ? • But wait…After measurement, the state collapses. • So we shall ask: can we at least carry these measurement result to somewhere and do something ? • We CAN ! • The protocol is called quantum teleportation. • Why teleportation -> Imagine transporting a person in a speed of light ?
  • 37. Quantum teleportation |𝜑 >1 = 𝑎 0 > +𝑏 1 > |𝜑 >23 = 1 2 00 > + 1 2 11 > H M {|00>, |01> |10>, |11>} X Z b1 b2 |𝜑 >3 = 𝑎 0 > +𝑏 1 >
  • 38. Quantum superdense coding • Hmm…It seems that each qubit need to be described in two bits… • Can we reverse it -> send two classical bits by only one qubit ? • WE CAN ! X Z |𝜑 > 𝐴 |𝜑 > 𝐴𝐵 = 1 2 00 > + 1 2 11 > 𝑠𝑒𝑛𝑑 M (b1,b2) b1 b2
  • 39. Quantum might raise your eyebrow (Recap) • Quantum parallelism • No cloning theorem • Application of quantum entanglement • Quantum teleportation • Quantum superdense coding
  • 40. Outline • A quantum intuition. (Observed !) • Axiomize quantum physics. (Observed !) • Applications : Sth you might raise your eyebrows. (Observed !) • A quantum algorithm: Grover’s search. • A quantum algorithm: Shor’s factorizing algorithm.
  • 41. Quantum algorithm • Remember quantum parallelism ? • This insights leads to development quantum algorithms ! • Currently most famous quantum algorithms (based on parallelism) • Grover’s search. • Shor’s factorization algorithm. • HHL (Harrow, Hassidim, Lloyd) linear equations solver. • Let’s jump into it.
  • 42. Black box search problem • The problem is simple: Find the red ball • Permitted operation: Take out and check. • Imagine there’s only 1 red ball out of N balls. • Classical algorithm ? O(N). • Why does this problem matter ? • Find a assignment for SAT problem. • Find a element in a array equals to xxx • Find maximum value/ minimum value/ … etc
  • 43. Black box search problem: Needle in haystack • General formulation: we have a function f: {0,1}n -> {0, 1}, want to find the assignment x∈ {0,1}n such that f(x) = 1. • Total number of possibility: 2n • Classical algorithm: • Choose (sample) one solution, ex: x = |01> • Compute f, store the value, verify |01>|f(x)>. • Classical object only permit one check at a time ! • Quantum algorithm: • Construct a uniform state: |𝜑 > = |𝑠 >= 1 2 |00 > + 1 2 01 > + 1 2 10 > + 1 2 |11 > • Verify it, …… f(| 𝜑 > ) =?????
  • 44. Quantum search algorithm (1) • We want to take advantage of quantum parallelism. • i.e. we want to have by some operation: |𝜑 > |0 >→ 1 2 |00 > |𝑓(00) > + 1 2 |10 > |𝑓(10) > + 1 2 |01 > |𝑓(01) > + 1 2 |11 > |𝑓(11) > • Why do we want it -> We compute f for all possible input in just 1 operation ! • Is this operation possible -> Yes ! It’s unitary ! • Remember the ancilla trick mentioned in the Tofolli gate slide ? X A A BB C⨁(𝐴⋀𝐵)C
  • 45. Quantum search algorithm (1) • We want to take advantage of quantum parallelism. • i.e. we want to have by some operation: |𝜑 > |0 >→ 1 2 |00 > |𝑓(00) > + 1 2 |10 > |𝑓(10) > + 1 2 |01 > |𝑓(01) > + 1 2 |11 > |𝑓(11) > • Why do we want it -> We compute f for all possible input in just 1 operation ! • Is this operation possible -> Yes ! It’s unitary ! • Remember the ancilla trick mentioned in the Tofolli gate slide ? X A A BB f C⨁(𝐴⋀𝐵)C
  • 46. Quantum search algorithm (1) • We want to take advantage of quantum parallelism. • i.e. we want to have by some operation: |𝜑 > |0 >→ 1 2 |00 > |𝑓(00) > + 1 2 |10 > |𝑓(10) > + 1 2 |01 > |𝑓(01) > + 1 2 |11 > |𝑓(11) > • Why do we want it -> We compute f for all possible input in just 1 operation ! • Is this operation possible -> Yes ! It’s unitary ! • Remember the ancilla trick mentioned in the Tofolli gate slide ? X A A BB f C⨁𝑓(𝐴, 𝐵)C
  • 47. Quantum search algorithm (1) • We want to take advantage of quantum parallelism. • i.e. we want to have by some operation: |𝜑 > |0 >→ 1 2 |00 > |𝑓(00) > + 1 2 |10 > |𝑓(10) > + 1 2 |01 > |𝑓(01) > + 1 2 |11 > |𝑓(11) > • Why do we want it -> We compute f for all possible input in just 1 operation ! • Is this operation possible -> Yes ! It’s unitary ! • Remember the ancilla trick mentioned in the Tofolli gate slide ? X A A BB f 0⨁𝑓(𝐴, 𝐵)0
  • 48. Quantum search algorithm (1) • We want to take advantage of quantum parallelism. • i.e. we want to have by some operation: |𝜑 > |0 >→ 1 2 |00 > |𝑓(00) > + 1 2 |10 > |𝑓(10) > + 1 2 |01 > |𝑓(01) > + 1 2 |11 > |𝑓(11) > • Why do we want it -> We compute f for all possible input in just 1 operation ! • Is this operation possible -> Yes ! It’s unitary ! • Remember the ancilla trick mentioned in the Tofolli gate slide ? • Quantum boolean gate. X A A BB f 0⨁𝑓(𝐴, 𝐵) Uf 0
  • 49. Quantum search algorithm (2) • What’s next ? • We have: 1 2 |00 > |𝑓(00) > + 1 2 |10 > |𝑓(10) > + 1 2 |01 > |𝑓(01) > + 1 2 |11 > |𝑓(11) > • Remember the meaning of the coefficient ? -> Square is the probability. • How to sample a x -> Measurement ! • Wait…Nothing change ! Only have ¼ probability to get the search target ! • If only…we can do something to the state • Make the coefficient of our target to be one! • Need to construct unitary transformation… • Grover’s idea: Rotate the state !
  • 50. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ |00 > |00 >⊥
  • 51. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ |00 > |00 >⊥ |𝜑 >= |00 >
  • 52. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ |00 > |00 >⊥ 𝜃 = 30
  • 53. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ |00 > |00 >⊥ |𝜑 > = − 1 4 |00 > + 3 4 |00 >⊥
  • 54. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ • Only two steps are enough ! |00 > |00 >⊥ |𝜑 >= |00 >
  • 55. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ • Only two steps are enough ! • Done with N=4 example. Consider N to be very large… 𝜃 ≈ 1 𝑁 |𝑡𝑎𝑟𝑔𝑒𝑡 >⊥ |𝑡𝑎𝑟𝑔𝑒𝑡 >
  • 56. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ • Only two steps are enough ! • Done with N=4 example. Consider N to be very large… 𝜃 ≈ 3 𝑁 |𝑡𝑎𝑟𝑔𝑒𝑡 >⊥ |𝑡𝑎𝑟𝑔𝑒𝑡 >
  • 57. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ • Only two steps are enough ! • Done with N=4 example. Consider N to be very large… 𝜃 ≈ 5 𝑁 |𝑡𝑎𝑟𝑔𝑒𝑡 >⊥ |𝑡𝑎𝑟𝑔𝑒𝑡 >
  • 58. Quantum search algorithm (3) • Suppose |00> is the answer, let’s revisit what we have… • |𝜑 >= 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >= 1 4 |00 > + 3 4 |00 >⊥ • Only two steps are enough ! • Done with N=4 example. Consider N to be very large… 𝜃 ≈ 2𝑘 + 1 𝑁 = 𝜋 2 𝑘 = Ο( 𝑁) Quadratic speedup !!! |𝑡𝑎𝑟𝑔𝑒𝑡 >⊥ |𝑡𝑎𝑟𝑔𝑒𝑡 >
  • 59. Quantum search algorithm • Let’s implement each iteration • How to flip the sign only at the target spot ? • The ancilla trick ver 2.0 |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ → − 1 4 |00 > + 3 4 |00 >⊥ X A A BB Uf C C⨁𝑓(𝐴, 𝐵)
  • 60. Quantum search algorithm • Let’s implement each iteration • How to flip the sign only at the target spot ? • The ancilla trick ver 2.0 |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ → − 1 4 |00 > + 3 4 |00 >⊥ X A A BB Uf C 1 2 |0 > − 1 2 |1 > = |0 >= |0 >=
  • 61. Quantum search algorithm • Let’s implement each iteration • How to flip the sign only at the target spot ? • The ancilla trick ver 2.0 |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ → − 1 4 |00 > + 3 4 |00 >⊥ X A A BB Uf C 1 2 |0 > − 1 2 |1 > = |0 >= |0 >= C⨁𝑓(0,0)
  • 62. Quantum search algorithm • Let’s implement each iteration • How to flip the sign only at the target spot ? • The ancilla trick ver 2.0 |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ → − 1 4 |00 > + 3 4 |00 >⊥ X A A BB Uf C 1 2 |0 > − 1 2 |1 > = |0 >= |0 >= -C
  • 63. Quantum search algorithm • Let’s implement each iteration • How to flip the sign only at the target spot ? • The ancilla trick ver 2.0 |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ → − 1 4 |00 > + 3 4 |00 >⊥ X A A BB Uf C 1 2 |0 > − 1 2 |1 > = |0 >= |0 >= -C 𝑈𝑓 |𝜑 > |𝐶 > = 1 4 𝑈𝑓 |00 > |𝐶 > + 3 4 𝑈𝑓 |00 >⊥|𝐶 > = − 1 4 |00 > |𝐶 > + 3 4 |00 >⊥|𝐶 >
  • 64. Quantum search algorithm • Let’s implement each iteration • How to flip the sign only at the target spot ? • The ancilla trick ver 2.0 • Discard the ancilla bit, we get what we want !! |𝜑 >= 1 4 |00 > + 3 4 |00 >⊥ → − 1 4 |00 > + 3 4 |00 >⊥ X A A BB Uf C 1 2 |0 > − 1 2 |1 > = |0 >= |0 >= -C 𝑈𝑓 |𝜑 > |𝐶 > = 1 4 𝑈𝑓 |00 > |𝐶 > + 3 4 𝑈𝑓 |00 >⊥|𝐶 > = − 1 4 |00 > |𝐶 > + 3 4 |00 >⊥|𝐶 >
  • 65. Quantum search algorithm • How to flip the state with respect to the uniform state |s> ? • Uniform state |𝑠 > = 𝑖=1 𝑁 1 𝑁 |𝑖 > • I’ll give you the expression of this operation A: (Note: N=2n) 𝐴 = 2 𝑠 >< 𝑠 − 𝐼 = 𝐻⨂𝑛 2 0 >< 0 − 𝐼 𝐻⨂𝑛 𝐻⨂2 𝑍 𝐻⨂2
  • 66. Grover’s search • Step 1: Initialize |𝜑 > with a uniform state n qubits such that N=2n • Step 2: (iteration) For k in range ( 𝑁): • |𝜑′ > |𝐶 > = 𝐺 |𝜑 > |𝐶 > • Step 3: Measure the state • Obtain final outcome. 𝐻⨂2 𝑍 𝐻⨂2 Uf
  • 67. Grover’s search: Recap • Query complexity: 𝑁 𝑣𝑠 𝑁 • How many functional call do we need ? • Again: Quantum parallelism ! Uf c
  • 68. Grover’s search: Further reading • Can you think of a quantum algorithm that find maximum in a list ? • Can you initialize with arbitrary quantum state? • Interesting References: • Amplitude amplification : Boost up a quantum algo only need O( 1 𝛿 ) repetition. • Grover search is optimal ! • Quantum walk via reflection between subspace.
  • 69. Outline • A quantum intuition. (Observed !) • Axiomize quantum physics. (Observed !) • Applications : Sth you might raise your eyebrows. (Observed !) • A quantum algorithm: Grover’s search. (Observed !) • A quantum algorithm: Shor’s factorizing algorithm.
  • 70. Recap: Quantum Boolean circuit • What’s the critical step in Grover’s search ? • Quantum parallelism for sure… • A smart way to extract the output of the function ! -> Encode to amplitude • We’ve considered binary output… • What if the function takes more than 2 outcome? • E.g. |𝜑 > = 00 >→ 𝑐 𝑓 0,0 00 > • What shall this c be ? • A natural extension: Phase encoding! X A A BB Uf C 1 2 |0 > − 1 2 |1 > = |0 >= |0 >= 𝐶⨁𝑓 𝐴, 𝐵 = −𝐶
  • 71. Phase encoding • Let’s apply a two-outcome function to a uniform state • Example of such function: Indicator function of the search problem • The phase encoding (What we want) 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 >→ − 1 2 |00 > + 1 2 |10 > + 1 2 |01 > + 1 2 |11 > • How do we do that: We pick a ancilla C = 1 2 |0 > − 1 2 |1 > -> Eigenvector ! • Let’s apply a four-outcome function to a uniform state. • Example of such function: f(a,b) = (2*a + b) mod 4 • The phase encoding (What we want) 1 2 00 > + 1 2 10 > + 1 2 01 > + 1 2 11 >→ 𝑒 2𝜋𝑖 𝑓 0,0 4 1 2 00 > +𝑒 2𝜋𝑖 𝑓 1,0 4 1 2 10 > +𝑒 2𝜋𝑖 𝑓 0,1 4 1 2 01 > +𝑒 2𝜋𝑖 𝑓 1,1 4 1 2 11 > • How do we do that: We pick a ancilla C = 𝑘=1 4 𝑒2𝜋𝑖𝑘/4 4 |𝑘 > -> Eigenvector !
  • 72. Quantum period finding • What’s next -> How to use the encoding • In search problem, we use the encoding to ‘squeeze’ the quantum state. • Introduce a new problem: Find the period of the function f • Period: f(x) = f(x ⨁ r). Find r. • Why important -> You’ll see, hehehee.. • E.g. f(x) = f(x ⨁ 4 ) |𝜑 > = 𝑒 2𝜋𝑖 ∗ 0 4 1 2 00 > +𝑒 2𝜋𝑖 ∗ 1 4 1 2 10 > +𝑒 2𝜋𝑖 ∗ 2 4 1 2 01 > +𝑒 2𝜋𝑖 ∗3 4 1 2 11 > • How to extract ‘4’ ? -> Inverse Fourier transform !!
  • 73. Quantum Fourier transform • Trust me : Discrete Fourier transform is unitary. • Trust me: Quantum Fourier transform can be done in O((logN)2) gates. • Trust me: |𝜑 > = 𝑒 2𝜋𝑖 ∗ 0 4 1 2 00 > +𝑒 2𝜋𝑖 ∗ 1 4 1 2 10 > +𝑒 2𝜋𝑖 ∗ 2 4 1 2 01 > +𝑒 2𝜋𝑖 ∗3 4 1 2 11 >→ |01 >
  • 74. Quantum period finding (Details) • In general case… • We know 0 < r < 2L • But we don’t know how to construct C -> wait…wha…? • Actually, we can ‘solve’ it ! • Here’s the sketch of the actual algorithm • Step 1: construct a uniform state with (L + log( 1 𝜀 )) qubits : |s> • Step 2: Apply quantum Boolean circuit Uf to |s>|0> : Uf |s>|0> • Step 3: Apply QIFT to the first register. • Step 4: Measure the first register, and do continuous fraction algorithm to find r.
  • 75. Quantum period finding (Complexity) • Query complexity: 1 !! • Other operation: O(L2), with 0 < r < 2L • Time to Shor up !
  • 76. Quantum order finding • Definition: let x < N and (x, N) are coprime. The order of x modulo N is defined to be the least positive integer r, such that 𝑥 𝑟 ≡ 1 𝑚𝑜𝑑 𝑁 • Property: 𝑟 ≤ 𝑁 • Property: the function f(k) = xk mod N is periodic with period r !! • How to find the order-> Quantum period finding. The end. • Query: 1 • Gate complexity: O(log 2 (N))
  • 77. Two lemmas I haven’t thought through yet Lemma 1: (How to find non-trivial factor) Suppose N is an L bit composite number, and x is an non trivial solution to P1 : 𝑥2 ≡ 1 𝑚𝑜𝑑 𝑁, which means 𝑥 ≠ 1 𝑚𝑜𝑑 𝑁 nor 𝑥 ≠ 𝑁 − 1 ≡ −1 𝑚𝑜𝑑 𝑁 . Then, at least one of gcd(x-1 ,N), gcd(x+1, N) is a non-trivial factor of N that can be computed in O(L3) Lemma 2: (It’s really likely to find such ‘x’) Suppose 𝑁 = 𝑝1 𝛼1 𝑝2 𝛼2 ⋯ 𝑝 𝑚 𝛼 𝑚 and let x be chosen uniformly at random from the set {0<t<N, (t,N) is coprime}. Let r be the order of x modulo N, then Pr 𝑟 𝑖𝑠 𝑒𝑣𝑒𝑛 𝑎𝑛𝑑 𝑥 𝑟 2 𝑖𝑠 𝑛𝑜𝑛𝑡𝑟𝑖𝑣𝑖𝑎𝑙 𝑡𝑜 𝑃1 ≥ 1 − 1 2 𝑚
  • 78. Shor’s factoring algorithm (Find a nontrivial factor) • Input: a composite number N • Step 1: Randomly sample 0<x<N, check if gcd(x,N)>1 • If so, you are lucky -> return gcd(x,N). • If not, don’t panic, quantum has your back -> go to step 2. • Step 2: Apply quantum order finding algorithm to x. • Check 𝑟 𝑖𝑠 𝑒𝑣𝑒𝑛 𝑎𝑛𝑑 𝑥 𝑟 2 𝑖𝑠 𝑛𝑜𝑛𝑡𝑟𝑖𝑣𝑖𝑎𝑙 𝑡𝑜 𝑃1. If so, compute gcd(xr/2-1 ,N), gcd(xr/2+1, N) , test if one of them is a non-trivial factor. Output it. • If not, 雖小。 But that’s fine-> run the algo again ! • Performance: O(log3 N) with O(1) success probability.
  • 79. Offline. • A quantum intuition. (Observed !) • Axiomize quantum physics. (Observed !) • Applications : Sth you might raise your eyebrows. (Observed !) • A quantum algorithm: Grover’s search. (Observed !) • A quantum algorithm: Shor’s factorizing algorithm. (Observed !)
  • 80. Recommended reference • Quantum computation bible -> Nielsen & Chuang, quantum computation and quantum information. • Linear algebraic reference -> The theory of quantum information, Waltrous. • Quantum tale -> Alice in quantumland.

Editor's Notes

  • #7: 觀測顏色
  • #8: 觀測長短
  • #9: 觀測長短
  • #10: 觀測長短
  • #11: 觀測長短
  • #12: 眉頭皺了一下蛋不要緊