TExcelTAD
Home › Information Theory › Channel Capacity

Channel Capacity

The capacity of a channel is the largest mutual information between input and output that any input distribution can achieve:

C=max⁡PXI(X;Y)C = \max_{P_X} I(X; Y)

The noisy-channel coding theorem gives this number its meaning: it is the highest rate, in bits per channel use, at which information can be sent with arbitrarily small error probability (The Noisy-Channel Coding Theorem).

Capacities of standard channels

Channel Capacity Achieving input
noiseless binary 1 bit uniform
binary symmetric, flip ff 1−H2(f)1 - H_2(f) uniform
binary erasure, erasure ee 1−e1 - e uniform
noisy typewriter with NN keys log⁡2N−1\log_2 N - 1 uniform
Z channel, f=0.15f = 0.15 about 0.685 P(X=1)≈0.445P(X = 1) \approx 0.445
python · try it yourself
import numpy as np
from scipy.optimize import minimize_scalar

def channel_mi(px, Q):
    py = px @ Q; joint = px[:, None] * Q; nz = joint > 0
    return float(np.sum(joint[nz] * np.log2((Q / np.where(py > 0, py, 1))[nz])))

def binary_capacity(Q):
    res = minimize_scalar(lambda p: -channel_mi(np.array([1 - p, p]), Q), bounds=(0, 1), method="bounded",
                          options={"xatol": 1e-10})
    return -res.fun, res.x

H2 = lambda f: -f * np.log2(f) - (1 - f) * np.log2(1 - f)
for name, Q, formula in [("BSC f=0.1", np.array([[0.9, 0.1], [0.1, 0.9]]), 1 - H2(0.1)),
                         ("BEC e=0.2", np.array([[0.8, 0.2, 0], [0, 0.2, 0.8]]), 0.8),
                         ("Z f=0.15", np.array([[1.0, 0.0], [0.15, 0.85]]), None)]:
    C, p = binary_capacity(Q)
    extra = f"   formula {formula:.4f}" if formula is not None else ""
    print(f"{name:10s}: C = {C:.4f} at P(X=1) = {p:.3f}{extra}")
BSC f=0.1 : C = 0.5310 at P(X=1) = 0.500   formula 0.5310
BEC e=0.2 : C = 0.8000 at P(X=1) = 0.500   formula 0.8000
Z f=0.15  : C = 0.6854 at P(X=1) = 0.445

Symmetric channels

A channel is symmetric if all rows are permutations of each other and all columns are permutations of each other. Then H(Y∣X)H(Y \mid X) is the same for every input, equal to the entropy H(r)H(\mathbf{r}) of one row, and uniform input makes the output uniform, so

C=log⁡2∣AY∣−H(r)C = \log_2 |\mathcal{A}_Y| - H(\mathbf{r})
python · try it yourself
import numpy as np

def channel_mi(px, Q):
    py = px @ Q; joint = px[:, None] * Q; nz = joint > 0
    return float(np.sum(joint[nz] * np.log2((Q / np.where(py > 0, py, 1))[nz])))

# a 4-ary symmetric channel: correct with prob 0.7, each other symbol with prob 0.1
Q = np.full((4, 4), 0.1) + np.eye(4) * 0.6
row = Q[0]
print("formula:   ", round(np.log2(4) + float(np.sum(row * np.log2(row))), 4))
print("uniform MI:", round(channel_mi(np.ones(4) / 4, Q), 4))
rng = np.random.default_rng(0)
print("best of 5000 random inputs:", round(max(channel_mi(rng.dirichlet(np.ones(4)), Q) for _ in range(5000)), 4))
formula:    0.6432
uniform MI: 0.6432
best of 5000 random inputs: 0.6431

