# 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? 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.

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$$
• 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$? Dec 18 '19 at 19:01
• 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$ Dec 18 '19 at 19:05
• 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? Dec 18 '19 at 19:24