Grover Agorlithm LEZ2
Grover Agorlithm LEZ2
Search Algorithm
Speedup?
Classical search: ! " steps
Grover’s Algorithm search: ! " steps
)
A remind: x ∈ 0,1 ⟷ x = 0, 1, 2, … 7 − 1 in binary with 7 = 2) (i.e. 9 = log = 7)
Step 1)
equal 1
amplitudes A black box operator, the
Oracle 1 marks |- ∗ ⟩ with a
-∗ minus sign
average of all
Step 2)
amplitudes Inversion about the mean
Repeat step 1) and 2) M times M. Grossi - IBM Italy -DO NOT DISTRIBUTE 4
Schematic Circuit
Hadamard
Transform
Step 0)
Grover
Operator G
" Step 2)
Inversion about the
Step 1) mean or Grover
Diffusion Operator
M. Grossi - IBM Italy -DO NOT DISTRIBUTE 5
Hadamard Transform
Step 0) Prepare all the basis states with equal amplitude, by applying the
⨂'
Hadamard transform to the initial state |0⟩= |000 … 0⟩ = |0⟩
1 /01
⨂'
( |0⟩ = + |2⟩ ≡ |7. ⟩
2 ' ,-.
( ⨂' 1
⨂'
1 /01
(⨂' |0⟩ = (|0⟩ ⨂' = |0⟩ + |1⟩ = + |2 ⟩
2 2' ,-.
! |$ ∗ ⟩ = − |$ ∗ ⟩
and leaves the other states unchanged |$ ⟩
! |$ ⟩ = |$ ⟩ if $ ≠ $ ∗
or more compactly
|# ⟩ =
%
∑ |/ ⟩ |2.⟩
&'( *,, * -.
sum of states that aren’t solution
:/2
|# ⟩
%
|0 ⟩ = ∑ |/ ⟩ sum of states that are solution
( *,, * -%
3−5 5
|2.⟩ = |# ⟩ + |0 ⟩
3 3 |0 ⟩
: :
|2.⟩ = cos |#⟩ + sin |0⟩
2 2
If apply > to a state of 1: |2.⟩
:/2
> ? |# ⟩ + @ |0 ⟩ = ? |# ⟩ − @ |0 ⟩ |# ⟩
the sign of the |0⟩ component changes >|2.⟩
M. Grossi - IBM Italy -DO NOT DISTRIBUTE 9
Geometric representation 2
&
By applying G ! |$%⟩ goes to an angle '
+ ) respect to |*⟩
|2 ⟩
at each iteration ! add an angle ) : ! |$%⟩
) )
! |$%⟩ = cos + ) |*⟩ + sin + ) |2⟩
2 2 ) |$%⟩
5 )/2
! 3 |$%⟩ = cos )3 |*⟩ + sin )3 |2⟩, )3 = 4 + ) |* ⟩
'
=|$%⟩
When stop the iterations?
7 5 7 |2 ⟩
Nearer possible to |2⟩ )3 ≃ 4≃ − 1
' ' &
! 3 |$%⟩
1 π
4 = CI −1 == >/@ )3
2 ) |$%⟩
)5
For calculation details see, for example, |* ⟩
Nielsen, Chuang – Quantum Computation and Quantum Information
M. Grossi - IBM Italy -DO NOT DISTRIBUTE 10
Now let’s apply the algorithm…
% |0⟩ , if ' # = 1 (# = # ∗ )
|# ⟩|1⟩ |# ⟩|1 ⊕ '(#)⟩ = |# ⟩ ,
|1⟩ , if ' # = 0 (# ≠ # ∗ )
3
If |$⟩ = |0⟩ − |1⟩
4
1
−|0⟩ + |1⟩ , if ' # = 1 (# = # ∗ )
1 % 2 1
|# ⟩ |0⟩ − |1⟩ |# ⟩ = (−1)8(9) |# ⟩ |0⟩ − |1⟩
2 1 2
|0⟩ − |1⟩ , if ' # = 0 (# ≠ # ∗ )
2