courseshub.world · Lives in Mathematics and Physics

Claude Shannon

Claude Elwood Shannon

A course in two strands: the life of the Michigan tinkerer who turned Boole’s logic into circuit design and then founded information theory at Bell Labs, and the mathematics of bits, codes, channels and secrecy that underlies every digital system.

Born 30 April 1916, Petoskey, Michigan Died 24 February 2001, Medford, Massachusetts A Mathematical Theory of Communication 1948 Level advanced undergraduate → graduate
Binary entropy H(p) and the capacity 1 − H(p) of a binary symmetric channel with crossover probability p. At p ≈ 0.11 each equals half a bit.
Lesson 00

How to use this course

Claude Shannon wrote two founding documents of the digital age eleven years apart. His 1937 master’s thesis showed that relay circuits obey Boole’s algebra of logic, which made circuit design a branch of algebra. His 1948 paper “A Mathematical Theory of Communication” defined information as a measurable quantity, proved that every channel has a capacity, and showed that reliable communication at any rate below capacity is possible. Around these he did fundamental work on cryptography, sampling, computer chess and machine learning. He also built juggling machines and rode a unicycle through the corridors of Bell Labs.

Prerequisites for Part II
  • Propositional logic and truth tables (Lesson 04).
  • Discrete probability: expectation, independence, the weak law of large numbers (Lessons 05, 06, 08, 10).
  • Fourier series and transforms at the level of a signals course (Lesson 07).
  • Basic game trees (Lesson 09).

Each technical lesson opens with a paragraph for the general reader, then gives precise statements, proof sketches and exercises with folded solutions. Logarithms are to base 2 unless stated otherwise, so information is measured in bits. Lessons 05 to 07 follow the 1948 paper and its 1949 companion on noise; Lesson 08 covers the secrecy paper; Lessons 09 and 10 cover his later work.

Reference

Timeline

1916Born 30 April in a hospital in Petoskey, Michigan; grows up in Gaylord, where his father is a businessman and probate judge and his mother a language teacher and principal of the high school.
1932Graduates from Gaylord High School; enters the University of Michigan.
1936Bachelor’s degrees in electrical engineering and in mathematics. Research assistant at MIT on Vannevar Bush’s differential analyzer.
1937Summer at Bell Telephone Laboratories. Master’s thesis, A Symbolic Analysis of Relay and Switching Circuits.
1938The thesis is published in the Transactions of the American Institute of Electrical Engineers.
1940PhD in mathematics at MIT, An Algebra for Theoretical Genetics, under Frank Hitchcock. National Research Fellow at the Institute for Advanced Study, Princeton, working under Hermann Weyl.
1941Joins Bell Labs as a research mathematician; wartime work on fire control and cryptography.
1943Early in the year, talks with Alan Turing in the Bell Labs cafeteria during Turing’s visit to the United States.
1945September: classified memorandum “A Mathematical Theory of Cryptography”.
1948“A Mathematical Theory of Communication”, Bell System Technical Journal, July and October.
194927 March: marries Mary Elizabeth (Betty) Moore. “Communication in the presence of noise”; “Communication theory of secrecy systems”; the book The Mathematical Theory of Communication with Warren Weaver.
1950“Programming a computer for playing chess”. Builds the maze-learning mouse Theseus.
1951“Prediction and entropy of printed English”.
1956Editorial “The Bandwagon”. Co-organizes the Dartmouth summer workshop on artificial intelligence. Elected to the National Academy of Sciences. Moves to MIT as visiting professor.
1958Donner Professor of Science at MIT.
1966National Medal of Science; IEEE Medal of Honor.
1972Harvey Prize of the Technion.
1973Gives the first Shannon Lecture of the IEEE information theory group, in Ashkelon, Israel.
1978Retires from MIT as professor emeritus.
1985Kyoto Prize in Basic Sciences.
2001Dies 24 February in Medford, Massachusetts, aged 84, after several years with Alzheimer’s disease.
Part I · Formation
Lesson 01

Gaylord and Ann Arbor, 1916–1936

Claude Elwood Shannon was born on 30 April 1916 in a hospital in Petoskey, Michigan, and grew up in the nearby small town of Gaylord. His father, also named Claude Elwood Shannon, was a businessman who served for a time as a probate judge. His mother, Mabel Wolf Shannon, taught languages and became principal of Gaylord High School.

As a boy he built things: model aeroplanes, a radio-controlled boat, and a telegraph line to a friend’s house half a mile away that used the wire of a barbed-wire fence. He delivered telegrams for Western Union. His hero was Thomas Edison, who turned out to be a distant relative. The habit of building gadgets stayed with him all his life and fed directly into his science.

Michigan

He graduated from Gaylord High School in 1932 and entered the University of Michigan in Ann Arbor. There he first met Boole’s algebra of logic. In 1936 he graduated with two bachelor’s degrees, one in electrical engineering and one in mathematics. The double training mattered: almost everything he did afterwards came from seeing an engineering problem with a mathematician’s eyes.

Lesson 02

MIT: relays and genetics, 1936–1940

In 1936 Shannon answered a notice for a research assistant to run Vannevar Bush’s differential analyzer at MIT. The analyzer was a room-sized mechanical computer that solved differential equations with shafts, gears and wheel-and-disc integrators. It was set up for each problem by a complex control circuit of relays. Shannon noticed that the relay circuits behaved like propositions in Boole’s logic. He spent the summer of 1937 at Bell Telephone Laboratories, where switching networks of exactly this kind ran the telephone system.

His master’s thesis, A Symbolic Analysis of Relay and Switching Circuits, submitted in August 1937 and published in 1938, worked this out in full (Lesson 04). The paper won the Alfred Noble Prize of the American engineering societies. Later writers have called it the most important master’s thesis of the century. It turned the design of switching circuits from an art into a calculation, and every digital computer’s logic is designed in its language.

A thesis in genetics

Bush then suggested that Shannon try algebra on another subject, and arranged for him to work at the Cold Spring Harbor laboratory on Long Island. The result was his doctoral thesis in mathematics, An Algebra for Theoretical Genetics (MIT, 1940), supervised by Frank Lauren Hitchcock. It gave an algebraic calculus for the distribution of genotypes in a population under random mating over several generations. Shannon never published it, and population geneticists did not see it until it was printed in his collected papers in 1993.

