The question is similar to this one. As suggested in the answer, I can easily do this with just one qubit: I repeatedly Hadamard it and measure in order to have a fair coin flip at every point. The problem with it is that, because of the measurements, the computation is not reversible.

So, again, suppose that in my circuit I have to generate multiple, say n, random coin flips. For example, this coin flips could be used to activate n CNOTs half of the time.

The trivial solution could be to use n different qubits and Hadamard them. However, this gets really huge when n is large.

Is there any better way? By better I mean using a smaller number of qubits and only a few simple quantum gates.

  • 1
    $\begingroup$ It seems as if you ask the same question again, as you already asked. $\endgroup$ – nippon Dec 17 '18 at 13:47
  • $\begingroup$ @nippon yes, but I thought that the previous question could remain for the general case, while in this case I want a reversible circuit. $\endgroup$ – tigerjack89 Dec 18 '18 at 15:31

You say it's a problem that when using measurements your circuit is not reversible, but generating a truly random number is an inherently non-reversible operation. Consider that for an operation to be reversible, you must be able to uniquely determine the input given the output. If the output of your operation is truly random, then it is by necessity unrelated to the input and thus not reversible.

You could possibly implement a classical deterministic pseudo-random number generator in a reversible way on a quantum computer and use that instead, but that sounds like a tremendous inconvenience unless you have a very good reason for requiring reversibility. At that point why not just generate the random numbers classically and give them as input to the quantum circuit?

  • $\begingroup$ I haven't said that I want to generate a truly random number; I want to just toss n coins. For example, suppose I want to apply a CNOT 50% of the time: I can Hadamard one qubit and then use it to control the CNOT. This computation is obviously reversible: I can CNOT and Hadamard again to return to the original state. Take a look at this for example goo.gl/htrJWL $\endgroup$ – tigerjack89 Dec 18 '18 at 15:24
  • $\begingroup$ Using a qbit in superposition as the control bit of a CNOT does not apply the CNOT 50% of the time, unless you're speaking in some abstract analogous sense. $\endgroup$ – ahelwer Dec 18 '18 at 22:57
  • $\begingroup$ Yeah, I was speaking in general, but I don't get your point. I mean, surely it's more difficult than a 50% chance, in reality we are talking about superposition and stuff. Is this what you mean? $\endgroup$ – tigerjack89 Dec 20 '18 at 7:15
  • $\begingroup$ No, I mean having a qbit in the $|+\rangle$ state (which you get to by putting $|0\rangle$ through Hadamard gate) as the control bit of a CNOT gate just entangles the control bit with the target bit. It doesn't activate the CNOT half the time or something like that. $\endgroup$ – ahelwer Dec 20 '18 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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