---
title: Carrier statistics lab
heading: Finding the Fermi level numerically, from freeze-out to intrinsic
eyebrow: B9 · Lesson 25 · Carrier statistics lab
xp: 50
---

::: hook
The formulas of lesson 15 assume every donor has given up its electron. That's true at room temperature, but not when it's cold, and the moment you let donors hold on to their electrons, the equations for the Fermi level no longer have a neat solution. Device simulators solve them numerically, and in this lab you'll do the same: write the carrier densities as functions of the Fermi level, find where charge balances by bisection, and trace a doped silicon sample's electron density from 30 K to 800 K.
:::

::: play
- The solid curve is the electron density $n$ for each possible Fermi level, in silicon with $N_d$ donors. The dashed curve is the positive charge, holes plus ionized donors.
- The real Fermi level is where they cross: charge balances only there. Read it off the axis.
- Cool the sample: the dashed curve bends down near the donor level as donors keep their electrons, and the crossing moves up. Heat it: holes take over and the crossing heads to midgap.
:::
:::

```sim plot
view: graph
x: E = 0..1.12 eV
y: N = 1e5..1e20 log
slider: T = 40..800 step 10 = 300 K
slider: x0 = 14..18 step 0.1 = 16
plot: 3.2e19*(T/300)^1.5*exp(-(1.12 - E)/(8.617e-5*T)) | label: electrons | samples: 600
plot: 1.8e19*(T/300)^1.5*exp(-E/(8.617e-5*T)) + 10^x0/(1 + 2*exp((E - 1.075)/(8.617e-5*T))) | label: holes + ionized donors | dashed | color: ch2 | samples: 600
readout: donors, per cm³ = 10^x0 | digits: 3
readout: intrinsic level above the valence band, eV = 0.56 + 8.617e-5*T/2*ln(1.8/3.2) | digits: 3
```

::: predict
## Bisection halves the search interval each step. Starting with an interval 2 eV wide, about how many steps reach a Fermi level good to 1 µeV?

- [ ] About 6
- [x] About 21
- [ ] About 1000
- [ ] About two million

::: reveal
About 21. Each step halves the interval, so after $k$ steps it's $2/2^k$ eV wide, and $2^{21} \approx 2 \times 10^6$. Bisection is slow compared with Newton's method (A5.34), but it can't fail as long as the answer is bracketed, which matters when the function changes by forty orders of magnitude across the interval.
:::
:::

::: nameit
## The model

Measure energies from the valence band edge, so $E_v = 0$ and $E_c = E_g$ = 1.12 eV for silicon. At temperature $T$:

$$n = N_c(T)e^{-(E_g - E_F)/kT} \qquad p = N_v(T)e^{-E_F/kT}$$

with $N_c = 3.2 \times 10^{19}(T/300)^{3/2}$ and $N_v = 1.8 \times 10^{19}(T/300)^{3/2}$ cm⁻³. A donor level sits $E_d$ = 45 meV below $E_c$ (phosphorus), and the donors that have given up their electron number

$$N_d^+ = \frac{N_d}{1 + 2e^{(E_F - (E_g - E_d))/kT}}$$

(the 2 counts the two spin states a bound electron can have). Charge neutrality is

$$p + N_d^+ - n = 0$$

The left side falls steadily as $E_F$ rises, so it has exactly one root.

## Bisection

Start with an interval known to contain the root, say $E_F$ from −0.5 to $E_g + 0.5$ eV. Evaluate the function at the midpoint; keep whichever half still has a sign change; repeat. After $k$ steps the interval has shrunk by $2^k$.

```python
lo, hi = -0.5, 1.62
for _ in range(60):
    mid = (lo + hi) / 2
    if f(mid) > 0:     # too much positive charge: the Fermi level must rise
        lo = mid
    else:
        hi = mid
```

## Three regions

Solved across temperature, the electron density shows the whole story of a doped semiconductor: **freeze-out** at low temperature, where donors hold their electrons; the **extrinsic** plateau, $n \approx N_d$, where devices are meant to work; and the **intrinsic** rise at high temperature, where $n_i$ overtakes the doping.
:::

