# FANOUT with Toffoli Gate

Figure 1.16: FANOUT with the Toffoli gate, with the second bit being the input to the FANOUT (and the other two bits standard ancilla states), and the output from the FANOUT appearing on the second and third bits.

Source: Quantum Computation and Quantum Information: 10th Anniversary Edition (Fig 1.16, p.30)
by Michael A. Nielsen & Isaac L. Chuang

How can we say that the third qubit is in the state $$a$$?

Let's assume $$a = x|0\rangle + y|1\rangle$$. We know that the output of the bottom two qubits is $$x|00\rangle+y|11\rangle$$ (entangled qubits) and the output of the second qubit must be $$x|0\rangle+y|1\rangle$$. Which says that they both have to be in the state $$|0\rangle$$ and $$|1\rangle$$ at the same time, and so the third qubit should have the same probabilities as like of the second qubit. But it can be $$-x|0\rangle + y|1\rangle$$ and many more possibilities as $$x$$ and $$y$$ are complex (as probabilities are square of modulo of coefficients).

Please correct me if my interpretation and understanding is wrong.

• Hi, Prasanth. Welcome to Quantum Computing SE! Please review How to write a good question?. I've edited your question this time, but it would be quite annoying for us to do it on your behalf every time. – Sanchayan Dutta Jan 2 '19 at 9:17
• Also, already has an answer here: Toffoli gate as FANOUT. – nippon Jan 2 '19 at 12:58
• Possible duplicate of Toffoli gate as FANOUT – AHusain Jan 2 '19 at 23:50
• But the question over there was about the cloning. There I understood that the output is an entangled pair. My question here is why can't the second qubit be equal to $-x|0\rangle+y|1\rangle$ as it has the same probabilities as like of the third qubit. How are we able to say that the second qubit will be in the state $a$? – Prasanth Kumar Vemula Jan 3 '19 at 7:39

1) the state $$a$$ will not be in superposition, since you're simulating a classical circuit and you can't have superposition in a classical circuit; $$a$$ will always be $$|0\rangle$$ or $$|1\rangle$$.
2) you know the state of the third qubit is $$a$$ because the circuit is defined to used Toffoli gate, and this is the definition of how Toffoli gate acts when input qubits are $$|1\rangle$$ and $$a$$. If a different gate was used the third qubit could be in a different state, but with this gate it will be in this state.