The Binary Symmetric Channel
The binary symmetric channel (BSC) is the workhorse model of information theory: each bit is flipped independently with probability . It is simple enough to analyse exactly and realistic enough to describe hard-decision decoding on radio links, memory errors and many other systems.
The model
The output is , where is a noise bit with , independent of .
import numpy as np
rng = np.random.default_rng(0)
f = 0.1
x = rng.integers(0, 2, 1_000_000)
y = x ^ (rng.random(x.size) < f)
print("measured flip rate:", round(float(np.mean(x != y)), 4))
print("P(Y=1):", round(float(y.mean()), 4))measured flip rate: 0.1
P(Y=1): 0.4999
Mutual information through a BSC
With input distribution , the output has , and since the noise is independent of the input,
whatever was sent: the channel always adds bits of uncertainty. is largest when is uniform, which happens for . So the capacity is
import numpy as np
def H2(p):
return 0.0 if p in (0, 1) else float(-p * np.log2(p) - (1 - p) * np.log2(1 - p))
f = 0.1
for p in [0.0, 0.1, 0.3, 0.5, 0.7]:
py1 = p * (1 - f) + (1 - p) * f
print(f"P(X=1) = {p:.1f}: I(X;Y) = {H2(py1) - H2(f):.4f} bits")
print("capacity 1 - H2(f) =", round(1 - H2(f), 4))P(X=1) = 0.0: I(X;Y) = 0.0000 bits
P(X=1) = 0.1: I(X;Y) = 0.2111 bits
P(X=1) = 0.3: I(X;Y) = 0.4558 bits
P(X=1) = 0.5: I(X;Y) = 0.5310 bits
P(X=1) = 0.7: I(X;Y) = 0.4558 bits
capacity 1 - H2(f) = 0.531
Capacity as a function of the noise
import numpy as np
def H2(p):
return 0.0 if p in (0, 1) else float(-p * np.log2(p) - (1 - p) * np.log2(1 - p))
for f in [0.0, 0.01, 0.05, 0.1, 0.2, 0.3, 0.5, 0.8, 1.0]:
C = 1 - H2(f)
print(f"f = {f:4.2f}: C = {C:.4f} {'#' * int(round(40 * C))}")f = 0.00: C = 1.0000 ########################################
f = 0.01: C = 0.9192 #####################################
f = 0.05: C = 0.7136 #############################
f = 0.10: C = 0.5310 #####################
f = 0.20: C = 0.2781 ###########
f = 0.30: C = 0.1187 #####
f = 0.50: C = 0.0000
f = 0.80: C = 0.2781 ###########
f = 1.00: C = 1.0000 ########################################
- At the output is independent of the input: capacity 0.
- At the channel always flips, which is as good as a perfect channel: just invert the output.
- Even a small error rate costs a lot: already takes 8% of the capacity.
Hard and soft decisions
A BSC often arises from thresholding a continuous signal: send , add Gaussian noise, and decide by the sign. The flip probability is , where is the standard normal CDF. Keeping the continuous value ("soft decision") preserves more information than the sign alone (The Gaussian Channel), and modern decoders use soft values (Sum-Product (Belief Propagation) Decoding).
import numpy as np
from scipy.stats import norm
for sigma in [0.5, 0.8, 1.0]:
f = norm.cdf(-1 / sigma)
H2 = -f * np.log2(f) - (1 - f) * np.log2(1 - f)
print(f"sigma = {sigma}: f = {f:.4f}, hard-decision capacity {1 - H2:.4f}")sigma = 0.5: f = 0.0228, hard-decision capacity 0.8434
sigma = 0.8: f = 0.1056, hard-decision capacity 0.5133
sigma = 1.0: f = 0.1587, hard-decision capacity 0.3689
In software
x ^ (rng.random(n) < f)simulates a BSC on a NumPy array of bits.- Measured bit error rates in hardware are reported as BER; a BER of corresponds to and capacity .
Exercises
Exercise 1: Capacity
What is the capacity of a BSC with ?
Answer
About 0.189 bits per use.
Solution
, so .
Exercise 2: Symmetry
Why do the BSCs with and have the same capacity?
Answer
Inverting the output turns one into the other.
Solution
The receiver can flip every output bit. Also .
Exercise 3: Find f for a target capacity (code)
What flip probability gives capacity exactly 0.5?
Answer
About 0.110.
Solution
import numpy as np
from scipy.optimize import brentq
H2 = lambda p: -p * np.log2(p) - (1 - p) * np.log2(1 - p)
print(round(brentq(lambda f: 1 - H2(f) - 0.5, 1e-9, 0.5), 4))0.11
A rate-1/2 code can work reliably on a BSC only if is below this value.
Test yourself
The capacity of a BSC with flip probability f is…
A BSC with f = 0.5 has capacity…
- 0
- 0.5
- 1
- it depends on the input
Which input distribution achieves the capacity of a BSC?
- uniform
- always send 0
- P(X=1) = f
- P(X=1) = 1 - f