In quantum mechanics, for systems where the total number of particles may not be preserved, the number operator is the observable that counts the number of particles.
The number operator acts on Fock space. Let
be a Fock state, composed of single-particle states drawn from a basis of the underlying Hilbert space of the Fock space. Given the corresponding creation and annihilation operators and we define the number operator by