We know that it is possible to factor large numbers on a quantum computer using Shor's algorithm.

But how about simply using a multiplication circuit in reverse?

The idea is to build a multiplication circuit using Toffoli gates (equivalent to a binary circuit), set the outputs to the number we want to factor and then measure the inputs to get one possible solution.

Would that work? If yes, then why not use it instead of Shor's algorithm?


1 Answer 1


Remember that the unitary portion of any quantum algorithm is necessarily reversible. On the other hand, the map $f(x,y)\mapsto x\cdot y$ which sends two integers to their product is not. This is typically worked around by having the reversible implementation "remember" one or both of the inputs. For example, we could use Toffoli gates to implement a unitary such that $$ U|x\rangle|y\rangle = |x\rangle|x\cdot y\rangle\tag1 $$ where $x,y\in\{0,\dots,2^n-1\}$ and the registers have $n$ and $2n$ qubits, respectively. But now we run into the problem of having to know one of the factors ahead of time. In other words, by executing the inverse $U^\dagger$ of $U$ we accomplish division, not factoring.


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.