::: example
## In silicon with $10^{16}$ donors at 300 K, the bisection gives $E_F$ = 0.911 eV above $E_v$. What fraction of the donors is ionized?

::: solution
1. **Donor level.**
   $$1.12 - 0.045 = 1.075\ \text{eV}$$
2. **Fermi level against the donor level.**
   $$\begin{aligned} E_F - E_d &= -0.164\ \text{eV} \\ &= -6.33kT \end{aligned}$$
3. **Fraction ionized.**
   $$\begin{aligned} \frac{N_d^+}{N_d} &= \frac{1}{1 + 2e^{-6.33}} \\ &= 0.9965 \end{aligned}$$
4. **What it means.** That's all but a third of a percent, which is why lesson 15 could assume full ionization.

**Answer:** 0.9965 of the donors are ionized, all but a third of a percent.
:::
:::

::: example
## The same sample at 77 K (liquid nitrogen) solves to $n = 3.8 \times 10^{15}$ cm⁻³. What has happened?

::: solution
1. **Fraction ionized.** Only 38% of the donors are ionized.
2. **Why.** At 77 K, $kT$ is 6.6 meV, and the 45 meV binding is about $7kT$, so most donors hold on to their electrons.
3. **The name.** That's freeze-out.
4. **What it means for circuits.** Circuits cooled to cryogenic temperatures need heavier doping, or devices designed around it.

**Answer:** freeze-out: at 77 K only 38% of the donors are ionized, because the 45 meV binding is about $7kT$.
:::
:::

::: check
given: d = -0.03 | 0 | 0.02; T = 77 | 300
answer: 100/(1 + 2*exp(d/(8.617e-5*T)))
tolerance: 0.5%

## The Fermi level is {d} eV from the donor level (negative means below it) at {T} K. What percentage of the donors is ionized?

::: right
Right. $\frac{1}{1 + 2e^{(E_F - E_d)/kT}}$ = {answer}%.
:::

::: misses
- [100/(1 + exp(d/(8.617e-5*T)))] Include the factor 2 for the two spin states.
- [any] Not yet. $N_d^+/N_d = 1/(1 + 2e^{(E_F - E_d)/kT})$.
:::
:::

::: check
given: w = 1 | 2; tol = 1e-3 | 1e-6 | 1e-9
answer: ceil(log(w/tol)/log(2))
tolerance: 0.1%

## Bisection starts with an interval {w} eV wide. How many halvings bring it below {tol} eV?

::: right
Right. The smallest $k$ with $w/2^k <$ {tol}: {answer}.
:::

::: misses
- [any] Not yet. Solve $w/2^k = $ tol and round up.
:::
:::

::: check
given: E = 0.8 | 0.95; T = 200 | 400
answer: 3.2e19*(T/300)^1.5*exp(-(1.12 - E)/(8.617e-5*T))
unit: cm^-3
tolerance: 1%

## In silicon at {T} K, the Fermi level is {E} eV above the valence band edge. What is the electron density, with $N_c = 3.2 \times 10^{19}(T/300)^{3/2}$ cm⁻³?

::: right
Right. {answer}.
:::

::: misses
- [3.2e19*exp(-(1.12 - E)/(8.617e-5*T))] Scale $N_c$ by $(T/300)^{3/2}$.
- [any] Not yet. $N_c(T)e^{-(E_g - E_F)/kT}$.
:::
:::

::: check
kind: python

## Write `carriers(EF, T)`, returning `(n, p)` in cm⁻³ for silicon with the Fermi level `EF` eV above the valence band edge at temperature `T`. Use $E_g$ = 1.12 eV, $k$ = 8.617e-5 eV/K, $N_c = 3.2 \times 10^{19}(T/300)^{3/2}$ and $N_v = 1.8 \times 10^{19}(T/300)^{3/2}$.

```python starter
import numpy as np
k = 8.617e-5
Eg = 1.12

def carriers(EF, T):
    return 1e10, 1e10

print(carriers(0.9, 300))
```

