---
title: Shannon capacity
heading: Shannon's formula for the most bits per second any scheme can send error-free through a noisy channel of given bandwidth and SNR, spectral efficiency, why extra SNR gives diminishing returns, the minimum energy per bit of −1.6 dB, and how close real links come
eyebrow: D4 · Lesson 6 · Shannon capacity
xp: 40
---

::: hook
In 1948 Claude Shannon proved something that seemed impossible: a noisy channel can carry information with as few errors as you like, as long as you send slower than a definite limit, its **capacity**. Above that limit, no scheme can avoid errors; below it, a clever enough code can make them vanish. The formula is short enough to fit on a business card, and for fifty years engineers chased it. Modern Wi-Fi, 5G and deep-space links, using the codes of lesson 8, now operate within about a decibel of it.
:::

::: play
- The capacity per hertz of bandwidth, $\log_2(1 + \text{SNR})$, against the SNR in decibels.
- At high SNR each extra 3 dB, a doubling of power, buys only one more bit per second per hertz. At low SNR capacity grows almost in proportion to power.
- The readouts give the capacity of a channel of bandwidth B at the chosen SNR.
:::

```sim plot
view: graph
x: s = -10..40
y: C = 0..14
slider: B = 0.003..100 = 20 log
slider: S = -10..40 step 0.5 = 25
plot: log(1 + 10^(s/10))/log(2) | samples: 400 | label: capacity, bits per second per hertz (s = SNR in dB)
marker: x = S | label: your SNR
readout: spectral efficiency, b/s/Hz = log(1 + 10^(S/10))/log(2) | digits: 3
readout: capacity, Mb/s = B*log(1 + 10^(S/10))/log(2) | digits: 4
```

::: predict
## A 20 MHz Wi-Fi channel has an SNR of 25 dB. What's the most it could possibly carry, error-free?

- [ ] 25 Mb/s
- [ ] 50 Mb/s
- [x] About 166 Mb/s
- [ ] 500 Mb/s

::: reveal
25 dB is a ratio of 316, and $C = B\log_2(1 + \text{SNR})$ = 20 MHz × log₂ 317 = 20 × 8.31 = 166 Mb/s. Real single-antenna Wi-Fi in 20 MHz manages about 86 Mb/s at this SNR (64-QAM with rate-5/6 coding) and 143 Mb/s at its very best, and multiple antennas multiply that by sending independent streams.
:::
:::

::: nameit
## The capacity formula

For a channel of bandwidth B with Gaussian noise and signal-to-noise ratio SNR,

$$C = B\log_2(1 + \text{SNR}) \text{ bits per second}$$

Below C, codes exist that make the error rate as small as desired; above it, errors are unavoidable. The ratio $\eta = R_b/B$ is the **spectral efficiency**.

## Diminishing returns

At high SNR, $\log_2(1 + \text{SNR}) \approx \text{SNR}_\text{dB}/3$: each doubling of power adds one bit per second per hertz. More bandwidth helps more: at the same total power, doubling B halves the SNR but doubles the multiplier.

## The energy limit

Writing SNR as $(E_b/N_0)\eta$ and requiring $\eta \le \log_2(1 + (E_b/N_0)\eta)$ gives the least energy per bit for each spectral efficiency:

$$\frac{E_b}{N_0} \ge \frac{2^\eta - 1}{\eta}$$

As η → 0 (unlimited bandwidth), this falls to ln 2 = 0.693, or **−1.59 dB**: no scheme can communicate reliably with less energy per bit. Uncoded BPSK needs 10.5 dB for an error rate of 10⁻⁶, so good coding is worth up to about 10 dB.
:::

::: example
## A telephone line passes 3 kHz with an SNR of 30 dB. What's its capacity?

::: solution
1. **Capacity.** 30 dB is an SNR of 1000:
   $$\begin{aligned} C &= 3000 \times \log_2 1001 \\ &= 29.9\ \text{kb/s} \end{aligned}$$
2. **Dial-up modems.** That's why dial-up modems stalled at 28.8 and 33.6 kb/s (56k modems used a digital trick at the phone company's end).

**Answer:** the line's capacity is 29.9 kb/s.
:::
:::

::: example
## What's the least $E_b/N_0$ for 2 and for 6 bits per second per hertz? What SNR does 4 b/s/Hz need?

::: solution
1. **2 b/s/Hz.**
   $$(2^2 - 1)/2 = 1.5$$
   or 1.76 dB.
2. **6 b/s/Hz.**
   $$(2^6 - 1)/6 = 10.5$$
   or 10.2 dB.
3. **SNR for 4 b/s/Hz.** It must be at least
   $$2^4 - 1 = 15$$
   or 11.8 dB.

**Answer:** the least $E_b/N_0$ is 1.76 dB for 2 b/s/Hz and 10.2 dB for 6 b/s/Hz, and 4 b/s/Hz needs an SNR of at least 11.8 dB.
:::
:::

::: example
## What is the capacity of a 1 MHz channel whose SNR is −10 dB, below the noise?

