Markov Chains Presentation Slides Markov Chains
Discrete-Time Dynamics & Transition Matrices
Stochastic Modeling & Analysis
The Gambler's Ruin
Imagine a gambler starting with \(k\) dollars. In each round, they win \$1 with probability \(p\) or lose \$1 with probability \(q = 1-p\).
The game ends if they reach \(N\) dollars (Success) or 0 dollars (Ruin).
Key Question
If \(p = 0.48\) (house edge), and the gambler starts with \$100 aiming for \$200, what is the probability of total ruin?
How does the "state" of wealth evolve over time?
Formal Definition
A Stochastic Process is a collection of random variables \(\{X_t, t \in T\}\) indexed by time \(t\).
State Space (\(S\)): The set of all possible values for \(X_t\).
Discrete Time: \(T = \{0, 1, 2, \dots\}\)
Index: \(X_n\) represents the state of the system at step \(n\).
"We aren't just looking at one outcome, but a sequence of random transitions."
The Markov Property
"Memorylessness"
\[ 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) \]
The future depends only on the present state, not on the path taken to get there.
The Transition Matrix (\(P\))
For a finite state space \(S = \{1, 2, \dots, m\}\), we define the one-step transition probabilities as:
\(p_{ij} = P(X_{n+1} = j \mid X_n = i)\)
Properties:
\(p_{ij} \geq 0\) for all \(i, j\)
\(\sum_{j \in S} p_{ij} = 1\) (Rows sum to 1)
\[ P = \begin{pmatrix} p_{11} & p_{12} & \cdots \\ p_{21} & p_{22} & \cdots \\ \vdots & \vdots & \ddots \end{pmatrix} \]
n-Step Transitions
How do we calculate the probability of being in state \(j\) after \(n\) steps starting from state \(i\)?
Chapman-Kolmogorov Theorem
\(P_{ij}^{(n+m)} = \sum_{k \in S} P_{ik}^{(n)} P_{kj}^{(m)}\)
Matrix Form \(P^{(n)} = P^n\)
The \(n\)-step transition matrix is simply the one-step matrix raised to the \(n\)-th power.
Transition Diagrams
1
2
Nodes = States, Edges = Probabilities
Graph theory meets probability. The topology of the graph dictates the dynamics of the chain.
Adjacency vs. Stochasticity
If there is an edge \(i \to j\), then \(p_{ij} > 0\). If no edge, \(p_{ij} = 0\).
Simulation Intuition
A "Random Walk" is a sequence of hops across this graph based on edge weights.
Summary
Markov Property
The past is irrelevant given the present.
Transition Matrix
The engine of the chain's evolution.
n-Step Flow
Computed via matrix exponentiation.
Coming up: Classifying the long-term behavior of these systems.
Dynamics Facilitation Guide Dynamics Facilitation Guide
Lesson 1: Discrete-Time Markov Chains
SEQUENCE
Stochastic Modeling
Instructional Intent
This lesson transitions students from elementary probability (independent events) to the study of dependent sequences of random variables. At the graduate level, emphasis should be placed on the algebraic structure of stochastic processes—specifically how linear algebra serves as the language for state transitions.
Key Theoretical Pillars
Formalization of the Markov Property
Construction of Row-Stochastic Matrices
Chapman-Kolmogorov derivation
Random Walk topology
Common Misconceptions
Confusing "memoryless" with "independent."
Assuming all matrices are square (though in DTMC they usually are).
Errors in matrix-vector vs. matrix-matrix multiplication order.
Lecture Deep-Dive
1. The Hook: Gambler's Ruin (\(15\) min)
Use this to motivate the need for a state-based approach. If \(p < 0.5\), the drift is negative. Ask students: "If you have infinite time but finite capital, is ruin inevitable?"
"The state of the system is the gambler's current wealth. Every bet is a transition. We are analyzing a path-dependent process where the 'path' is forgotten at every step."
2. Formalizing the Property (\(25\) min)
Drive home the conditional probability definition. Stress that \(P(X_{n+1} \mid X_n)\) encapsulates all relevant history.
Advanced Note:
Discuss the difference between time-homogeneous and time-inhomogeneous chains. For this sequence, we focus on homogeneous chains where \(P\) does not change with \(n\).
3. Transition Matrix Mechanics (\(30\) min)
Demonstrate the conversion of a state-transition diagram to a matrix. Ensure students understand that row \(i\) represents the conditional distribution of the next state given we are currently in state \(i\).
// Matrix Logic Example
If S = {A, B}, and P(A->B) = 0.3, then P(A->A) must be 0.7.
Row 1: [0.7, 0.3]
Facilitating the Simulation
In the workshop portion, students will simulate a Random Walk. Guide them through these algorithmic steps:
1
Initialization:
Define the state space and the transition matrix \(P\).
2
Iteration:
Use a random number generator and the cumulative distribution of a row in \(P\) to select the next state.
3
Aggregation:
Repeat the walk 10,000 times to observe the distribution of final states. How does this compare to \(P^n\)?
Dynamics Dynamics Worksheet Transition Dynamics
Lesson 1: Discrete-Time Markov Chains
Name:
Date:
1
State Space & Transition Matrices
A security system monitors three rooms: (1) Main Lobby, (2) Vault, and (3) Corridor. Every minute, a guard moves between them. From the Lobby, they move to the Corridor with probability 0.8 or stay put. From the Vault, they must move to the Lobby. From the Corridor, they move to the Vault with probability 0.5 or the Lobby with probability 0.5.
A. Define the state-space \(S\) and construct the one-step transition probability matrix \(P\).
\[ P = \begin{pmatrix} & & \\ & & \\ & & \end{pmatrix} \]
B. Draw the transition diagram corresponding to matrix \(P\).
2
n-Step Calculations
Given a two-state Markov chain with transition matrix \(P = \begin{pmatrix} 0.7 & 0.3 \\ 0.4 & 0.6 \end{pmatrix}\).
A. Using the Chapman-Kolmogorov equations, calculate \(P^{(2)}\). Show your matrix multiplication steps.
B. If the initial distribution is \(\alpha = [0.5, 0.5]\), find the probability distribution after 2 steps.
3
The Markov Property in Practice
"The Markov Property states that the future is independent of the past, given the present."
Provide a real-world scenario where this assumption is likely violated and explain why. How would you redefine the state to fix it?
4
Gambler's Ruin Exploration
Consider a gambler with \$2 who bets \$1 at a time. They win \$1 with probability \(p\) and lose \$1 with probability \(q = 1-p\). They stop if they reach \$4 or \$0.
A. Identify the absorbing states in this chain.
B. Construct the transition matrix for states \(\{0, 1, 2, 3, 4\}\). Use variables \(p\) and \(q\).
(5x5 Matrix Area)
C. Why is this chain fundamentally different from one that simply loops forever between two states?
Stationarity Presentation Slides Classification & Stationarity
Long-Term Behavior of Markov Chains
Lesson 02 // Stochastic Modeling
The \$1 Trillion Random Walk
Google's PageRank algorithm treats the entire web as a directed graph.
A "random surfer" clicks on links at random. What is the long-run probability of being on a specific page?
"Importance" is the stationary distribution of this massive Markov chain.
A
B
C
Random Surfer Model
State Classification
Communication
State \(i\) communicates with \(j\) (\(i \to j\)) if there is a path with positive probability.
Mutual communication: \(i \leftrightarrow j\).
Irreducibility
A chain is irreducible if every state can reach every other state.
"One single communicating class."
Periodicity
State \(i\) has period \(d\) if transitions only occur in multiples of \(d\).
\(d=1\) is Aperiodic .
Recurrence & Transience
Recurrent State
"The state you are guaranteed to visit again."
\(P(\text{return to } i \mid \text{start at } i) = 1\)
Transient State
"Eventually, you will leave and never come back."
\(P(\text{return to } i \mid \text{start at } i) < 1\)
In a finite Markov chain, it is impossible for all states to be transient.
"At least one state (or class) must be recurrent."
The Stationary Distribution (\(\pi\))
A probability distribution \(\pi\) is stationary if, once the system reaches this distribution, it remains there forever.
\[ \pi P = \pi \]
Constraint
\[ \sum_{i \in S} \pi_i = 1 \]
Finding \(\pi\) is an eigenvector problem for the eigenvalue \(\lambda = 1\).
Convergence Theorem
If a Markov chain is Irreducible , Aperiodic , and Positive Recurrent (Ergodic), then:
\(\lim_{n \to \infty} P_{ij}^n = \pi_j\)
"The starting state eventually becomes irrelevant. The long-run proportion of time spent in state \(j\) is \(\pi_j\)."
Calculating \(\pi\)
System of Equations
\(\pi_1 p_{11} + \pi_2 p_{21} + \dots = \pi_1\)
\(\pi_1 p_{12} + \pi_2 p_{22} + \dots = \pi_2\)
\(\dots\)
\(\sum \pi_i = 1\)
Stationarity Facilitation Guide Stationarity Facilitation Guide
Lesson 2: State Classification & Stationarity
SEQUENCE
Stochastic Modeling
Instructional Roadmap
The primary objective is for students to distinguish between the transient phase of a chain and its stationary phase. While Lesson 1 focused on "what happens next," Lesson 2 focuses on "what happens eventually."
Advanced Mathematical Focus
Commensurate vs. Incommensurate periods.
The Perron-Frobenius Theorem context for \(\pi\).
Convergence rates (eigenvalue gap).
The Google "Teleportation" factor (\(d\)).
Crucial Visuals
Strongly connected components in the transition graph.
"Spider-traps" and "Dead-ends" in web graphs.
Path-dependent vs. Path-independent limits.
The PageRank Deep-Dive
The Problem of "Sink" States
In a raw web graph, many pages are "dead ends" (no out-links) or part of a cycle that doesn't reach the rest of the web. This makes the chain reducible or potentially gives it multiple stationary distributions.
// The Google Solution: The Damping Factor
M = (1-d)P + d(E/n)
where d is typically 0.15 (15% chance to teleport to a random page).
This addition makes the chain Irreducible and Aperiodic , guaranteeing a unique stationary distribution.
Guiding the Workshop
Students will solve \(\pi P = \pi\) for a small network. Remind them of these steps:
1. Redundancy:
The system \(\pi(P-I) = 0\) always has one linearly dependent equation. Students MUST replace one equation with the normalization condition \(\sum \pi_i = 1\).
2. Symmetry:
For undirected, connected graphs with equal weights, the stationary distribution is proportional to the degree of the nodes: \(\pi_i = \frac{deg(i)}{\sum deg(j)}\).
Extension for High-Achievers
Detailed Balance Equation
Introduce the concept of Reversibility . If \(\pi_i p_{ij} = \pi_j p_{ji}\), then \(\pi\) is stationary. This is the foundation of MCMC (Markov Chain Monte Carlo) methods like the Metropolis-Hastings algorithm.
Eigenvalue Interpretation
Explain that the second largest eigenvalue (\(\lambda_2\)) determines the speed of convergence. A small gap (\(1 - \lambda_2\)) means the chain mixes slowly.
Stationarity Analysis Activity PageRank Analysis
Lesson 2: Classification & Stationarity
Name:
Date:
Part 1: State Classification
Consider a Markov chain on states \(\{1, 2, 3, 4, 5\}\) with the following transition matrix:
\[ P = \begin{pmatrix} 0.5 & 0.5 & 0 & 0 & 0 \\ 0.5 & 0.5 & 0 & 0 & 0 \\ 0 & 0 & 0.7 & 0.3 & 0 \\ 0 & 0 & 0.4 & 0.6 & 0 \\ 0.2 & 0.2 & 0.2 & 0.2 & 0.2 \end{pmatrix} \]
A. Identify the communicating classes.
B. Which states are recurrent? Transient?
C. Is this chain irreducible? Explain why or why not.
Part 2: The "Mini-Web" Stationary Distribution
A tiny internet has three pages: A , B , and C .
- A links to B and C.
- B links only to C.
- C links back to A.
A. Construct the transition matrix \(P\) for a "random surfer" (assume links are chosen with equal probability).
\[ P = \begin{pmatrix} & & \\ & & \\ & & \end{pmatrix} \]
B. Set up the stationary equations \(\pi P = \pi\) and the normalization constraint \(\sum \pi_i = 1\).
C. Solve for \(\pi = [\pi_A, \pi_B, \pi_C]\). Which page is the most "important"?
Part 3: The Damping Factor Effect
If a page links to nothing (a "dangling node"), the row in the transition matrix is all zeros, which violates the stochastic property (\(\sum p_{ij} = 1\)). Google fixes this by having the surfer "teleport" to a random page.
"How does adding a teleportation probability (e.g., \(d=0.15\)) ensure that the Markov chain is both irreducible and aperiodic?"
"In a real-world social network, what would a 'stationary distribution' represent for users in terms of influence?"
Poisson Presentation Slides The Poisson Process
Counting Random Events in Continuous Time
Lesson 03 // Stochastic Modeling
The Inspection Paradox
Buses arrive at a stop according to a Poisson process with an average interval of 10 minutes.
You arrive at a random time. How long do you expect to wait for the next bus?
The Counter-Intuitive Truth
Common sense says 5 minutes. The math says 10 minutes.
Why does "random entry" bias us toward longer intervals?
Formal Counting Process
A counting process \(\{N(t), t \geq 0\}\) is a Poisson process with rate \(\lambda > 0\) if:
1. Independent Increments
The number of events in non-overlapping time intervals are independent.
2. Stationary Increments
The distribution of events depends only on the length of the interval, not the start time.
\[ P(N(t) = n) = \frac{e^{-\lambda t} (\lambda t)^n}{n!} \]
Interarrival Times (\(T_n\))
Let \(T_n\) be the time between the \((n-1)\)-th and \(n\)-th event.
In a Poisson process, interarrival times are i.i.d. Exponential random variables with parameter \(\lambda\).
\(f(t) = \lambda e^{-\lambda t}\) for \(t \geq 0\).
Memorylessness
\[ P(T > s + t \mid T > s) = P(T > t) \]
"The probability of waiting another hour is the same regardless of how long you've already waited."
Summation & Thinning
Summation
If you merge two independent Poisson processes (\(\lambda_1\) and \(\lambda_2\)), the result is a Poisson process with rate \(\lambda_1 + \lambda_2\).
Thinning
If you classify events into two types with probability \(p\) and \(1-p\), each type forms an independent Poisson process with rates \(p\lambda\) and \((1-p)\lambda\).
Waiting Time (\(S_n\))
The time until the \(n\)-th event occurs (\(S_n = \sum_{i=1}^n T_i\)) follows a Gamma (or Erlang) Distribution .
\[ f_{S_n}(t) = \frac{\lambda e^{-\lambda t} (\lambda t)^{n-1}}{(n-1)!} \]
Note the structural similarity to the Poisson PMF.
Varying Intensity: \(\lambda(t)\)
Real-world rates change over time (e.g., call center volume).
The number of events in \((0, t]\) follows a Poisson distribution with mean:
\[ m(t) = \int_0^t \lambda(s) ds \]
Modeling Tip
"When \(\lambda\) is a function of time, we lose stationary increments, but we keep independent increments."
Poisson Facilitation Guide Poisson Facilitation Guide
Lesson 3: Poisson Processes & Interarrivals
SEQUENCE
Stochastic Modeling
Core Concepts for Graduate Seminar
While undergraduate courses focus on the Poisson PMF, a graduate course must focus on the interplay between the counting process \(N(t)\) and the sequence of arrival times \(S_n\).
Key Derivations
Deriving the Exponential distribution from the Poisson property \(P(N(t)=0) = e^{-\lambda t}\).
Relationship between Poisson and Uniform distributions (Conditional arrivals).
The Erlang distribution as a sum of Exponentials.
Common Pitfalls
Assuming the rate \(\lambda\) is the mean (it's the rate; \(\lambda t\) is the mean).
Misapplying the memoryless property to the total wait time rather than the remaining wait time.
Explaining the Inspection Paradox
"Why is the expected wait equal to the average interarrival time?"
1. Bias in Selection: When you arrive at a random time, you are more likely to fall into a longer-than-average interval. Imagine a sequence of intervals: [2, 18, 5, 15]. The average is 10, but the 18-minute interval covers more of the timeline.
2. Memorylessness: Since the Poisson process is memoryless, the time until the next arrival doesn't care that you've just arrived. It is still Exponential with mean \(1/\lambda\).
3. The Length-Biased Distribution: In renewal theory, the interval containing your arrival is actually the sum of two independent Exponentials (the time since the last bus and the time until the next). Its expectation is \(2/\lambda\).
Seminar Prompts
Thinning in Biology
"Suppose a cell receives a Poisson stream of signals. If only 10% of signals trigger a response, why is the response stream still Poisson?"
Non-Homogeneity
"How would you model supermarket arrivals where the rate peaks at 5 PM? What happens to the interarrival distributions?"
Guidance for Student Problem Set
Problem 1 (Merging): Students should sum the rates. If \(\lambda_A = 2\) and \(\lambda_B = 3\), the total rate is 5. The probability that the next event is from A is \(\lambda_A / (\lambda_A + \lambda_B)\).
Problem 2 (Memoryless): Challenge students to prove that \(P(X > s+t \mid X > s) = P(X > t)\) using the definition of the Exponential CDF.
Problem 3 (Gamma/Erlang): Ensure they understand the difference between the time for one event (Exponential) and the time for n events (Gamma).
Poisson Arrival Problems Arrival Logic
Lesson 3: Poisson Processes & Interarrivals
Name:
Date:
1
The Memoryless Property
The lifetime of a specific industrial sensor follows an Exponential distribution with a mean of 500 hours (\(\lambda = 1/500\)).
A. Suppose the sensor has already been running for 300 hours. What is the probability it survives at least another 500 hours? Show your proof using the memoryless property.
B. If we have two such sensors running independently in parallel, what is the rate \(\lambda_{total}\) at which failures occur?
2
Thinning a Process
Emails arrive at a support desk according to a Poisson process with rate \(\lambda = 10\) per hour. Studies show that 20% of these emails are "Urgent" while 80% are "Routine".
A. What is the probability that exactly 3 urgent emails arrive in a 2-hour window?
B. Given that exactly 10 emails arrived in one hour, what is the conditional distribution of the number of urgent emails among them?
3
Waiting Time Distribution
In a Poisson process with rate \(\lambda\), let \(S_3\) be the time until the third event occurs.
A. Write the Probability Density Function (PDF) for \(S_3\). Identify the name of this distribution.
\[ f_{S_3}(t) = \]
B. Use the relationship \(P(S_n \leq t) = P(N(t) \geq n)\) to explain why the time until the third event is related to the Poisson PMF.
4
The Inspection Paradox Reflection
"I’ve been waiting at this bus stop for 15 minutes. The average gap between buses is 10 minutes. It feels like the universe is out to get me."
Mathematically justify why this passenger’s frustration is consistent with the properties of a Poisson process. Does the fact that they have already waited 15 minutes decrease the expected time until the next bus arrives?
Continuous Time Presentation Slides Continuous-Time Dynamics
Generator Matrices & Kolmogorov Equations
Lesson 04 // Stochastic Modeling
Bridging the Gap
Discrete Time (DTMC)
Transitions occur at steps \(n = 1, 2, \dots\)
Governed by Transition Matrix \(P\).
State change is immediate at each tick.
Continuous Time (CTMC)
Transitions can occur at any time \(t \geq 0\).
Governed by Generator Matrix \(Q\).
Time spent in each state is Exponential.
The Infinitesimal Generator
The rate of moving from state \(i\) to \(j\) is \(q_{ij}\).
\(q_{ij} = \lim_{h \to 0} \frac{P_{ij}(h)}{h}\)
Properties of \(Q\):
\(q_{ij} \geq 0\) for \(i \neq j\)
\(q_{ii} = -\sum_{j \neq i} q_{ij}\)
Rows sum to 0
\[ Q = \begin{pmatrix} -q_1 & q_{12} & \cdots \\ q_{21} & -q_2 & \cdots \\ \vdots & \vdots & \ddots \end{pmatrix} \]
Exponential Holding Times
"How long do we wait in state \(i\) before a transition occurs?"
Wait Duration
Exponential with rate \(q_i = -q_{ii}\)
Mean Wait = \(1/q_i\)
Next State Logic
Move to state \(j\) with probability
\(q_{ij} / q_i\)
The Master Equation
To find the time-dependent probabilities \(P(t)\), we solve the Kolmogorov Forward Equation :
\[ \frac{d}{dt} P(t) = P(t) Q \]
Solution Form
\[ P(t) = e^{Qt} \]
Calculating the matrix exponential is the key to solving continuous stochastic dynamics.
Birth-Death Processes
A fundamental class of CTMCs where transitions only occur to adjacent states.
Birth (\(i \to i+1\)): Rate \(\lambda_i\)
Death (\(i \to i-1\)): Rate \(\mu_i\)
Q-Matrix Structure
Tridiagonal Matrix
\[ \begin{pmatrix} -\lambda_0 & \lambda_0 & 0 \\ \mu_1 & -(\lambda_1+\mu_1) & \lambda_1 \\ 0 & \mu_2 & \dots \end{pmatrix} \]
Continuous Stationarity
In continuous time, the stationary distribution \(\pi\) is the solution to:
\[ \pi Q = 0 \]
Subject to \(\sum \pi_i = 1\)
"Net flow into each state must equal net flow out of each state."
Lesson 4 Summary
Continuous Time Facilitation Guide Continuous Dynamics Guide
Lesson 4: Continuous-Time Markov Chains
SEQUENCE
Stochastic Modeling
The Shift to Rates
The transition from discrete to continuous time is conceptually challenging. Students must shift from probabilities to rates. Ensure they understand that while a probability is bounded by [0,1], a rate can be any positive value.
The "Q" Matrix Nuance
Negative diagonals represent total departure rate.
Rows sum to zero because the system must go somewhere (or stay).
Unlike \(P\), \(Q\) is a derivative.
Differential Framework
Forward Eq: \(\frac{d}{dt} P(t) = P(t)Q\)
Backward Eq: \(\frac{d}{dt} P(t) = QP(t)\)
Steady state: \(0 = \pi Q\)
Analyzing Birth-Death Models
This is the bridge to Lesson 5 (Queueing). Use the following logic to help students calculate stationary distributions for birth-death processes without full matrix inversion:
Cut Equations (Balance Equations)
"Rate of crossing any 'cut' between states must balance."
\(\pi_i \lambda_i = \pi_{i+1} \mu_{i+1}\)
yields
\(\pi_n = \pi_0 \prod_{i=0}^{n-1} \frac{\lambda_i}{\mu_{i+1}}\)
This recursive relationship allows solving for \(\pi_0\) using the normalization \(\sum \pi_n = 1\).
Seminar Discussion
The Threshold of Extinction:
"In a simple population model (\(\lambda_i = i\lambda\), \(\mu_i = i\mu\)), if \(\mu > \lambda\), what is the probability of eventual extinction? Why is 0 an absorbing state?"
Computation Challenges:
"For large Q-matrices, computing \(e^{Qt}\) via Taylor expansion is numerically unstable. How would we use diagonal decomposition instead?"
The Matrix Exponential Insight
Remind students that \(e^{Qt} = I + Qt + \frac{(Qt)^2}{2!} + \dots\).
For small \(t=h\), \(P(h) \approx I + Qh\).
This confirms that \(P_{ij}(h) \approx q_{ij}h\) for \(i \neq j\) and \(P_{ii}(h) \approx 1 - q_i h\). This is the key to simulating CTMCs using a "discretized" approach or the Gillespie Algorithm .
Continuous Time Dynamics Worksheet Continuous Flux
Lesson 4: CTMC & Generator Matrices
Name:
Date:
1
Constructing the Q-Matrix
A machine can be in three states: (1) Operational, (2) Degraded, and (3) Broken. Transitions occur with rates:
- From Operational to Degraded at rate 0.5/day.
- From Degraded to Broken at rate 1.0/day.
- Repair from Degraded to Operational takes on average 0.5 days.
- Repair from Broken to Operational takes on average 2 days.
A. Construct the generator matrix \(Q\) for this system.
\[ Q = \begin{pmatrix} & & \\ & & \\ & & \end{pmatrix} \]
B. What is the expected time spent in the "Degraded" state before any transition occurs?
2
Solving for Time-Dependence
Consider a simple two-state system (\(1 \leftrightarrow 2\)) with generator matrix \(Q = \begin{pmatrix} -\lambda & \lambda \\ \mu & -\mu \end{pmatrix}\).
A. Set up the Kolmogorov Forward Equation for \(P_{11}(t)\).
\[ \frac{d}{dt} P_{11}(t) = \]
B. Show that the solution for the stationary distribution \(\pi\) (as \(t \to \infty\)) is given by \(\pi_1 = \frac{\mu}{\lambda + \mu}\) and \(\pi_2 = \frac{\lambda}{\lambda + \mu}\).
3
Pure Birth Model (Yule Process)
Let \(\lambda_n = n\lambda\) be the birth rate when the population size is \(n\). There are no deaths (\(\mu_n = 0\)).
A. Construct the Q-matrix for the first four states \(\{1, 2, 3, 4\}\).
B. Why can this process never reach a stationary distribution?
4
The "Embedded" Chain
Every CTMC has an Embedded Discrete-Time Markov Chain that describes the sequence of states visited, ignoring the time spent in each.
Explain how you would construct the transition matrix \(P_{emb}\) from a given generator matrix \(Q\). Does the embedded chain have the same stationary distribution as the continuous chain? Why or why not?
Queueing Presentation Slides Queueing Theory
System Performance & Optimization
Lesson 05 // Stochastic Modeling
The Triage Challenge
Critical patients arrive at an ER randomly. Doctors spend varying amounts of time on each case.
"How many beds do we need to ensure 95% of patients are seen within 10 minutes?"
The Optimization Balance
Too many servers = Wasted resources.
Too few servers = Catastrophic wait times.
Stochastic modeling identifies the 'Sweet Spot'.
Describing Queues (A/B/c)
A
Arrivals
M = Markovian (Poisson)
D = Deterministic
G = General
B
Service
M = Exponential
D = Deterministic
G = General
c
Servers
Number of parallel service channels.
Example: M/M/1 (The simplest stochastic queue)
Little's Law
An incredibly general result that relates long-term average queue length (\(L\)) to average time in system (\(W\)).
\[ L = \lambda W \]
\(L\): Avg. Customers
\(\lambda\): Arrival Rate
\(W\): Avg. Time Spent
The M/M/1 System
Arrivals (\(\lambda\)), Service (\(\mu\)).
Stability Condition: \(\rho = \frac{\lambda}{\mu} < 1\)
If \(\rho \geq 1\), the queue grows to infinity!
Steady State Stats
Avg in Queue: \(L = \frac{\rho}{1-\rho}\)
Avg Wait: \(W = \frac{1}{\mu - \lambda}\)
Prob System is Empty: \(P_0 = 1 - \rho\)
Scaling Out: M/M/k
With \(k\) servers, the death rate becomes state-dependent.
\(\mu_n = n\mu\) for \(n < k\)
\(\mu_n = k\mu\) for \(n \geq k\)
Erlang-C Formula
Used to calculate the probability that an arriving customer will have to wait for service.
"The mathematical foundation of modern call center staffing."
Economic Design
Total Cost (\(TC\))
\(TC = c_k \cdot k + c_w \cdot L\)
Balance the cost of service (\(c_k\)) against the cost of waiting (\(c_w\)).
"Optimization is the ultimate application of stochastic theory."
Sequence Mastery
Theoretical
You can derive the long-term stability of complex, random systems.
Applied
You can optimize resources under conditions of uncertainty.
Queueing Facilitation Guide Performance Analysis Guide
Lesson 5: Queueing Theory
SEQUENCE
Stochastic Modeling
The Culmination of Theory
This lesson synthesizes everything: Poisson arrivals (Lesson 3), continuous-time state changes (Lesson 4), and long-term stationarity (Lesson 2). The goal is to move from "abstract matrix math" to "operational engineering."
Key Analytical Focus
The stability condition \(\rho < 1\).
Why variance in service time matters (the P-K formula context).
The difference between "time in queue" vs. "time in system".
Deriving M/M/1 stats using birth-death equations.
Common Student Errors
Misusing Little's Law by using the wrong \(\lambda\) (e.g., effective vs. total).
Assuming \(W_q\) (wait in queue) is the same as \(W\) (total time).
Underestimating the impact of \(\rho\) approaching 1.
Discussion: The 'Hockey Stick' Curve
"Why does a system with 90% utilization feel so much worse than one with 80%?"
Graph the function \(W = \frac{1}{\mu(1-\rho)}\). As \(\rho \to 1\), the wait time increases nonlinearly.
If \(\rho = 0.5\), \(W\) is proportional to 2.
If \(\rho = 0.9\), \(W\) is proportional to 10.
If \(\rho = 0.99\), \(W\) is proportional to 100.
This explains why slight increases in demand can lead to systemic collapse in power grids, internet routing, and healthcare.
Project Guidance
Students will optimize a multi-server (M/M/k) triage system. Guide them through these three "Policy" choices:
1. Priority Queuing:
"How does the model change if 'Red' patients jump to the front of the line? Does the Markov property still hold for the remaining queue?"
2. Pooling vs. Dedicated Lines:
"Is it better to have one shared queue for 3 doctors (M/M/3) or 3 separate queues for 3 doctors (3 x M/M/1)? Why is the pooled system mathematically superior?"
Final Reflections
"The entire sequence has been about characterizing uncertainty. In Lesson 1, we learned to track it. In Lesson 5, we learned to manage it. Encourage students to think about where else these models apply: algorithmic trading, logistics, wildlife migration, and network security."
Queueing Theory Project Guide Hospital Triage Design
Lesson 5: Queueing Theory Project
Name:
Date:
The Scenario
Saint Jude's Hospital is redesigning its Emergency Room triage system. Patients arrive at a rate of \(\lambda = 18\) per hour . Currently, there are 4 doctors , each able to treat a patient in 12 minutes on average (\(\mu = 5\) per hour). The arrival and service processes are assumed to be Poisson/Exponential.
1
Baseline System Analysis (M/M/4)
A. Calculate the system utilization \(\rho\). Is the system currently stable?
B. Using Little's Law (\(L = \lambda W\)), if the average number of patients waiting in the system is \(L = 12\), what is the average time a patient spends in the hospital?
2
The "Flu Season" Surge
During flu season, the arrival rate spikes to \(\lambda = 24\) per hour .
A. Prove that the current 4-doctor system will collapse under this demand. What is the minimum number of doctors (\(k\)) required to restore stability?
B. If we hire a fifth doctor (\(k=5\)), the system returns to an M/M/5 queue. Describe qualitatively how the "tail" of the wait-time distribution changes compared to the baseline.
3
Strategic Triage Design
The hospital board is considering two options:
Option A: A single shared queue for all doctors.
Option B: Splitting into two separate ER zones (Trauma and Routine), each with its own arrival stream and dedicated doctors.
"Which option is likely to result in lower average wait times? Use your knowledge of multi-server vs. single-server stochastic pooling to justify your answer."
4
Reflection: The Limits of Modeling
Our M/M/k model assumes that service times are Exponentially distributed . However, real-world data shows that many triage tasks have a "heavy tail" (some cases take much, much longer than others).
If the service distribution is NOT exponential, which results from this course can still be applied, and which must be discarded? How would you adjust your model to handle non-Markovian service times?