# Conservative Quantum Logic Gate

In "Quantum Computation and Quantum Information," by Nielsen & Chuang, pg 156, a conservative logic gate is defined as one which preserves the number of zeros and ones. This definition makes sense for bits with definite 1's and 0's, but how does this definition extend to qubits?

For instance, consider the unitary operator $$U = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 2^{-1/2} & 2^{-1/2} & 0 \\ 0 & 2^{-1/2} & 2^{-1/2} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix}$$ This gate takes a state $|01\rangle$ to a balanced superposition of $|01\rangle$ and $|10\rangle$, has it "conserved the number of 0's and 1's? (I think so.)

What about a gate that takes $|0011\rangle$ to a balanced superposition of $|0111\rangle$ and $|0001\rangle$?

EDIT: The question is really in the last line. Is a balanced superposition of $|0111\rangle$ and $|0001\rangle$ really "conserving" the number of 1's from $|0011\rangle$. While it commutes with the counting operator, measurement will definitely give a different number of 1's! So is that still called conservation?

• I suppose it could mean any operator which commutes with the operator that counts the number of ones. In which case the answers to your questions are yes and yes. Commented Jan 2, 2018 at 22:39
• That's one possibility, but what if the condition is that the operation must be guaranteed to preserve the count for any pure state, not just the expectation? Commented Jan 2, 2018 at 22:47
• They may be describing gates whose matrix form is a permutation matrix (e.g. Toffoli, Fredkin, CNOT) - these gates have the property of jostling around 1's and 0's for a given input state. This is my best guess as to what N&C meant, especially since they were vague in defining what was being conserved: is there conservation of pre-measurement expectation values, or post-measurement properties? In the first case, your matrix would satisfy "conservative", but in the second case it would not. Commented Jan 3, 2018 at 3:03
• kzhou is right: The proper definition is to commute with the "number operator" counting the number of ones. What other linear definition should there be? --- In any case, what precisely is the question here? Commented Jan 3, 2018 at 12:26
• Grateful for input. I am asking if there might be a better non-linear definition or there is a good explanation why the second case is conservative even though it clearly does not preserve the number of 0's and 1's. Commented Jan 3, 2018 at 16:28

"The number of zeros" and "the number of ones" are, respectively, the matrices $$N_0=\begin{pmatrix}2&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&0&0 \end{pmatrix} \quad\text{and}\quad N_1=\begin{pmatrix}0&0&0&0\\ 0&1&0&0\\ 0&0&1&0\\ 0&0&0&2 \end{pmatrix},$$ in the $\{|00\rangle, |01\rangle, |10\rangle, |11\rangle \}$ basis, and they add to a multiple of the identity, $N_0+N_1=2=2\,\mathbb I$. Saying that a unitary $U$ "conserves the number of zeros" (or equivalently the number of ones) is, by definition, saying that it commutes with $N_0$ (and equivalently with $N_1$), and therefore that it takes any eigenvector of $N_0$ and $N_1$ (itself necessarily of the form $|00\rangle$, $a|01\rangle+b|10\rangle$, or $|11\rangle$) to another eigenvector of the same eigenvalue. The same is true, with a transparent generalization, to the tensor product of any number of qubits.
As such, if a unitary takes $|0011\rangle$ to a superposition of $|0111\rangle$ and $|0001\rangle$ then, regardless of how even-weighted the superposition, is not considered to conserve $N_1$, because it takes vectors from one eigenspace and puts them outside that eigenspace, and therefore it cannot commute with $N_1$.