# Solving a circuit implementing a two-level unitary operation

The circuit below implements the following two-level unitary transformation:

$$\tilde{U}$$ is a unitary matrix: $$\tilde{U} = \left[\begin{matrix} a & c \\ b & d \end{matrix}\right]$$

where $$a, b, c, d$$ are any complex numbers.

As we can see, $$U$$ acts non-trivially only on the states $$\lvert 000 \rangle, \lvert 111 \rangle$$.

How would you solve the circuit for the input state $$\lvert 000 \rangle$$ or $$\lvert 111 \rangle$$? My problem is figuring out how to deal with the state $$\tilde{U}A$$ in last two CNOT gates.

EDIT: to clarify what I want:

• I start with $$\lvert \psi_{0} \rangle = \lvert 0, 0, 0 \rangle$$
• after the first CNOT I get $$\lvert \psi_{1} \rangle = \lvert 0, 0, 1 \rangle$$
• after the second CNOT I get $$\lvert \psi_{2} \rangle = \lvert 0, 1, 1 \rangle$$
• ...

How would you write $$\lvert \psi_{3} \rangle$$, $$\lvert \psi_{4} \rangle$$, $$\lvert \psi_{5} \rangle$$? For this specific circuit, is it even possible to write the full steps like that?

• what's the difference between white circle and black circle? – user1271772 Oct 19 '18 at 18:07
• The black circle represent a control which should be 1 to be applied. A white one would require a 0. – cnada Oct 19 '18 at 18:28
• You already said what U does through the full matrix/ circuit. Do you want to say what is after each gate individually? – AHusain Oct 19 '18 at 19:04
• @AHusain precisely, suppose you do not have the matrix representation, you only have the circuit, therefore you need to solve it. – Davide_sd Oct 19 '18 at 19:37
• So you have written down the matrices for each of the three types of gates in the circuit and are having trouble with the multiplication step $U=U_1 U_2 U_3 U_2 U_1$? You can use computer algebra to do that if you're having trouble doing a bunch of 8 by 8 matrix multiplications. – AHusain Oct 19 '18 at 19:56

$$| \psi_3 \rangle = a | 0 1 1 \rangle + b | 1 1 1 \rangle\\$$
$$| \psi_4 \rangle = a | 0 0 1 \rangle + b | 1 1 1 \rangle\\$$
$$| \psi_5 \rangle = a | 0 0 0 \rangle + b | 1 1 1 \rangle\\$$