# Are these notations for the CCNOT gate with different controls correct?

Following this answer by @DaftWullie, I give what I think of different cases of the CC-NOT gate:

1. $$I\otimes I\otimes I+ P_0\otimes P_0\otimes(U-I)$$ is the CC-NOT operator when the first two controls are $$0$$.

2. $$I\otimes I\otimes I+ P_0\otimes P_1\otimes(U-I)$$ is the CC-NOT operator when the first control is $$0$$ and second is $$1$$.

3. $$I\otimes I\otimes I+ P_1\otimes P_0\otimes(U-I)$$ is the CC-NOT operator when the first control is $$1$$ and second is $$0$$.
4. $$I\otimes I\otimes I+ P_1\otimes P_1\otimes(U-I)$$ is the CC-NOT operator when both controls are $$1$$.

What I understood from these cases is the following:

Consider the second case of $$I\otimes I\otimes I+ P_0\otimes P_1\otimes(U-I)$$. The first part of this operator does not check states of the first and second qubit i.e whether they are $$00,01,10,11$$ and operates the identity on the third qubit, which it did have to do when the states were $$00,10,11$$, but because of the Identity operated when the controls were $$01$$ is not what was intended so we add the extra part with projection operators $$P_0$$ and $$P_1$$ with the target qubit being acted by $$(U-I)$$ to negate the effect produced when we did not check the states and acted on the third qubit with the identity operator. I have similar arguments for the rest of the cases. Are they correct?

Here, $$U$$ is the unitary transform that I want to implement on the third register controlled by the first two, that is, the $$X$$ gate. $$P_0$$ and $$P_1$$ are the projection operators onto $$|0\rangle$$ and $$|1\rangle$$.

## 1 Answer

Yes.

Both $$I \otimes I \otimes I + P_0 \otimes P_1 \otimes (U-I)$$ etc and the various CC-NOT are linear so in order to check equality of the operators, you only need to check on a basis. That is what you have done with the computational basis.