In January 1940 he married Norma Levor; they divorced the following year.

Lesson 03

Princeton, Bell Labs and the war, 1940–1945

In 1940–41 Shannon held a National Research Fellowship at the Institute for Advanced Study in Princeton, working under Hermann Weyl. He spent much of his time thinking about the transmission of information, the problem that would occupy him for the next eight years. In 1941 he joined Bell Labs in New Jersey as a research mathematician.

The war set his agenda. Under contracts with the National Defense Research Committee he worked on anti-aircraft fire control: predicting where an aircraft will be from noisy radar tracks. With Ralph Blackman and Hendrik Bode he wrote a report on data smoothing and prediction in fire-control systems, which treated the problem as separating a signal from noise, in parallel with Norbert Wiener’s classified work on prediction. He also worked on secure telephony, including the X System that protected transatlantic telephone conversations between Allied leaders.

Early in 1943 Alan Turing came to Bell Labs to study speech encipherment. Neither could tell the other about his secret work, but they met at tea in the cafeteria and talked about thinking machines; Turing showed Shannon his 1936 paper on computable numbers. In September 1945 Shannon finished a classified memorandum, “A Mathematical Theory of Cryptography”. Much of the theory of information appears there first, worked out for codebreaking. The declassified version became the 1949 secrecy paper (Lesson 08). The general theory came out in 1948.

Part II · The mathematics
Lesson 04

Switching algebra

For the general reader. A relay is a switch worked by an electromagnet. Two switches in a row let current through only if both are closed; two side by side let it through if either is. These are exactly “and” and “or” in logic. Shannon saw that a whole network of relays is therefore a formula in Boole’s algebra, and that simplifying the formula simplifies the circuit.

Goals
  • Translate series–parallel contact networks into Boolean expressions and back.
  • Use the Shannon expansion to design and simplify circuits.
  • Prove by counting that almost all Boolean functions need very large circuits.

The calculus of contacts

