Two different formulas for the calculation of energy in QM
The De-Broglie approach tells us that the momentum of a wave is $$p=\frac{h}{\lambda}.$$ Thus for an electromagnetic wave ($m=0$, phase velocity $c$) the Energy is: $$E=pc=h\frac{c}{\lambda}=h\nu.$$ For a particle with mass $m$, which can also be described as a wave with wavelength $\lambda$ (e.g. electron) the kinetic Energy is calculated with: $$E_{\rm kin}=\frac{1}{2}mv^2=\frac{p^2}{2m}=\frac{h^2}{2m\lambda^2}.$$
- The first one $E=\frac{hc}{\lambda}$ should be used for massless ($m=0$) particle.
- The second one $E=\frac{h²}{2m\lambda²}$ should be used for massive ($m \neq 0$) particles.
The first equation gives the energy of a photon (zero mass) in terms of its wavelength, $\lambda$.
The second gives the kinetic energy of a particle of mass m (moving at a speed much less than $c$, the speed of light) in terms of its de Broglie wavelength, $\lambda$.