Tutorials › Stochastic Processes › Common Errors in M/M/1 Balance Equations

The M/M/1 Queue · Tutorial 645 of 994

Common Errors in M/M/1 Balance Equations

Use the state-by-state flow equations to find and check the stationary distribution of an M/M/1 queue, and to diagnose common errors.

Intermediate 11 min read

What You'll Learn

  • Write the M/M/1 generator, including its special boundary row at zero.
  • Distinguish transition rates from probabilities in the embedded jump chain.
  • Derive the stationary flow equations and their local balance form.
  • Check normalization and verify a proposed distribution at each state.
  • Identify when an M/M/1 stationary probability distribution exists.

Why Check Each State?

For an M/M/1 queue, a stationary distribution is not validated just because its terms look geometric or because a few equations seem to fit. At each state, the probability flow into that state must equal the flow out. The state \(0\) is especially important: when the system is empty, a service completion cannot occur. Using the interior service rate at this boundary, reversing an arrival and a departure, or omitting the normalizing constant can each produce an incorrect answer.

Consider a probability space \((\Omega,\mathcal{F},\mathbb{P})\) carrying the continuous-time Markov process \((X_t)_{t\ge0}\), where \(X_t\) is the number of customers in the system at time \(t\), with state space \(S=\{0,1,2,\ldots\}\) and filtration \((\mathcal{F}_t)_{t\ge0}\). Arrivals occur at rate \(\lambda\ge0\), and service times are exponential with rate \(\mu>0\). A customer departs at rate \(\mu\) when \(X_t\ge1\); at state \(0\), there is no departure. The process is nonexplosive: its total transition rate is at most \(\lambda+\mu\).

Definition: The generator \(Q=(q_{ij})\) records the transition rates: for \(i\ne j\), \(q_{ij}\) is the rate of a transition from \(i\) to \(j\), and \(q_{ii}=-\sum_{j\ne i}q_{ij}\). For the M/M/1 process, \(q_{01}=\lambda\), \(q_{00}=-\lambda\), and for \(n\ge1\), \(q_{n,n+1}=\lambda\), \(q_{n,n-1}=\mu\), and \(q_{nn}=-(\lambda+\mu)\). All other entries are zero. Thus each row of \(Q\) sums to \(0\).

A stationary distribution is a probability row vector \(\pi=(\pi_0,\pi_1,\ldots)\) such that if \(X_0\) has distribution \(\pi\), then \(X_t\) has distribution \(\pi\) for every \(t\ge0\). For this bounded-rate process, the standard generator criterion says that a probability vector is stationary exactly when \(\pi Q=0\). This criterion is a standard result for continuous-time Markov chains; its general proof is given in the later course material on continuous-time chains. Here the equations \(\pi Q=0\) express the state-by-state flow balances.

The Correct Balance Equations

At state \(0\), the only transition out is an arrival, at rate \(\lambda\); the only transition in is a service completion from state \(1\), at rate \(\mu\). At a state \(n\ge1\), transitions in come from \(n-1\) by an arrival and \(n+1\) by a service completion. Transitions out come from \(n\) by an arrival or a service completion. Consequently, the balance equations are

$$ \lambda\pi_0=\mu\pi_1,\qquad \lambda\pi_{n-1}+\mu\pi_{n+1}=(\lambda+\mu)\pi_n,\quad n\ge1. $$

The first equation is a boundary equation, not the \(n\ge1\) equation with \(n=0\) substituted into it. In particular, there is no service-completion flow out of state \(0\).

Theorem: For \(\lambda\ge0\) and \(\mu>0\), the M/M/1 process has a stationary probability distribution if and only if \(\lambda<\mu\). When it exists, it is unique and is given by \(\pi_n=(1-\rho)\rho^n\) for \(n\ge0\), where \(\rho=\lambda/\mu\). For \(\lambda=0\), this formula means \(\pi_0=1\) and \(\pi_n=0\) for \(n\ge1\).

