Simon Problem
Simon Problem
1 Introduction
In the last lecture we Talked about Bernstein Vazirani problem in which given an n qubit
input string, we need to find an unknown n qubit string such that the sum of the bitwise
product of these two strings modulo 2 is a given 1 qubit result. Simon problem is a
straightforward extension of Bernstein-Vazirani problem in which the input is an n qubit
string which has the property that there exists anunknown n qubit string such that the
bitwise XOR of this unknown string with a pair of input strings gives the same n qubit
output. The unknown string is unique and satisfies the above properties for distinct pairs
of inputs.
2 Simon Problem
Simon’s problem is a generalization of Bernstein Vazirani problem to the case where the
oracle can evaluate a function
i.e., both the input and the output are n bit strings, whereas in Bernstein Vazirani prob-
lem, the output is a single bit. The function f has the property that for all inputs x and
y,
f (x) = f (y)
if, and only if, x = y ⊕ ξ where ⊕ denotes addition modulo 2 and ξ is a non-zero string
which is to be determined.
c D. K. Ghosh, IIT Bombay 2
Example 1:
Consider n = 3. Let f (x) be a function given by the following table:
x f (x)
000 011
001 010
010 010
011 011
100 111
101 110
110 110
111 111
Note that the pairs of strings which satisfy f (x) = f (y) are delated by x = y ⊕ ξ where
ξ = 011. (e.g. the strings 100 and 111 both evaluate to the same value of f (x) = 111 and
it is seen that 100 ⊕ 011 = 111, likewise for the other three pairs.)
matches with any of the previous k strings. The probability that we will find a match is
k 2k
Pk = ≤ n+1
k(k − 1) 2 − k2
2n − 1 −
2
where the last inequality is obtained by reducing the denominator of the previous expres-
sion. This expression holds for every attempt. Hence the probability that there will be a
match in the first m attempts is given by adding the probability of success for k = 2 to
k = m,
m m
X 2k X 2m 2m2
P (success in m attempts) = ≤ ≤
k=1
2n+1 − k 2 k=2
2n+1 − m2 2n+1 − m2
Suppose we decide that the classical algorithm is good if the above probability is at least
3/4, then we must have
2m2 3
n+1 2
≥
2 −m 4
which gives r
6 n
m≥ 2
11
which shows that classical algorithm requires exponential number of queries. A quantum
computer, on the other hand, can speed up the process dramatically.
At this point, if we query the second register, we would measure a value of f (x). If the
function is one-one, i.e. if the string ξ = {0⊗n }, each value of f (x) will be measured
with a probability of 1/2n . If, on the other hand, the function is 2-1, i.e. if ξ 6= {0⊗n },
1
the probability of measuring a particular value of f (x) is n−1 . There are two values of
2
x0 , viz., x and x0 + ⊕ξ which correspond to the measured value f0 in the second regis-
1
ter. The state in the first register is then a linear combination √ [| x0 i+ | x0 + ξi], so
2
c D. K. Ghosh, IIT Bombay 4
that on measuring the first register, | x0 i and | x0 + ξi are obtained with equal proba-
bility. A measurement of the first register, therefore, does not give us information about ξ.
Instead of measuring the first register, we pass the n qubits of the register through
Hadamard gates and then measure the first register in a computational basis, as shown in
the figure. Recall that the second register was measured first (M1 ) as a result of which the
two registers have become entangled before being passed through the Hadamard gates.
: n :
n : n : : H : M2
0 : H : : :
: :
Uf
: :
n : M1
0 :
: :
1 P x·y
Recalling that the Hadamard transform of | xi gives √ y∈0,1 (−1) | yi, we get, in
2
the case where x =| 0⊗n i, the Hadamard transform of the first register to give
1 X X
(−1)x·y | yi | f (x)i
2n n n
x∈{0,1} y∈{0,1}
When we measure the second register (M1 ), we measure a random string with equal
probability. Suppose we measure a string a particular string | zi. Since the function is 2
to 1, | zi = f (| x0 i) or f (| x0 + ξi). The state in the first register has thus collapsed to
a superposition of these two states. Instead of measuring the first register (which would
have given us with equal probability, one of these two states), we have passed the collapsed
state through Hadamard gates, which gives us for the first register,
1 X
x0 ·y 1 X
[(−1) + (−1) (x0 +ξ)·y
] | yi = (−1)x0 ·y [1 + (−1)ξ·y ] | yi
2(n+1)/2 n
2(n+1)/2
n
y∈{0,1} y∈{0,1}
x f (x)
000 011
001 010
010 010
011 011
100 111
101 110
110 110
111 111
Starting with | 000i in both the input and the ancilla registers, the Hadamard trans-
form on the input register gives a uniform linear combination of 8 basis states, i.e. the
input to the oracle is
1 X
√ | xi | 000i
8 x∈{0,1}3
Since the second register is | 000i, on application of the oracle, the second register will
contain f (x) corresponding to each x. The content of the two registers is given by
1
√ [| 000i | 011i+ | 001i | 010i+ | 010i | 010i+ | 011i | 011i
8 (3)
+ | 100i | 111i+ | 101i | 110i+ | 110i | 110i+ | 111i | 111i]
Suppose now, the measurement of the second register gives | 111i. The state of the
1
register is then √ [| 100i+ | 111i]. When the three bits of the first register is passed
2
through Hadamard gates, we get
1 1 X 1 X
√ √ (−1)100.y | yi + √ (−1)111.y | yi
2 8 y∈{0,1}3 8 y∈{0,1}3
c D. K. Ghosh, IIT Bombay 6
We are given that there exists a string ξ such that 100 ⊕ ξ = 111. Thus we may write
the above expression as
1 X
(−1)100.y 1 + (−1)ξ·y | yi
4 3
y∈{0,1}
The non-zero coefficients of | yi in the above equation are those for which (−1)ξ·y = 1.
For the values of ξ applicable in this case, the content of the first register will be
1
[| 000i+ | 011i− | 100i− | 111i]
2
the signs in the above expression are determined by the pre-factor (−1)100·y . If a mea-
surement of the first register is made, the four states in the above expression occur with
equall probability. Suppose the measurement yields | 100i. Since ξ is orthogonall to this,
we conclude that the left most bit of ξ is 0. If a second measurement gives | 111i, we
can conclude that the last two bits are equal. Since the left most bit is a zero and the
function being 2 to 1, the string is not 000, the only alternative for the other two bits is
to be 11. Thus ξ = 011.
Probability of Success
The probability of success of the algorithm depends on our ability to ensure that the
measurement of the first register will generate n independent states. Since each run of
the algorithm is independent, the problem is similar to calculation of probability with
replacement. Note that the null state being orthogonal to all others, does not yield a
two to one function. When we measure the first register, the probability that we do not
2n − 1
choose the null state is , as only one of the 2n states is the null state. Let the first
2n
state picked by y1 . We now run the algorithm once more and draw a second vector y2 .
The probability that we do not draw either a null state or the state y1 is
2n − 1 2n − 2
P (y1 , y2 ) =
2n 2n
Thus the probability of choosing n independent vectors is
2n − 1 2n − 2 2n − 2n−1
Pn = . . .
2n 2n 2n
which can be written as
n Y∞
Y 1 1
Pn = 1− k ≥ 1− k
k=1
2 k=1
2
The product above has an approximate value 0.288788 which is greater than 1/4. Thus
if we repeat the algorithm 4m times the probability of failure is
4m
1
Pf ailure < 1 − < e−m
4
, which is very small even for 4m = 10.