# Error in showing $\operatorname{CPHASE}_{12}=\operatorname{CPHASE}_{21}$ in the matrix representation

I read that the relation $$\operatorname{CPHASE}_{12}=\operatorname{CPHASE}_{21}$$ in the matrix representation but when I tried to work it out I don't see how.

$$\operatorname{CPHASE}_{12}$$ acts in the following way:

$$\operatorname{CPHASE}_{12}|00\rangle=\operatorname{CPHASE}_{12}|0\rangle|0\rangle=|0\rangle|0\rangle=|00\rangle$$

$$\operatorname{CPHASE}_{12}|01\rangle=\operatorname{CPHASE}_{12}|0\rangle|1\rangle=|0\rangle|1\rangle=|01\rangle$$

$$\operatorname{CPHASE}_{12}|10\rangle=\operatorname{CPHASE}_{12}|1\rangle|0\rangle=|1\rangle(-|0\rangle)=-|10\rangle$$

$$\operatorname{CPHASE}_{12}|11\rangle=\operatorname{CPHASE}_{12}|1\rangle|1\rangle=|1\rangle(-|1\rangle)=-|11\rangle$$

Which means its matrix representation is:

$$\operatorname{CPHASE}_{12}= \begin{pmatrix} 1 &0&0&0\\0&1&0&0\\0&0&-1&0\\0&0&0&-1 \end{pmatrix}$$

$$\operatorname{CPHASE}_{21}$$ though acts as follows:

$$\operatorname{CPHASE}_{21}|00\rangle=\operatorname{CPHASE}_{12}|0\rangle|0\rangle=|0\rangle|0\rangle=|00\rangle$$

$$\operatorname{CPHASE}_{21}|01\rangle=\operatorname{CPHASE}_{12}|0\rangle|1\rangle=(-|0\rangle)|1\rangle=-|01\rangle$$

$$\operatorname{CPHASE}_{21}|10\rangle=\operatorname{CPHASE}_{12}|1\rangle|0\rangle=|1\rangle|0\rangle=|10\rangle$$

$$\operatorname{CPHASE}_{21}|11\rangle=\operatorname{CPHASE}_{12}|1\rangle|1\rangle=(-|1\rangle)|1\rangle=-|11\rangle$$

Which will give matrix representation:

$$\operatorname{CPHASE}_{21}=\begin{pmatrix} 1 &0&0&0\\0&-1&0&0\\0&0&1&0\\0&0&0&-1 \end{pmatrix}$$

Obviously, the way I have done it has not produced the aforementioned identity, so where am I going wrong?

The gates you calculated are not controlled gates.

The $$\operatorname{CPHASE}_{12}$$ and $$\operatorname{CPHASE}_{21}$$ you calculated are just $$\sigma_z \otimes \mathbb{I}$$ and $$\mathbb{I} \otimes \sigma_z$$ respectively. These are not controlled gates. A general controlled phase gates controlled on 1 is

$$$$\operatorname{CPHASE}_{12} = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes R_{\phi},$$$$

where, $$$$R_{\phi} = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\phi} \end{bmatrix}$$$$

Which means $$\operatorname{CPHASE}_{12}$$ is $$\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{i\phi} \end{bmatrix}$$ You can similarly calculate the other one, Now, even these gates are not equivalent, maybe you read that their action on some states are equivalent. Please provide the reference of your claim about the equivalency of the two gates.

How to relate to $$\operatorname{CNOT}_{12}$$

For $$\phi = \pi$$ $$$$\operatorname{CPHASE}_{12} = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes R_{\pi} = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix},$$$$ A $$\operatorname{CNOT}_{12}$$ gate is $$$$\operatorname{CNOT}_{12} = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes \sigma_x = \vert 0 \rangle \langle 0 \vert \otimes \mathbb{I} + \vert 1 \rangle \langle 1 \vert \otimes \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix},$$$$

Which means, $$$$\operatorname{CNOT}_{12} = (\mathbb{I} \otimes R^{\pi/2}_y) \cdot \operatorname{CPHASE}_{12} \cdot (\mathbb{I} \otimes R^{-\pi/2}_y)$$$$

• I don't understand how this matrix can be the $CNOT_{12}$ gate ( I'm not saying you're wrong but I don't understand) . We want the phase to be flipped if the first qubit is 1, so I would have thought the transformation would be $|\psi \rangle = c_{00}|00>+c_{01}|01>+c_{10}|10 \rangle +c_{11}|11\rangle \rightarrow c_{00}|00>+c_{01}|01>-c_{10}|10 \rangle -c_{11}|11\rangle$, but it looks to me as though the gate you provided will give $|\psi \rangle = c_{00}|00>+c_{01}|01>+c_{10}|10 \rangle +c_{11}|11\rangle \rightarrow c_{00}|00>+c_{01}|01>+c_{10}|10 \rangle -c_{11}|11\rangle$, – bhapi Apr 27 at 19:55
• And the identity was from an assignment paper I only have a paper copy of. Note though that it was the second assignment we're on assignment 8 now, dealing with open quantum systems, so this isn't a homework question I'm just going back over everything for exams – bhapi Apr 27 at 19:57
• 1) For $\phi = \pi$ the above gate is controlled-z gate, you can shift the basis of second system to make the gate equivalent to $CNOT_{12}$. I can edit my answer to show this explicitly if this doesn't make sense! – Hemant Apr 27 at 20:14
• That would be so helpful thank you so much :) I'm just a little lost about this one XD – bhapi Apr 27 at 20:17
• 2) I think you are confused what controlled phase gate does. A CNOT gate applies a NOT gate depending on the control, similarly a CPHASE gate applies a phase gate depending on the control. what you are doing (by changing phases) is just a rotation operation its not controlled. – Hemant Apr 27 at 20:19