Sign in
← Atlas
Exact & formalOperatorsFermionic Hamiltonians

Fermionic number operator

The Jordan-Wigner-encoded fermionic number operator n = c†c = (I-Z)/2, whose eigenvalues count mode occupation exactly.

number operatorjordan-wignerfermionic simulationoccupation

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
N=2 sector (e.g. half-filling)38%
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 ii are

ci=(k<iZk)σi,ci=(k<iZk)σi+,σi±=12(XiiYi),c^\dagger_i = \Big(\prod_{k<i} Z_k\Big)\sigma^-_i, \qquad c_i = \Big(\prod_{k<i} Z_k\Big)\sigma^+_i, \qquad \sigma^{\pm}_i = \tfrac12(X_i \mp iY_i),

and the number operator ni=cicin_i = c^\dagger_i c_i is

ni=(k<iZk)σi(k<iZk)σi+=σiσi+=IZi2,n_i = \Big(\prod_{k<i} Z_k\Big)\sigma^-_i \Big(\prod_{k<i} Z_k\Big)\sigma^+_i = \sigma^-_i\sigma^+_i = \frac{I - Z_i}{2},

since the two ZZ-strings square to identity and cancel — the number operator, unlike creation or annihilation individually, never needs the nonlocal Jordan-Wigner string. This is why nin_i is diagonal and single-qubit local even though cic_i and cic^\dagger_i individually act nonlocally in the qubit register.

Spectrum. (IZi)/2(I-Z_i)/2 has eigenvalue 00 on 0|0\rangle and 11 on 1|1\rangle exactly, matching Fock-space occupation number one-to-one. The total number operator N=iniN = \sum_i n_i 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 UniniU n_{i\uparrow}n_{i\downarrow}), every chemical-potential term (μini-\mu\sum_i n_i), 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 ni\langle n_i \rangle 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
Native
number_operator.py
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.

Literature & references
Über das Paulische Äquivalenzverbot1928 · P. Jordan, E. Wigner

Original paper introducing the Jordan-Wigner transformation from which the number operator's (I-Z)/2 form is derived.

doi.org/10.1007/bf01331938