Why is the action of controlled-Z unaltered by exchanging target control qubits?

In the book "Quantum Computer Science", when explaining the error correction code, it uses this picture and says "the action of controlled-z is unaltered by exchanging the target and control qubits".

Does this mean that the act of cZ(control ancilla qubit and target codeword qubit) is equal to cz(control codeword qubit and target ancilla qubit)? If this is the case, why is that?

In my understanding, |1>Z|0>(first qubit is control qubit) is not equal to Z|0>|1>(second qubit is control qubit).

If we have an arbitrary two qubit state:

$$|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$$

then after applying $$CZ_{1 \rightarrow 2}$$ controlled from the first qubit we will obtain:

$$CZ_{1 \rightarrow 2}|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle - d|11\rangle$$

because control operation works when the control qubit is $$|1\rangle$$ and $$Z$$ gate changes the sign of the amplitude of the $$|1\rangle$$ state, hence $$CZ_{1 \rightarrow 2}$$ action is changing the sign of the $$|11\rangle$$.

Now the action of $$CZ_{2 \rightarrow 1}$$:

$$CZ_{2 \rightarrow 1}|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle - d|11\rangle$$

The same is true here only the sign of the $$|11\rangle$$ should be changed because of similar reasons. This can be seen also by using matrices:

$$CZ_{1 \rightarrow 2} = |0\rangle \langle 0| I + |1 \rangle \langle 1| Z = \\ = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \\ 0&0&0&-1 \\ \end{pmatrix}=\\ =I |0\rangle \langle 0| + Z |1 \rangle \langle 1| = CZ_{2 \rightarrow 1}$$

• I see! Thanks!! Aug 15 '20 at 15:53