why p and n type semiconductors are electrically neutral?
Refer to the figure above, its a p type semiconductor. In a p- type semiconductor, the impurity atom has less electrons. In this case, there is one less which gives rise to a hole of positive charge. The pure atom has a nucleus of charge +4e and the electrons of charge -4e(outermost electrons). Suppose there n number of atoms, total positive charge on atom = +4ne.
The total charge before the doping = +4ne-4ne = 0
In doping one atom is replaced by a low order group element. The doping atom has +3e nucleus and 3 electrons leaving a vacant position.
The total charge after doping = +4(n-1)e+3e-3e-4(n-1)e = 0