9

IBM Quantum Experience and other Algorithm Creators generally draw the CZ gates like this:

enter image description here

Does it not matter which qubit is the control and which is the target? If so why?

Jadon Erwin
  • 201
  • 2
  • 7

1 Answers1

14

First, note that the Controlled-X gate can be written as:

$$ CX = |0\rangle \langle 0| \otimes I + |1 \rangle \langle 1| \otimes X $$

This tells us that the first qubit is the controlled, and the second qubit is the target. And when the controlled qubit is $|0\rangle$ we do nothing hence the Idenity operator. When the controlled-qubit is a $|1\rangle$ we apply the $X$ operator. So when you look at $CX$ gate you see something like:

enter image description here

to indicate that the first qubit is the controlled and the second is the target since it matters. Also note that $CX$ has the matrix representation in the compuational basis as: $$ CX= \begin{pmatrix}1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0 \end{pmatrix} $$


Now, if you look at the the controlled-Z ($CZ$) gate matrix representation in the computational basis, you will see: $$ CZ = \begin{pmatrix}1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & -1 \end{pmatrix} $$

But note that this can be written as:

$$ CZ = |0\rangle \langle0| \otimes I + |1\rangle\langle1|\otimes Z = I \otimes |0\rangle\langle0| + Z \otimes |1\rangle\langle1| $$

what this tells us is that it's symmetric... it doesn't matter which qubit is the controlled or target. So why not just create a controlled gate with both being the controlled qubits... that is why you see $CZ$ usually shown as;

enter image description here

KAJ226
  • 14,182
  • 2
  • 12
  • 34