Give each contact a variable that is 1 when the contact conducts and 0 when it does not. A series connection conducts when both parts do, so it corresponds to the product \(xy\). A parallel connection conducts when either does, so it corresponds to \(x+y\) with \(1+1=1\). A contact that is closed when relay \(X\) is unenergized corresponds to the complement \(x'\). Shannon’s 1938 paper used the dual convention: his variable was the hindrance, 0 for a closed contact, so that series became sum and parallel became product. The two conventions are interchanged by De Morgan’s laws, and engineers soon adopted the one used here.

Theorem (Shannon expansion)

For every Boolean function \(f(x_1,\dots,x_n)\) and every \(i\),

\[ f = x_i\, f\big|_{x_i=1} + x_i'\, f\big|_{x_i=0}, \]

where \(f|_{x_i=c}\) denotes \(f\) with \(x_i\) set to \(c\). Iterating over all variables gives the disjunctive normal form \(f=\sum_{\varepsilon\in\{0,1\}^n} f(\varepsilon)\,x_1^{\varepsilon_1}\cdots x_n^{\varepsilon_n}\), with \(x^1=x\), \(x^0=x'\).

Proof. Both sides are Boolean functions; check them at \(x_i=1\) and at \(x_i=0\). At \(x_i=1\) the right side is \(f|_{x_i=1}+0\); at \(x_i=0\) it is \(f|_{x_i=0}\). ∎ The expansion is Boole’s, from his books of 1847 and 1854; Shannon made it the basic tool of circuit synthesis. In circuit terms it is a transfer contact on relay \(X_i\) that routes the current to one of two smaller networks.

How big must a circuit be?

In “The synthesis of two-terminal switching circuits” (1949) Shannon asked how many contacts are needed to realize a function of \(n\) variables. There are \(2^{2^n}\) functions, a huge number, while the number of small networks is comparatively modest. A counting argument then shows that most functions need large networks.

Theorem (Shannon, 1949)

For every \(\varepsilon>0\), the fraction of Boolean functions of \(n\) variables that can be realized by a two-terminal contact network with fewer than \((1-\varepsilon)\,2^n/n\) contacts tends to 0 as \(n\to\infty\). On the other hand, every function of \(n\) variables can be realized with \(O(2^n/n)\) contacts.

The lower bound is proved by showing that the number of networks with \(k\) contacts is at most about \((Ckn)^k\) for a constant \(C\), and comparing with \(2^{2^n}\) (Exercise 4.3 does the same for gate circuits). Oleg Lupanov showed in 1958 that \((1+\varepsilon)2^n/n\) contacts always suffice, so the constant is sharp. The paradox Shannon left behind is that although almost every function is hard, no one can name a specific function proved to need large circuits. That gap is still at the centre of complexity theory.

Exercise 4.1A network has two branches in parallel: contacts \(x\) and \(y\) in series, and contacts \(x\), \(y'\) and \(z\) in series. Simplify it.

Show solution
The function is \(xy+xy'z=x(y+y'z)=x(y+z)\), using \(y+y'z=(y+y')(y+z)=y+z\). The five contacts become three: \(x\) in series with \(y\parallel z\).

Exercise 4.2Use the Shannon expansion on \(x\) to design a network for the majority function \(m(x,y,z)=xy+yz+zx\).

Show solution
\(m|_{x=1}=y+z\) and \(m|_{x=0}=yz\). So \(m=x(y+z)+x'yz\): a transfer contact on \(x\) leads either to \(y\parallel z\) or to \(y\) in series with \(z\). Since \(m=yz+x(y+z)\) also holds, the \(x'\) contact can be dropped, giving five contacts.

Exercise 4.3A circuit with \(s\) gates, each computing one of the 16 Boolean functions of two earlier wires (inputs or gates), can be described by a list of \(s\) choices. Show there are at most \(\big(16(n+s)^2\big)^s\) such circuits, and deduce that for large \(n\) almost all functions of \(n\) variables need more than \(2^n/(4n)\) gates.

Show solution
Each gate picks a function (16 ways) and two inputs among at most \(n+s\) wires. Take \(s=2^n/(4n)\). For \(n\ge2\), \(n+s\le2^n\), so the count is at most \(2^{s(4+2n)}=2^{2^n(2n+4)/(4n)}=2^{2^n(1/2+1/n)}\). The fraction of all \(2^{2^n}\) functions computable this way is at most \(2^{-2^n(1/2-1/n)}\to0\). Circuits with fewer gates are included by padding with dummy gates.
Lesson 05

Entropy and source coding

For the general reader. How much information is in a message? Shannon’s answer ignores meaning and looks only at uncertainty. A fair coin toss carries one bit. A message from a predictable source, like English text where “q” is almost always followed by “u”, carries less per symbol than its length suggests, and can be compressed. Shannon’s entropy measures exactly how far: no lossless code can do better on average, and good codes come arbitrarily close.

Goals
  • Define entropy and see why it is essentially the only reasonable measure of uncertainty.
  • State and prove the source coding theorem through the asymptotic equipartition property.
  • Bound the length of optimal prefix codes.

Entropy

Shannon built on Harry Nyquist’s 1924 and Ralph Hartley’s 1928 papers at Bell Labs; Hartley had measured information by the logarithm of the number of possible messages. Shannon added probability. For a random variable \(X\) taking values with probabilities \(p_1,\dots,p_n\),

\[ H(X) = -\sum_{i=1}^n p_i\log p_i \quad\text{bits},\qquad 0\log0=0. \]

Shannon took the name from statistical mechanics, where the same expression, with Boltzmann’s constant in place of the base-2 logarithm, is the Gibbs entropy. He credited John Tukey with the word “bit”.

Theorem (Shannon, 1948, Appendix 2)

Let \(H(p_1,\dots,p_n)\) be defined for all probability vectors, and suppose (i) \(H\) is continuous in the \(p_i\); (ii) \(A(n)=H(\tfrac1n,\dots,\tfrac1n)\) increases with \(n\); (iii) if a choice is split into two successive choices, \(H\) is the weighted sum: \(H(p_1,\dots,p_n)=H(p_1+p_2,p_3,\dots,p_n)+(p_1+p_2)\,H\big(\tfrac{p_1}{p_1+p_2},\tfrac{p_2}{p_1+p_2}\big)\). Then \(H=-K\sum p_i\log p_i\) for a positive constant \(K\).

Proof sketch. Grouping \(s^m\) equally likely outcomes into \(s^{m-1}\) groups of \(s\) gives \(A(s^m)=mA(s)\). Comparing \(s^m\le t^n<s^{m+1}\) and using monotonicity shows \(A(t)/A(s)=\log t/\log s\), so \(A(n)=K\log n\). For rational probabilities \(p_i=n_i/N\), view a choice among \(N\) equal outcomes as a choice of \(i\) followed by a choice among \(n_i\); then \(K\log N=H(p)+\sum p_iK\log n_i\), which gives the formula. Continuity extends it to all \(p\). ∎

The source coding theorem

Let \(X_1,X_2,\dots\) be independent copies of \(X\). By the weak law of large numbers applied to \(-\log p(X_i)\),

\[ -\frac1n\log p(X_1,\dots,X_n) \longrightarrow H(X) \quad\text{in probability.} \]

This is the asymptotic equipartition property. It says that for large \(n\) almost all probability sits on a typical set of about \(2^{nH}\) sequences, each of probability about \(2^{-nH}\).

Theorem (source coding, Shannon 1948)

Let a memoryless source have entropy \(H\) bits per symbol. For every \(R>H\) there are block codes that map \(n\) symbols to \(\lceil nR\rceil\) bits and from which the source sequence can be recovered with error probability tending to 0 as \(n\to\infty\). For every \(R<H\), the error probability of any such codes tends to 1.

For lossless variable-length codes the corresponding statement is sharp at every block length. A prefix code is one in which no codeword begins another, so that a stream can be cut into codewords without separators.

Theorem (Kraft inequality and Shannon’s bound)

Binary prefix codes with codeword lengths \(\ell_1,\dots,\ell_n\) exist if and only if \(\sum_i2^{-\ell_i}\le1\). Consequently every prefix code for \(X\) has expected length \(\bar L\ge H(X)\), and the lengths \(\ell_i=\lceil-\log p_i\rceil\) give a prefix code with \(\bar L<H(X)+1\).

Proof of the bound. With \(q_i=2^{-\ell_i}/\sum_j2^{-\ell_j}\), \(\bar L-H=\sum p_i\log(p_i/q_i)-\log\sum_j2^{-\ell_j}\ge0\), since the first term is a Kullback–Leibler divergence and the second is non-negative by Kraft. The lengths \(\lceil-\log p_i\rceil\) satisfy Kraft and are less than \(-\log p_i+1\). ∎ Coding blocks of \(k\) symbols brings the cost per symbol within \(1/k\) of \(H\). Shannon’s construction, and a similar one by Robert Fano, are not always optimal; David Huffman, a student in Fano’s class, found the optimal algorithm in 1952.

Exercise 5.1A source emits A, B, C, D with probabilities \(\tfrac12,\tfrac14,\tfrac18,\tfrac18\). Compute \(H\) and find a prefix code achieving it.

Show solution
\(H=\tfrac12\cdot1+\tfrac14\cdot2+\tfrac18\cdot3+\tfrac18\cdot3=1.75\) bits. The code A = 0, B = 10, C = 110, D = 111 has expected length 1.75. Equality holds because every probability is a power of \(\tfrac12\).

Exercise 5.2Show that \(0\le H(X)\le\log n\) for \(X\) with \(n\) values, with equality on the right only for the uniform distribution.

Show solution
Each term \(-p_i\log p_i\ge0\). For the upper bound, \(\log n-H=\sum p_i\log(np_i)=D(p\,\|\,u)\ge0\), where \(u\) is uniform, by Jensen’s inequality applied to the concave \(\log\): \(\sum p_i\log\frac{1}{np_i}\le\log\sum p_i\frac1{np_i}=0\). Equality in Jensen requires \(np_i\) constant, so \(p=u\).

Exercise 5.3A biased coin has \(P(\text{heads})=0.9\). Compute its entropy. Why can a single toss not be coded in fewer than 1 bit, while long sequences can be coded at about 0.47 bits per toss?

Show solution
\(H=-0.9\log0.9-0.1\log0.1\approx0.137+0.332=0.469\) bits. A codeword has a whole number of bits, so one toss costs at least 1 bit. For blocks of \(k\) tosses the bound \(H\le\bar L/k<H+1/k\) applies, so the cost per toss approaches 0.469.
Lesson 06

Channel capacity

For the general reader. Before 1948 engineers assumed that to make errors rarer on a noisy line you had to send more slowly, and that error-free transmission needed an infinitely slow rate. Shannon proved the opposite. Every channel has a capacity. Below it, clever coding makes errors as rare as you like at a fixed rate; above it, no coding can. The result was a complete surprise, and it set the goal that coding theorists spent the next fifty years trying to reach.

Goals
  • Define mutual information and capacity for discrete memoryless channels.
  • State the noisy-channel coding theorem and sketch random coding and the converse.
  • Compute the capacity of the binary symmetric and erasure channels.

Mutual information

A discrete memoryless channel is a family of conditional distributions \(p(y\mid x)\) from an input alphabet to an output alphabet, used independently at each time step. For an input distribution \(p(x)\), define the conditional entropy \(H(X\mid Y)=-\sum_{x,y}p(x,y)\log p(x\mid y)\) and the mutual information

\[ I(X;Y)=H(X)-H(X\mid Y)=H(Y)-H(Y\mid X)=\sum_{x,y}p(x,y)\log\frac{p(x,y)}{p(x)p(y)}. \]

Shannon called \(H(X\mid Y)\) the equivocation: the uncertainty about what was sent that remains after receiving. The capacity is \(C=\max_{p(x)}I(X;Y)\).

Theorem (noisy-channel coding, Shannon 1948)

Let a discrete memoryless channel have capacity \(C\). For every \(R<C\) and \(\varepsilon>0\), for all large \(n\) there is a code of \(\lceil2^{nR}\rceil\) codewords of length \(n\) and a decoder whose probability of error is less than \(\varepsilon\) for every message. Conversely, for any sequence of codes with rate \(R>C\), the average error probability is bounded away from 0.

Proof sketch

Achievability by random coding. Fix the capacity-achieving \(p(x)\) and choose every symbol of every codeword independently from it. Decode \(y^n\) to the unique codeword that is jointly typical with it. The true codeword is jointly typical with high probability by the AEP. A fixed wrong codeword, independent of \(y^n\), is jointly typical with probability about \(2^{-nI(X;Y)}\). With \(2^{nR}\) wrong codewords, the union bound gives a total error of about \(2^{-n(I-R)}\to0\). The average over random codes is small, so some code is good; discarding the worse half of its codewords makes the maximal error small too. Shannon’s argument was a sketch; Amiel Feinstein (1954) and Jacob Wolfowitz (1957) made it rigorous.

Converse. Let the message \(W\) be uniform on \(2^{nR}\) values and \(P_e\) the error probability. Fano’s inequality gives \(H(W\mid Y^n)\le1+P_e\,nR\). The channel is memoryless, so \(I(W;Y^n)\le I(X^n;Y^n)\le nC\). Then \(nR=H(W)\le1+P_enR+nC\), so \(P_e\ge1-C/R-1/(nR)\), bounded away from 0 when \(R>C\). ∎

The proof shows that good codes exist, since random ones work, but it gives no practical way to decode them. Constructing codes that approach capacity with efficient decoding took decades: Robert Gallager’s low-density parity-check codes (1960), turbo codes (1993) and polar codes (Erdal Arıkan, 2009).

Exercise 6.1The binary symmetric channel flips each bit independently with probability \(p\). Show that its capacity is \(C=1-H(p)\), where \(H(p)=-p\log p-(1-p)\log(1-p)\). Evaluate at \(p=0.11\).

Show solution
\(I(X;Y)=H(Y)-H(Y\mid X)\). Given \(X\), \(Y\) is flipped with probability \(p\), so \(H(Y\mid X)=H(p)\) for every input distribution. \(H(Y)\le1\), with equality for uniform input. So \(C=1-H(p)\). At \(p=0.11\): \(H\approx0.11(3.184)+0.89(0.168)\approx0.350+0.150=0.500\), so \(C\approx0.5\) bit per use: the crossing point in the graph at the top of the page.

Exercise 6.2The binary erasure channel delivers each bit correctly with probability \(1-\alpha\) and otherwise outputs “?”. Show \(C=1-\alpha\).

Show solution
Let \(P(X=1)=\pi\). Given \(Y\ne{?}\), \(X\) is known; given \(Y={?}\) (probability \(\alpha\), independent of \(X\)), \(X\) has its prior distribution. So \(H(X\mid Y)=\alpha H(\pi)\) and \(I=(1-\alpha)H(\pi)\), maximized at \(\pi=\tfrac12\): \(C=1-\alpha\). The answer is intuitive: a fraction \(\alpha\) of the uses is lost, and if the sender knew which, it could simply avoid them.

Exercise 6.3On a binary symmetric channel with \(p=0.1\), compare the triple-repetition code (send each bit three times, decode by majority) with what the coding theorem promises.

Show solution
Repetition fails when at least two of three bits flip: \(3p^2(1-p)+p^3=0.027+0.001=0.028\). The rate is \(1/3\). Capacity is \(1-H(0.1)\approx1-0.469=0.531\). The theorem promises codes at rate 0.5, say, with error probability below \(10^{-9}\) or any other target, given long enough blocks. Repetition buys a modest reduction in error at a large cost in rate.
Lesson 07

Sampling and the Gaussian channel

For the general reader. Telephone lines and radio links carry continuous waveforms, not bits. Shannon showed how to bring them into the same framework. A signal that contains no frequencies above \(W\) is completely determined by \(2W\) samples per second. With noise added, each sample can carry only a limited number of bits, and the resulting formula for capacity, \(W\log(1+S/N)\), is the most famous equation in communication engineering.

Goals
  • State and prove the sampling theorem.
  • Derive the capacity of the band-limited Gaussian channel by sphere packing.
  • Find the minimum energy per bit.

Sampling

The sampling theorem was published by Shannon in “Communication in the presence of noise” (Proceedings of the IRE, January 1949). He noted that it was common knowledge in the communication art. Edmund Whittaker (1915), Vladimir Kotelnikov (1933) and Nyquist had given versions; Shannon’s paper made it standard.

Theorem (sampling)

Let \(f\in L^2(\mathbb R)\) have Fourier transform supported in \([-W,W]\) (frequencies in hertz). Then

\[ f(t)=\sum_{n=-\infty}^{\infty} f\!\left(\frac{n}{2W}\right)\operatorname{sinc}(2Wt-n),\qquad \operatorname{sinc}(x)=\frac{\sin\pi x}{\pi x}, \]

with convergence in \(L^2\) and uniformly on \(\mathbb R\).

Proof. Write \(f(t)=\int_{-W}^{W}F(\nu)e^{2\pi i\nu t}d\nu\). Expand \(F\) on \([-W,W]\) in the Fourier series \(F(\nu)=\sum_nc_ne^{-2\pi i n\nu/2W}\), where \(c_n=\frac1{2W}\int F(\nu)e^{2\pi in\nu/2W}d\nu=\frac1{2W}f(\tfrac n{2W})\). Substitute and integrate term by term: \(\int_{-W}^{W}e^{2\pi i\nu(t-n/2W)}d\nu=2W\operatorname{sinc}(2Wt-n)\). ∎

So a band-limited signal of duration \(T\) has about \(2WT\) degrees of freedom: it is a point in a space of dimension \(2WT\).

The Gaussian channel

Suppose each sample \(x_i\) is received as \(y_i=x_i+z_i\), with \(z_i\) independent Gaussian noise of variance \(N\), and the transmitter has average power \(P\), so that \(\frac1n\sum x_i^2\le P\).

Theorem (Shannon, 1948–49)

The capacity of this channel is \(C=\tfrac12\log\big(1+\tfrac PN\big)\) bits per sample. For a channel of bandwidth \(W\) with white Gaussian noise of one-sided spectral density \(N_0\), so \(N=N_0W\) in the band, this gives

\[ C=W\log_2\!\left(1+\frac{P}{N_0W}\right)\ \text{bits per second}. \]

Sphere-packing picture. A codeword is a point in \(\mathbb R^n\) of norm at most \(\sqrt{nP}\). Noise moves it to a nearby point; by the law of large numbers the received point lies, with high probability, near the surface of a sphere of radius \(\sqrt{nN}\) about the codeword. All received vectors lie in a sphere of radius \(\sqrt{n(P+N)}\). Decoding works if the noise spheres barely overlap, so the number of codewords is at most about the ratio of volumes,

\[ \left(\frac{\sqrt{n(P+N)}}{\sqrt{nN}}\right)^{n}=\left(1+\frac PN\right)^{n/2}, \]

that is, \(\tfrac12\log(1+P/N)\) bits per sample. Shannon showed by random coding on the sphere that this rate can actually be achieved. The analytic proof uses differential entropy \(h(Z)=-\int p\log p\), and the fact that among densities with variance \(\sigma^2\) the Gaussian maximizes it, with \(h=\tfrac12\log(2\pi e\sigma^2)\). Then \(I(X;Y)=h(Y)-h(Z)\le\tfrac12\log2\pi e(P+N)-\tfrac12\log2\pi eN\).

Exercise 7.1A telephone channel has bandwidth 3000 Hz and signal-to-noise ratio 30 dB. Estimate its capacity.

Show solution
30 dB means \(P/N=1000\). \(C=3000\log_2(1001)\approx3000\times9.97\approx29{,}900\) bits per second. Dial-up modems of the 1990s, at 28.8 and 33.6 kbit/s, operated near this limit.

Exercise 7.2Let \(E_b=P/R\) be the energy per bit at rate \(R\). Show that reliable communication requires \(E_b/N_0\ge\ln2\approx0.693\) (about \(-1.59\) dB), however large the bandwidth.

Show solution
We need \(R\le W\log_2(1+P/(N_0W))\). Since \(\log_2(1+u)\le u/\ln2\), \(R\le P/(N_0\ln2)\), with the bound approached as \(W\to\infty\). Dividing by \(R\): \(1\le E_b/(N_0\ln2)\). This “Shannon limit” is the benchmark for power-limited links such as deep-space probes.

Exercise 7.3Show that \(\operatorname{sinc}(2Wt-n)\) equals 1 at \(t=n/2W\) and 0 at every other sample point \(m/2W\). Why does this make the sampling series an interpolation formula?

Show solution
At \(t=m/2W\) the argument is \(m-n\), an integer, and \(\sin\pi(m-n)=0\) unless \(m=n\), where the limit is 1. So at each sample time exactly one term of the series survives, and the series reproduces the sample values exactly; between samples it fills in the unique band-limited interpolant.
Lesson 08

Secrecy systems

For the general reader. Before Shannon, cryptography was a craft of clever tricks. His 1949 paper treated a cipher as a noisy channel deliberately built to confuse the enemy, and asked what security can be proved. He showed that unbreakable secrecy is possible but expensive: the secret key must be as long as the message. He also showed that natural language is so redundant that, with an ordinary cipher, a few dozen letters of intercepted text usually determine the key.

Goals
  • Define perfect secrecy and prove that the one-time pad achieves it.
  • Prove that perfect secrecy requires as much key as message.
  • Estimate the unicity distance of classical ciphers from the redundancy of English.

A secrecy system has a message \(M\), a key \(K\) chosen independently of \(M\), and a cryptogram \(E=e_K(M)\), from which \(M\) can be recovered when \(K\) is known. The enemy knows the system and the probability distributions, but not the key.

Definition and theorem (Shannon, 1949)

The system has perfect secrecy if \(P(M=m\mid E=c)=P(M=m)\) for all \(m,c\), equivalently \(I(M;E)=0\). If a system has perfect secrecy, then \(H(K)\ge H(M)\); in particular, the number of keys is at least the number of messages of positive probability. The one-time pad on \(n\)-bit messages, \(E=M\oplus K\) with \(K\) uniform on \(\{0,1\}^n\), has perfect secrecy.

Proof. \(M\) is determined by \(E\) and \(K\), so \(H(M\mid E,K)=0\). Then \(H(M)=H(M\mid E)\le H(M,K\mid E)=H(K\mid E)+H(M\mid E,K)=H(K\mid E)\le H(K)\), where the first equality is perfect secrecy. For the pad: for any \(m\) and \(c\), \(P(E=c\mid M=m)=P(K=c\oplus m)=2^{-n}\), independent of \(m\). ∎ The pad itself goes back to Gilbert Vernam’s teleprinter cipher of 1917; Shannon proved it secure and proved that nothing cheaper can be.

Equivocation and unicity distance

For a practical cipher with a short key, the enemy’s uncertainty about the key, the key equivocation \(H(K\mid E_1\dots E_n)\), decreases as more cryptogram letters \(E_1,\dots,E_n\) are intercepted. If the language has entropy \(H_L\) bits per letter in an alphabet of size \(A\), its redundancy per letter is \(D=\log A-H_L\). Each intercepted letter then removes about \(D\) bits of uncertainty about the key, until none remains.

Estimate (unicity distance)

For a “random cipher” model, the key equivocation falls to about zero after

\[ U\approx\frac{H(K)}{D} \]

letters of cryptogram. Beyond \(U\), a solution is typically unique; below it, many keys give meaningful decipherments.

Shannon’s companion paper “Prediction and entropy of printed English” (1951) estimated \(H_L\) by asking people to guess the next letter of a text. He found roughly 0.6 to 1.3 bits per letter once long-range context is used, against \(\log27\approx4.75\) for 26 letters and a space. English is therefore more than half redundant. The 1949 secrecy paper also introduced the ideas of confusion and diffusion that still guide the design of block ciphers.

Exercise 8.1Estimate the unicity distance of a simple substitution cipher on 26 letters, taking \(D\approx3.2\) bits per letter.

Show solution
There are \(26!\) equally likely keys, \(H(K)=\log_226!\approx88.4\) bits. \(U\approx88.4/3.2\approx28\) letters. Shannon gave about 30, in line with the experience of cryptanalysts that a newspaper cryptogram of a few lines has a unique solution.

Exercise 8.2A careless user encrypts two messages \(M_1,M_2\) with the same one-time pad key. What does the enemy learn?

Show solution
\(E_1\oplus E_2=M_1\oplus M_2\): the key cancels. The enemy now has the XOR of two redundant texts, which can typically be separated by guessing likely words, as in the American Venona project against reused Soviet pads. The theorem’s condition \(H(K)\ge H(M)\) is violated: the key carries \(n\) bits, the pair of messages up to \(2n\).

Exercise 8.3A Vigenère cipher uses a random key of 12 letters. Estimate its unicity distance with \(D\approx3.2\).

Show solution
\(H(K)=12\log_226\approx56.4\) bits, so \(U\approx56.4/3.2\approx18\) letters. In practice an analyst needs much more text to find the key, because the estimate counts information, not computational effort. Shannon distinguished the two: a cipher may be theoretically breakable yet practically secure if breaking it requires infeasible work.
Lesson 09

Games, mazes and reliable machines

For the general reader. After 1948 Shannon turned his playful inventiveness on the new computers. He wrote the first serious analysis of how a computer could play chess, built a mechanical mouse that learned its way through a maze, showed how to build reliable machines from unreliable parts, and found the smallest number of internal states a universal computer needs. Much of early artificial intelligence and fault-tolerant computing starts from these papers.

Goals
  • Understand minimax search with an evaluation function, and Shannon’s estimate of the size of chess.
  • Analyse how redundant relay networks amplify reliability.
  • Meet Shannon’s two-state universal Turing machine.

Chess

“Programming a computer for playing chess” (Philosophical Magazine, 1950) begins from the fact that chess is a finite game of perfect information.

Theorem (value of finite games)

In a finite two-player zero-sum game of perfect information, the value \(v\) of each position defined by backward induction, \(v(\text{terminal})=\) its payoff, \(v(s)=\max_{s'}v(s')\) if the first player is to move and \(\min_{s'}v(s')\) otherwise, is the outcome under optimal play. Either player can guarantee it.

So chess is in principle trivial, and in practice impossible to solve. Shannon estimated about \(10^3\) possibilities for a pair of moves (one by each side) and about 40 move pairs in a typical game, so about \(10^{120}\) games, now called the Shannon number. He proposed instead to search a few moves ahead and apply an evaluation function to the positions reached, scoring material, pawn structure and mobility, and to back the values up by minimax. He distinguished “type A” programs, which search every line to a fixed depth, from “type B” programs, which search selectively, as human players do. Computer chess followed this plan until Deep Blue defeated Garry Kasparov in 1997.

In 1950 he built, with Betty Shannon’s help, Theseus, a mouse on magnets moved beneath a maze of 25 squares by a relay circuit. It explored by trial and error, remembered in relays which exit had worked from each square, and then ran the maze directly. If the maze was changed it relearned. He demonstrated it at the Macy conference on cybernetics in 1951.

Reliable circuits from unreliable relays

In 1956 Edward F. Moore and Shannon answered a question raised by John von Neumann: can arbitrarily reliable computation be done with unreliable parts? Suppose each contact is closed with probability \(p\), independently. A network built from such contacts is closed with a probability \(h(p)\), a polynomial in \(p\).

Theorem (Moore–Shannon, 1956)

For every two-terminal contact network other than a single contact, \(h(p)\) crosses the line \(h=p\) at most once in \((0,1)\), and from below. Consequently, given contacts that close with probability \(a\) when they should be closed and with probability \(c<a\) when they should be open, for every \(\varepsilon>0\) there is a network of such contacts that is closed with probability above \(1-\varepsilon\) and below \(\varepsilon\) in the two cases.

The idea is amplification: a network with \(h(p)>p\) above the crossing point and \(h(p)<p\) below it pushes probabilities apart, and composing networks (substituting a copy for each contact) iterates \(h\). Choosing networks whose crossing point lies between \(c\) and \(a\) and iterating drives \(a\) towards 1 and \(c\) towards 0.

A two-state universal machine

In Automata Studies (1956), which he edited with John McCarthy, Shannon showed that a universal Turing machine can be built with only two internal states, at the price of a large tape alphabet, and that one state is not enough. He also showed that two tape symbols suffice, at the price of many states. The product of states and symbols became the standard measure of the size of a universal machine.

Exercise 9.1Two pairs of contacts in series are connected in parallel. Show that \(h(p)=2p^2-p^4\), find the crossing point, and check that the network improves reliable contacts and degrades unreliable ones.

Show solution
Each series pair is closed with probability \(p^2\); the parallel combination is open only if both pairs are open: \(h=1-(1-p^2)^2=2p^2-p^4\). Solving \(h(p)=p\) with \(p\ne0\): \(2p-p^3=1\), i.e. \((p-1)(p^2+p-1)=0\), so \(p=(\sqrt5-1)/2\approx0.618\). For example \(h(0.9)=0.964\) but \(h(0.5)=0.4375\).

Exercise 9.2Apply the minimax rule to a game tree in which the first player chooses between moves A and B, after which the second player chooses between two replies. The leaf values are (A: 3, 12) and (B: 8, 2). What should the first player do, and which leaf need not be evaluated if A is searched first and B’s first reply is the 2?

Show solution
The second player minimizes: \(v(A)=3\), \(v(B)=2\). The first player maximizes and picks A, value 3. If A is searched first, its value is 3; when B’s first reply already gives 2 < 3, B cannot be better than 2 for the first player, so the remaining leaf (8) need not be examined. This is alpha–beta pruning, the refinement of Shannon’s scheme introduced later in the 1950s.

Exercise 9.3Check the Shannon number: with about \(10^3\) choices per move pair and 40 move pairs, how many games are there? Compare with roughly \(10^{80}\) atoms in the observable universe.

Show solution
\((10^3)^{40}=10^{120}\), which exceeds the number of atoms by a factor of \(10^{40}\). Even examining one game per atom per nanosecond for the age of the universe (about \(4\times10^{26}\) ns) leaves the search incomplete by many orders of magnitude.
Lesson 10

After 1948: zero error and distortion

For the general reader. Shannon kept extending his theory in a handful of papers, each opening a field. One asked what rate is possible if errors are forbidden outright, not merely made rare; the answer turned into a deep problem in graph theory. Another asked how much information is needed to reproduce a source only approximately, which is the mathematics behind every compressed photo and song.

Goals
  • Define the zero-error capacity and compute a lower bound for the pentagon.
  • State the rate–distortion theorem and compute \(R(D)\) for binary and Gaussian sources.
  • Note the result that feedback does not increase capacity.

Zero-error capacity (1956)

Call two inputs of a channel confusable if some output can arise from both, and let \(G\) be the graph on the inputs with confusable pairs joined. A zero-error code of length 1 is an independent set in \(G\). For length \(n\), two input words are confusable if they are confusable or equal in every coordinate; this is the strong product \(G^{\boxtimes n}\).

Definition (Shannon, 1956)

The zero-error capacity is \(C_0=\log\Theta(G)\), where \(\Theta(G)=\lim_{n\to\infty}\alpha(G^{\boxtimes n})^{1/n}=\sup_n\alpha(G^{\boxtimes n})^{1/n}\) and \(\alpha\) is the size of a largest independent set. In general \(\alpha(G)\le\Theta(G)\le\) the fractional bound Shannon gave.

Shannon computed \(\Theta\) for every graph with at most five vertices except the pentagon \(C_5\), for which he showed \(\sqrt5\le\Theta(C_5)\le5/2\). László Lovász proved \(\Theta(C_5)=\sqrt5\) in 1979 with his theta function. \(\Theta(C_7)\) is still unknown. The same 1956 paper proved that feedback from receiver to sender does not increase the ordinary capacity of a memoryless channel.

Rate–distortion (1959)

Let a source emit independent symbols \(X\), let \(d(x,\hat x)\ge0\) measure the cost of reproducing \(x\) as \(\hat x\), and allow average distortion \(D\).

Theorem (Shannon, 1959)

The minimum number of bits per symbol needed to describe the source so that it can be reproduced with expected distortion at most \(D\) is

\[ R(D)=\min_{p(\hat x\mid x):\ \mathbb E\,d(X,\hat X)\le D} I(X;\hat X). \]

For a fair binary source with Hamming distortion, \(R(D)=1-H(D)\) for \(0\le D\le\tfrac12\). For a Gaussian source of variance \(\sigma^2\) with squared error, \(R(D)=\tfrac12\log(\sigma^2/D)\) for \(D\le\sigma^2\): each extra bit cuts the mean-square error by a factor of 4. Shannon also observed the duality between this problem and channel coding, and in 1961 opened multi-user information theory with a paper on two-way channels.

Exercise 10.1Label the vertices of \(C_5\) by \(\mathbb Z/5\), with \(i\) and \(i\pm1\) adjacent. Show that \(\{(i,2i\bmod5):i\in\mathbb Z/5\}\) is an independent set in \(C_5\boxtimes C_5\), and deduce \(\Theta(C_5)\ge\sqrt5\).

Show solution
Two distinct pairs \((i,2i)\) and \((j,2j)\) are adjacent in the strong product only if \(i-j\in\{0,\pm1\}\) and \(2i-2j\in\{0,\pm1\}\). With \(i\ne j\), \(i-j=\pm1\) forces \(2(i-j)=\pm2\notin\{0,\pm1\}\) mod 5. So the five pairs are independent, \(\alpha(C_5^{\boxtimes2})\ge5\), and \(\Theta\ge5^{1/2}\). Since \(\alpha(C_5)=2\), coding over pairs beats single letters: \(\sqrt5\approx2.236>2\).

Exercise 10.2A fair binary source may be reproduced with up to 11% of bits wrong. How many bits per symbol are needed? How does this compare with simply dropping bits?

Show solution
\(R(0.11)=1-H(0.11)\approx0.5\) bit per symbol. Sending only half the bits and guessing the rest at random gives distortion \(\tfrac12\cdot\tfrac12=0.25\) at the same rate, more than twice as large. Rate–distortion coding achieves 0.11 by quantizing long blocks jointly.

Exercise 10.3For a Gaussian source, how many bits per sample give a signal-to-distortion ratio of 60 dB?

Show solution
\(\sigma^2/D=10^6\), so \(R=\tfrac12\log_210^6\approx\tfrac12(19.93)\approx10\) bits per sample: the familiar rule of about 6 dB per bit.
Part III · Life and legacy
Lesson 11

Bell Labs and MIT, 1948–1978

“A Mathematical Theory of Communication” appeared in the Bell System Technical Journal in July and October 1948. In 1949 it was reprinted as a book, The Mathematical Theory of Communication, with an expository essay by Warren Weaver of the Rockefeller Foundation; the change from “A” to “The” in the title marked how quickly it had been accepted. On 27 March 1949 Shannon married Mary Elizabeth (Betty) Moore, a numerical analyst at Bell Labs, who worked with him on several of his machines.

Fame came fast, and Shannon was uneasy with it. Information theory was applied to psychology, biology, linguistics and economics, often loosely. In 1956 he wrote a one-page editorial, “The Bandwagon”, warning that the theory was not a universal solvent and asking for careful work. The same year he helped organize, with John McCarthy, Marvin Minsky and Nathaniel Rochester, the Dartmouth summer workshop that gave artificial intelligence its name. In 1951 he had joined a classified advisory group on cryptology for the government.

MIT

In 1956 Shannon went to MIT as a visiting professor, and in 1958 he became Donner Professor of Science, a post he held until 1978, when he became professor emeritus. He kept a consulting connection with Bell Labs. He published less and less, preferring to work on problems that amused him. His doctoral students at MIT included Ivan Sutherland, whose 1963 thesis Sketchpad founded interactive computer graphics, Heinrich Ernst, who built an early computer-controlled robot hand. Danny Hillis, later designer of the Connection Machine, is also listed among his students.

His interests included the stock market and gambling. He pointed his colleague Edward Thorp to John Kelly’s 1956 paper on betting with inside information, which gives the optimal fraction of capital to wager in terms of information rates. With Thorp he built a small wearable computer, about 1961, to predict roulette. At home he built juggling machines, a calculator working in Roman numerals (THROBAC), and a machine that solved Rubik’s Cube. He juggled and rode a unicycle, and he formulated a juggling theorem relating the times balls spend in the air and in the hand. In 1965, on a visit to the Soviet Union, he played a game of chess with the world champion Mikhail Botvinnik.

DiscussionShannon’s 1948 theory deliberately excluded meaning. Read “The Bandwagon” and Weaver’s essay. Where did later applications of information theory to biology or psychology respect Shannon’s warning, and where did they not?

Lesson 12

Last years and legacy

In 1973 Shannon was the first recipient of the Shannon Award of the IEEE information theory group, and he gave the first Shannon Lecture, in Ashkelon, Israel. He received the National Medal of Science in 1966, the IEEE Medal of Honor in the same year, the Harvey Prize in 1972 and the Kyoto Prize in 1985. He had been elected to the National Academy of Sciences in 1956. In 1985 he made a surprise appearance at the International Symposium on Information Theory in Brighton, England, where participants lined up for his autograph.

From the mid-1990s he suffered from Alzheimer’s disease, and he spent his last years in a nursing home. He died on 24 February 2001 in Medford, Massachusetts, aged 84.

Legacy

  • Digital logic: switching algebra, from the 1937 thesis, is the language of every logic design tool.
  • Communication: capacity is the target of all modern coding. LDPC, turbo and polar codes now operate within a fraction of a decibel of Shannon’s limit in mobile telephony, Wi-Fi, satellite links and deep-space probes.
  • Compression: lossless compression rests on the source coding theorem, and audio, image and video coding on rate–distortion theory.
  • Cryptography: the 1949 paper turned cryptography into a mathematical science; perfect secrecy, unicity distance, confusion and diffusion remain standard concepts.
  • Mathematics: information theory became a branch of probability, with links to statistics, ergodic theory (Kolmogorov–Sinai entropy), combinatorics (the Shannon capacity of graphs) and quantum physics (quantum information).
  • Computing and AI: computer chess, learning machines, fault tolerance and the minimal universal machine all start from his papers.

Final projectRead Part I of the 1948 paper (the discrete noiseless case). Write a two-page account for a strong undergraduate that states the source coding theorem in modern notation, works one example of a Markov source in full, and explains one place where Shannon’s argument is a sketch that later authors had to complete.

Reference

Sources and further reading

Biography

  1. J. J. O’Connor and E. F. Robertson, Claude Elwood Shannon, MacTutor History of Mathematics.
  2. Claude Shannon, Wikipedia.
  3. S. W. Golomb et al., Claude Elwood Shannon (1916–2001), Notices of the AMS 49 (2002) 8–16.
  4. Mathematics Genealogy Project, Claude Elwood Shannon.
  5. Engineering and Technology History Wiki, Oral history: Claude E. Shannon (interview by R. Price, 1982).
  6. J. Soni and R. Goodman, A Mind at Play: How Claude Shannon Invented the Information Age, Simon & Schuster, 2017.
  7. J. Gleick, The Information: A History, a Theory, a Flood, Pantheon, 2011.

Mathematics

  1. C. E. Shannon, A symbolic analysis of relay and switching circuits, Trans. AIEE 57 (1938) 713–723.
  2. C. E. Shannon, A mathematical theory of communication, Bell System Tech. J. 27 (1948) 379–423, 623–656. PDF.
  3. C. E. Shannon, Communication in the presence of noise, Proc. IRE 37 (1949) 10–21.
  4. C. E. Shannon, Communication theory of secrecy systems, Bell System Tech. J. 28 (1949) 656–715.
  5. C. E. Shannon, The synthesis of two-terminal switching circuits, Bell System Tech. J. 28 (1949) 59–98.
  6. C. E. Shannon, Programming a computer for playing chess, Philosophical Magazine (7) 41 (1950) 256–275.
  7. C. E. Shannon, Prediction and entropy of printed English, Bell System Tech. J. 30 (1951) 50–64.
  8. C. E. Shannon, The zero error capacity of a noisy channel, IRE Trans. Inform. Theory 2 (1956) 8–19.
  9. E. F. Moore and C. E. Shannon, Reliable circuits using less reliable relays, J. Franklin Inst. 262 (1956) 191–208, 281–297.
  10. C. E. Shannon, A universal Turing machine with two internal states, in C. E. Shannon and J. McCarthy (eds.), Automata Studies, Princeton, 1956.
  11. C. E. Shannon, Coding theorems for a discrete source with a fidelity criterion, IRE Nat. Conv. Rec. part 4 (1959) 142–163.
  12. N. J. A. Sloane and A. D. Wyner (eds.), Claude Elwood Shannon: Collected Papers, IEEE Press, 1993.
  13. T. M. Cover and J. A. Thomas, Elements of Information Theory, 2nd ed., Wiley, 2006.
  14. L. Lovász, On the Shannon capacity of a graph, IEEE Trans. Inform. Theory 25 (1979) 1–7.