Can Toffoli operate on a qubit in superposition?


I understand that CNOT and Toffoli (CCNOT) gates are not universal for quantum computation since they (alone) cannot create superposition. Moreover, it is totally possible to perform a CNOT operation where the control qubit is in superposition, $\alpha\vert 0 \rangle + \beta\vert 1 \rangle$, and target qubit to be $\vert 0 \rangle$.

My question is can we have a control qubit to be in superposition while using CCNOT, something like the following?

Toffoli Gate containing superposition

If yes, what will be the values for $p, q, $ and $r$? If not, why not?

The related material I found are universality of the toffoli gate and CNOT in superposition.

Thank you in advance!

M. Al Jumaily

Posted 2019-12-18T17:48:50.210

Reputation: 628



Control qubit can be in superposition, why not? This is how entangled qubits are created. But the circuit you have drawn does not entangle qubits, it actually does not change qubit states at all, and $|p\rangle = \alpha| 0 \rangle + \beta| 1 \rangle$, $|q\rangle=|0\rangle$, $|r\rangle=|0\rangle$.

It would be more interesting if the input value of the 2nd qubit was $|1\rangle$; then the 2nd output value $|q\rangle=|1\rangle$, but there is no separated $|p\rangle$ and $|r\rangle$ output values, instead you have 2-qubit entangled state

$$|pr\rangle=\alpha|00\rangle + \beta|1 1 \rangle$$


Posted 2019-12-18T17:48:50.210

Reputation: 2 447

So if the 2nd qubit is $\vert 1 \rangle$, then $\vert q \rangle = \vert 1 \rangle$, $ \vert p \rangle = \alpha\vert 0 \rangle + \beta\vert 1 \rangle$ and $ \vert r \rangle= \vert pr \rangle = \alpha \vert 00 \rangle + \beta \vert 11 \rangle$? – M. Al Jumaily – 2019-12-18T19:01:32.103

No. $\vert pr \rangle$ is entangled 2-qubit state which cannot be factored into separate $\vert p \rangle$ and $\vert r \rangle$ states. In other words, there is $\vert pr \rangle$ but no $\vert p \rangle$ and $\vert r \rangle$ – kludg – 2019-12-18T19:05:55.303

So I can say that the input is three separate qubits and the output is a one separate qubit and one entangled 2-qubit state? – M. Al Jumaily – 2019-12-18T19:13:33.340

Yes, this is OK; or simply "one separate qubit and two entangled qubits". – kludg – 2019-12-18T19:18:38.437

One last thing, I had $\vert q \rangle = \vert 0 \rangle$ and you said it would be more interesting if $\vert q \rangle = \vert 1 \rangle$. Can $\vert q \rangle = \alpha_2 \vert 0 \rangle + \beta_2 \vert 1 \rangle$? How about all three qubits to be in superposition? is that allowed? – M. Al Jumaily – 2019-12-18T19:24:22.333

I guess you mean 2nd input; yes, if both control qubits are in superposition then all 3 qubits should be entangled; target qubit can be in superposition too; superposition is always allowed. – kludg – 2019-12-18T19:32:07.480