```python solution
import numpy as np
k = 8.617e-5
Eg = 1.12

def carriers(EF, T):
    kT = k * T
    Nc = 3.2e19 * (T / 300) ** 1.5
    Nv = 1.8e19 * (T / 300) ** 1.5
    return Nc * np.exp(-(Eg - EF) / kT), Nv * np.exp(-EF / kT)

print(carriers(0.9, 300))
```

```python tests
import numpy as np
n, p = carriers(0.92, 300)
assert abs(n / 1.3965e16 - 1) < 1e-3, f"0.2 eV below the band edge at 300 K, n should be 1.40e16; got {n:.3e}."
for EF in (0.3, 0.6, 1.0):
    n, p = carriers(EF, 300)
    assert abs(np.sqrt(n * p) / 9.3813e9 - 1) < 1e-3, f"n·p should equal n_i² (n_i = 9.38e9 at 300 K) wherever the Fermi level is; got sqrt(np) = {np.sqrt(n * p):.3e}."
n, p = carriers(0.56, 600)
assert abs(np.sqrt(n * p) / 1.3421e15 - 1) < 2e-3, f"At 600 K, n_i should be 1.34e15; got {np.sqrt(n * p):.3e}."
```

::: right
Right. Notice that $np$ never depends on the Fermi level: that's the mass-action law, now coming out of your own code.
:::
:::

::: check
kind: python

## Write `solve_ef(Nd, T)`: the Fermi level (eV above $E_v$) where $p + N_d^+ - n = 0$, with $N_d^+ = N_d/(1 + 2e^{(E_F - E_d)/kT})$ and the donor level at $E_d = E_g - 0.045$ eV. Use bisection on −0.5 to $E_g$ + 0.5 eV.

```python starter
import numpy as np
k = 8.617e-5
Eg = 1.12

def carriers(EF, T):
    Nc = 3.2e19 * (T / 300) ** 1.5
    Nv = 1.8e19 * (T / 300) ** 1.5
    return Nc * np.exp(-(Eg - EF) / (k * T)), Nv * np.exp(-EF / (k * T))

def solve_ef(Nd, T):
    return Eg - k * T * np.log(3.2e19 / Nd)

print(solve_ef(1e16, 300))
```

```python solution
import numpy as np
k = 8.617e-5
Eg = 1.12

def carriers(EF, T):
    Nc = 3.2e19 * (T / 300) ** 1.5
    Nv = 1.8e19 * (T / 300) ** 1.5
    return Nc * np.exp(-(Eg - EF) / (k * T)), Nv * np.exp(-EF / (k * T))

def solve_ef(Nd, T):
    Ed = Eg - 0.045
    lo, hi = -0.5, Eg + 0.5
    for _ in range(60):
        mid = (lo + hi) / 2
        n, p = carriers(mid, T)
        if p + Nd / (1 + 2 * np.exp((mid - Ed) / (k * T))) - n > 0:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2

print(solve_ef(1e16, 300))
```

```python tests
import numpy as np
EF = solve_ef(1e16, 300)
assert abs(EF - 0.91129) < 2e-4, f"At 300 K with 1e16 donors, E_F should be 0.9113 eV above E_v; got {EF:.4f}."
n = carriers(EF, 300)[0]
assert abs(n / 9.965e15 - 1) < 2e-3, f"Nearly all donors are ionized at 300 K, so n should be 9.97e15; got {n:.3e}."
n77 = carriers(solve_ef(1e16, 77), 77)[0]
assert abs(n77 / 3.819e15 - 1) < 0.01, f"At 77 K only about 38% of the donors are ionized, so n should be 3.82e15; got {n77:.3e}. Check the donor ionization term."
```

::: right
Right. At 300 K the answer is within a fraction of a millielectronvolt of lesson 15's full-ionization formula, and at 77 K it isn't close: freeze-out.
:::
:::

::: check
kind: python

## Write `n_vs_T(Nd, temps)`: an array of the electron density at each temperature in `temps`, using your `solve_ef` and `carriers`. The test checks the three regions for $N_d = 10^{16}$ cm⁻³.

