@@ -198,15 +198,40 @@ What happens if we bring two differently doped semiconductors together (one of $
### Band diagram
Previously we dealt with homogeneous materials, now coordinate (let's call it $x$) starts playing a role. We can represent the properties of inhomogeneous materials using the **band diagram**. The main idea is to plot dependence of various energies ($E_F$, bottom of conduction band, top of the valence band) as a function of position.
Previously we dealt with homogeneous materials, now the position coordinate (let's call it $x$) starts playing a role.
We represent the properties of inhomogeneous materials using the **band diagram**.
The main idea is to plot the dependence of various energies ($E_F$, bottom of conduction band $E_C$, top of the valence band $E_V$) as a function of position.
So here is our problem for today:

> An important remark is in order: before we counted all energies with respect to the top of the valence band. Now $E_F$ is the same everywhere if the sample is in equilibrium, and the bands are shifted due to an extra electrostatic potential.
More specifically: How fast does the electrostatic potential change in the intermediate region? What is the charge density at the junction if we make the chemically-defined boundary between materials very precise?
The main difference between $n$-type and $p$-type semiconductors is the location of the Fermi level $E_F$.
The Fermi level of an $n$-type semiconductor is close to the donor states.
On the other hand, the $p$-type semiconductor has its Fermi level near the acceptor states.
At equilibrium (no external fields), we do not expect to see any currents in the system and therefore the **Fermi level $E_F$ must be constant** across the system.
To achieve a homogenous Fermi level, we could bring up in energy the $p$-type region or bring down the $n$-type region until the Fermi levels are aligned.
The resulting band diagram is shown above.
However, a question arises: what happens at the junction?
We can understand the junction with a simple picture.
In physics, most of the time we expect things to change *continuously*.
Therefore, we expect that the valance $E_V$ and conduction $E_C$ bands connect continuously in the middle region.
On the contrary, if the bands are discontinuous, then an electric field must develop at a single point in the middle region to shift the bands in energy.
However, we do not expect such point-like electric fields to develop because electrons can move freely in semiconductors.
On a more microscopic level, the electrons at the junction in the $n$-type semiconductor will move into the $p$-type semiconductor to **recombine** with the holes.
After the recombination, the $n$ and $p$-type semiconductors lose an electron and a hole respectively.
As a result, a single positive ionized donor dopant is not screened anymore and the $n$-type semiconductor obtains a positive overall charge.
Similarly, $p$-type region obtains a negative charge.
Therefore, an electric field develops across the junction.
As the recombination process continues, more unbalanced charges develop and the electric field grows until it is large enough to prevent the electrons/holes from crossing the junction.
The region where the electric field develops is called the **depletion region** because the electrons and holes are depleted in that area.
We now understand the rough qualitative picture of what happens at the $np$-junction.
However, can we understand things more quantitatively?
Specifically, how fast does the electrostatic potential change in the **depletion region** ?
What is the charge density at the junction if we make the chemically-defined boundary between materials very precise?
We may instead use a key bit of insight: **the density of electrons and holes drops exponentially fast as soon as potential deviates by $kT \ll \delta \varphi$ from its bulk value**.