# Do global phases matter when a gate is converted into a controlled gate?

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:

1. 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$$.
2. There is a rule stating that we should not take the global phase into account when converting a gate into a controlled gate.

• Global phase acts on the whole state. The phase acting on the controlled qubit only is not global. Apr 7, 2021 at 16:13

You are definitely right, for a controlled gate the global phase (of the gate) does matter. That makes your first possibility the valid one. A rule that we should not take it into account would make things very ambiguous.

There is, however, something extra you can say. Let's say we have your gate $$M$$, and a gate $$K = e^{i\phi}M$$, e.g. it acts the same up to a global phase. As you pointed out, we have for the controlled versions:

$$$$\begin{split} CM &= |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes M,\\ CK &= |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes K = |0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes e^{i\phi}M \not = CM,\\ \end{split}$$$$ so they are not the same, as there is an extra 'phase' part on only the 'controlled-part'.

However, the 'controlled part' is, of course, the part for which the control qubit is $$|1\rangle$$ - and we can effectively change this (relative!) phase by applying a single-qubit operation.

Thus, if we first apply $$CK$$ and afterwards apply the gate $$R_{z}(-\phi) = \begin{bmatrix}1 & 0 \\ 0 & e^{-i\phi}\end{bmatrix}^{1}$$ on the control qubit, we delete the relative phase. That is:

$$$$(R_{z}(-\phi) \otimes I) \bullet CK = (R_{z}(-\phi) \otimes I)\bullet (|0\rangle\langle 0| \otimes I + |1\rangle\langle 1| \otimes e^{i\phi}M) \hat{=} CM.$$$$ (here, $$\bullet$$ means a 'composition' of two maps/gates)

$$^{1}$$up to your definition, I actually may have omitted a global phase here - but this really is a global phase, so we can forget about it.

• How to generalize the $R_z$ fix to a scenario of multiple controls? Dec 13, 2023 at 6:15
• Then it's harder, as the phase is not just on the $|1\rangle$ state of a single (control) qubit, but rather on the $|1\dots 1\rangle$ state on all the control qubits. The gate that applies a phase on $|1\dots 1\rangle$ and nothing on all the other states is an entangling gate (e.g. for two control qubits this gate would be the CPHASE gate) so there are no methods to apply such a phase correction with local gates.
– JSdJ
Dec 17, 2023 at 9:14
• I think I found a solution which works for me, which is changing the global phase for the circuit being controlled itself: quantumcomputing.stackexchange.com/a/27066/6313 Dec 17, 2023 at 10:47