# Why does the number operator gives the number of excitations?

Could somebody explain why the number operator (for a simple harmonic oscillator) gives the number of excitations?

I understand its definition and its relation to the Hamiltonian, but I just can't see how the number pops out!

I think the best way for you to see this would be to try it out yourself; take the expectation value of the number operator acting on state $$\left| n \right>$$. Use the relation $$\hat a \left| n \right> = \sqrt{n} \left| n - 1 \right>$$ Note that taking the hermitian conjugate of this relation gives that $$\left< n \right| \hat a^\dagger = \left< n - 1 \right| \sqrt{n}.$$
Every eigenvalue of the harmonic $$\hat{H}$$ is of the form $$E_n =\hbar\omega(n+1/2)$$. Therefore, one can label the eigenstates as $$|n\rangle$$, uniquely since the spectrum is non-degenerate. There is nothing else to the story, apart that a labeling operator can be constructed explictly. Any reference to a number of excitations is out of context, if not wrong: the number operator is just an operator that happens to label the eigenstates of $$\hat{H}$$. A higher number corresponds just to a higher excitation (that is, a state with higher energy) in the spectrum.
The reason for calling it number operator, and for the record also for calling $$a$$ and $$a^\dagger$$ annihilation and creation operators, is for how these are used in QFT (or when dealing with multiple particles in second quantization formalism). For QED I can give you a super short story. For every frequency (precisely, for every mode) the $$E$$ and $$B$$ fields satisfy a harmonic oscillator equation, as follows from Maxwell's equations. Therefore when quantizing the EM field we get a set of harmonic oscillator states for every frequency, and for a series of reasons the label $$n$$ can be interpreted as the number of photons 'occupying' that frequency.