What is doping in the context of PN junctions and why is it done?
Pure silicon has four valence electrons that are able to conduct electricity. Doping adjusts the concentrations of the charge carriers within the silicon crystals to either increase the number of electrons or increase the number of "holes" (aka lack of electrons). Doping with elements that have 5 valence electrons such as arsenic increases the number of electrons in the silicon crystal. This makes it "negative" or n-type. Doping with elements that have 3 valence electrons such as boron or indium creates silicon crystals that have a high concentration of holes, making it "positive" or p-type. This causes electrons to move only in one direction: from n-type to p-type. This is essentially a silicon diode. The property of allowing electrons to only flow in one direction forms the basis for more advanced transistors such as BJTs and MOSFETs.