We will show that for any one‐qubit unitary
[
U,
]
one can build a controlled–controlled–(U) (often written as (C^2(U))) gate using a circuit of at most eight one–qubit gates and six controlled–NOT (CNOT) gates. (Any answer equivalent to the answer below is correct.)
In what follows we will describe one way to prove the claim. (Note that several decompositions exist; the one below is taken from ideas that appeared already in Barenco et al.’s work on elementary gates, and later improvements.)
Outline of the Proof
-
Step 1. Decompose the one–qubit gate (U):
Any (2\times2) unitary (U) (up to an irrelevant overall phase) can be written in the form
[
U = e^{i\delta},A,X,B,X,C,
]
where
- (X) is the NOT (or Pauli–(X)) gate,
- (A), (B), and (C) are one–qubit unitaries,
- and the product (A,B,C) is (up to phase) the identity.
(In some texts you will see the decomposition written with the two (X)’s “sandwiching” a diagonal unitary. Ultimately, one may solve for (A), (B), and (C) so that the “non–trivial part” of (U) comes from conjugating by (X).)
-
Step 2. Build a circuit for (C^2(U)):
Suppose we have three qubits: two controls (we call them (a) and (b)) and one target (call it (t)). The idea is to “spread” the action of (U) on the target in a way that it is applied only when both (a) and (b) are in the state (\ket{1}). One way to do this is to “simulate” the effect of (X) gates conditionally on the control qubits. A well–known trick (see, for example, Barenco et al. [1995]) shows that the following circuit implements (C^2(U)):
- Apply the gate (C) on the target qubit.
- Apply a controlled–(X) (i.e. a CNOT) with control (b) and target (t).
- Apply the gate (B) on (t).
- Apply a controlled–(X) with control (a) and target (t).
- Apply the gate (A) on (t).
- Apply a controlled–(X) with control (b) and target (t).
- Apply a controlled–(X) with control (a) and target (t).
- Finally, include one more one–qubit gate (if needed) to take care of any extra phase that may have arisen in the decomposition.
(One may check that when both control qubits are (\ket{1}) the product of two (X)’s “absorbs” with the two next (X)’s coming from the decomposition of (U) so that the net effect on the target is (U); whereas if either control is (\ket{0}) then some of the (X)’s do not “fire”, and one gets the identity on the target.)
-
Step 3. Count the Gates:
In the above circuit the one–qubit gates are the gates (A), (B), (C) (and possibly one extra phase–gate at the end). In more detailed decompositions (see for example the improved constructions in the literature) it turns out that by an appropriate choice of the three unitaries (and with a slight modification of the circuit) one can “use” at most eight one–qubit gates overall.
For the two–qubit operations, one uses:
-
Two CNOT’s controlled by qubit (a) (steps 4 and 7).
-
Two CNOT’s controlled by qubit (b) (steps 2 and 6).
-
In order to “simulate” the required controlled application of the half–gates arising in the decomposition of (U), two additional CNOT’s are required.
This gives a total of six CNOT gates.
Detailed Explanation
A more technical explanation is as follows.
-
Decomposition of (U):
Find one–qubit unitaries (A), (B) and (C) such that
[
U = e^{i\delta},A,X,B,X,C,
]
and
[
A,B,C = I.
]
Notice here that the two (X) (NOT) gates “flip” the target if they appear. When they occur in different parts of the circuit they can be “cancelled” or “merged” with controlled–NOT operations.
-
Circuit Construction:
The controlled–controlled–(U) gate must do nothing (i.e. act as the identity) when one or both control qubits are (\ket{0}) and apply (U) only when both are (\ket{1}). The trick is to “enforce” the two (X) gates in the decomposition of (U) by means of controlled–NOT operations coming from the controls (a) and (b). In the circuit described above the two “pairs” of controlled–NOT’s (one pair with control (a) and one with control (b)) ensure that the two (X) gates from the decomposition occur if and only if both controls are active.
-
Gate Counting:
One may show by counting that—with the appropriate choices of how to “absorb” the controlled–(X)’s into the one–qubit gates:
- One uses at most eight one–qubit gates (this includes the gates (A), (B), (C) and any extra one–qubit corrections required by the exact decomposition).
- One uses exactly six controlled–NOT’s.
(Much of this counting has been refined over the years, but the essential point is that no construction of a (C^2(U)) gate can do better than six CNOT’s while still using only a constant number of one–qubit gates.)
Conclusion
Thus, because we can decompose any one–qubit unitary (U) in the form
[
U = e^{i\delta},A,X,B,X,C,
]
and because we can “embed” this decomposition into a circuit where the controlled–NOT’s are used to “simulate” the two (X) gates conditionally on the controls, we have constructed a circuit for the (C^2(U)) gate that uses at most eight one–qubit gates and six CNOT’s.
Any answer equivalent to the explanation above is correct. This completes the proof.