I am reading through the Phase Kickback chapter of the IBM online textbook about quantum computation. It is stated that, when applying any controlled Z-rotation, the concept of test and control qubit is lost. To show this phenomenon, the effect of a Controlled-T gate (Z-rotation of $\pi/4$) on the state $|1+ \rangle$ is demonstrated mathematically. The formal control qubit would be $|+\rangle$ while the target qubit would be $|1\rangle$. As I show in the image, the "target" qubit stays unchanged, while the "control" qubit has got rotated (it has now a relative phase).

I then wanted to prove myself that the same result would be delivered when applying the Controlled-T gate on the state $|+1 \rangle$, which physically would mean to swap the two qubits with respect to the former situation. I would then expect the same result as above, but with the two qubits "flipped" on opposite sides of the tensor product. In this case, however, I get a different result (a global phase). I think that I cannot commutate the tensor product, because this would mean physically swapping the two qubits, right? Can somebody explain to me the conceptual mistake that I am doing?


  • 1
    $\begingroup$ In your penultimate line, why have you put $e^{i\pi/4}$ in the $|01\rangle$ term? $\endgroup$ – DaftWullie Sep 21 '20 at 14:59
  • 1
    $\begingroup$ Also - would you be able to transcribe your notes to mathjax? Lovely handwriting, we just tend to prefer LaTeX to images of math $\endgroup$ – C. Kang Sep 21 '20 at 15:11
  • $\begingroup$ @DaftWullie because I thought that, for the controlled-T operation, the only condition needed to be fulfilled is that the "control" qubit should be in the $|1\rangle$ state, but not necessary also for the "target" qubit. The answer of Davit shows it correctly. $\endgroup$ – gionti Sep 22 '20 at 10:41
  • $\begingroup$ Yes, exactly - if the control is in $|1\rangle$, apply the $T$ gate to the target. That's different from just applying a phase. $\endgroup$ – DaftWullie Sep 22 '20 at 11:17

When we apply a phase gate, a relative phase is added (this is the definition that I will use in this answer for the phase gate). In the Qiskit's textbook (and in the textbook by M. Nielsen and I. Chuang) $T$ is defined as a phase gate $P(\frac{\pi}{4})$:

$$ P |\psi \rangle = P (\alpha |0\rangle + \beta |1\rangle) = \alpha |0\rangle + e^{i\varphi}\beta |1\rangle \\ P(\varphi) = \begin{pmatrix} 1&0 \\ 0&e^{i \phi} \end{pmatrix} \qquad T = P(\frac{\pi}{4}) = \begin{pmatrix} 1&0 \\ 0&e^{i \frac{\pi}{4}} \end{pmatrix} $$

where $P$ is the phase gate, $\alpha$ and $\beta$ are some initial amplitudes, $\varphi$ is the phase defined by the $P$ gate. Note that only $|1\rangle$ in the superposition state has obtained the phase. The same works for the controlled phase gate: only $|11\rangle$ obtains a phase because the control qubit should be $|1\rangle$ and the target qubit also should be $|1\rangle$:

$$CP_{2 \rightarrow 1} |+1 \rangle = CP_{2 \rightarrow 1} \frac{1}{\sqrt{2}} (|01\rangle + |11\rangle) = \\ = \frac{1}{\sqrt{2}} (|01\rangle + e^{i \varphi}|11\rangle) = \frac{1}{\sqrt{2}} (|0\rangle + e^{i \varphi}|1\rangle) \otimes |1\rangle$$

where $CP$ is the controlled phase gate, $2 \rightarrow 1$ subscript denotes that the $CP$ gate is controlled by the second qubit. More general proof for $CP_{1 \rightarrow 2} = CP_{2 \rightarrow 1}$ can be derived by using matrix representation of the $CP$ gate. This proof is similar to the proof for $CZ_{1 \rightarrow 2} = CZ_{2 \rightarrow 1}$ that can be found in this answer.

$$CP_{1 \rightarrow 2} = |0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes P = \\ = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \\ 0&0&0&e^{i \varphi} \\ \end{pmatrix} = \\ =I \otimes |0\rangle \langle 0| + P \otimes |1\rangle \langle 1| = CP_{2 \rightarrow 1}$$

Side note about why the "symmetry" is not true for controlled $R_z$ gate in contrast to controlled $P$ gate:

If for the general case instead of $P(\varphi)$ we will use $R_z(\varphi)$ gate then we will have a different result:

$$CRZ_{1 \rightarrow 2} = |0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes R_z = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&e^{-i \frac{\varphi}{2}}&0 \\ 0&0&0&e^{i \frac{\varphi}{2}} \\ \end{pmatrix}\\ CRZ_{2 \rightarrow 1} = I \otimes |0\rangle \langle 0| + R_z \otimes |1\rangle \langle 1| = \begin{pmatrix} 1&0&0&0 \\ 0&e^{-i \frac{\varphi}{2}}&0&0 \\ 0&0&1&0 \\ 0&0&0&e^{i \frac{\varphi}{2}} \\ \end{pmatrix}$$

where $R_z(\varphi) = \begin{pmatrix} e^{-i \frac{\varphi}{2}}&0 \\ 0&e^{i \frac{\varphi}{2}} \end{pmatrix}$. So $CRZ_{1 \rightarrow 2} \ne CRZ_{2 \rightarrow 1}$. This answer also might be relevant where the difference between the controlled versions of $R_z$ and $U1 = P$ is discussed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.