Original paper introducing the Jordan-Wigner transformation from which the number operator's (I-Z)/2 form is derived.
doi.org/10.1007/bf01331938 ↗Fermionic number operator
The Jordan-Wigner-encoded fermionic number operator n = c†c = (I-Z)/2, whose eigenvalues count mode occupation exactly.
Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.
Every fermionic simulation needs a way to read out how many particles occupy each mode; the number operator is the diagonal Pauli operator that makes this readout exact and trivial to verify, and it is the building block every interaction term (like Hubbard's U n↑n↓) is written in terms of.
Circuit & simulation
What this takes and returns
TakesNothingWhat joins here
No input port, deliberately. You measure a state with this entry; you do not apply it and pass a register on.
Nothing in the Atlas meets this end.
ReturnsNothingWhat joins here
No output port, deliberately. An observable is measured with, never applied, so there is no register to hand on.
Nothing in the Atlas meets this end.
Not a stage. You measure a state with this; you do not apply it and pass a register on. It has a width and deliberately no ports. See all 60 →
How it works
Under the Jordan-Wigner transform, the fermionic creation/annihilation operators for mode are
and the number operator is
since the two -strings square to identity and cancel — the number operator, unlike creation or annihilation individually, never needs the nonlocal Jordan-Wigner string. This is why is diagonal and single-qubit local even though and individually act nonlocally in the qubit register.
Spectrum. has eigenvalue on and on exactly, matching Fock-space occupation number one-to-one. The total number operator has eigenvalue on any basis string equal to that string's Hamming weight, and commutes with any Hamiltonian built only from hopping and density-density terms (both are number-conserving), which is exactly the symmetry exploited to block-diagonalize the Fermi-Hubbard operator elsewhere in this catalog.
Role as a building block. Every density-density interaction (Hubbard's ), every chemical-potential term (), and every measurement of "how many particles are in this orbital" in quantum chemistry / condensed-matter simulations is expressed directly in terms of this operator. Because it is diagonal, expectation values can be read out with a single computational-basis measurement per mode — no ancilla or phase-estimation circuit is required, unlike for off-diagonal observables.
Implementation
import numpy as np
from qiskit.quantum_info import SparsePauliOp
def number_operator(n: int, mode: int) -> SparsePauliOp:
s = ["I"] * n
s[mode] = "Z"
return SparsePauliOp(["".join(["I"] * n), "".join(reversed(s))], [0.5, -0.5])
def total_number_operator(n: int) -> SparsePauliOp:
total = number_operator(n, 0)
for m in range(1, n):
total = total + number_operator(n, m)
return total.simplify()
n = 4
N = total_number_operator(n)
diag = np.real(N.to_matrix()).diagonal()
hamming_weights = [bin(i).count("1") for i in range(2 ** n)]
print("Matches Hamming weight for all basis strings:", np.allclose(sorted(diag), sorted(hamming_weights)))
RESULT = {"matches_hamming_weight": bool(np.allclose(sorted(diag), sorted(hamming_weights))), "eigenvalues": [float(v) for v in diag]}
Quantum vs classical
Classical baseline
Use a classical state-vector or matrix simulation at the same width, precision, and measurement objective.
Quantum claim
The quantum record demonstrates a state or operator behavior; it does not make classical simulation or communication costs disappear.
How to compare
Compare fidelity, samples, gate depth, noise, memory, and the cost of preparing and reading the state.
Declared gaps
Nobody has reviewed this record for gaps yet.