2
$\begingroup$

Does there exist an oracle that inputs a quantum state, say for example

$$ \frac{1}{2^N} \sum_{n=0}^{2^N - 1} \left | n \right > \left | f(n) \right > $$

and allows us to find $n$ such that $f(n) = A$ for some given $A$? Or easier, $f(n) = 0^{\otimes N}$.

This state can be represented, in vector form, like this

$$ \begin{pmatrix} \left | f(000) \right > \\ \left | f(001) \right > \\ \left | f(010) \right > \\ \left | f(011) \right > \\ \vdots \end{pmatrix} $$

This question is very similar to Grover's algorithm, which instead asks:

find x such that $f(x) = 1$

$$ \frac{1}{\sqrt{2^N}} \sum_{n=0}^{2^N -1} (-1)^{f(n)} \left | n \right > $$

Of course Grover's algorithm has a solution that runs in $O(\sqrt{2^N})$ time. Does the problem I pose have a solution, and is it efficient?

$\endgroup$

2 Answers 2

2
$\begingroup$

As stated by rhundt, using Grover's algorithm would work here. Actually, we can do even better and show that these two problems are equivalent. Since Grover's algorithm is optimal for this problem, it shows that we cannot solve this problem faster than $O\left(\sqrt{2^n}\right)$.

Let us denote $U_f$ the unitary that acts as the following on the basis states: $$U_f|x, y\rangle=|x,y\oplus f(x)\rangle$$ Now, suppose we initialize our state in the uniform superposition on the first register, and in the $|0\rangle$ state for the second register and another register: $$\sum_{n=0}^{2^n-1}|n\rangle|0\rangle|0\rangle$$ We can apply $U_f$ to the first and second register: $$\sum_{n=0}^{2^n-1}|n\rangle|f(n)\rangle|0\rangle$$ Now, we apply an $X$ gate on the third register controlled on the second one being in state $A$: $$\sum_{n=0}^{2^n-1}|n\rangle|f(n)\rangle|f(n)=A\rangle$$ Finally, we apply $U_f$ once again to uncompute the second register: $$\sum_{n=0}^{2^n-1}|n\rangle|f(n)=A\rangle$$ By doing so, we've successfully created an oracle that returns $1$ on $n$ if $f(n)$ is equal to $1$, which is exactly Grover's problem. This proves that Grover's algorithm can be used to solve your problem.

On the other hand, we easily see that Grover's problem is a special case of your problem: simply replace $A$ by $1$ and you're left with Grover's problem. Thus, these two problems are equivalent, and as such Grover's algorithm is the optimal method to solve it.

$\endgroup$
2
$\begingroup$

I think that if you encode the state just as you indicated - the left part is the binary encoding of $n$ and the right part is the binary encoding of $f(n)$ - using Grover and just marking the element $A$ will let you find the state that has $A$ on its right side and hence the index on the left side.

I would have to try this out but intuitively I don't see why this wouldn't work. Of course, the number of qubit increases by 2x, as you have to encode $n$ and $f(n)$.

$\endgroup$
2
  • $\begingroup$ Thank you for the answer. Grover's algorithm would take something like $\sqrt{2^{2N}} = 2^N$ steps to complete this problem (applications of the Grover operator. Is it possible, for this specific problem, to have a polynomial time algorithm? Where $N$ is the number of qubits, not the number of states. $\endgroup$
    – wavosa
    Commented Feb 22, 2023 at 22:33
  • $\begingroup$ Grover's algorithm was proven optimal in the original case (with $f(x) = 1$ for the marked element, and $0$ else). But does that carry through here, is the gist of what I'm asking. $\endgroup$
    – wavosa
    Commented Feb 22, 2023 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.