Proof. Let \(\pi\) be any stationary probability distribution, so its entries are nonnegative, sum to \(1\), and satisfy the balance equations. Define the net upward flow across the boundary between states \(n\) and \(n+1\) by \(J_n=\lambda\pi_n-\mu\pi_{n+1}\). The equation at state \(0\) gives \(J_0=0\). For \(n\ge1\), rearranging the balance equation gives \(\lambda\pi_{n-1}-\mu\pi_n=\lambda\pi_n-\mu\pi_{n+1}\), or \(J_{n-1}=J_n\). Inductively, every \(J_n=0\), so \(\lambda\pi_n=\mu\pi_{n+1}\) for all \(n\ge0\). If \(\lambda=0\), this forces \(\pi_{n+1}=0\) for every \(n\), and normalization gives \(\pi_0=1\). If \(\lambda>0\), it gives \(\pi_{n+1}=\rho\pi_n\), hence \(\pi_n=\pi_0\rho^n\). When \(\rho<1\), the geometric sum is \(\sum_{n=0}^{\infty}\rho^n=1/(1-\rho)\), so normalization requires \(\pi_0=1-\rho\). When \(\rho=1\), all entries equal \(\pi_0\), and they cannot sum to \(1\) unless \(\pi_0=0\), which would make their sum \(0\). When \(\rho>1\), if \(\pi_0>0\) the terms \(\pi_0\rho^n\) do not even tend to zero, so their sum diverges; if \(\pi_0=0\), the recurrence forces every entry to be zero. Thus no stationary probability distribution exists for \(\rho\ge1\). Conversely, when \(\rho<1\), the proposed entries are nonnegative and sum to \((1-\rho)/(1-\rho)=1\). They satisfy \(\lambda\pi_n=\mu\pi_{n+1}\) because \(\mu(1-\rho)\rho^{n+1}=\lambda(1-\rho)\rho^n\), including the case \(\lambda=0\). These equalities give the state \(0\) balance and, by adding the two neighboring flows, each interior balance. The generator criterion therefore makes this probability vector stationary. The recurrence and normalization also show it is the only one. \(\square\)

Three Checks That Catch Common Errors

Worked Example: A False Service Rate at State Zero

Take \(\lambda=1\) and \(\mu=2\). The generator has row \(0\) equal to \((-1,1,0,\ldots)\), whose entries sum to \(0\). Each row \(n\ge1\) has entries \(2\) in column \(n-1\), \(-3\) in column \(n\), and \(1\) in column \(n+1\); their sum is \(2-3+1=0\).

A common incorrect boundary equation is \(2\pi_0=1\pi_1\), on the mistaken premise that service can take the system from state \(0\) to state \(-1\). The actual state \(0\) equation is \(1\pi_0=2\pi_1\), so it requires \(\pi_1=\tfrac12\pi_0\), not \(\pi_1=2\pi_0\). The interior balance at state \(1\) is \(\pi_0+2\pi_2=3\pi_1\). The zero-flow recurrence from the correct boundary equation gives \(\pi_2=\tfrac12\pi_1=\tfrac14\pi_0\), and substitution yields \(\pi_0+2(\tfrac14\pi_0)=\tfrac32\pi_0=3(\tfrac12\pi_0)\), as required.

Check: The false boundary equation and the interior equations cannot jointly hold for a nonzero probability vector. The incorrect boundary equation requires \(\pi_1=2\pi_0\), while the interior recurrence requires \(\pi_1=\tfrac12\pi_0\); together these imply \(\pi_0=\pi_1=0\), and the recurrence then forces every entry to be zero.

Worked Example: Reversing the Upward and Downward Rates

Again let \(\lambda=1\) and \(\mu=2\). The generator rows sum to zero: at state \(0\), \(-1+1=0\), and at every \(n\ge1\), \(2-3+1=0\). For the stationary flow, an arrival moves upward at rate \(1\), while a service completion moves downward at rate \(2\). Hence the zero-flow equation is \(1\pi_n=2\pi_{n+1}\), or \(\pi_{n+1}=\tfrac12\pi_n\).