Properties of capacity

  • 0≤C≤min⁡(log⁡2∣AX∣,log⁡2∣AY∣)0 \le C \le \min(\log_2 |\mathcal{A}_X|, \log_2 |\mathcal{A}_Y|).
  • C=0C = 0 exactly when the output is independent of the input for every input distribution.
  • Capacity is a maximum of a concave function over the probability simplex, so it can be computed reliably by convex optimization or by the Blahut-Arimoto algorithm (Computing Capacity: Blahut-Arimoto).
  • Feedback (the transmitter seeing what was received) does not increase the capacity of a memoryless channel, though it can make coding much simpler.

Using a channel many times

For nn independent uses of a channel, the capacity of the combined channel is nCnC. Capacity is additive, which is why it is quoted per use.

python · try it yourself
import numpy as np
from itertools import product

def channel_mi(px, Q):
    py = px @ Q; joint = px[:, None] * Q; nz = joint > 0
    return float(np.sum(joint[nz] * np.log2((Q / np.where(py > 0, py, 1))[nz])))

Q = np.array([[0.9, 0.1], [0.1, 0.9]])
Q2 = np.kron(Q, Q)                    # two uses: inputs 00, 01, 10, 11
print("one use, uniform input:", round(channel_mi(np.ones(2) / 2, Q), 4))
print("two uses, uniform input:", round(channel_mi(np.ones(4) / 4, Q2), 4))
one use, uniform input: 0.531
two uses, uniform input: 1.062

In software

  • For binary-input channels, a bounded scalar optimizer over P(X=1)P(X = 1) is enough. For larger alphabets use Blahut-Arimoto or a convex solver over the simplex.
  • Link budgets in communications compare the data rate needed with the capacity; a rate above capacity is impossible to support reliably, whatever the code.

Exercises

Exercise 1: Erasure channel

What is the capacity of a binary erasure channel that loses 30% of bits?

Answer

0.7 bits per use.

Solution

C=1−eC = 1 - e. Intuitively, the 70% of bits that arrive are perfect, and the transmitter cannot know in advance which ones will be lost.

Exercise 2: Typewriter

What is the capacity of a 26-key noisy typewriter, where each key produces itself or the next letter with probability 12\frac{1}{2}?

Answer

log⁡213≈3.70\log_2 13 \approx 3.70 bits.

Solution

log⁡226−1=log⁡213\log_2 26 - 1 = \log_2 13. It is achieved without any errors by using only every second key: those 13 keys produce disjoint output pairs.

Exercise 3: A ternary channel (code)

Find the capacity of the channel with rows (0.8,0.2,0)(0.8, 0.2, 0), (0.1,0.8,0.1)(0.1, 0.8, 0.1), (0,0.2,0.8)(0, 0.2, 0.8) by random search over input distributions.

Answer

About 0.827 bits, with input probabilities about (0.43,0.14,0.43)(0.43, 0.14, 0.43): the noisy middle symbol is used rarely.

Solution
python · try it yourself
import numpy as np

def channel_mi(px, Q):
    py = px @ Q; joint = px[:, None] * Q; nz = joint > 0
    return float(np.sum(joint[nz] * np.log2((Q / np.where(py > 0, py, 1))[nz])))

Q = np.array([[0.8, 0.2, 0.0], [0.1, 0.8, 0.1], [0.0, 0.2, 0.8]])
rng = np.random.default_rng(1)
cands = rng.dirichlet(np.ones(3), size=20000)
vals = np.array([channel_mi(p, Q) for p in cands])
print(round(vals.max(), 3), np.round(cands[vals.argmax()], 2))
0.827 [0.43 0.14 0.43]

Test yourself

Channel capacity is defined as…

  1. the maximum of I(X;Y)I(X; Y) over input distributions
  2. the mutual information for uniform input
  3. H(Y)H(Y)
  4. the minimum error probability

The capacity of a binary erasure channel with erasure probability e is…

  1. 1−e1 - e
  2. 1−H2(e)1 - H_2(e)
  3. ee
  4. H2(e)H_2(e)

For n independent uses of a channel with capacity C, the total capacity is…

  1. nC
  2. C
  3. CnC^n
  4. C+log⁡2nC + \log_2 n