From Stationary Probabilities to Moments
For an M/M/1 queue, the stationary distribution describes how often the system contains \(n\) customers over the long run. Its individual probabilities are useful, but performance questions often call for a summary: the average number in the system, or how much that number fluctuates. A probability generating function packages the probabilities into one expression, and its derivatives yield these summaries directly.
Consider a continuous-time M/M/1 queue on a probability space \((\Omega,\mathcal{F},\mathbb{P})\). Let \((X_t)_{t\ge0}\) be its number of customers in the system, with state space \(S=\{0,1,2,\ldots\}\), arrival rate \(\lambda\ge0\), and service rate \(\mu>0\). The state counts customers waiting and, when the system is nonempty, the customer in service. We use the natural filtration \(\mathcal{F}_t=\sigma(X_s:0\le s\le t)\). The calculations below concern the stationary regime, in which \(X_t\) has the same distribution at each time \(t\).
When \(\lambda>0\), define the utilization \(\rho=\lambda/\mu\). The stable case is \(0<\rho<1\). The earlier material on stationary probabilities for the M/M/1 queue gives, in this case, \(\pi_n=\mathbb{P}(X_t=n)=(1-\rho)\rho^n\) for \(n\ge0\). These probabilities sum to one because \(\sum_{n=0}^{\infty}(1-\rho)\rho^n=(1-\rho)/(1-\rho)=1\). If \(\lambda=0\), the stationary system is empty with probability one; the moment formulas below also hold at \(\rho=0\). For \(\lambda\ge\mu\), there is no stationary probability distribution on the nonnegative integers, so stationary moments of this form do not apply.
The PGF is not a different queueing model; it is a way to encode the stationary distribution. In particular, \(G(1)=1\) for a probability distribution. The first derivative at one gives the mean, while the second derivative at one gives the factorial second moment \(\mathbb{E}[N(N-1)]\). The distinction between that factorial moment and \(\mathbb{E}[N^2]\) matters when calculating variance.
The Geometric PGF and Its Derivatives
Proof. For \(0<\rho<1\), substitute the geometric stationary probabilities into the definition of the PGF. The resulting power series is a geometric series with ratio \(\rho z\), so it converges when \(|\rho z|<1\), and its sum is
At \(\rho=0\), the stationary probabilities are \(\pi_0=1\) and \(\pi_n=0\) for \(n\ge1\), so the defining sum is \(G(z)=1\). This also agrees with the displayed expression evaluated at \(\rho=0\). \(\square\)
For \(0<\rho<1\), the power series for \(G\) has radius of convergence \(1/\rho>1\). It can therefore be differentiated twice term by term in a neighborhood of \(z=1\). The differentiated series identify the derivatives with moments: the first derivative weights each probability by \(n\), and the second by \(n(n-1)\).
Proof. First suppose \(0<\rho<1\). Differentiating the PGF gives $$ G'(z)=\frac{\rho(1-\rho)}{(1-\rho z)^2}, \qquad G''(z)=\frac{2\rho^2(1-\rho)}{(1-\rho z)^3}. $$ Termwise differentiation of its defining series gives \(G'(1)=\sum_{n\ge0}n\pi_n=\mathbb{E}[N]\) and \(G''(1)=\sum_{n\ge0}n(n-1)\pi_n=\mathbb{E}[N(N-1)]\). Substituting \(z=1\) into the derivatives yields $$ \mathbb{E}[N]=\frac{\rho(1-\rho)}{(1-\rho)^2} =\frac{\rho}{1-\rho}, \qquad \mathbb{E}[N(N-1)]=\frac{2\rho^2(1-\rho)}{(1-\rho)^3} =\frac{2\rho^2}{(1-\rho)^2}. $$ Since \(N^2=N(N-1)+N\), it follows that $$ \mathbb{E}[N^2]=\frac{2\rho^2}{(1-\rho)^2}+\frac{\rho}{1-\rho} =\frac{2\rho^2+\rho(1-\rho)}{(1-\rho)^2} =\frac{\rho+\rho^2}{(1-\rho)^2}. $$ Using \(\operatorname{Var}(N)=\mathbb{E}[N^2]-(\mathbb{E}[N])^2\), we obtain $$ \operatorname{Var}(N)=\frac{\rho+\rho^2}{(1-\rho)^2} -\frac{\rho^2}{(1-\rho)^2} =\frac{\rho}{(1-\rho)^2}. $$ When \(\rho=0\), \(N=0\) with probability one, so its mean and variance are both zero, which agrees with the stated formulas. \(\square\)
The denominator in the variance is squared, whereas the denominator in the mean is not. Thus fluctuations increase more rapidly than the mean as \(\rho\) approaches one from below. This is a property of the stationary distribution; it does not assert that a queue with an arbitrary initial state has these moments at every finite time.
Worked Calculations
Worked Example: Utilization One-Half
Suppose \(\lambda=2\) and \(\mu=4\), in consistent units of customers per unit time. The stability condition holds because \(2<4\), and \(\rho=\lambda/\mu=2/4=1/2\). Find the stationary mean and variance.
The stationary PGF is $$ G(z)=\frac{1-\tfrac12}{1-\tfrac12z}=\frac{1}{2-z}. $$ It is normalized: \(G(1)=1/(2-1)=1\). Differentiating this expression gives \(G'(z)=1/(2-z)^2\) and \(G''(z)=2/(2-z)^3\). Evaluating at one, \(G'(1)=1/(2-1)^2=1\) and \(G''(1)=2/(2-1)^3=2\). Hence \(\mathbb{E}[N]=1\), while \(\mathbb{E}[N(N-1)]=2\). Therefore \(\mathbb{E}[N^2]=2+1=3\), and \(\operatorname{Var}(N)=3-1^2=2\).
Check: Substitution into the formulas gives \(\rho/(1-\rho)=(1/2)/(1/2)=1\) and \(\rho/(1-\rho)^2=(1/2)/(1/2)^2=2\), agreeing with the derivative calculation.
Worked Example: Utilization Two-Thirds
Suppose \(\lambda=4\) and \(\mu=6\). Since \(4<6\), the queue is in the stable regime, and \(\rho=4/6=2/3\). Compute the mean and variance from the PGF.
Using the geometric PGF, $$ G(z)=\frac{1-\tfrac23}{1-\tfrac23z}=\frac{1}{3-2z}. $$ Its normalization check is \(G(1)=1/(3-2)=1\). Differentiation gives \(G'(z)=2/(3-2z)^2\) and \(G''(z)=8/(3-2z)^3\). Thus \(G'(1)=2/(3-2)^2=2\), and \(G''(1)=8/(3-2)^3=8\). The second derivative is the factorial moment, so \(\mathbb{E}[N^2]=8+2=10\), not \(8\). The variance is \(10-2^2=6\).
Check: The closed-form formulas give \((2/3)/(1/3)=2\) for the mean and \((2/3)/(1/3)^2=6\) for the variance. Both match the values computed from the derivatives.
Worked Example: Utilization Three-Quarters
Suppose \(\lambda=3\) and \(\mu=4\). The condition \(3<4\) ensures stability, and \(\rho=3/4\). Find the stationary moments and compare them with those at utilization one-half.
The PGF is $$ G(z)=\frac{1-\tfrac34}{1-\tfrac34z}=\frac{1}{4-3z}, $$ and \(G(1)=1/(4-3)=1\). Its derivatives are \(G'(z)=3/(4-3z)^2\) and \(G''(z)=18/(4-3z)^3\). Therefore \(G'(1)=3/(4-3)^2=3\) and \(G''(1)=18/(4-3)^3=18\). It follows that \(\mathbb{E}[N]=3\), \(\mathbb{E}[N^2]=18+3=21\), and \(\operatorname{Var}(N)=21-3^2=12\).
Check: Direct substitution gives \((3/4)/(1/4)=3\) for the mean and \((3/4)/(1/4)^2=12\) for the variance. Compared with the one-half case, the mean has risen from \(1\) to \(3\), and the variance from \(2\) to \(12\), confirming that variability grows sharply as utilization increases.
Interpretation and Common Mistakes
The mean \(\mathbb{E}[N]\) is an average number of customers in the entire system, including any customer in service. It is not the average number waiting alone. The variance describes the spread of this stationary number around its mean, in squared customer-count units. Neither quantity is a probability: for example, a mean of \(3\) does not mean that the system contains exactly \(3\) customers at every time.
A frequent calculation error is to identify \(G''(1)\) with \(\mathbb{E}[N^2]\). The derivative of \(z^n\) taken twice is \(n(n-1)z^{n-2}\), not \(n^2z^{n-2}\). For example, at \(\rho=1/2\), the correct calculation gives \(G''(1)=2\), which is \(\mathbb{E}[N(N-1)]\). Treating \(2\) as \(\mathbb{E}[N^2]\) would give the incorrect variance \(2-1^2=1\). The correction is to add the mean: \(\mathbb{E}[N^2]=G''(1)+G'(1)=2+1=3\), and then the variance is \(3-1^2=2\).
Another mistake is to use the stationary formulas at or above the stability threshold. At \(\rho=1\), the expression \((1-\rho)\rho^n\) assigns zero to every state, so it cannot be a probability distribution; at \(\rho>1\), the geometric sequence cannot be normalized as a stationary probability distribution either. The formulas for mean and variance require \(0\le\rho<1\). In the limiting approach \(\rho\uparrow1\), both formulas diverge, but that divergence is not a finite stationary mean or variance at \(\rho=1\).
Check Your Understanding
Use the PGF and moment identities above. In each calculation, distinguish the factorial second moment from the raw second moment.
- For \(\lambda=1\) and \(\mu=3\), calculate \(\rho\), the stationary mean, and the variance.
- Show from the geometric PGF that \(G(1)=1\) whenever \(0\le\rho<1\).
- If \(G'(1)=4\) and \(G''(1)=20\), find \(\mathbb{E}[N^2]\) and \(\operatorname{Var}(N)\).
- Explain why differentiating the PGF twice gives \(\mathbb{E}[N(N-1)]\), rather than \(\mathbb{E}[N^2]\).
- Why can the stationary mean and variance formulas not be used for an M/M/1 queue with \(\lambda\ge\mu\)?