A quantum combination lock
To learn how quantum algorithms differ from classical ones, we need a problem that allows us to compare a quantum algorithm to its classical counterpart. The problem, we want to look at, is the problem of finding out the secret code that is behind a quantum "combination lock".
Imagine, we have a couple of CNOT gates hidden in a black box. This box is prepared so, that we are not able to see which gates are inside. But we know that they follow some pattern. This pattern is given by a secret code, e.g. 110. For each and every 1 in the secret bit string there is a CNOT gate connecting the qubit at the corresponding position with an answer qubit.
So in the case of the secret code 110, we would have the following two-qubit gates between guess and answer qubits:
-
A
\(\ket{0}\)
-
B
\(\ket{1}\)
Exactly! The first CNOT gate is applied as the first digit is guessed correctly. The second CNOT gate is not applied.
Not quite! The first CNOT gate is applied as the first digit is guessed correctly. The second CNOT gate is not applied.
Cracking the black box open
Normally, we are not provided with the circuit itself and we are tasked to find out what the secret code is by guessing and looking at the answer.
Let's go for a classical solution first. Without further ado, can you figure out the secret code without opening the blackbox?
Measurement
-
A
1001
-
B
0101
-
C
1100
-
D
1101
That's right! The secret code is 1101.
You can now also open the black box to take a look inside.
Not quite! The secret code is actually 1101.
You can now also open the black box to take a look
inside.
-
A
1
-
B
2
-
C
3
-
D
4
Exactly! In general, it takes at least 4 tries to figure out the secret code. You will find out how on the next page.
Close, but not quite! In general, it takes at least 4 tries to figure out the secret code. You will find out how on the next page.