If the electron is confined to move in one dimension within the box then the de Broglie waves associated with the electron will be standing waves.
Since the wave must have zero value (i.e a node) at the walls of the box only waves that have a wavelength (λ)) = 2L/n are allowed.
L is the length of the box and n is a positive integer.
The de Broglie wavelength (λ) of an electron of mass me travelling with velocity v = h/meλ, where h is Planck’s constant.
The kinetic energy of the electron = ½ mev2.
Kinetic energy = ½[mv2] = ½[me(h/λ) me)2] = ½[me(nh/2Lme)2] = ½[n2h2/4meL2] = n2h2/8meL2
Examples of waves fitting into a box, the energy levels and the probability functions are shown above for n=1,2,3 and and 4.
We have assumed the amplitude of the wave associated with the electron to be sinusoidal and the probability of the electron being at a particular point to be proportional to the amplitude of the wave squared. This follows from Schrödinger’s wave equation.