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 following is in bra–ket notation: 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
and we have
where is the number of particles in state . The above equality can be proven by noting that
then