The Fermi-Dirac function, represented by a sigmoid curve, indicates the probability of an energy state being occupied by an electron at a given temperature. The Fermi level represents the energy state with a 50 percent occupancy probability and lies between the valence and conduction bands. At absolute zero, energy states up to the Fermi level are filled, while those above are empty. At higher temperatures, states above the Fermi level may be filled. In intrinsic semiconductors, equal concentrations of holes and electrons imply that the Fermi level lies in the middle of the band gap. In n-type semiconductors, a higher electron concentration shifts the Fermi level close to the conduction band. In p-type semiconductors, the Fermi level lies near the valence band, due to a higher hole concentration. As temperature increases, more electrons transition from the valence to the conduction band, moving the Fermi level closer to the conduction band. When materials with different Fermi levels connect, electrons flow from the higher Fermi level to the lower one to align the Fermi levels at the junction to establish equilibrium.