Let's say that we have a unitary matrix M such that: $$ M = e^{i\pi/8}\begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/12} \\ \end{pmatrix} $$ If we were to apply this unitary matrix to the state $|1\rangle$, we would get: $$ M|1\rangle\ =\ e^{i\pi/8+i\pi/12}\begin{pmatrix} 0\\ 1 \end{pmatrix} $$
Where the global phase is $ e^{i\pi/8+i\pi/12}$.
However, when we want to convert this global phase into a controlled gate, we would use the following implementation: $$ CM = |0\rangle\langle0| \otimes I + |1\rangle\langle1| \otimes M $$ But would this mean that the global phase does matter in such cases?
The way I see it, there are two possibilities:
- We do take the global phase into account in the resulting unitary matrix, as such: $$ CM = \begin{pmatrix}1 & 0 & 0 & 0 \\0 & 1 & 0 & 0 \\0 & 0 & e^{i\pi/8} & 0 \\0 & 0 & 0 & e^{i\pi/8+i\pi/12} \\\end{pmatrix} $$ This option would mean that multiplying with the state $|{+}{+}\rangle$, gives us the state: $$ \frac{|00\rangle + |01\rangle+e^{i\pi/8}|10\rangle+e^{i\pi/8+i\pi/12}|11\rangle}{2} $$ In this case, M's global phase has changed into a relative phase when applied as a control on the state $|{+}{+}\rangle$.
- There is a rule stating that we should not take the global phase into account when converting a gate into a controlled gate.
Could somebody please help me with getting this clear?