Substituting a phosphorus atom (with five valence electrons) for a silicon atom in a silicon crystal leaves an extra, unbonded electron that is relatively free to move around the crystal.
Substituting a boron atom (with three valence electrons) for a silicon atom in a silicon crystal leaves a hole (a bond missing an electron) that is relatively free to move around the crystal.
A dopant is a chemical element (impurity) added in small amounts to an otherwise pure semiconductor material such as silicon to modify the electrical properties of the material. An n-dopant introduces more electrons and creates an n-type semiconductor; a p-dopant creates electron vacancies known as holes and creates a p-type semiconductor. Dopants have either three or five valence electrons, which is one less or one more than silicon's four.
Phosphorus atoms, which have five valence electrons, are used in doping n-type silicon, because phosphorus provides its fifth free electron. A phosphorus atom occupies the same place in the crystal lattice formerly occupied by the silicon atom it replaced. Four of its valence electrons take over the bonding responsibilities of the four silicon valence electrons that they replaced. But the fifth valence electron remains free, having no bonding responsibilities. When phosphorus atoms are substituted for silicon in a crystal, many free electrons become available.
The most common method of doping is to coat a layer of silicon material with phosphorus and then heat the surface. This allows the phosphorus atoms to diffuse into the silicon. The temperature is then reduced so the rate of diffusion drops to zero. Other methods of introducing phosphorus into silicon include gaseous diffusion, a liquid dopant spray-on process, and a technique where phosphorus ions are precisely driven into the surface of the silicon.
The n-type silicon doped with phosphorus cannot form an electric field by itself. We also need p-type silicon. Boron, which has only three valence electrons, is used for doping p-type silicon. Boron is introduced during silicon processing when the silicon is purified for use in photovoltaic devices such as solar cells. When a boron atom takes a position in the crystal lattice formerly occupied by a silicon atom, a bond will be missing an electron. In other words, there is an extra positively charged hole.