::: solution
1. **Capacity.** −10 dB is an SNR of 0.1:
   $$\begin{aligned} C &= 10^6\log_2(1 + 0.1) \\ &= 138\ \text{kb/s} \end{aligned}$$
2. **Below the noise.** Capacity never reaches zero: with enough coding (or spreading), data can be carried under the noise, which is how GPS signals, arriving at about −20 dB, are received.

**Answer:** the capacity is 138 kb/s.
:::
:::

::: check
given: B = 1 | 20 | 80; S = 15 | 20 | 30
answer: B*log(1 + 10^(S/10))/log(2)
unit: Mb/s
tolerance: 0.5%

## A {B} MHz channel has an SNR of {S} dB. What's its Shannon capacity?

::: right
Right. $B\log_2(1 + \text{SNR})$ = {answer} Mb/s.
:::

::: misses
- [B*log(1 + S)/log(2)] Convert the SNR from decibels first.
- [B*log(1 + 10^(S/10))] Use log base 2 for bits.
- [any] Not yet. Shannon's formula.
:::
:::

::: check
given: n = 2 | 4 | 6 | 8
answer: 10*log(2^n - 1)
unit: dB
tolerance: 0.5%

## What's the least SNR that can support {n} bits per second per hertz?

::: right
Right. $2^\eta - 1$, or {answer} dB.
:::

::: misses
- [any] Not yet. Solve $\eta = \log_2(1 + \text{SNR})$ for the SNR.
:::
:::

::: check
given: n = 0.5 | 2 | 4 | 6
answer: 10*log((2^n - 1)/n)
unit: dB
tolerance: 0.5%

## What's the least $E_b/N_0$ that can support {n} bits per second per hertz?

::: right
Right. $(2^\eta - 1)/\eta$ = {answer} dB.
:::

::: misses
- [10*log(2^n - 1)] That's the SNR; divide by η for energy per bit.
- [any] Not yet. The energy limit.
:::
:::

::: check
given: k = 3 | 10 | 30; S = 10 | 20 | 40
answer: k*log(1 + 10^(S/10))/log(2)
unit: kb/s
tolerance: 0.5%

## A {k} kHz audio channel has an SNR of {S} dB. What's its capacity?

::: right
Right. {answer} kb/s.
:::

::: misses
- [any] Not yet. $B\log_2(1 + \text{SNR})$.
:::
:::

::: check
kind: parts
given: B = 0.003 | 1 | 20; S = -10 | 10 | 30

## A channel has {B} MHz of bandwidth and {S} dB SNR.

::: part
answer: B*1e6*log(1 + 10^(S/10))/log(2)/1e6
unit: Mb/s
tolerance: 0.5%

### What is its capacity?

::: misses
- [any] $B\log_2(1 + \text{SNR})$.
:::
:::

::: part
answer: log(1 + 10^(S/10))/log(2)
unit: b/s/Hz
tolerance: 0.5%

### How many bits per second per hertz is that?

::: misses
- [any] $\log_2(1 + \text{SNR})$.
:::
:::
:::

::: check
kind: parts
given: r = 2 | 4 | 6

## A link must carry {r} bits per second per hertz.

::: part
answer: 10*log((2^r - 1)/r)
unit: dB
tolerance: 0.5%

### What is the least $E_b/N_0$ that Shannon allows?

::: misses
- [any] $(2^r - 1)/r$.
:::
:::

::: part
answer: 10*log(2^r - 1)
unit: dB
tolerance: 0.5%

### What is the least SNR?

::: misses
- [any] $2^r - 1$.
:::
:::
:::

::: explain
## Why does doubling a link's power add only one bit per second per hertz at high SNR?

::: model
Capacity grows with the logarithm of one plus the signal-to-noise ratio, because what limits a channel is how many distinguishable signal levels fit between the noise's spread and the signal's size. The number of distinguishable levels grows with the ratio of signal amplitude to noise amplitude, the square root of the power ratio, and the bits per symbol grow with the logarithm of that number. Doubling the power multiplies the number of levels by about √2 in each of two dimensions, which adds one bit per two-dimensional symbol, or one bit per second per hertz. More bandwidth, by contrast, adds whole new symbols per second, so at low SNR extra bandwidth buys more capacity than extra power.
:::
:::

::: practice

::: check
given: B = 0.01 | 400; S = 1 | 45
answer: B*log(1 + 10^(S/10))/log(2)
unit: Mb/s
tolerance: 0.5%

## Capacity: {B} MHz at {S} dB?

::: misses
- [any] $B\log_2(1 + \text{SNR})$.
:::
:::

::: check
given: n = 0.5 | 1.5 | 2 | 3 | 4 | 6 | 8 | 12
answer: 10*log((2^n - 1)/n)
unit: dB
tolerance: 0.5%

## Least $E_b/N_0$ for η = {n}?

::: misses
- [any] $(2^\eta - 1)/\eta$.
:::
:::
:::
