# Decomposition of any 2-level matrix into single qubit and CNOT gates

I saw an example which takes a 2 level matrix. Which is a $$8\times8$$ matrix that acts non trivially only on 2 levels of only states $$|000\rangle$$ and $$|111\rangle$$. The way they do it is by using a gray code from $$|000\rangle$$ to $$|111\rangle$$ and then shifting $$|000\rangle$$ to $$|011\rangle$$ and performing the $$U$$ operation only on the most left qubit conditional on the two $$|11\rangle$$ qubits to the right.

The thing I am trying to do, is to show that in the end this is equivalent to the original $$U$$ operation of $$8\times 8$$ matrix. How can I show their equivalency?

What I was trying to do is, to take the $$U$$ acting on the left hand side qubit and tensor product it with two identity matrices acting on the two other qubits. But this doesn't yeild the original $$U$$ ($$8\times 8$$ matrix). What did I get wrong here?

And how do you actually prove that the original $$8\times 8$$ matrix operation $$U$$ acting only on states $$|000\rangle$$ and $$|011\rangle$$ can be translated by a small $$U$$ matrix acting only on the most left qubit plus CNOT gates. How can I show it? It would be even preferred to show it by using matrix manipulation of sorts to get the original $$8\times 8$$ matrix. Or even some intuition would be good as well. Thanks!