taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.10-17

Exercise 1.2.10-17

not stated yet in Lean solution written

RatingM27
MarkersM (mathematical)
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.10 of Volume 1. Companion chapter: Analysis of an algorithm

The task

Show that h(z)=g(f(z))h(z)=g(f(z)) is a probability generating function, say what it means, and give its mean and variance.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Check that the coefficients are nonnegative and that h(1)=1h(1)=1.

Hint 2

Expand g(f(z))=∑kqkf(z)kg(f(z))=\sum_kq_kf(z)^k.

Hint 3

For (c) differentiate hh with the chain rule and use (12) and (13).

Solution

Show the solution

(a) Let f(z)=∑jpjzjf(z)=\sum_jp_jz^j and g(z)=∑kqkzkg(z)=\sum_kq_kz^k with pj,qk≥0p_j,q_k\ge0 and f(1)=g(1)=1f(1)=g(1)=1. Then h(z)=∑kqkf(z)kh(z)=\sum_kq_kf(z)^k. Each power f(z)kf(z)^k has nonnegative coefficients, and qk≥0q_k\ge0, so all coefficients of hh are nonnegative (the series converges for ∣z∣≤1|z|\le1, since f(∣z∣)≤1f(|z|)\le1 there). Also h(1)=g(f(1))=g(1)=1h(1)=g(f(1))=g(1)=1. So hh is a probability generating function.

(b) Let ff describe the score SS of one trial. Let KK be an independent number of trials, with the generating function gg. Then f(z)kf(z)^k is the generating function of the total score of kk independent trials, and K=kK=k has the probability qkq_k. So h(z)=∑kqkf(z)kh(z)=\sum_kq_kf(z)^k describes the sum of the scores of a random number of independent trials. For example, ff may give the number of daughters of one woman and gg the number of women in one generation. Then hh gives the number in the next generation.

(c) Let a=mean⁡(f)a=\operatorname{mean}(f), α=var⁡(f)\alpha=\operatorname{var}(f), b=mean⁡(g)b=\operatorname{mean}(g), β=var⁡(g)\beta=\operatorname{var}(g). The chain rule gives h′(z)=g′(f(z))f′(z)h'(z)=g'(f(z))f'(z), so mean⁡(h)=g′(1)f′(1)=ba\operatorname{mean}(h)=g'(1)f'(1)=ba. Differentiate again: h′′(z)=g′′(f(z))f′(z)2+g′(f(z))f′′(z)h''(z)=g''(f(z))f'(z)^2+g'(f(z))f''(z), so h′′(1)=g′′(1)a2+g′(1)f′′(1)h''(1)=g''(1)a^2+g'(1)f''(1). By (13), g′′(1)=β+b2−bg''(1)=\beta+b^2-b and f′′(1)=α+a2−af''(1)=\alpha+a^2-a. Then

var⁡(h)=h′′(1)+h′(1)−h′(1)2=(β+b2−b)a2+b(α+a2−a)+ab−a2b2=βa2+bα.\operatorname{var}(h)=h''(1)+h'(1)-h'(1)^2=(\beta+b^2-b)a^2+b(\alpha+a^2-a)+ab-a^2b^2=\beta a^2+b\alpha.

So mean⁡(h)=mean⁡(g)mean⁡(f)\operatorname{mean}(h)=\operatorname{mean}(g)\operatorname{mean}(f) and var⁡(h)=var⁡(g)mean⁡(f)2+mean⁡(g)var⁡(f)\operatorname{var}(h)=\operatorname{var}(g)\operatorname{mean}(f)^2+\operatorname{mean}(g)\operatorname{var}(f).

Check

Let f=g=12+12zf=g=\frac12+\frac12z (a fair coin). Then h=12+12(12+12z)=34+14zh=\frac12+\frac12\bigl(\frac12+\frac12z\bigr)=\frac34+\frac14z, with mean 14\frac14 and variance 14⋅34=316\frac14\cdot\frac34=\frac3{16}. The formulas give mean 12⋅12=14\frac12\cdot\frac12=\frac14 and variance 14⋅14+12⋅14=316\frac14\cdot\frac14+\frac12\cdot\frac14=\frac3{16}.

Remarks

The mean is multiplicative, and the variance has two parts: the spread of the number of trials, and the spread of each trial. The iterated composition f(f(⋯f(z)))f(f(\cdots f(z))) is the generating function of a branching process.

This solution is drafted, and a person has not reviewed it yet. The source.

In Lean

not stated yet The exercise is not stated in Lean yet.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.