Reversing the rates instead gives the incorrect recurrence \(\pi_{n+1}=2\pi_n\). If \(\pi_0>0\), it produces \(\pi_n=2^n\pi_0\), whose terms do not tend to zero, so they cannot be probabilities with finite sum. If \(\pi_0=0\), the recurrence makes every term zero, also not a probability distribution.

Check against the actual balance: The correct normalized candidate is \(\pi_n=\tfrac12(\tfrac12)^n\). Its entries sum to \(\tfrac12\sum_{n=0}^{\infty}(\tfrac12)^n=\tfrac12\cdot2=1\). At state \(0\), inflow is \(2\pi_1=2\cdot\tfrac14=\tfrac12\), and outflow is \(1\pi_0=1\cdot\tfrac12=\tfrac12\). The upward and downward directions must be read from the transition itself, not inferred from the order in which rates are written.

Worked Example: A Geometric Sequence Without Normalization

With \(\lambda=1\) and \(\mu=2\), each generator row sums to zero: the state \(0\) row contributes \(-1+1=0\), and each positive-state row contributes \(2-3+1=0\). A proposed sequence \(\widetilde{\pi}_n=(\tfrac12)^n\) has the correct ratio between consecutive terms, so it satisfies the local flow equalities. But its total mass is \(\sum_{n=0}^{\infty}(\tfrac12)^n=2\), not \(1\). It is not a probability distribution.

To normalize, multiply every term by \(\tfrac12\), giving \(\pi_n=\tfrac12(\tfrac12)^n\). The total is \(\tfrac12\cdot2=1\). In particular, \(\pi_0=\tfrac12\), \(\pi_1=\tfrac14\), and \(\pi_2=\tfrac18\). The state \(0\) balance checks as \(1\pi_0=\tfrac12=2\pi_1\). At state \(1\), incoming flow is \(1\pi_0+2\pi_2=\tfrac12+\tfrac14=\tfrac34\); outgoing flow is \(3\pi_1=3\cdot\tfrac14=\tfrac34\).

Check: The ratio test establishes the balance equations, but it does not establish that the entries sum to one. The normalized vector has both required properties: it sums to one and satisfies the state \(0\) and state \(1\) equations. The recurrence verifies every other interior state in the same way.

A Practical Audit

When checking an M/M/1 balance calculation, start by writing the transitions at the boundary separately from those in the interior. Then check the direction and units of each flow: a rate from \(n\) to \(n+1\) is an upward arrival rate, while a rate from \(n\) to \(n-1\) is a downward service rate. A stationary equation compares rate multiplied by probability with rate multiplied by probability; it is not obtained by swapping the two rates or by using a probability from a different chain.

In particular, the embedded jump chain records the next state conditional on a jump. At \(n\ge1\), its upward and downward probabilities are \(\lambda/(\lambda+\mu)\) and \(\mu/(\lambda+\mu)\), respectively; at \(0\), its next jump is upward with probability \(1\). Those jump probabilities are not the generator rates. Do not insert them into \(\pi Q=0\) as if they were rates, and do not treat state \(0\) as if it had the same possible departures as a positive state.

Finally, test a proposed answer in three distinct ways: check the boundary balance, check at least one interior balance using its incoming and outgoing flows, and check that the entries are nonnegative and sum to one. For the M/M/1 stationary distribution, the recurrence and boundary balance imply \(\pi_n=\pi_0\rho^n\); normalization is possible only when \(\rho<1\). A sequence satisfying the algebra but failing the sum, or a normalized sequence that fails the boundary equation, is not a stationary probability distribution.

Check Your Understanding

For each question, identify the state-by-state flows before deciding whether a proposed equation or distribution is valid.

  1. For \(\lambda=2\) and \(\mu=3\), write the balance equation at state \(0\) and at state \(2\).
  2. For \(\lambda=1\) and \(\mu=3\), what ratio must consecutive stationary probabilities satisfy? Which rate corresponds to an upward transition?
  3. For \(\lambda=\mu>0\), explain why the balance recurrence cannot be normalized to a probability distribution.
  4. A proposed sequence satisfies every local balance equation but sums to \(4\). Is it a stationary distribution? What correction is needed?
  5. Why is the boundary equation not obtained by allowing a service completion from state \(0\)?