```python starter
import numpy as np
k = 8.617e-5
Eg = 1.12

def carriers(EF, T):
    Nc = 3.2e19 * (T / 300) ** 1.5
    Nv = 1.8e19 * (T / 300) ** 1.5
    return Nc * np.exp(-(Eg - EF) / (k * T)), Nv * np.exp(-EF / (k * T))

def solve_ef(Nd, T):
    lo, hi = -0.5, Eg + 0.5
    for _ in range(60):
        mid = (lo + hi) / 2
        n, p = carriers(mid, T)
        if p + Nd / (1 + 2 * np.exp((mid - Eg + 0.045) / (k * T))) - n > 0:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2

def n_vs_T(Nd, temps):
    return np.full(len(temps), Nd)

print(n_vs_T(1e16, [50, 300, 800]))
```

```python solution
import numpy as np
k = 8.617e-5
Eg = 1.12

def carriers(EF, T):
    Nc = 3.2e19 * (T / 300) ** 1.5
    Nv = 1.8e19 * (T / 300) ** 1.5
    return Nc * np.exp(-(Eg - EF) / (k * T)), Nv * np.exp(-EF / (k * T))

def solve_ef(Nd, T):
    lo, hi = -0.5, Eg + 0.5
    for _ in range(60):
        mid = (lo + hi) / 2
        n, p = carriers(mid, T)
        if p + Nd / (1 + 2 * np.exp((mid - Eg + 0.045) / (k * T))) - n > 0:
            lo = mid
        else:
            hi = mid
    return (lo + hi) / 2

def n_vs_T(Nd, temps):
    return np.array([carriers(solve_ef(Nd, T), T)[0] for T in temps])

print(n_vs_T(1e16, [50, 300, 800]))
```

```python tests
import numpy as np
n = n_vs_T(1e16, [50, 300, 800])
assert len(n) == 3, "Return one density per temperature."
assert n[0] < 0.1e16, f"At 50 K most donors are frozen out; n should be about 5.5e14, got {n[0]:.3e}."
assert abs(n[1] / 1e16 - 1) < 0.01, f"At 300 K, n should be close to the doping; got {n[1]:.3e}."
assert n[2] > 3e16, f"At 800 K the intrinsic carriers dominate; n should be about 3.6e16, got {n[2]:.3e}."
```

::: right
Right. Plot `n_vs_T` on a log scale from 30 to 800 K and you'll see the three regions; heavier doping widens the plateau at the cold end and narrows it at the hot end.
:::
:::

::: explain
## Why can a donor hold on to its electron at 77 K, when it's bound by 45 meV and $kT$ is only 6.6 meV?

::: model
Being bound by about seven times $kT$ makes it unlikely for any one donor's electron to be free at a given moment, but the free electrons have an enormous number of conduction-band states to spread into, which favors ionization. The balance between those two is what the Fermi level settles. At 300 K the binding is less than $2kT$ and the many available states win easily, so nearly every donor is ionized. At 77 K the Boltzmann factor $e^{-E/kT}$ for freeing the electron has fallen by a factor of hundreds, and a majority of donors keep their electrons. The numerical solution weighs both effects exactly.
:::
:::

::: practice

::: check
given: T = 30 | 77 | 300
answer: 1000*8.617e-5*T
unit: meV
tolerance: 0.5%

## What is $kT$ at {T} K?

::: misses
- [any] $8.617 \times 10^{-5}T$ eV.
:::
:::

::: check
given: T = 77 | 150 | 250 | 350 | 450 | 600
answer: 3.2e19*(T/300)^1.5
unit: cm^-3
tolerance: 0.5%

## What is silicon's $N_c$ at {T} K, scaling from $3.2 \times 10^{19}$ cm⁻³ at 300 K?

::: misses
- [any] $(T/300)^{3/2}$.
:::
:::

::: check
given: Ed = 45 | 54; T = 77 | 300
answer: Ed/(1000*8.617e-5*T)
tolerance: 0.5%

## A donor is bound by {Ed} meV. How many times $kT$ is that at {T} K?

::: misses
- [any] Divide by $kT$.
:::
:::
:::
