The valence and conduction bands in an n-type material are at slightly lower energy levels than the valence and conduction bands in a p-type material. Recall that p-type material has trivalent impurities and n-type material has pentavalent impurities. The trivalent impurities exert lower forces on the outer-shell electrons than the pentavalent impurities. The lower forces in p-type materials mean that the electron orbits are slightly larger and hence have greater energy than the electron orbits in the n-type materials.
An energy diagram for a pn junction at the instant of formation is shown in Figure (a). As you can see, the valence and conduction bands in the n region are at lower energy levels than those in the p region, but there is a significant amount of overlapping.
The free electrons in the n region that occupy the upper part of the conduction band in terms of their energy can easily diffuse across the junction (they do not have to gain additional energy) and temporarily become free electrons in the lower part of the p-region conduction band. After crossing the junction, the electrons quickly lose energy and fall into the holes in the p-region valence band as indicated in Figure (a).
As the diffusion continues, the depletion region begins to form and the energy level of the n-region conduction band decreases. The decrease in the energy level of the conduction band in the n region is due to the loss of the higher nergy electrons that have diffused across the junction to the p region. Soon, there are no electrons left in the n-region conduction band with enough energy to get across the junction to the p-region conduction band, as indicated by the alignment of the top of the n-region conduction band and the bottom of the p-region conduction band in Figure (b). At this point, the junction is at equilibrium; and the depletion region is complete because diffusion has ceased. There is an energy gradiant across the depletion region which acts as an “energy hill” that an n-region electron must climb to get to the p region.
Notice that as the energy level of the n-region conduction band has shifted downward, the energy level of the valence band has also shifted downward. It still takes the same amount of energy for a valence electron to become a free electron. In other words, the energy gap between the valence band and the conduction band remains the same.