Doping is a technique used to modify the density of charge carriers in semiconductors. A small section of the periodic table is copied as follows.
Boron is a “Group 3” element. It has 3 valence electrons in its outmost shell. Once it is introduced into the silicon lattice it will bond to the nearby silicon atoms with the traditional double bonds, and produce a hole which will accept electrons and migrate around. The hole concentration (p) is approximate to the density of Boron atoms.
Phosphorus is a “Group 5” element. It has 5 valence electrons in its outmost shell. Once it is bonded to the nearby silicon it will produce a free electron and the electron acts as a donor. The electron concentration (n) is approximate to the density of Phosphorus atoms.
Note that the product of n and p is constant, which is equal to ni2.
Finally, an interesting question quoted from Prof. Razavi’s Youtube video on Electronics:
Q: What happens to n and p in n-type silicon as T increases?
A: n keeps constant and p increases as T increases.