Probability, Random Variables, Generating Functions, and Markov Chains

Poisson Distribution and Arrival Modeling

  • Conceptual Definition:

    • A Poisson variable models a series of events that occur independently of each other in space or time at a constant, known average rate.
    • It represents a discrete count of occurrences across a continuous domain (time or space).
    • Formulated by French mathematician Siméon-Denis Poisson (1781–1840).
  • Mathematical Specifications:

    • Parameter: Requires a single parameter, λ>0\lambda > 0, which represents the expected number of occurrences (average rate) in the specified interval.
    • Support / Range: The sample space consists of all non-negative integers: {0,1,2,3,… }\{0, 1, 2, 3, \dots\}.
    • Probability Mass Function (PMF):P(N=k)={λke−λk!,k∈{0,1,2,3,… }0,otherwiseP(N = k) = \begin{cases} \frac{\lambda^k e^{-\lambda}}{k!}, & k \in \{0, 1, 2, 3, \dots\} \\ 0, & \text{otherwise} \end{cases}
  • Verification of Total Probability:

    • Summing the PMF over all possible values of kk establishes that the probabilities sum to 11 using the Taylor series expansion of eλe^{\lambda}:         ∑k=0∞P(N=k)=∑k=0∞λke−λk!=e−λ∑k=0∞λkk!=e−λ(1+λ+λ22!+λ33!+… )=e−λeλ=1\sum_{k=0}^{\infty} P(N = k) = \sum_{k=0}^{\infty} \frac{\lambda^k e^{-\lambda}}{k!} = e^{-\lambda} \sum_{k=0}^{\infty} \frac{\lambda^k}{k!} = e^{-\lambda} \left( 1 + \lambda + \frac{\lambda^2}{2!} + \frac{\lambda^3}{3!} + \dots \right) = e^{-\lambda} e^{\lambda} = 1
  • Derivation of Expectation:

    • The expected value E(N)E(N) is derived from the definition of expectation:         E(N)=∑k=0∞kP(N=k)=∑k=0∞kλke−λk!E(N) = \sum_{k=0}^{\infty} k P(N = k) = \sum_{k=0}^{\infty} k \frac{\lambda^k e^{-\lambda}}{k!}
    • The k=0k = 0 term is zero, so the index shifts to k=1k = 1:         E(N)=∑k=1∞kλke−λk!=∑k=1∞λke−λ(k−1)!E(N) = \sum_{k=1}^{\infty} k \frac{\lambda^k e^{-\lambda}}{k!} = \sum_{k=1}^{\infty} \frac{\lambda^k e^{-\lambda}}{(k - 1)!}
    • Factoring out λe−λ\lambda e^{-\lambda}:         E(N)=λe−λ∑k=1∞λk−1(k−1)!=λe−λ(1+λ1!+λ22!+λ33!+… )=λe−λeλ=λE(N) = \lambda e^{-\lambda} \sum_{k=1}^{\infty} \frac{\lambda^{k - 1}}{(k - 1)!} = \lambda e^{-\lambda} \left( 1 + \frac{\lambda}{1!} + \frac{\lambda^2}{2!} + \frac{\lambda^3}{3!} + \dots \right) = \lambda e^{-\lambda} e^{\lambda} = \lambda
  • Application Examples:

    • Lightbulb Failures: In a large building, lightbulbs fail independently without external shocks (e.g., power surges). If bulbs require replacement at an average rate of 1 per hour, the number of failures NN in a given hour is modeled by N∼Poi(1)N \sim \text{Poi}(1).
    • Call Centre Inquiries: A call centre receives calls at an average rate of 20 calls per hour20\,\text{calls per hour} throughout its working day. Calls arrive independently and uniformly over time, such that N∼Poi(20)N \sim \text{Poi}(20). The exact probability of receiving exactly 17 calls in a specific hour is:         P(N=17)=2017e−2017!≈0.076=7.6%P(N = 17) = \frac{20^{17} e^{-20}}{17!} \approx 0.076 = 7.6\%

Limiting Derivation of the Poisson Distribution

  • Binomial Foundation:

    • The Poisson distribution arises as the limiting case of a Binomial distribution as the number of trials approaches infinity while the expected value remains constant.
    • A Binomial variable represents the sum of independent Bernoulli trials, each with success probability pp.
  • Time Discretization Process:

    • A continuous time unit (e.g., 1 day) is partitioned into NN sub-intervals of equal length.
    • For sufficiently large NN, each interval is small enough that at most one event can occur within it, transforming each interval into a Bernoulli trial.
    • To keep the overall expected number of events equal to λ\lambda, the probability of an event in any single sub-interval is set to p=λNp = \frac{\lambda}{N}.
    • The count of occurrences across the entire period is modeled by X∼Bin(N,λN)X \sim \text{Bin}\left(N, \frac{\lambda}{N}\right), preserving the expectation E(X)=N(λN)=λE(X) = N \left(\frac{\lambda}{N}\right) = \lambda.
  • Step-by-Step Limit Proof:

    • The Binomial probability mass function evaluated at kk successes is:         P(X=k)=(Nk)(λN)k(1−λN)N−k=N!k!(N−k)!λkNk(1−λN)N(1−λN)−kP(X = k) = \binom{N}{k} \left(\frac{\lambda}{N}\right)^k \left(1 - \frac{\lambda}{N}\right)^{N - k} = \frac{N!}{k!(N - k)!} \frac{\lambda^k}{N^k} \left(1 - \frac{\lambda}{N}\right)^N \left(1 - \frac{\lambda}{N}\right)^{-k}
    • Rearranging terms:         P(X=k)=λkk![N(N−1)(N−2)…(N−k+1)Nk](1−λN)N(1−λN)−kP(X = k) = \frac{\lambda^k}{k!} \left[ \frac{N(N - 1)(N - 2)\dots(N - k + 1)}{N^k} \right] \left(1 - \frac{\lambda}{N}\right)^N \left(1 - \frac{\lambda}{N}\right)^{-k}
    • Analyzing individual limits as N→∞N \to \infty for fixed kk:         lim⁡N→∞N(N−1)(N−2)…(N−k+1)Nk=lim⁡N→∞1⋅(1−1N)(1−2N)…(1−k−1N)=1\lim_{N \to \infty} \frac{N(N - 1)(N - 2)\dots(N - k + 1)}{N^k} = \lim_{N \to \infty} 1 \cdot \left(1 - \frac{1}{N}\right) \left(1 - \frac{2}{N}\right) \dots \left(1 - \frac{k - 1}{N}\right) = 1lim⁡N→∞(1−λN)N=e−λ\lim_{N \to \infty} \left(1 - \frac{\lambda}{N}\right)^N = e^{-\lambda}lim⁡N→∞(1−λN)−k=(1−0)−k=1\lim_{N \to \infty} \left(1 - \frac{\lambda}{N}\right)^{-k} = (1 - 0)^{-k} = 1
    • Combining these limits gives the Poisson PMF:         lim⁡N→∞P(X=k)=λke−λk!\lim_{N \to \infty} P(X = k) = \frac{\lambda^k e^{-\lambda}}{k!}

Merging and Splitting of Poisson Variables

  • Merging Independent Poisson Variables:

    • Theorem: If X∼Poi(λ)X \sim \text{Poi}(\lambda) and Y∼Poi(μ)Y \sim \text{Poi}(\mu) are independent random variables, their sum Z=X+YZ = X + Y is distributed as Z∼Poi(λ+μ)Z \sim \text{Poi}(\lambda + \mu).
    • Proof by Convolution:         The event Z=kZ = k occurs when X=jX = j and Y=k−jY = k - j for any j∈{0,1,…,k}j \in \{0, 1, \dots, k\}:         P(Z=k)=∑j=0kP(X=j)P(Y=k−j)=∑j=0k(λje−λj!)(μk−je−μ(k−j)!)P(Z = k) = \sum_{j=0}^k P(X = j) P(Y = k - j) = \sum_{j=0}^k \left( \frac{\lambda^j e^{-\lambda}}{j!} \right) \left( \frac{\mu^{k - j} e^{-\mu}}{(k - j)!} \right)         Factoring out constants independent of jj:         P(Z=k)=e−(λ+μ)∑j=0kλjμk−jj!(k−j)!=e−(λ+μ)k!∑j=0kk!j!(k−j)!λjμk−jP(Z = k) = e^{-(\lambda + \mu)} \sum_{j=0}^k \frac{\lambda^j \mu^{k - j}}{j! (k - j)!} = \frac{e^{-(\lambda + \mu)}}{k!} \sum_{j=0}^k \frac{k!}{j!(k - j)!} \lambda^j \mu^{k - j}         By the Binomial Theorem, ∑j=0k(kj)λjμk−j=(λ+μ)k\sum_{j=0}^k \binom{k}{j} \lambda^j \mu^{k - j} = (\lambda + \mu)^k:         P(Z=k)=(λ+μ)ke−(λ+μ)k!P(Z = k) = \frac{(\lambda + \mu)^k e^{-(\lambda + \mu)}}{k!}         Hence, Z∼Poi(λ+μ)Z \sim \text{Poi}(\lambda + \mu).
    • Merging Example: A commercial website tracks hourly traffic. Non-purchasing visitors arrive at an average rate of 10,000 per hour10{,}000\,\text{per hour} (Xnon-purchase∼Poi(10,000)X_{\text{non-purchase}} \sim \text{Poi}(10{,}000)). Purchasing visitors arrive at an average rate of 2,000 per hour2{,}000\,\text{per hour} (Xpurchase∼Poi(2,000)X_{\text{purchase}} \sim \text{Poi}(2{,}000)). The total hourly visitor count is:         Xtotal=Xnon-purchase+Xpurchase∼Poi(10,000+2,000)=Poi(12,000)X_{\text{total}} = X_{\text{non-purchase}} + X_{\text{purchase}} \sim \text{Poi}(10{,}000 + 2{,}000) = \text{Poi}(12{,}000)
  • Splitting Poisson Variables (Thinning):

    • Theorem: Let total events follow X∼Poi(λ)X \sim \text{Poi}(\lambda). If each event is independently classified as Type 1 with probability pp and Type 2 with probability 1−p1 - p, the count of Type 1 events X1X_1 is distributed as X1∼Poi(λp)X_1 \sim \text{Poi}(\lambda p).
    • Proof by Total Probability:         Condition on the total count X=n+mX = n + m, where nn is the number of Type 1 events and mm is the number of Type 2 events:         P(X1=n∣X=n+m)=(n+mn)pn(1−p)mP(X_1 = n \mid X = n + m) = \binom{n + m}{n} p^n (1 - p)^m         Summing over all possible values of mm (m≥0m \ge 0):         P(X1=n)=∑m=0∞P(X1=n∣X=n+m)P(X=n+m)P(X_1 = n) = \sum_{m=0}^{\infty} P(X_1 = n \mid X = n + m) P(X = n + m)P(X1=n)=∑m=0∞[(n+m)!n!m!pn(1−p)m][λn+me−λ(n+m)!]P(X_1 = n) = \sum_{m=0}^{\infty} \left[ \frac{(n + m)!}{n! m!} p^n (1 - p)^m \right] \left[ \frac{\lambda^{n + m} e^{-\lambda}}{(n + m)!} \right]P(X1=n)=e−λ(λp)nn!∑m=0∞[λ(1−p)]mm!P(X_1 = n) = \frac{e^{-\lambda} (\lambda p)^n}{n!} \sum_{m=0}^{\infty} \frac{[\lambda (1 - p)]^m}{m!}         Recognizing that ∑m=0∞[λ(1−p)]mm!=eλ(1−p)\sum_{m=0}^{\infty} \frac{[\lambda(1 - p)]^m}{m!} = e^{\lambda(1 - p)}:         P(X1=n)=e−λ(λp)nn!eλ(1−p)=e−λ+λ−λp(λp)nn!=(λp)ne−λpn!P(X_1 = n) = \frac{e^{-\lambda} (\lambda p)^n}{n!} e^{\lambda(1 - p)} = \frac{e^{-\lambda + \lambda - \lambda p} (\lambda p)^n}{n!} = \frac{(\lambda p)^n e^{-\lambda p}}{n!}         Therefore, X1∼Poi(λp)X_1 \sim \text{Poi}(\lambda p).
    • Splitting Example: A retail shop expects an average of 12 customers per hour12\,\text{customers per hour}. If 50%50\% (p=0.5p = 0.5) of arrivals are male and enter independently, the arrival of male customers per hour is modeled by:         Xmale∼Poi(12×0.5)=Poi(6)X_{\text{male}} \sim \text{Poi}(12 \times 0.5) = \text{Poi}(6)

Poisson Processes and Exponential Waiting Times

  • Poisson Process Definition:

    • A continuous-time stochastic process {X(t),t≥0}\{X(t), t \ge 0\} with rate parameter λ>0\lambda > 0 is a Poisson process if:
      1. X(t)X(t) is a counting process with X(0)=0X(0) = 0 taking values in non-negative integers {0,1,2,… }\{0, 1, 2, \dots\}.
      2. Stationary Increments: The distribution of the number of events counted in any time interval of length TT depends only on the interval duration TT, not on the starting point.
      3. Independent Increments: The counts of events occurring across disjoint time intervals are statistically independent.
      4. For any duration t>0t > 0, the count in that interval satisfies X(t)∼Poi(λt)X(t) \sim \text{Poi}(\lambda t), with PMF:             P(X(t)=k)=(λt)ke−λtk!P(X(t) = k) = \frac{(\lambda t)^k e^{-\lambda t}}{k!}
  • Derivation of Waiting Times:

    • Let WW denote the waiting time until the first event occurs.
    • For any duration t>0t > 0, the event that the waiting time exceeds tt (W>tW > t) is identical to the event that zero arrivals occur in the interval [0,t][0, t] (X(t)=0X(t) = 0):         P(W>t)=P(X(t)=0)=(λt)0e−λt0!=e−λtP(W > t) = P(X(t) = 0) = \frac{(\lambda t)^0 e^{-\lambda t}}{0!} = e^{-\lambda t}
    • The cumulative distribution function (CDF) of WW is:         FW(t)=P(W≤t)=1−P(W>t)=1−e−λt,t>0F_W(t) = P(W \le t) = 1 - P(W > t) = 1 - e^{-\lambda t}, \quad t > 0
    • Differentiating the CDF yields the probability density function (PDF):         fW(w)=ddwFW(w)={λe−λw,w>00,otherwisef_W(w) = \frac{d}{dw} F_W(w) = \begin{cases} \lambda e^{-\lambda w}, & w > 0 \\ 0, & \text{otherwise} \end{cases}
    • Thus, the waiting time follows an Exponential distribution: W∼Exp(λ)W \sim \text{Exp}(\lambda).
  • Properties of the Exponential Distribution:

    • PDF Integration Verification:∫0∞fW(w) dw=∫0∞λe−λw dw=[−e−λw]0∞=0−(−1)=1\int_0^{\infty} f_W(w)\,dw = \int_0^{\infty} \lambda e^{-\lambda w}\,dw = \left[ -e^{-\lambda w} \right]_0^{\infty} = 0 - (-1) = 1
    • Expectation Derivation (Integration by Parts):E(W)=∫0∞wλe−λw dwE(W) = \int_0^{\infty} w \lambda e^{-\lambda w}\,dw         Setting u=wu = w (du=dwdu = dw) and dv=λe−λw dwdv = \lambda e^{-\lambda w}\,dw (v=−e−λwv = -e^{-\lambda w}):         E(W)=[−we−λw]0∞+∫0∞e−λw dw=0+[−1λe−λw]0∞=1λE(W) = \left[ -w e^{-\lambda w} \right]_0^{\infty} + \int_0^{\infty} e^{-\lambda w}\,dw = 0 + \left[ -\frac{1}{\lambda} e^{-\lambda w} \right]_0^{\infty} = \frac{1}{\lambda}Intuition: If arrivals occur at rate λ=5 per hour\lambda = 5\,\text{per hour}, the expected inter-arrival duration is 15=0.2 hours\frac{1}{5} = 0.2\,\text{hours}.
    • Memoryless (No-Memory) Property:         For any elapsed waiting durations a,b>0a, b > 0:         P(W>a+b∣W>a)=P({W>a+b}∩{W>a})P(W>a)=P(W>a+b)P(W>a)=e−λ(a+b)e−λa=e−λb=P(W>b)P(W > a + b \mid W > a) = \frac{P(\{W > a + b\} \cap \{W > a\})}{P(W > a)} = \frac{P(W > a + b)}{P(W > a)} = \frac{e^{-\lambda (a + b)}}{e^{-\lambda a}} = e^{-\lambda b} = P(W > b)Implication: The probability of waiting an additional time bb does not depend on the already elapsed wait time aa.
  • Relative Arrival Times of Independent Processes:

    • Suppose two individuals, A and B, experience independent random events (e.g., accidents) modeled as Poisson processes with rates λ\lambda and μ\mu, respectively.
    • Let WA∼Exp(λ)W_A \sim \text{Exp}(\lambda) and WB∼Exp(μ)W_B \sim \text{Exp}(\mu) be their respective times until the next event.
    • The probability that A experiences an accident before B is found by conditioning on the occurrence time tt of A's accident:         P(WA<WB)=∫0∞P(WB>t∣WA=t)fWA(t) dt=∫0∞P(WB>t)fWA(t) dtP(W_A < W_B) = \int_0^{\infty} P(W_B > t \mid W_A = t) f_{W_A}(t)\,dt = \int_0^{\infty} P(W_B > t) f_{W_A}(t)\,dt
    • Since P(WB>t)=∫t∞μe−μw dw=e−μtP(W_B > t) = \int_t^{\infty} \mu e^{-\mu w}\,dw = e^{-\mu t} and fWA(t)=λe−λtf_{W_A}(t) = \lambda e^{-\lambda t}:         P(WA<WB)=∫0∞e−μt(λe−λt) dt=λ∫0∞e−(λ+μ)t dt=λ[−e−(λ+μ)tλ+μ]0∞=λλ+μP(W_A < W_B) = \int_0^{\infty} e^{-\mu t} \left( \lambda e^{-\lambda t} \right)\,dt = \lambda \int_0^{\infty} e^{-(\lambda + \mu) t}\,dt = \lambda \left[ -\frac{e^{-(\lambda + \mu) t}}{\lambda + \mu} \right]_0^{\infty} = \frac{\lambda}{\lambda + \mu}
    • If A has a higher rate than B (λ>μ\lambda > \mu), then P(WA<WB)>0.5P(W_A < W_B) > 0.5.
  • Comparison of Analytical Approaches:

    • Problem Statement: Purchasing customers arrive at rate μ per hour\mu\,\text{per hour}; non-purchasing customers arrive at rate λ per hour\lambda\,\text{per hour}. What is the probability that over a 2-hour window, exactly 3 customers enter the shop and all 3 make a purchase?
    • Method 1 (Merged Total Rate and Conditional Binomial Probabilities):
      • Combined arrival rate is λ+μ\lambda + \mu. Over 2 hours2\,\text{hours}, the total arrival count follows Ntotal∼Poi(2(λ+μ))N_{\text{total}} \sim \text{Poi}(2(\lambda + \mu)).
      • The probability of 3 total arrivals is:             P(Ntotal=3)=[2(λ+μ)]3e−2(λ+μ)3!P(N_{\text{total}} = 3) = \frac{[2(\lambda + \mu)]^3 e^{-2(\lambda + \mu)}}{3!}
      • Each arrival is a purchasing customer with probability μλ+μ\frac{\mu}{\lambda + \mu}. The probability all 3 purchase is (μλ+μ)3\left(\frac{\mu}{\lambda + \mu}\right)^3.
      • Joint probability:             P=[2(λ+μ)]3e−2(λ+μ)3!(μλ+μ)3=8(λ+μ)3e−2(λ+μ)3!μ3(λ+μ)3=(2μ)3e−2(λ+μ)3!P = \frac{[2(\lambda + \mu)]^3 e^{-2(\lambda + \mu)}}{3!} \left(\frac{\mu}{\lambda + \mu}\right)^3 = \frac{8(\lambda + \mu)^3 e^{-2(\lambda + \mu)}}{3!} \frac{\mu^3}{(\lambda + \mu)^3} = \frac{(2\mu)^3 e^{-2(\lambda + \mu)}}{3!}
    • Method 2 (Independent Poisson Factorization):
      • In 2 hours2\,\text{hours}, purchasing arrivals follow NP∼Poi(2μ)N_P \sim \text{Poi}(2\mu) and non-purchasing arrivals follow NNP∼Poi(2λ)N_{NP} \sim \text{Poi}(2\lambda).
      • The event requires NP=3N_P = 3 and NNP=0N_{NP} = 0:             P(NP=3)=(2μ)3e−2μ3!,P(NNP=0)=(2λ)0e−2λ0!=e−2λP(N_P = 3) = \frac{(2\mu)^3 e^{-2\mu}}{3!}, \quad P(N_{NP} = 0) = \frac{(2\lambda)^0 e^{-2\lambda}}{0!} = e^{-2\lambda}
      • By independence, multiply the individual probabilities:             P=[(2μ)3e−2μ3!][e−2λ]=(2μ)3e−2(λ+μ)3!P = \left[ \frac{(2\mu)^3 e^{-2\mu}}{3!} \right] \left[ e^{-2\lambda} \right] = \frac{(2\mu)^3 e^{-2(\lambda + \mu)}}{3!}
      • Both formulations produce identical results.

Sums of Random Variables and Generating Functions

  • Convolutional Bottleneck for Sums of Random Variables:

    • Let Coin A be tossed 5 times (NA∼Bin(5,0.5)N_A \sim \text{Bin}(5, 0.5)) and Coin B be tossed 10 times (NB∼Bin(10,0.5)N_B \sim \text{Bin}(10, 0.5)). Both coins are fair.
    • To determine the distribution of NA+NBN_A + N_B directly via convolution:         P(NA+NB=k)=∑j=0kP(NA=j)P(NB=k−j)=∑j=0k[5!j!(5−j)!0.55][10!(k−j)!(10−(k−j))!0.510]P(N_A + N_B = k) = \sum_{j=0}^k P(N_A = j) P(N_B = k - j) = \sum_{j=0}^k \left[ \frac{5!}{j!(5 - j)!} 0.5^5 \right] \left[ \frac{10!}{(k - j)!(10 - (k - j))!} 0.5^{10} \right]
    • Simplifying this expression to prove that NA+NB∼Bin(15,0.5)N_A + N_B \sim \text{Bin}(15, 0.5) requires non-trivial combinatorial summation identities.
    • Summing more than two variables compounds this complexity. For four independent variables X1,X2,X3,X4X_1, X_2, X_3, X_4, evaluating P(X1+X2+X3+X4=k)P(X_1 + X_2 + X_3 + X_4 = k) necessitates a triple nested summation:         P(X1+X2+X3+X4=k)=∑j=0k∑m=0k−j∑n=0k−j−mP(X1=j)P(X2=m)P(X3=n)P(X4=k−j−m−n)P(X_1 + X_2 + X_3 + X_4 = k) = \sum_{j=0}^k \sum_{m=0}^{k - j} \sum_{n=0}^{k - j - m} P(X_1 = j) P(X_2 = m) P(X_3 = n) P(X_4 = k - j - m - n)
  • Generating Functions Definition:

    • A generating function transforms a probability distribution into a function of a dummy variable zz, streamlining calculations involving sums and moments.
    • The generating function of a random variable XX is defined as:         gX(z)=E(zX)g_X(z) = E(z^X)
    • Discrete Form: For a discrete variable taking non-negative integer values:         gX(z)=∑kP(X=k)zkg_X(z) = \sum_{k} P(X = k) z^k
    • Continuous Form: For a continuous random variable with PDF fX(x)f_X(x):         gX(z)=∫−∞∞zxfX(x) dxg_X(z) = \int_{-\infty}^{\infty} z^x f_X(x)\,dx
    • Example (Fair Six-Sided Die):         For a fair die with PMF P(X=k)=16P(X = k) = \frac{1}{6} for k∈{1,2,3,4,5,6}k \in \{1, 2, 3, 4, 5, 6\}:         gX(z)=16z+16z2+16z3+16z4+16z5+16z6g_X(z) = \frac{1}{6} z + \frac{1}{6} z^2 + \frac{1}{6} z^3 + \frac{1}{6} z^4 + \frac{1}{6} z^5 + \frac{1}{6} z^6
  • Extracting Moments from Generating Functions:

    • First Derivative and Expectation:ddzgX(z)=gX′(z)=ddz∑kP(X=k)zk=∑kkP(X=k)zk−1\frac{d}{dz} g_X(z) = g'_X(z) = \frac{d}{dz} \sum_k P(X = k) z^k = \sum_k k P(X = k) z^{k - 1}         Evaluating at z=1z = 1:         gX′(1)=∑kkP(X=k)(1)k−1=∑kkP(X=k)=E(X)g'_X(1) = \sum_k k P(X = k) (1)^{k - 1} = \sum_k k P(X = k) = E(X)
    • Second Derivative and Variance:d2dz2gX(z)=gX′′(z)=∑kk(k−1)P(X=k)zk−2\frac{d^2}{dz^2} g_X(z) = g''_X(z) = \sum_k k(k - 1) P(X = k) z^{k - 2}         Evaluating at z=1z = 1:         gX′′(1)=∑kk(k−1)P(X=k)=∑kk2P(X=k)−∑kkP(X=k)=E(X2)−E(X)g''_X(1) = \sum_k k(k - 1) P(X = k) = \sum_k k^2 P(X = k) - \sum_k k P(X = k) = E(X^2) - E(X)         Rearranging for E(X2)E(X^2):         E(X2)=gX′′(1)+gX′(1)E(X^2) = g''_X(1) + g'_X(1)         The variance is given by:         Var(X)=E(X2)−[E(X)]2=gX′′(1)+gX′(1)−[gX′(1)]2\text{Var}(X) = E(X^2) - [E(X)]^2 = g''_X(1) + g'_X(1) - [g'_X(1)]^2
  • Sum of Independent Random Variables:

    • Theorem: If X1X_1 and X2X_2 are independent random variables, the generating function of their sum Y=X1+X2Y = X_1 + X_2 is the product of their individual generating functions:         gY(z)=E(zX1+X2)=E(zX1zX2)=E(zX1)E(zX2)=gX1(z)gX2(z)g_Y(z) = E(z^{X_1 + X_2}) = E(z^{X_1} z^{X_2}) = E(z^{X_1}) E(z^{X_2}) = g_{X_1}(z) g_{X_2}(z)
    • Summation Proof:gY(z)=∑k=0∞P(Y=k)zk=∑k=0∞[∑j=0kP(X1=j)P(X2=k−j)]zkg_Y(z) = \sum_{k=0}^{\infty} P(Y = k) z^k = \sum_{k=0}^{\infty} \left[ \sum_{j=0}^k P(X_1 = j) P(X_2 = k - j) \right] z^kgY(z)=∑k=0∞∑j=0kP(X1=j)zjP(X2=k−j)zk−jg_Y(z) = \sum_{k=0}^{\infty} \sum_{j=0}^k P(X_1 = j) z^j P(X_2 = k - j) z^{k - j}         Setting u=ju = j and v=k−jv = k - j, the double sum factors into independent sums:         gY(z)=(∑u=0∞P(X1=u)zu)(∑v=0∞P(X2=v)zv)=gX1(z)gX2(z)g_Y(z) = \left( \sum_{u=0}^{\infty} P(X_1 = u) z^u \right) \left( \sum_{v=0}^{\infty} P(X_2 = v) z^v \right) = g_{X_1}(z) g_{X_2}(z)

Common Generating Functions and Applications

  • Poisson Distribution (X∼Poi(λ)X \sim \text{Poi}(\lambda)):

    • Derivation:         gX(z)=∑k=0∞λke−λk!zk=e−λ∑k=0∞(λz)kk!=e−λeλz=eλ(z−1)g_X(z) = \sum_{k=0}^{\infty} \frac{\lambda^k e^{-\lambda}}{k!} z^k = e^{-\lambda} \sum_{k=0}^{\infty} \frac{(\lambda z)^k}{k!} = e^{-\lambda} e^{\lambda z} = e^{\lambda(z - 1)}
    • Sum of nn Independent Poisson Variables:         If X1,…,XnX_1, \dots, X_n are i.i.d. with Xi∼Poi(λ)X_i \sim \text{Poi}(\lambda), and Y=∑i=1nXiY = \sum_{i=1}^n X_i:         gY(z)=∏i=1ngXi(z)=[eλ(z−1)]n=enλ(z−1)g_Y(z) = \prod_{i=1}^n g_{X_i}(z) = [e^{\lambda(z - 1)}]^n = e^{n\lambda(z - 1)}         Matching this generating function to the standard form demonstrates that Y∼Poi(nλ)Y \sim \text{Poi}(n\lambda).
  • Bernoulli Distribution (T∼Bern(p)T \sim \text{Bern}(p)):

    • With support {0,1}\{0, 1\}, where P(T=1)=pP(T = 1) = p and P(T=0)=1−pP(T = 0) = 1 - p:         gT(z)=(1−p)z0+pz1=1−p+pzg_T(z) = (1 - p) z^0 + p z^1 = 1 - p + p z
  • Binomial Distribution (S∼Bin(n,p)S \sim \text{Bin}(n, p)):

    • Since S=∑i=1nTiS = \sum_{i=1}^n T_i where Ti∼iidBern(p)T_i \stackrel{\text{iid}}{\sim} \text{Bern}(p), its generating function is:         gS(z)=[gT(z)]n=(1−p+pz)ng_S(z) = [g_T(z)]^n = (1 - p + p z)^n
  • Geometric Distribution (X∼Geo(p)X \sim \text{Geo}(p)):

    • Defined over trials until the first success, with support k∈{1,2,3,… }k \in \{1, 2, 3, \dots\} and PMF P(X=k)=(1−p)k−1pP(X = k) = (1 - p)^{k - 1} p:         gX(z)=∑k=1∞zk(1−p)k−1p=zp∑k=1∞[z(1−p)]k−1=zp[1+z(1−p)+z2(1−p)2+… ]g_X(z) = \sum_{k=1}^{\infty} z^k (1 - p)^{k - 1} p = z p \sum_{k=1}^{\infty} [z(1 - p)]^{k - 1} = z p \left[ 1 + z(1 - p) + z^2(1 - p)^2 + \dots \right]
    • For ∣z(1−p)∣<1|z(1 - p)| < 1, summing this geometric progression gives:         gX(z)=zp1−z(1−p)g_X(z) = \frac{z p}{1 - z(1 - p)}
  • Exponential Distribution (Y∼Exp(λ)Y \sim \text{Exp}(\lambda)):

    • For continuous PDF fY(y)=λe−λyf_Y(y) = \lambda e^{-\lambda y} (y≥0y \ge 0):         gY(z)=∫0∞zyλe−λy dyg_Y(z) = \int_0^{\infty} z^y \lambda e^{-\lambda y}\,dy
    • Writing zy=(eln⁡(z))y=eyln⁡(z)z^y = (e^{\ln(z)})^y = e^{y \ln(z)}:         gY(z)=λ∫0∞e−y(λ−ln⁡(z)) dyg_Y(z) = \lambda \int_0^{\infty} e^{-y(\lambda - \ln(z))}\,dy
    • Evaluating this integral (valid for λ>ln⁡(z)\lambda > \ln(z)):         gY(z)=λ[−e−y(λ−ln⁡(z))λ−ln⁡(z)]0∞=λλ−ln⁡(z)g_Y(z) = \lambda \left[ -\frac{e^{-y(\lambda - \ln(z))}}{\lambda - \ln(z)} \right]_0^{\infty} = \frac{\lambda}{\lambda - \ln(z)}

Sum of a Random Number of Random Variables

  • Theoretical Framework:

    • In many real-world processes, both the individual terms and the number of terms being summed are random variables.
    • Real-World Example: An insurance firm's total annual payout depends on two distinct random components: the total count of individual claims (NN) and the monetary size of each claim (XiX_i).
    • Let NN be a non-negative integer-valued random variable, and let X1,X2,…,XNX_1, X_2, \dots, X_N be i.i.d. random variables with common generating function gX(z)g_X(z). Define X0=0X_0 = 0.
    • The random sum is defined as:         SN=∑i=1NXiS_N = \sum_{i=1}^N X_i
  • Derivation of the Compound Generating Function:

    • By the Law of Total Expectation:         gSN(z)=E(zSN)=E(E(zSN∣N))=∑k=0∞E(zSN∣N=k)P(N=k)g_{S_N}(z) = E(z^{S_N}) = E(E(z^{S_N} \mid N)) = \sum_{k=0}^{\infty} E(z^{S_N} \mid N = k) P(N = k)
    • Conditional on N=kN = k, Sk=∑i=1kXiS_k = \sum_{i=1}^k X_i is a sum of kk independent random variables:         E(zSN∣N=k)=E(z∑i=1kXi)=[gX(z)]kE(z^{S_N} \mid N = k) = E\left( z^{\sum_{i=1}^k X_i} \right) = [g_X(z)]^k
    • Substituting back into the total expectation:         gSN(z)=∑k=0∞[gX(z)]kP(N=k)g_{S_N}(z) = \sum_{k=0}^{\infty} [g_X(z)]^k P(N = k)
    • By definition, gN(z)=∑k=0∞zkP(N=k)g_N(z) = \sum_{k=0}^{\infty} z^k P(N = k). Replacing the argument zz with gX(z)g_X(z) gives:         gSN(z)=gN(gX(z))g_{S_N}(z) = g_N(g_X(z))
    • Rule: The generating function of a random sum of i.i.d. variables is the generating function of the counting variable NN, evaluated at the generating function of the individual terms XiX_i.
  • The Poisson Hen Problem:

    • A hen lays N∼Poi(λ)N \sim \text{Poi}(\lambda) eggs. Each egg independently hatches into a chick with probability pp.
    • The number of chicks from the ii-th egg is a Bernoulli trial: Xi∼Bern(p)X_i \sim \text{Bern}(p).
    • The total number of hatched chicks is SN=∑i=1NXiS_N = \sum_{i=1}^N X_i.
    • Component generating functions:         gN(z)=eλ(z−1),gX(z)=1−p+pzg_N(z) = e^{\lambda(z - 1)}, \quad g_X(z) = 1 - p + p z
    • Evaluating the compound generating function:         gSN(z)=gN(gX(z))=eλ([1−p+pz]−1)=eλ(pz−p)=eλp(z−1)g_{S_N}(z) = g_N(g_X(z)) = e^{\lambda([1 - p + p z] - 1)} = e^{\lambda(p z - p)} = e^{\lambda p (z - 1)}
    • This matches the generating function of a Poisson distribution: SN∼Poi(λp)S_N \sim \text{Poi}(\lambda p).
  • Vehicle Passing Waiting Time:

    • A driver overtakes vehicles according to a Poisson process at a rate of 10 cars per minute10\,\text{cars per minute}.
    • The inter-arrival time between successive vehicles follows Wi∼Exp(10)W_i \sim \text{Exp}(10).
    • Each overtaken vehicle is blue with probability 20%20\% (p=0.2p = 0.2), independent of all other vehicles.
    • The number of vehicles overtaken until the first blue vehicle appears follows a Geometric distribution: X∼Geo(0.2)X \sim \text{Geo}(0.2).
    • The total time elapsed until the next blue vehicle is overtaken is the random sum:         Wblue=∑i=1XWiW_{\text{blue}} = \sum_{i=1}^X W_i
    • The component generating functions are:         gX(z)=0.2z1−0.8z,gW(z)=1010−ln⁡(z)g_X(z) = \frac{0.2 z}{1 - 0.8 z}, \quad g_W(z) = \frac{10}{10 - \ln(z)}
    • Evaluating the compound generating function:         gWblue(z)=gX(gW(z))=0.2(1010−ln⁡(z))1−0.8(1010−ln⁡(z))g_{W_{\text{blue}}}(z) = g_X(g_W(z)) = \frac{0.2 \left(\frac{10}{10 - \ln(z)}\right)}{1 - 0.8 \left(\frac{10}{10 - \ln(z)}\right)}
    • Multiplying numerator and denominator by 10−ln⁡(z)10 - \ln(z):         gWblue(z)=2[10−ln⁡(z)]−8=22−ln⁡(z)g_{W_{\text{blue}}}(z) = \frac{2}{[10 - \ln(z)] - 8} = \frac{2}{2 - \ln(z)}
    • This matches the generating function of an Exponential distribution: Wblue∼Exp(2)W_{\text{blue}} \sim \text{Exp}(2).
    • Consistency: Thinning a Poisson process of rate 1010 with probability 0.20.2 yields a Poisson process of blue cars with rate 10×0.2=210 \times 0.2 = 2, whose inter-arrival time is distributed as Exp(2)\text{Exp}(2).

Time Series and the Markov Property

  • Time Series Characterization:

    • A time series is a sequential collection of data points recorded at successive time intervals (e.g., tracking the AUD to USD exchange rate over a 20-year period).
    • Predictive modeling of time series involves determining:
      1. Whether future values depend exclusively on the current value.
      2. Whether momentum exists, requiring the historical trajectory to be factored in.
      3. Whether external variables outside the series have predictive utility.
  • Spurious Correlations:

    • High mathematical correlation between two historical time series does not imply a causal relationship or predictive validity.
    • Real-World Spurious Examples:
      • U.S. crude oil imports from Norway correlated with drivers killed in railway collisions (95%95\% correlation).
      • Total revenue of U.S. skiing facilities correlated with deaths from bedsheet tangling (97%97\% correlation).
      • Number of films featuring Nicolas Cage correlated with swimming-pool drownings (67%67\% correlation).

Spurious correlations between unrelated variables

  • The Markov Property:

    • Let X0,X1,X2,…X_0, X_1, X_2, \dots be a sequence of random variables taking values in a discrete state space SS.
    • The sequence is a Markov Chain if the conditional distribution of any future state depends only on the current state, independent of past history:         P(Xn+1=j∣Xn=i,Xn−1=in−1,…,X0=i0)=P(Xn+1=j∣Xn=i)P(X_{n+1} = j \mid X_n = i, X_{n-1} = i_{n-1}, \dots, X_0 = i_0) = P(X_{n+1} = j \mid X_n = i)         for all steps nn and all states j,i,in−1,…,i0∈Sj, i, i_{n-1}, \dots, i_0 \in S.
    • Named after Russian mathematician Andrey Markov (1856–1922).
  • Classification of Real-World Systems:

    • Snakes and Ladders: The state space is S={1,2,…,100}S = \{1, 2, \dots, 100\}. If a player's path from X0=1X_0 = 1 through X11=41X_{11} = 41 is recorded, the probability distribution of X12X_{12} depends solely on current square X11=41X_{11} = 41, making it a Markov Chain.
    • Population Eye Color Proportions: The discretized proportion of a population with green eyes functions as a Markov Chain, as there is no inherent momentum driving the proportion up or down over time.
    • Harmful Genetic Conditions: The discretized proportion of a population with a harmful genetic condition is not a Markov Chain. Because the condition reduces reproductive fitness, the historical transmission rate affects future frequency.
    • Bucket Water Volume: Adding 1 Litre of water per minute to a bucket without drainage is a Markov Chain, since the future volume is fully determined by the current volume: Vt+1=Vt+1V_{t+1} = V_t + 1.
    • Gambler's Bankroll: In a game of pure chance, the gambler's bankroll is a Markov Chain. If the game involves skill, past performance conveys information about player skill level, violating the Markov property.

Snakes and Ladders board (states 1 to 100)

Random Walks and Linear Difference Equations

  • Simple Random Walk Formalism:

    • A random walk is a Markov chain on an integer state space where transitions are restricted to adjacent states with defined probabilities Pi,j=P(Xn+1=j∣Xn=i)P_{i, j} = P(X_{n+1} = j \mid X_n = i).
    • Coin Toss Game (Gambler's Ruin): A player bets $1\$1 on a fair coin. Heads awards $2\$2 (net gain +$1+\$1); Tails awards $0\$0 (net loss −$1-\$1). Both outcomes have probability 0.50.5.
    • The player begins with an initial fortune of $k\$k and plays repeatedly until reaching either $0\$0 (ruin) or $20\$20 (target profit). State space: k∈{0,1,2,…,20}k \in \{0, 1, 2, \dots, 20\}.
  • Formulating Difference Equations via Total Probability:

    • Let WkW_k denote the probability of eventually reaching the target fortune ($20\$20) before going broke, starting from current fortune $k\$k.
    • Partitioning over the outcome of the next bet:         Wk=P(loses next bet)Wk−1+P(wins next bet)Wk+1W_k = P(\text{loses next bet}) W_{k - 1} + P(\text{wins next bet}) W_{k + 1}
    • For a fair coin (p=0.5p = 0.5):         Wk=12Wk−1+12Wk+1W_k = \frac{1}{2} W_{k - 1} + \frac{1}{2} W_{k + 1}
    • Rearranging into standard form:         Wk+1−2Wk+Wk−1=0W_{k + 1} - 2 W_k + W_{k - 1} = 0
    • Boundary conditions:
      • W0=0W_0 = 0 (bankrupt; target cannot be reached).
      • W20=1W_{20} = 1 (target reached; absorption occurs).
  • Theory of Linear Difference Equations:

    • First-Order Difference Equations:         The relation Cn+1=MCnC_{n+1} = M C_n has the general solution Cn=KMnC_n = K M^n.         Example: Cn+1=2Cn  ⟹  Cn=K2nC_{n+1} = 2 C_n \implies C_n = K 2^n.
    • Second-Order Linear Homogeneous Difference Equations:         For the equation aCn+2+bCn+1+cCn=0a C_{n+2} + b C_{n+1} + c C_n = 0, assume a trial solution of the form Cn=KMnC_n = K M^n.         Substituting this into the difference equation gives the characteristic equation:         aM2+bM+c=0a M^2 + b M + c = 0Case 1: Distinct Roots (M1≠M2M_1 \ne M_2):Cn=K1M1n+K2M2nC_n = K_1 M_1^n + K_2 M_2^nCase 2: Repeated Roots (M1=M2=MM_1 = M_2 = M):Cn=K1Mn+K2nMn=(K1+K2n)MnC_n = K_1 M^n + K_2 n M^n = (K_1 + K_2 n) M^n
    • Worked Example (Distinct Roots): Solve Cn+2−7Cn+1+10Cn=0C_{n+2} - 7 C_{n+1} + 10 C_n = 0.         The characteristic equation is M2−7M+10=0M^2 - 7 M + 10 = 0, which factors as (M−5)(M−2)=0(M - 5)(M - 2) = 0, giving roots M=5M = 5 and M=2M = 2.         General solution: Cn=K15n+K22nC_n = K_1 5^n + K_2 2^n.
  • Analytical Solution for the Fair Coin Walk:

    • The equation Wk+1−2Wk+Wk−1=0W_{k + 1} - 2 W_k + W_{k - 1} = 0 has the characteristic equation M2−2M+1=0M^2 - 2 M + 1 = 0.
    • Factoring gives (M−1)2=0(M - 1)^2 = 0, yielding the repeated root M=1M = 1.
    • General solution:         Wk=A1(1)k+A2k(1)k=A1+A2kW_k = A_1 (1)^k + A_2 k (1)^k = A_1 + A_2 k
    • Applying the boundary conditions:         W0=A1=0  ⟹  A1=0W_0 = A_1 = 0 \implies A_1 = 0W20=A1+20A2=1  ⟹  20A2=1  ⟹  A2=120W_{20} = A_1 + 20 A_2 = 1 \implies 20 A_2 = 1 \implies A_2 = \frac{1}{20}
    • The probability of reaching $20\$20 from fortune $k\$k is:         Wk=k20W_k = \frac{k}{20}
    • For an initial capital of $10\$10:         W10=1020=0.5=50%W_{10} = \frac{10}{20} = 0.5 = 50\%

Asymmetric Random Walks and Casino Ruin Probabilities

  • European Roulette Formulation:

    • A gambler wagers $1\$1 repeatedly on an even-money bet on a European roulette wheel (18 red pockets, 18 black pockets, 1 green zero pocket; 37 pockets total).
    • Winning probability: p=1837≈48.65%p = \frac{18}{37} \approx 48.65\%.
    • Losing probability: q=1937≈51.35%q = \frac{19}{37} \approx 51.35\%.
    • The player starts with $k\$k and plays until reaching $D\$D (profit target) or $0\$0 (ruin).
  • Difference Equation Derivation:

    • Conditioning on the next spin:         Wk=1937Wk−1+1837Wk+1W_k = \frac{19}{37} W_{k - 1} + \frac{18}{37} W_{k + 1}
    • Rearranging into standard form:         18Wk+1−37Wk+19Wk−1=018 W_{k + 1} - 37 W_k + 19 W_{k - 1} = 0
    • Boundary conditions: W0=0W_0 = 0 and WD=1W_D = 1.
  • Solution via Characteristic Roots:

    • The characteristic equation is:         18M2−37M+19=018 M^2 - 37 M + 19 = 0
    • Factoring:         (18M−19)(M−1)=0  ⟹  M1=1,M2=1918(18 M - 19)(M - 1) = 0 \implies M_1 = 1, \quad M_2 = \frac{19}{18}
    • Since the roots are distinct, the general solution is:         Wk=A1(1)k+A2(1918)k=A1+A2(1918)kW_k = A_1 (1)^k + A_2 \left(\frac{19}{18}\right)^k = A_1 + A_2 \left(\frac{19}{18}\right)^k
    • Applying boundary condition W0=0W_0 = 0:         A1+A2=0  ⟹  A1=−A2A_1 + A_2 = 0 \implies A_1 = -A_2
    • Applying boundary condition WD=1W_D = 1:         A1+A2(1918)D=A2[(1918)D−1]=1  ⟹  A2=1(1918)D−1A_1 + A_2 \left(\frac{19}{18}\right)^D = A_2 \left[ \left(\frac{19}{18}\right)^D - 1 \right] = 1 \implies A_2 = \frac{1}{\left(\frac{19}{18}\right)^D - 1}
    • The particular solution for the winning probability is:         Wk=(1918)k−1(1918)D−1W_k = \frac{\left(\frac{19}{18}\right)^k - 1}{\left(\frac{19}{18}\right)^D - 1}
  • The Effect of House Edge over Time:

    • Consider a player starting with $100\$100 (k=100k = 100) attempting to double their money to $200\$200 (D=200D = 200):         W100=(1918)100−1(1918)200−1≈0.0045=0.45%W_{100} = \frac{\left(\frac{19}{18}\right)^{100} - 1}{\left(\frac{19}{18}\right)^{200} - 1} \approx 0.0045 = 0.45\%
    • Comparison: In a fair game (p=0.5p = 0.5), the player has a 50%50\% chance of reaching the target (W100=100200=0.5W_{100} = \frac{100}{200} = 0.5). In European roulette, despite a modest house advantage per bet (p=48.65%p = 48.65\%  versus 50%50\%), the probability of doubling the bankroll drops from 50%50\% to 0.45%0.45\%.

Expected Duration of Random Walks and Simulation

  • Expected Duration of Play:

    • Let CkC_k denote the expected number of bets until absorption (reaching either $0\$0 or $20\$20), starting with $k\$k.
    • The player must take at least 10 bets to conclude if starting at $10\$10, but can continue indefinitely.
    • Conditioning on the next coin toss:         Ck=1+12Ck−1+12Ck+1C_k = 1 + \frac{1}{2} C_{k - 1} + \frac{1}{2} C_{k + 1}
    • Rearranging into a second-order non-homogeneous difference equation:         Ck+1−2Ck+Ck−1=−2C_{k + 1} - 2 C_k + C_{k - 1} = -2
    • Boundary conditions:         C0=0,C20=0C_0 = 0, \quad C_{20} = 0         (Zero additional steps are required if the player is already at an absorption boundary).
    • The exact analytical solution is:         Ck=k(20−k)=20k−k2C_k = k(20 - k) = 20k - k^2
    • Finding the starting value that maximizes duration:         ddk(20k−k2)=20−2k=0  ⟹  k=10\frac{d}{dk} (20k - k^2) = 20 - 2k = 0 \implies k = 10
    • The expected duration is maximized at k=10k = 10 (the point furthest from both boundaries), with an expected duration of:         C10=10(20−10)=100 gamesC_{10} = 10(20 - 10) = 100\,\text{games}
  • Stochastic Simulation:

    • When analytic solutions to difference equations or complex Markov systems are intractable, computer packages simulate large numbers of realizations.
    • Sample paths are generated numerically, and statistical properties (such as absorption probabilities and expected duration) are estimated by averaging across runs.
    • Demonstration: A plot of 20 realizations of a random walk starting at position 0 (representing $10\$10 starting capital) shows paths either hitting the upper boundary at +10+10 ($20\$20 total capital) or the lower boundary at −10-10 ($0\$0 total capital).

Simulation of 20 realizations of a random walk with absorption barriers