Unformatted Document Excerpt
Coursehero >>
New Jersey >>
Rutgers >>
STATS 580
Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
to Introduction Probability Models Ninth Edition
This page intentionally left blank
Introduction to Probability Models
Ninth Edition
Sheldon M. Ross
University of California Berkeley, California
AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO Academic Press is an imprint of Elsevier
Acquisitions Editor Project Manager Marketing Managers Cover Design Composition Cover Printer Interior Printer
Tom Singer Sarah M. Hajduk Linda Beattie, Leah Ackerson Eric DeCicco VTEX Phoenix Color The MapleVail Book Manufacturing Group
Academic Press is an imprint of Elsevier 30 Corporate Drive, Suite 400, Burlington, MA 01803, USA 525 B Street, Suite 1900, San Diego, California 921014495, USA 84 Theobald's Road, London WC1X 8RR, UK This book is printed on acidfree paper.
Copyright 2007, Elsevier Inc. All rights reserved. No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopy, recording, or any information storage and retrieval system, without permission in writing from the publisher. Permissions may be sought directly from Elsevier's Science & Technology Rights Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333, Email: permissions@elsevier.com. You may also complete your request online via the Elsevier homepage (http://elsevier.com), by selecting "Support & Contact" then "Copyright and Permission" and then "Obtaining Permissions." Library of Congress CataloginginPublication Data Application Submitted British Library CataloguinginPublication Data A catalogue record for this book is available from the British Library. ISBN13: 9780125980623 ISBN10: 0125980620 For information on all Academic Press publications visit our Web site at www.books.elsevier.com Printed in the United States of America 06 07 08 09 10 9 8 7 6
5
4
3
2
1
Contents
Preface xiii
1. Introduction to Probability Theory 1
1.1. 1.2. 1.3. 1.4. 1.5. 1.6. Introduction 1 Sample Space and Events 1 Probabilities Defined on Events 4 Conditional Probabilities 7 Independent Events 10 Bayes' Formula 12 Exercises 15 References 21
2. Random Variables 23
2.1. Random Variables 23 2.2. Discrete Random Variables 27 2.2.1. The Bernoulli Random Variable 28 2.2.2. The Binomial Random Variable 29 2.2.3. The Geometric Random Variable 31 2.2.4. The Poisson Random Variable 32 2.3. Continuous Random Variables 34 2.3.1. The Uniform Random Variable 35 2.3.2. Exponential Random Variables 36 2.3.3. Gamma Random Variables 37 2.3.4. Normal Random Variables 37
v
vi
Contents
2.4. Expectation of a Random Variable 38 2.4.1. The Discrete Case 38 2.4.2. The Continuous Case 41 2.4.3. Expectation of a Function of a Random Variable 43 2.5. Jointly Distributed Random Variables 47 2.5.1. Joint Distribution Functions 47 2.5.2. Independent Random Variables 51 2.5.3. Covariance and Variance of Sums of Random Variables 53 2.5.4. Joint Probability Distribution of Functions of Random Variables 61 2.6. Moment Generating Functions 64 2.6.1. The Joint Distribution of the Sample Mean and Sample Variance from a Normal Population 74 2.7. Limit Theorems 77 2.8. Stochastic Processes 83 Exercises 85 References 96
3. Conditional Probability and Conditional Expectation 97
Introduction 97 The Discrete Case 97 The Continuous Case 102 Computing Expectations by Conditioning 105 3.4.1. Computing Variances by Conditioning 117 3.5. Computing Probabilities by Conditioning 120 3.6. Some Applications 137 3.6.1. A List Model 137 3.6.2. A Random Graph 139 3.6.3. Uniform Priors, Polya's Urn Model, and BoseEinstein Statistics 147 3.6.4. Mean Time for Patterns 151 3.6.5. The kRecord Values of Discrete Random Variables 155 3.7. An Identity for Compound Random Variables 158 3.7.1. Poisson Compounding Distribution 161 3.7.2. Binomial Compounding Distribution 163 3.7.3. A Compounding Distribution Related to the Negative Binomial 164 Exercises 165 3.1. 3.2. 3.3. 3.4.
Contents
vii
4. Markov Chains 185
4.1. 4.2. 4.3. 4.4. 4.5. Introduction 185 ChapmanKolmogorov Equations 189 Classification of States 193 Limiting Probabilities 204 Some Applications 217 4.5.1. The Gambler's Ruin Problem 217 4.5.2. A Model for Algorithmic Efficiency 221 4.5.3. Using a Random Walk to Analyze a Probabilistic Algorithm for the Satisfiability Problem 224 Mean Time Spent in Transient States 230 Branching Processes 233 Time Reversible Markov Chains 236 Markov Chain Monte Carlo Methods 247 Markov Decision Processes 252 Hidden Markov Chains 256 4.11.1. Predicting the States 261 Exercises 263 References 280
4.6. 4.7. 4.8. 4.9. 4.10. 4.11.
5. The Exponential Distribution and the Poisson Process 281
5.1. Introduction 281 5.2. The Exponential Distribution 282 5.2.1. Definition 282 5.2.2. Properties of the Exponential Distribution 284 5.2.3. Further Properties of the Exponential Distribution 291 5.2.4. Convolutions of Exponential Random Variables 298 5.3. The Poisson Process 302 5.3.1. Counting Processes 302 5.3.2. Definition of the Poisson Process 304 5.3.3. Interarrival and Waiting Time Distributions 307 5.3.4. Further Properties of Poisson Processes 310 5.3.5. Conditional Distribution of the Arrival Times 316 5.3.6. Estimating Software Reliability 328 5.4. Generalizations of the Poisson Process 330 5.4.1. Nonhomogeneous Poisson Process 330 5.4.2. Compound Poisson Process 337 5.4.3. Conditional or Mixed Poisson Processes 343
viii
Contents
Exercises 346 References 364
6. ContinuousTime Markov Chains 365
6.1. 6.2. 6.3. 6.4. 6.5. 6.6. 6.7. 6.8. Introduction 365 ContinuousTime Markov Chains 366 Birth and Death Processes 368 The Transition Probability Function Pij (t) 375 Limiting Probabilities 384 Time Reversibility 392 Uniformization 401 Computing the Transition Probabilities 404 Exercises 407 References 415
7. Renewal Theory and Its Applications 417
7.1. 7.2. 7.3. 7.4. 7.5. 7.6. 7.7. 7.8. 7.9. Introduction 417 Distribution of N(t) 419 Limit Theorems and Their Applications 423 Renewal Reward Processes 433 Regenerative Processes 442 7.5.1. Alternating Renewal Processes 445 SemiMarkov Processes 452 The Inspection Paradox 455 Computing the Renewal Function 458 Applications to Patterns 461 7.9.1. Patterns of Discrete Random Variables 462 7.9.2. The Expected Time to a Maximal Run of Distinct Values 469 7.9.3. Increasing Runs of Continuous Random Variables 471 The Insurance Ruin Problem 473 Exercises 479 References 492
7.10.
8. Queueing Theory 493
8.1. Introduction 493 8.2. Preliminaries 494 8.2.1. Cost Equations 495 8.2.2. SteadyState Probabilities 496
Contents
ix
8.3. Exponential Models 499 8.3.1. A SingleServer Exponential Queueing System 499 8.3.2. A SingleServer Exponential Queueing System Having Finite Capacity 508 8.3.3. A Shoeshine Shop 511 8.3.4. A Queueing System with Bulk Service 514 8.4. Network of Queues 517 8.4.1. Open Systems 517 8.4.2. Closed Systems 522 8.5. The System M/G/1 528 8.5.1. Preliminaries: Work and Another Cost Identity 528 8.5.2. Application of Work to M/G/1 529 8.5.3. Busy Periods 530 8.6. Variations on the M/G/1 531 8.6.1. The M/G/1 with RandomSized Batch Arrivals 531 8.6.2. Priority Queues 533 8.6.3. An M/G/1 Optimization Example 536 8.6.4. The M/G/1 Queue with Server Breakdown 540 8.7. The Model G/M/1 543 8.7.1. The G/M/1 Busy and Idle Periods 548 8.8. A Finite Source Model 549 8.9. Multiserver Queues 552 8.9.1. Erlang's Loss System 553 8.9.2. The M/M/k Queue 554 8.9.3. The G/M/k Queue 554 8.9.4. The M/G/k Queue 556 Exercises 558 References 570
9. Reliability Theory 571
9.1. Introduction 571 9.2. Structure Functions 571 9.2.1. Minimal Path and Minimal Cut Sets 574 9.3. Reliability of Systems of Independent Components 578 9.4. Bounds on the Reliability Function 583 9.4.1. Method of Inclusion and Exclusion 584 9.4.2. Second Method for Obtaining Bounds on r(p) 593 9.5. System Life as a Function of Component Lives 595 9.6. Expected System Lifetime 604 9.6.1. An Upper Bound on the Expected Life of a Parallel System 608
x
Contents
9.7. Systems with Repair 610 9.7.1. A Series Model with Suspended Animation 615 Exercises 617 References 624
10. Brownian Motion and Stationary Processes 625
10.1. Brownian Motion 625 10.2. Hitting Times, Maximum Variable, and the Gambler's Ruin Problem 629 10.3. Variations on Brownian Motion 631 10.3.1. Brownian Motion with Drift 631 10.3.2. Geometric Brownian Motion 631 10.4. Pricing Stock Options 632 10.4.1. An Example in Options Pricing 632 10.4.2. The Arbitrage Theorem 635 10.4.3. The BlackScholes Option Pricing Formula 638 10.5. White Noise 644 10.6. Gaussian Processes 646 10.7. Stationary and Weakly Stationary Processes 649 10.8. Harmonic Analysis of Weakly Stationary Processes 654 Exercises 657 References 662
11. Simulation 663
11.1. Introduction 663 11.2. General Techniques for Simulating Continuous Random Variables 668 11.2.1. The Inverse Transformation Method 668 11.2.2. The Rejection Method 669 11.2.3. The Hazard Rate Method 673 11.3. Special Techniques for Simulating Continuous Random Variables 677 11.3.1. The Normal Distribution 677 11.3.2. The Gamma Distribution 680 11.3.3. The ChiSquared Distribution 681 11.3.4. The Beta (n, m) Distribution 681 11.3.5. The Exponential DistributionThe Von Neumann Algorithm 682 11.4. Simulating from Discrete Distributions 685 11.4.1. The Alias Method 688
Contents
xi
11.5. Stochastic Processes 692 11.5.1. Simulating a Nonhomogeneous Poisson Process 693 11.5.2. Simulating a TwoDimensional Poisson Process 700 11.6. Variance Reduction Techniques 703 11.6.1. Use of Antithetic Variables 704 11.6.2. Variance Reduction by Conditioning 708 11.6.3. Control Variates 712 11.6.4. Importance Sampling 714 11.7. Determining the Number of Runs 720 11.8. Coupling from the Past 720 Exercises 723 References 731
Appendix: Solutions to Starred Exercises 733 Index 775
This page intentionally left blank
Preface
This text is intended as an introduction to elementary probability theory and stochastic processes. It is particularly well suited for those wanting to see how probability theory can be applied to the study of phenomena in fields such as engineering, computer science, management science, the physical and social sciences, and operations research. It is generally felt that there are two approaches to the study of probability theory. One approach is heuristic and nonrigorous and attempts to develop in the student an intuitive feel for the subject which enables him or her to "think probabilistically." The other approach attempts a rigorous development of probability by using the tools of measure theory. It is the first approach that is employed in this text. However, because it is extremely important in both understanding and applying probability theory to be able to "think probabilistically," this text should also be useful to students interested primarily in the second approach.
New to This Edition
The ninth edition contains the following new sections. Section 3.7 is concerned with compound random variables of the form SN = N Xi , where N is independent of the sequence of independent and i=1 identically distributed random variables Xi , i 1. It starts by deriving a general identity concerning compound random variables, as well as a corollary of that identity in the case where the Xi are positive and integer valued. The corollary is then used in subsequent subsections to obtain recursive formulas for the probability mass function of SN , when N is a Poisson distribution (Subsection 3.7.1), a binomial distribution (Subsection 3.7.2), or a negative binomial distribution (Subsection 3.7.3).
xiii
xiv
Preface
Section 4.11 deals with hidden Markov chains. These models suppose that a random signal is emitted each time a Markov chain enters a state, with the distribution of the signal depending on the state entered. The Markov chain is hidden in the sense that it is supposed that only the signals and not the underlying states of the chain are observable. As part of our analysis of these models we present, in Subsection 4.11.1, the Viterbi algorithm for determining the most probable sequence of first n states, given the first n signals. Section 8.6.4 analyzes the Poisson arrival single server queue under the assumption that the working server will randomly break down and need repair. There is also new material in almost all chapters. Some of the more significant additions being the following. Example 5.9, which is concerned with the expected number of normal cells that survive until all cancer cells have been killed. The example supposes that each cell has a weight, and the probability that a given surviving cell is the next cell killed is proportional to its weight. A new approachbased on time sampling of a Poisson processis presented in Subsection 5.4.1 for deriving the probability mass function of the number of events of a nonhomogeneous Poisson process that occur in any specified time interval. There is additional material in Section 8.3 concerning the M/M/1 queue. Among other things, we derive the conditional distribution of the number of customers originally found in the system by a customer who spends a time t in the system before departing. (The conditional distribution is Poisson.) In Example 8.3, we illustrate the inspection paradox, by obtaining the probability distribution of the number in the system as seen by the first arrival after some specified time.
Course
Ideally, this text would be used in a oneyear course in probability models. Other possible courses would be a onesemester course in introductory probability theory (involving Chapters 13 and parts of others) or a course in elementary stochastic processes. The textbook is designed to be flexible enough to be used in a variety of possible courses. For example, I have used Chapters 5 and 8, with smatterings from Chapters 4 and 6, as the basis of an introductory course in queueing theory.
Preface
xv
Examples and Exercises
Many examples are worked out throughout the text, and there are also a large number of exercises to be solved by students. More than 100 of these exercises have been starred and their solutions provided at the end of the text. These starred problems can be used for independent study and test preparation. An Instructor's Manual, containing solutions to all exercises, is available free to instructors who adopt the book for class.
Organization
Chapters 1 and 2 deal with basic ideas of probability theory. In Chapter 1 an axiomatic framework is presented, while in Chapter 2 the important concept of a random variable is introduced. Subsection 2.6.1 gives a simple derivation of the joint distribution of the sample mean and sample variance of a normal data sample. Chapter 3 is concerned with the subject matter of conditional probability and conditional expectation. "Conditioning" is one of the key tools of probability theory, and it is stressed throughout the book. When properly used, conditioning often enables us to easily solve problems that at first glance seem quite difficult. The final section of this chapter presents applications to (1) a computer list problem, (2) a random graph, and (3) the Polya urn model and its relation to the BoseEinstein distribution. Subsection 3.6.5 presents krecord values and the surprising Ignatov's theorem. In Chapter 4 we come into contact with our first random, or stochastic, process, known as a Markov chain, which is widely applicable to the study of many realworld phenomena. Applications to genetics and production processes are presented. The concept of time reversibility is introduced and its usefulness illustrated. Subsection 4.5.3 presents an analysis, based on random walk theory, of a probabilistic algorithm for the satisfiability problem. Section 4.6 deals with the mean times spent in transient states by a Markov chain. Section 4.9 introduces Markov chain Monte Carlo methods. In the final section we consider a model for optimally making decisions known as a Markovian decision process. In Chapter 5 we are concerned with a type of stochastic process known as a counting process. In particular, we study a kind of counting process known as a Poisson process. The intimate relationship between this process and the exponential distribution is discussed. New derivations for the Poisson and nonhomogeneous Poisson processes are discussed. Examples relating to analyzing greedy algorithms, minimizing highway encounters, collecting coupons, and tracking the AIDS virus, as well as material on compound Poisson processes, are included
xvi
Preface
in this chapter. Subsection 5.2.4 gives a simple derivation of the convolution of exponential random variables. Chapter 6 considers Markov chains in continuous time with an emphasis on birth and death models. Time reversibility is shown to be a useful concept, as it is in the study of discretetime Markov chains. Section 6.7 presents the computationally important technique of uniformization. Chapter 7, the renewal theory chapter, is concerned with a type of counting process more general than the Poisson. By making use of renewal reward processes, limiting results are obtained and applied to various fields. Section 7.9 presents new results concerning the distribution of time until a certain pattern occurs when a sequence of independent and identically distributed random variables is observed. In Subsection 7.9.1, we show how renewal theory can be used to derive both the mean and the variance of the length of time until a specified pattern appears, as well as the mean time until one of a finite number of specified patterns appears. In Subsection 7.9.2, we suppose that the random variables are equally likely to take on any of m possible values, and compute an expression for the mean time until a run of m distinct values occurs. In Subsection 7.9.3, we suppose the random variables are continuous and derive an expression for the mean time until a run of m consecutive increasing values occurs. Chapter 8 deals with queueing, or waiting line, theory. After some preliminaries dealing with basic cost identities and types of limiting probabilities, we consider exponential queueing models and show how such models can be analyzed. Included in the models we study is the important class known as a network of queues. We then study models in which some of the distributions are allowed to be arbitrary. Included are Subsection 8.6.3 dealing with an optimization problem concerning a single server, general service time queue, and Section 8.8, concerned with a single server, general service time queue in which the arrival source is a finite number of potential users. Chapter 9 is concerned with reliability theory. This chapter will probably be of greatest interest to the engineer and operations researcher. Subsection 9.6.1 illustrates a method for determining an upper bound for the expected life of a parallel system of not necessarily independent components and (9.7.1) analyzing a series structure reliability model in which components enter a state of suspended animation when one of their cohorts fails. Chapter 10 is concerned with Brownian motion and its applications. The theory of options pricing is discussed. Also, the arbitrage theorem is presented and its relationship to the duality theorem of linear program is indicated. We show how the arbitrage theorem leads to the BlackScholes option pricing formula. Chapter 11 deals with simulation, a powerful tool for analyzing stochastic models that are analytically intractable. Methods for generating the values of arbitrarily distributed random variables are discussed, as are variance reduction methods for increasing the efficiency of the simulation. Subsection 11.6.4 introduces the
Preface
xvii
important simulation technique of importance sampling, and indicates the usefulness of tilted distributions when applying this method.
Acknowledgments
We would like to acknowledge with thanks the helpful suggestions made by the many reviewers of the text. These comments have been essential in our attempt to continue to improve the book and we owe these reviewers, and others who wish to remain anonymous, many thanks: Mark Brown, City University of New York Tapas Das, University of South Florida Israel David, BenGurion University Jay Devore, California Polytechnic Institute Eugene Feinberg, State University of New York, Stonybrook Ramesh Gupta, University of Maine Marianne Huebner, Michigan State University Garth Isaak, Lehigh University Jonathan Kane, University of Wisconsin Whitewater Amarjot Kaur, Pennsylvania State University Zohel Khalil, Concordia University Eric Kolaczyk, Boston University Melvin Lax, California State University, Long Beach Jean Lemaire, University of Pennsylvania George Michailidis, University of Michigan Krzysztof Osfaszewski, University of Illinois Erol Pekoz, Boston University
xviii
Preface
Evgeny Poletsky, Syracuse University Anthony Quas, University of Victoria David Scollnik, University of Calgary Mary Shepherd, Northwest Missouri State University Galen Shorack, University of Washington, Seattle Osnat Stramer, University of Iowa Gabor Szekeley, Bowling Green State University Marlin Thomas, Purdue University Zhenyuan Wang, University of Binghamton Julie Zhou, University of Victoria Special thanks to Donald Minassian of Butler University, for his extremely careful reading of the text.
Introduction to Probability Theory
1
1.1. Introduction
Any realistic model of a realworld phenomenon must take into account the possibility of randomness. That is, more often than not, the quantities we are interested in will not be predictable in advance but, rather, will exhibit an inherent variation that should be taken into account by the model. This is usually accomplished by allowing the model to be probabilistic in nature. Such a model is, naturally enough, referred to as a probability model. The majority of the chapters of this book will be concerned with different probability models of natural phenomena. Clearly, in order to master both the "model building" and the subsequent analysis of these models, we must have a certain knowledge of basic probability theory. The remainder of this chapter, as well as the next two chapters, will be concerned with a study of this subject.
1.2.
Sample Space and Events
Suppose that we are about to perform an experiment whose outcome is not predictable in advance. However, while the outcome of the experiment will not be known in advance, let us suppose that the set of all possible outcomes is known. This set of all possible outcomes of an experiment is known as the sample space of the experiment and is denoted by S. Some examples are the following. 1. If the experiment consists of the flipping of a coin, then S = {H, T } where H means that the outcome of the toss is a head and T that it is a tail.
1
2
1
Introduction to Probability Theory
2. If the experiment consists of rolling a die, then the sample space is S = {1, 2, 3, 4, 5, 6} where the outcome i means that i appeared on the die, i = 1, 2, 3, 4, 5, 6. 3. If the experiments consists of flipping two coins, then the sample space consists of the following four points: S = {(H, H ), (H, T ), (T , H ), (T , T )} The outcome will be (H, H ) if both coins come up heads; it will be (H, T ) if the first coin comes up heads and the second comes up tails; it will be (T , H ) if the first comes up tails and the second heads; and it will be (T , T ) if both coins come up tails. 4. If the experiment consists of rolling two dice, then the sample space consists of the following 36 points: (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6) (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6) (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6) S= (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6) (5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6) (6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6) where the outcome (i, j ) is said to occur if i appears on the first die and j on the second die. 5. If the experiment consists of measuring the lifetime of a car, then the sample space consists of all nonnegative real numbers. That is, S = [0, ) Any subset E of the sample space S is known as an event. Some examples of events are the following. 1 . In Example (1), if E = {H }, then E is the event that a head appears on the flip of the coin. Similarly, if E = {T }, then E would be the event that a tail appears. 2 . In Example (2), if E = {1}, then E is the event that one appears on the roll of the die. If E = {2, 4, 6}, then E would be the event that an even number appears on the roll.
The set (a, b) is defined to consist of all points x such that a < x < b. The set [a, b] is defined to consist of all points x such that a x b. The sets (a, b] and [a, b) are defined, respectively, to consist of all points x such that a < x b and all points x such that a x < b.
1.2.
Sample Space and Events
3
3 . In Example (3), if E = {(H, H ), (H, T )}, then E is the event that a head appears on the first coin. 4 . In Example (4), if E = {(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1)}, then E is the event that the sum of the dice equals seven. 5 . In Example (5), if E = (2, 6), then E is the event that the car lasts between two and six years. For any two events E and F of a sample space S we define the new event E F to consist of all outcomes that are either in E or in F or in both E and F . That is, the event E F will occur if either E or F occurs. For example, in (1) if E = {H } and F = {T }, then E F = {H, T } That is, E F would be the whole sample space S. In (2) if E = {1, 3, 5} and F = {1, 2, 3}, then E F = {1, 2, 3, 5} and thus E F would occur if the outcome of the die is 1 or 2 or 3 or 5. The event E F is often referred to as the union of the event E and the event F . For any two events E and F , we may also define the new event EF , sometimes written E F , and referred to as the intersection of E and F , as follows. EF consists of all outcomes which are both in E and in F . That is, the event EF will occur only if both E and F occur. For example, in (2) if E = {1, 3, 5} and F = {1, 2, 3}, then EF = {1, 3} and thus EF would occur if the outcome of the die is either 1 or 3. In Example (1) if E = {H } and F = {T }, then the event EF would not consist of any outcomes and hence could not occur. To give such an event a name, we shall refer to it as the null event and denote it by . (That is, refers to the event consisting of no outcomes.) If EF = , then E and F are said to be mutually exclusive. We also define unions and intersections of more than two events in a similar manner. If E1 , E2 , . . . are events, then the union of these events, denoted by n=1 En , is defined to be that event which consists of all outcomes that are in En for at least one value of n = 1, 2, . . . . Similarly, the intersection of the events En , denoted by En , is defined to be the event consisting of those outcomes that n=1 are in all of the events En , n = 1, 2, . . . . Finally, for any event E we define the new event E c , referred to as the complement of E, to consist of all outcomes in the sample space S that are not in E. That is, E c will occur if and only if E does not occur. In Example (4)
4
1
Introduction to Probability Theory
if E = {(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1)}, then E c will occur if the sum of the dice does not equal seven. Also note that since the experiment must result in some outcome, it follows that S c = .
1.3.
Probabilities Defined on Events
Consider an experiment whose sample space is S. For each event E of the sample space S, we assume that a number P (E) is defined and satisfies the following three conditions: (i) 0 P (E) 1. (ii) P (S) = 1. (iii) For any sequence of events E1 , E2 , . . . that are mutually exclusive, that is, events for which En Em = when n = m, then
P
n=1
En =
n=1
P (En )
We refer to P (E) as the probability of the event E.
Example 1.1 In the coin tossing example, if we assume that a head is equally
likely to appear as a tail, then we would have P ({H }) = P ({T }) =
1 2
On the other hand, if we had a biased coin and felt that a head was twice as likely to appear as a tail, then we would have P ({H }) = 2 , 3 P ({T }) =
1 3
Example 1.2 In the die tossing example, if we supposed that all six numbers
were equally likely to appear, then we would have P ({1}) = P ({2}) = P ({3}) = P ({4}) = P ({5}) = P ({6}) =
1 6
From (iii) it would follow that the probability of getting an even number would equal P ({2, 4, 6}) = P ({2}) + P ({4}) + P ({6}) =
1 2
1.3.
Probabilities Defined on Events
5
Remark We have chosen to give a rather formal definition of probabilities as
being functions defined on the events of a sample space. However, it turns out that these probabilities have a nice intuitive property. Namely, if our experiment is repeated over and over again then (with probability 1) the proportion of time that event E occurs will just be P (E). Since the events E and E c are always mutually exclusive and since E E c = S we have by (ii) and (iii) that 1 = P (S) = P (E E c ) = P (E) + P (E c ) or P (E c ) = 1  P (E) (1.1)
In words, Equation (1.1) states that the probability that an event does not occur is one minus the probability that it does occur. We shall now derive a formula for P (E F ), the probability of all outcomes either in E or in F . To do so, consider P (E) + P (F ), which is the probability of all outcomes in E plus the probability of all points in F . Since any outcome that is in both E and F will be counted twice in P (E) + P (F ) and only once in P (E F ), we must have P (E) + P (F ) = P (E F ) + P (EF ) or equivalently P (E F ) = P (E) + P (F )  P (EF ) (1.2)
Note that when E and F are mutually exclusive (that is, when EF = ), then Equation (1.2) states that P (E F ) = P (E) + P (F )  P () = P (E) + P (F ) a result which also follows from condition (iii). [Why is P () = 0?]
Example 1.3 Suppose that we toss two coins, and suppose that we assume
that each of the four outcomes in the sample space S = {(H, H ), (H, T ), (T , H ), (T , T )} is equally likely and hence has probability 1 . Let 4 E = {(H, H ), (H, T )} and F = {(H, H ), (T , H )}
That is, E is the event that the first coin falls heads, and F is the event that the second coin falls heads.
6
1
Introduction to Probability Theory
By Equation (1.2) we have that P (E F ), the probability that either the first or the second coin falls heads, is given by P (E F ) = P (E) + P (F )  P (EF ) =
1 2
+
1 2 1 4
 P ({H, H }) =
3 4
=1
This probability could, of course, have been computed directly since P (E F ) = P ({H, H ), (H, T ), (T , H )}) =
3 4
We may also calculate the probability that any one of the three events E or F or G occurs. This is done as follows: P (E F G) = P ((E F ) G) which by Equation (1.2) equals P (E F ) + P (G)  P ((E F )G) Now we leave it for you to show that the events (E F )G and EG F G are equivalent, and hence the preceding equals P (E F G) = P (E) + P (F )  P (EF ) + P (G)  P (EG F G) = P (E) + P (F )  P (EF ) + P (G)  P (EG)  P (F G) + P (EGF G) = P (E) + P (F ) + P (G)  P (EF )  P (EG)  P (F G) + P (EF G) (1.3) In fact, it can be shown by induction that, for any n events E1 , E2 , E3 , . . . , En , P (E1 E2 En ) =
i
P (Ei ) 
i<j
P (Ei Ej ) +
i<j <k
P (Ei Ej Ek )

i<j <k<l
P (Ei Ej Ek El ) (1.4)
+ + (1)n+1 P (E1 E2 En )
In words, Equation (1.4) states that the probability of the union of n events equals the sum of the probabilities of these events taken one at a time minus the sum of the probabilities of these events taken two at a time plus the sum of the probabilities of these events taken three at a time, and so on.
1.4.
Conditional Probabilities
7
1.4.
Conditional Probabilities
Suppose that we toss two dice and that each of the 36 possible outcomes is equally 1 likely to occur and hence has probability 36 . Suppose that we observe that the first die is a four. Then, given this information, what is the probability that the sum of the two dice equals six? To calculate this probability we reason as follows: Given that the initial die is a four, it follows that there can be at most six possible outcomes of our experiment, namely, (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), and (4, 6). Since each of these outcomes originally had the same probability of occurring, they should still have equal probabilities. That is, given that the first die is a four, then the (conditional) probability of each of the outcomes (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6) is 1 while the (conditional) probability 6 of the other 30 points in the sample space is 0. Hence, the desired probability will be 1 . 6 If we let E and F denote, respectively, the event that the sum of the dice is six and the event that the first die is a four, then the probability just obtained is called the conditional probability that E occurs given that F has occurred and is denoted by P (EF ) A general formula for P (EF ) which is valid for all events E and F is derived in the same manner as the preceding. Namely, if the event F occurs, then in order for E to occur it is necessary for the actual occurrence to be a point in both E and in F , that is, it must be in EF . Now, because we know that F has occurred, it follows that F becomes our new sample space and hence the probability that the event EF occurs will equal the probability of EF relative to the probability of F . That is, P (EF ) = P (EF ) P (F ) (1.5)
Note that Equation (1.5) is only well defined when P (F ) > 0 and hence P (EF ) is only defined when P (F ) > 0.
Example 1.4 Suppose cards numbered one through ten are placed in a hat, mixed up, and then one of the cards is drawn. If we are told that the number on the drawn card is at least five, then what is the conditional probability that it is ten?
Solution: Let E denote the event that the number of the drawn card is ten, and let F be the event that it is at least five. The desired probability is P (EF ).
8
1
Introduction to Probability Theory
Now, from Equation (1.5) P (EF ) = P (EF ) P (F )
However, EF = E since the number of the card will be both ten and at least five if and only if it is number ten. Hence, P (EF ) =
1 10 6 10
=
1 6
Example 1.5 A family has two children. What is the conditional probability
that both are boys given that at least one of them is a boy? Assume that the sample space S is given by S = {(b, b), (b, g), (g, b), (g, g)}, and all outcomes are equally likely. [(b, g) means, for instance, that the older child is a boy and the younger child a girl.] Solution: Letting B denote the event that both children are boys, and A the event that at least one of them is a boy, then the desired probability is given by P (BA) = = P (BA) P (A) P ({(b, b)}) = P ({(b, b), (b, g), (g, b)})
1 4 3 4
=
1 3
Example 1.6 Bev can either take a course in computers or in chemistry. If Bev
takes the computer course, then she will receive an A grade with probability 1 ; if 2 she takes the chemistry course then she will receive an A grade with probability 1 . 3 Bev decides to base her decision on the flip of a fair coin. What is the probability that Bev will get an A in chemistry? Solution: If we let C be the event that Bev takes chemistry and A denote the event that she receives an A in whatever course she takes, then the desired probability is P (AC). This is calculated by using Equation (1.5) as follows: P (AC) = P (C)P (AC) =
11 23
=
1 6
Example 1.7 Suppose an urn contains seven black balls and five white balls.
We draw two balls from the urn without replacement. Assuming that each ball in the urn is equally likely to be drawn, what is the probability that both drawn balls are black?
1.4.
Conditional Probabilities
9
Solution: Let F and E denote, respectively, the events that the first and second balls drawn are black. Now, given that the first ball selected is black, there 6 are six remaining black balls and five white balls, and so P (EF ) = 11 . As 7 P (F ) is clearly 12 , our desired probability is P (EF ) = P (F )P (EF ) =
7 6 12 11
=
42 132
Example 1.8 Suppose that each of three men at a party throws his hat into the center of the room. The hats are first mixed up and then each man randomly selects a hat. What is the probability that none of the three men selects his own hat?
Solution: We shall solve this by first calculating the complementary probability that at least one man selects his own hat. Let us denote by Ei , i = 1, 2, 3, the event that the ith man selects his own hat. To calculate the probability P (E1 E2 E3 ), we first note that P (Ei ) = 1 , 3 P (Ei Ej ) = 1 , 6 P (E1 E2 E3 ) =
1 6
i = 1, 2, 3 i=j (1.6)
To see why Equation (1.6) is correct, consider first P (Ei Ej ) = P (Ei )P (Ej Ei ) Now P (Ei ), the probability that the ith man selects his own hat, is clearly 1 3 since he is equally likely to select any of the three hats. On the other hand, given that the ith man has selected his own hat, then there remain two hats that the j th man may select, and as one of these two is his own hat, it follows that with probability 1 he will select it. That is, P (Ej Ei ) = 1 and so 2 2 P (Ei Ej ) = P (Ei )P (Ej Ei ) = To calculate P (E1 E2 E3 ) we write P (E1 E2 E3 ) = P (E1 E2 )P (E3 E1 E2 ) = 1 P (E3 E1 E2 ) 6 However, given that the first two men get their own hats it follows that the third man must also get his own hat (since there are no other hats left). That is,
11 32
=
1 6
10
1
Introduction to Probability Theory
P (E3 E1 E2 ) = 1 and so P (E1 E2 E3 ) = Now, from Equation (1.4) we have that P (E1 E2 E3 ) = P (E1 ) + P (E2 ) + P (E3 )  P (E1 E2 )  P (E1 E3 )  P (E2 E3 ) + P (E1 E2 E3 ) =1 =
2 3 1 2 1 6
+
1 6
Hence, the probability that none of the men selects his own hat is 1  2 = 1. 3 3
1.5.
Independent Events
Two events E and F are said to be independent if P (EF ) = P (E)P (F ) By Equation (1.5) this implies that E and F are independent if P (EF ) = P (E) [which also implies that P (F E) = P (F )]. That is, E and F are independent if knowledge that F has occurred does not affect the probability that E occurs. That is, the occurrence of E is independent of whether or not F occurs. Two events E and F that are not independent are said to be dependent.
Example 1.9 Suppose we toss two fair dice. Let E1 denote the event that the
sum of the dice is six and F denote the event that the first die equals four. Then P (E1 F ) = P ({4, 2}) = while P (E1 )P (F ) =
5 1 36 6 1 36
=
5 216
and hence E1 and F are not independent. Intuitively, the reason for this is clear for if we are interested in the possibility of throwing a six (with two dice), then we
1.5.
Independent Events
11
will be quite happy if the first die lands four (or any of the numbers 1, 2, 3, 4, 5) because then we still have a possibility of getting a total of six. On the other hand, if the first die landed six, then we would be unhappy as we would no longer have a chance of getting a total of six. In other words, our chance of getting a total of six depends on the outcome of the first die and hence E1 and F cannot be independent. Let E2 be the event that the sum of the dice equals seven. Is E2 independent of F ? The answer is yes since P (E2 F ) = P ({(4, 3)}) = while P (E2 )P (F ) =
11 66 1 36
=
1 36
We leave it for you to present the intuitive argument why the event that the sum of the dice equals seven is independent of the outcome on the first die. The definition of independence can be extended to more than two events. The events E1 , E2 , . . . , En are said to be independent if for every subset E1 , E2 , . . . , Er , r n, of these events P (E1 E2 Er ) = P (E1 )P (E2 ) P (Er ) Intuitively, the events E1 , E2 , . . . , En are independent if knowledge of the occurrence of any of these events has no effect on the probability of any other event.
Example 1.10 (Pairwise Independent Events That Are Not Independent) Let
a ball be drawn from an urn containing four balls, numbered 1, 2, 3, 4. Let E = {1, 2}, F = {1, 3}, G = {1, 4}. If all four outcomes are assumed equally likely, then P (EF ) = P (E)P (F ) = 1 , 4 P (EG) = P (E)P (G) = 1 , 4 P (F G) = P (F )P (G) =
1 4
However,
1 4
= P (EF G) = P (E)P (F )P (G)
Hence, even though the events E, F, G are pairwise independent, they are not jointly independent.
12
1
Introduction to Probability Theory
Suppose that a sequence of experiments, each of which results in either a "success" or a "failure," is to be performed. Let Ei , i 1, denote the event that the ith experiment results in a success. If, for all i1 , i2 , . . . , in ,
n
P (Ei1 Ei2 Ein ) =
j =1
P (Eij )
we say that the sequence of experiments consists of independent trials.
Example 1.11 The successive flips of a coin consist of independent trials if we assume (as is usually done) that the outcome on any flip is not influenced by the outcomes on earlier flips. A "success" might consist of the outcome heads and a "failure" tails, or possibly the reverse.
1.6.
Bayes' Formula
Let E and F be events. We may express E as E = EF EF c because in order for a point to be in E, it must either be in both E and F , or it must be in E and not in F . Since EF and EF c are mutually exclusive, we have that P (E) = P (EF ) + P (EF c ) = P (EF )P (F ) + P (EF c )P (F c ) = P (EF )P (F ) + P (EF c )(1  P (F )) (1.7)
Equation (1.7) states that the probability of the event E is a weighted average of the conditional probability of E given that F has occurred and the conditional probability of E given that F has not occurred, each conditional probability being given as much weight as the event on which it is conditioned has of occurring.
Example 1.12 Consider two urns. The first contains two white and seven
black balls, and the second contains five white and six black balls. We flip a fair coin and then draw a ball from the first urn or the second urn depending on whether the outcome was heads or tails. What is the conditional probability that the outcome of the toss was heads given that a white ball was selected?
1.6.
Bayes' Formula
13
Solution: Let W be the event that a white ball is drawn, and let H be the event that the coin comes up heads. The desired probability P (H W ) may be calculated as follows: P (H W ) = = = P (H W ) P (W H )P (H ) = P (W ) P (W ) P (W H )P (H ) P (W H )P (H ) + P (W H c )P (H c )
21 92 21 92
+
5 1 11 2
=
22 67
Example 1.13 In answering a question on a multiplechoice test a student
either knows the answer or guesses. Let p be the probability that she knows the answer and 1  p the probability that she guesses. Assume that a student who guesses at the answer will be correct with probability 1/m, where m is the number of multiplechoice alternatives. What is the conditional probability that a student knew the answer to a question given that she answered it correctly? Solution: Let C and K denote respectively the event that the student answers the question correctly and the event that she actually knows the answer. Now P (KC) = P (CK)P (K) P (KC) = P (C) P (CK)P (K) + P (CK c )P (K c ) p = p + (1/m)(1  p) mp = 1 + (m  1)p
Thus, for example, if m = 5, p = 1 , then the probability that a student knew 2 the answer to a question she correctly answered is 5 . 6
Example 1.14 A laboratory blood test is 95 percent effective in detecting a
certain disease when it is, in fact, present. However, the test also yields a "false positive" result for 1 percent of the healthy persons tested. (That is, if a healthy person is tested, then, with probability 0.01, the test result will imply he has the disease.) If 0.5 percent of the population actually has the disease, what is the probability a person has the disease given that his test result is positive? Solution: Let D be the event that the tested person has the disease, and E the event that his test result is positive. The desired probability P (DE) is
14
1
Introduction to Probability Theory
obtained by P (DE) = = = P (ED)P (D) P (DE) = P (E) P (ED)P (D) + P (ED c )P (D c ) (0.95)(0.005) (0.95)(0.005) + (0.01)(0.995) 95 0.323 294
Thus, only 32 percent of those persons whose test results are positive actually have the disease. Equation (1.7) may be generalized in the following manner. Suppose that F1 , F2 , . . . , Fn are mutually exclusive events such that n Fi = S. In other i=1 words, exactly one of the events F1 , F2 , . . . , Fn will occur. By writing
n
E=
i=1
EFi
and using the fact that the events EFi , i = 1, . . . , n, are mutually exclusive, we obtain that
n
P (E) =
i=1 n
P (EFi )
=
i=1
P (EFi )P (Fi )
(1.8)
Thus, Equation (1.8) shows how, for given events F1 , F2 , . . . , Fn of which one and only one must occur, we can compute P (E) by first "conditioning" upon which one of the Fi occurs. That is, it states that P (E) is equal to a weighted average of P (EFi ), each term being weighted by the probability of the event on which it is conditioned. Suppose now that E has occurred and we are interested in determining which one of the Fj also occurred. By Equation (1.8) we have that P (Fj E) = = P (EFj ) P (E) P (EFj )P (Fj ) n i=1 P (EFi )P (Fi ) (1.9)
Equation (1.9) is known as Bayes' formula.
Exercises
15
Example 1.15 You know that a certain letter is equally likely to be in any
one of three different folders. Let i be the probability that you will find your letter upon making a quick examination of folder i if the letter is, in fact, in folder i, i = 1, 2, 3. (We may have i < 1.) Suppose you look in folder 1 and do not find the letter. What is the probability that the letter is in folder 1? Solution: Let Fi , i = 1, 2, 3 be the event that the letter is in folder i; and let E be the event that a search of folder 1 does not come up with the letter. We desire P (F1 E). From Bayes' formula we obtain P (F1 E) = = P (EF1 )P (F1 ) 3 i=1 P (EFi )P (Fi ) (1  1 ) 1 3 (1  1 ) 1 3 +
1 3
+
1 3
=
1  1 3  1
Exercises
1. A box contains three marbles: one red, one green, and one blue. Consider an experiment that consists of taking one marble from the box then replacing it in the box and drawing a second marble from the box. What is the sample space? If, at all times, each marble in the box is equally likely to be selected, what is the probability of each point in the sample space? *2. Repeat Exercise 1 when the second marble is drawn without replacing the first marble. 3. A coin is to be tossed until a head appears twice in a row. What is the sample space for this experiment? If the coin is fair, what is the probability that it will be tossed exactly four times? 4. Let E, F, G be three events. Find expressions for the events that of E, F, G (a) (b) (c) (d) (e) (f) (g) (h) only F occurs, both E and F but not G occur, at least one event occurs, at least two events occur, all three events occur, none occurs, at most one occurs, at most two occur.
*5. An individual uses the following gambling system at Las Vegas. He bets $1 that the roulette wheel will come up red. If he wins, he quits. If he loses then he
16
1
Introduction to Probability Theory
makes the same bet a second time only this time he bets $2; and then regardless of the outcome, quits. Assuming that he has a probability of 1 of winning each 2 bet, what is the probability that he goes home a winner? Why is this system not used by everyone? 6. 7. Show that E(F G) = EF EG. Show that (E F )c = E c F c . 0.7. In general, show
8. If P (E) = 0.9 and P (F ) = 0.8, show that P (EF ) that P (EF ) P (E) + P (F )  1
This is known as Bonferroni's inequality. *9. We say that E F if every point in E is also in F . Show that if E F , then P (F ) = P (E) + P (F E c ) 10. Show that
n n
P (E)
P
i=1
Ei
i=1
P (Ei )
This is known as Boole's inequality. Hint: Either use Equation (1.2) and mathematical induction, or else show that n n i1 c i=1 Ei = i=1 Fi , where F1 = E1 , Fi = Ei j =1 Ej , and use property (iii) of a probability. 11. If two fair dice are tossed, what is the probability that the sum is i, i = 2, 3, . . . , 12? 12. Let E and F be mutually exclusive events in the sample space of an experiment. Suppose that the experiment is repeated until either event E or event F occurs. What does the sample space of this new super experiment look like? Show that the probability that event E occurs before event F is P (E)/ [P (E) + P (F )]. Hint: Argue that the probability that the original experiment is performed n times and E appears on the nth time is P (E) (1  p)n1 , n = 1, 2, . . . , where p = P (E) + P (F ). Add these probabilities to get the desired answer. 13. The dice game craps is played as follows. The player throws two dice, and if the sum is seven or eleven, then she wins. If the sum is two, three, or twelve, then she loses. If the sum is anything else, then she continues throwing until she either throws that number again (in which case she wins) or she throws a seven (in which case she loses). Calculate the probability that the player wins.
Exercises
17
14. The probability of winning on a single toss of the dice is p. A starts, and if he fails, he passes the dice to B, who then attempts to win on her toss. They continue tossing the dice back and forth until one of them wins. What are their respective probabilities of winning? 15. Argue that E = EF EF c , E F = E F E c . 16. Use Exercise 15 to show that P (E F ) = P (E) + P (F )  P (EF ). *17. Suppose each of three persons tosses a coin. If the outcome of one of the tosses differs from the other outcomes, then the game ends. If not, then the persons start over and retoss their coins. Assuming fair coins, what is the probability that the game will end with the first round of tosses? If all three coins are biased and have probability 1 of landing heads, what is the probability that the game will end 4 at the first round? 18. Assume that each child who is born is equally likely to be a boy or a girl. If a family has two children, what is the probability that both are girls given that (a) the eldest is a girl, (b) at least one is a girl? *19. Two dice are rolled. What is the probability that at least one is a six? If the two faces are different, what is the probability that at least one is a six? 20. Three dice are thrown. What is the probability the same number appears on exactly two of the three dice? 21. Suppose that 5 percent of men and 0.25 percent of women are colorblind. A colorblind person is chosen at random. What is the probability of this person being male? Assume that there are an equal number of males and females. 22. A and B play until one has 2 more points than the other. Assuming that each point is independently won by A with probability p, what is the probability they will play a total of 2n points? What is the probability that A will win? 23. For events E1 , E2 , . . . , En show that P (E1 E2 En ) = P (E1 )P (E2 E1 )P (E3 E1 E2 ) P (En E1 En1 ) 24. In an election, candidate A receives n votes and candidate B receives m votes, where n > m. Assume that in the count of the votes all possible orderings of the n + m votes are equally likely. Let Pn,m denote the probability that from the first vote on A is always in the lead. Find (b) P3,1 (c) Pn,1 (d) P3,2 (a) P2,1 (f ) Pn,2 (g) P4,3 (h) P5,3 (i) P5,4 ( j) Make a conjecture as to the value of Pn,m . (e) P4,2
18
1
Introduction to Probability Theory
*25. Two cards are randomly selected from a deck of 52 playing cards. (a) What is the probability they constitute a pair (that is, that they are of the same denomination)? (b) What is the conditional probability they constitute a pair given that they are of different suits? 26. A deck of 52 playing cards, containing all 4 aces, is randomly divided into 4 piles of 13 cards each. Define events E1 , E2 , E3 , and E4 as follows: E1 = {the first pile has exactly 1 ace}, E2 = {the second pile has exactly 1 ace}, E3 = {the third pile has exactly 1 ace}, E4 = {the fourth pile has exactly 1 ace} Use Exercise 23 to find P (E1 E2 E3 E4 ), the probability that each pile has an ace. *27. Suppose in Exercise 26 we had defined the events Ei , i = 1, 2, 3, 4, by E1 = {one of the piles contains the ace of spades}, E2 = {the ace of spades and the ace of hearts are in different piles}, E3 = {the ace of spades, the ace of hearts, and the ace of diamonds are in different piles}, E4 = {all 4 aces are in different piles} Now use Exercise 23 to find P (E1 E2 E3 E4 ), the probability that each pile has an ace. Compare your answer with the one you obtained in Exercise 26. 28. If the occurrence of B makes A more likely, does the occurrence of A make B more likely? 29. Suppose that P (E) = 0.6. What can you say about P (EF ) when (a) E and F are mutually exclusive? (b) E F ? (c) F E? *30. Bill and George go target shooting together. Both shoot at a target at the same time. Suppose Bill hits the target with probability 0.7, whereas George, independently, hits the target with probability 0.4. (a) Given that exactly one shot hit the target, what is the probability that it was George's shot? (b) Given that the target is hit, what is the probability that George hit it? 31. What is the conditional probability that the first die is six given that the sum of the dice is seven?
Exercises
19
*32. Suppose all n men at a party throw their hats in the center of the room. Each man then randomly selects a hat. Show that the probability that none of the n men selects his own hat is 1 1 (1)n 1  +  + 2! 3! 4! n! Note that as n this converges to e1 . Is this surprising? 33. In a class there are four freshman boys, six freshman girls, and six sophomore boys. How many sophomore girls must be present if sex and class are to be independent when a student is selected at random? 34. Mr. Jones has devised a gambling system for winning at roulette. When he bets, he bets on red, and places a bet only when the ten previous spins of the roulette have landed on a black number. He reasons that his chance of winning is quite large since the probability of eleven consecutive spins resulting in black is quite small. What do you think of this system? 35. A fair coin is continually flipped. What is the probability that the first four flips are (a) H , H , H , H ? (b) T , H , H , H ? (c) What is the probability that the pattern T , H , H , H occurs before the pattern H , H , H , H ? 36. Consider two boxes, one containing one black and one white marble, the other, two black and one white marble. A box is selected at random and a marble is drawn at random from the selected box. What is the probability that the marble is black? 37. In Exercise 36, what is the probability that the first box was the one selected given that the marble is white? 38. Urn 1 contains two white balls and one black ball, while urn 2 contains one white ball and five black balls. One ball is drawn at random from urn 1 and placed in urn 2. A ball is then drawn from urn 2. It happens to be white. What is the probability that the transferred ball was white? 39. Stores A, B, and C have 50, 75, and 100 employees, and, respectively, 50, 60, and 70 percent of these are women. Resignations are equally likely among all employees, regardless of sex. One employee resigns and this is a woman. What is the probability that she works in store C? *40. (a) A gambler has in his pocket a fair coin and a twoheaded coin. He selects one of the coins at random, and when he flips it, it shows heads. What is the probability that it is the fair coin? (b) Suppose that he flips the same coin a
20
1
Introduction to Probability Theory
second time and again it shows heads. Now what is the probability that it is the fair coin? (c) Suppose that he flips the same coin a third time and it shows tails. Now what is the probability that it is the fair coin? 41. In a certain species of rats, black dominates over brown. Suppose that a black rat with two black parents has a brown sibling. (a) What is the probability that this rat is a pure black rat (as opposed to being a hybrid with one black and one brown gene)? (b) Suppose that when the black rat is mated with a brown rat, all five of their offspring are black. Now, what is the probability that the rat is a pure black rat? 42. There are three coins in a box. One is a twoheaded coin, another is a fair coin, and the third is a biased coin that comes up heads 75 percent of the time. When one of the three coins is selected at random and flipped, it shows heads. What is the probability that it was the twoheaded coin? 43. Suppose we have ten coins which are such that if the ith one is flipped then heads will appear with probability i/10, i = 1, 2, . . . , 10. When one of the coins is randomly selected and flipped, it shows heads. What is the conditional probability that it was the fifth coin? 44. Urn 1 has five white and seven black balls. Urn 2 has three white and twelve black balls. We flip a fair coin. If the outcome is heads, then a ball from urn 1 is selected, while if the outcome is tails, then a ball from urn 2 is selected. Suppose that a white ball is selected. What is the probability that the coin landed tails? *45. An urn contains b black balls and r red balls. One of the balls is drawn at random, but when it is put back in the urn c additional balls of the same color are put in with it. Now suppose that we draw another ball. Show that the probability that the first ball drawn was black given that the second ball drawn was red is b/(b + r + c). 46. Three prisoners are informed by their jailer that one of them has been chosen at random to be executed, and the other two are to be freed. Prisoner A asks the jailer to tell him privately which of his fellow prisoners will be set free, claiming that there would be no harm in divulging this information, since he already knows that at least one will go free. The jailer refuses to answer this question, pointing out that if A knew which of his fellows were to be set free, then his own probability of being executed would rise from 1 to 1 , since he would then be one 3 2 of two prisoners. What do you think of the jailer's reasoning? 47. For a fixed event B, show that the collection P (AB), defined for all events A, satisfies the three conditions for a probability. Conclude from this that P (AB) = P (ABC)P (CB) + P (ABC c )P (C c B) Then directly verify the preceding equation.
References
21
*48. Sixty percent of the families in a certain community own their own car, thirty percent own their own home, and twenty percent own both their own car and their own home. If a family is randomly chosen, what is the probability that this family owns a car or a house but not both?
References
Reference [2] provides a colorful introduction to some of the earliest developments in probability theory. References [3], [4], and [7] are all excellent introductory texts in modern probability theory. Reference [5] is the definitive work which established the axiomatic foundation of modern mathematical probability theory. Reference [6] is a nonmathematical introduction to probability theory and its applications, written by one of the greatest mathematicians of the eighteenth century.
1. L. Breiman, "Probability," AddisonWesley, Reading, Massachusetts, 1968. 2. F. N. David, "Games, Gods, and Gambling," Hafner, New York, 1962. 3. W. Feller, "An Introduction to Probability Theory and Its Applications," Vol. I, John Wiley, New York, 1957. 4. B. V. Gnedenko, "Theory of Probability," Chelsea, New York, 1962. 5. A. N. Kolmogorov, "Foundations of the Theory of Probability," Chelsea, New York, 1956. 6. Marquis de Laplace, "A Philosophical Essay on Probabilities," 1825 (English Translation), Dover, New York, 1951. 7. S. Ross, "A First Course in Probability," Sixth Edition, Prentice Hall, New Jersey, 2002.
This page intentionally left blank
Random Variables
2
2.1. Random Variables
It frequently occurs that in performing an experiment we are mainly interested in some functions of the outcome as opposed to the outcome itself. For instance, in tossing dice we are often interested in the sum of the two dice and are not really concerned about the actual outcome. That is, we may be interested in knowing that the sum is seven and not be concerned over whether the actual outcome was (1, 6) or (2, 5) or (3, 4) or (4, 3) or (5, 2) or (6, 1). These quantities of interest, or more formally, these realvalued functions defined on the sample space, are known as random variables. Since the value of a random variable is determined by the outcome of the experiment, we may assign probabilities to the possible values of the random variable.
Example 2.1 Letting X denote the random variable that is defined as the sum
of two fair dice; then P {X = 2} = P {(1, 1)} =
1 36 , 2 36 , 3 36 , 4 36 , 5 36 , 6 36 ,
P {X = 3} = P {(1, 2), (2, 1)} =
P {X = 4} = P {(1, 3), (2, 2), (3, 1)} =
P {X = 5} = P {(1, 4), (2, 3), (3, 2), (4, 1)} =
P {X = 6} = P {(1, 5), (2, 4), (3, 3), (4, 2), (5, 1)} =
P {X = 7} = P {(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1)} = P {X = 8} = P {(2, 6), (3, 5), (4, 4), (5, 3), (6, 2)} = P {X = 9} = P {(3, 6), (4, 5), (5, 4), (6, 3)} =
4 36 , 5 36 ,
23
24
2
Random Variables
P {X = 10} = P {(4, 6), (5, 5), (6, 4)} = P {X = 11} = P {(5, 6), (6, 5)} = P {X = 12} = P {(6, 6)} =
1 36 2 36 ,
3 36 ,
(2.1)
In other words, the random variable X can take on any integral value between two and twelve, and the probability that it takes on each value is given by Equation (2.1). Since X must take on one of the values two through twelve, we must have that
12 12
1=P
i=2
{X = n} =
n=2
P {X = n}
which may be checked from Equation (2.1).
Example 2.2 For a second example, suppose that our experiment consists
of tossing two fair coins. Letting Y denote the number of heads appearing, then Y is a random variable taking on one of the values 0, 1, 2 with respective probabilities P {Y = 0} = P {(T , T )} = 1 , 4 P {Y = 1} = P {(T , H ), (H, T )} = 2 , 4 P {Y = 2} = P {(H, H )} =
1 4
Of course, P {Y = 0} + P {Y = 1} + P {Y = 2} = 1.
Example 2.3 Suppose that we toss a coin having a probability p of coming up
heads, until the first head appears. Letting N denote the number of flips required, then assuming that the outcome of successive flips are independent, N is a random variable taking on one of the values 1, 2, 3, . . . , with respective probabilities P {N = 1} = P {H } = p, P {N = 2} = P {(T , H )} = (1  p)p, P {N = 3} = P {(T , T , H )} = (1  p)2 p, . . . P {N = n} = P {(T , T , . . . , T , H )} = (1  p)n1 p,
n1
n
1
2.1.
Random Variables
25
As a check, note that
P
n=1
{N = n} =
n=1
P {N = n}
=p
n=1
(1  p)n1
=
p 1  (1  p)
=1
Example 2.4 Suppose that our experiment consists of seeing how long a battery can operate before wearing down. Suppose also that we are not primarily interested in the actual lifetime of the battery but are concerned only about whether or not the battery lasts at least two years. In this case, we may define the random variable I by I= 1, 0, if the lifetime of battery is two or more years otherwise
If E denotes the event that the battery lasts two or more years, then the random variable I is known as the indicator random variable for event E. (Note that I equals 1 or 0 depending on whether or not E occurs.) of m possible outcomes with respective probabilities p1 , . . . , pm , m pi = 1, i=1 are continually performed. Let X denote the number of trials needed until each outcome has occurred at least once. Rather than directly considering P {X = n} we will first determine P {X > n}, the probability that at least one of the outcomes has not yet occurred after n trials. Letting Ai denote the event that outcome i has not yet occurred after the first n trials, i = 1, . . . , m, then
m
Example 2.5 Suppose that independent trials, each of which results in any
P {X > n} = P
i=1 m
Ai
=
i=1
P (Ai ) 
i<j
P (Ai Aj ) P (Ai Aj Ak )  + (1)m+1 P (A1 Am )
+
i<j < k
26
2
Random Variables
Now, P (Ai ) is the probability that each of the first n trials results in a noni outcome, and so by independence P (Ai ) = (1  pi )n Similarly, P (Ai Aj ) is the probability that the first n trials all result in a noni and nonj outcome, and so P (Ai Aj ) = (1  pi  pj )n As all of the other probabilities are similar, we see that
m
P {X > n} =
i=1
(1  pi )n 
i<j
(1  pi  pj )n
+
i<j < k
(1  pi  pj  pk )n 
Since P {X = n} = P {X > n  1}  P {X > n}, we see, upon using the algebraic identity (1  a)n1  (1  a)n = a(1  a)n1 , that
m
P {X = n} =
i=1
pi (1  pi )n1 
i<j
(pi + pj )(1  pi  pj )n1
+
i<j < k
(pi + pj + pk )(1  pi  pj  pk )n1 
In all of the preceding examples, the random variables of interest took on either a finite or a countable number of possible values. Such random variables are called discrete. However, there also exist random variables that take on a continuum of possible values. These are known as continuous random variables. One example is the random variable denoting the lifetime of a car, when the car's lifetime is assumed to take on any value in some interval (a, b). The cumulative distribution function (cdf ) (or more simply the distribution function) F () of the random variable X is defined for any real number b,  < b < , by F (b) = P {X b}
In words, F (b) denotes the probability that the random variable X takes on a value that is less than or equal to b. Some properties of the cdf F are (i) F (b) is a nondecreasing function of b,
A set is countable if its elements can be put in a onetoone correspondence with the sequence of positive integers.
2.2.
Discrete Random Variables
27
(ii) limb F (b) = F () = 1, (iii) limb F (b) = F () = 0. Property (i) follows since for a < b the event {X a} is contained in the event {X b}, and so it must have a smaller probability. Properties (ii) and (iii) follow since X must take on some finite value. All probability questions about X can be answered in terms of the cdf F (). For example, P {a < X b} = F (b)  F (a) for all a < b
This follows since we may calculate P {a < X b} by first computing the probability that X b [that is, F (b)] and then subtracting from this the probability that X a [that is, F (a)]. If we desire the probability that X is strictly smaller than b, we may calculate this probability by P {X < b} = lim P {X
h0+ h0+
b  h}
= lim F (b  h) where limh0+ means that we are taking the limit as h decreases to 0. Note that P {X < b} does not necessarily equal F (b) since F (b) also includes the probability that X equals b.
2.2.
Discrete Random Variables
As was previously mentioned, a random variable that can take on at most a countable number of possible values is said to be discrete. For a discrete random variable X, we define the probability mass function p(a) of X by p(a) = P {X = a} The probability mass function p(a) is positive for at most a countable number of values of a. That is, if X must assume one of the values x1 , x2 , . . . , then p(xi ) > 0, p(x) = 0,
i = 1, 2, . . . all other values of x
Since X must take on one of the values xi , we have p(xi ) = 1
i=1
28
2
Random Variables
Figure 2.1. Graph of F (x).
The cumulative distribution function F can be expressed in terms of p(a) by F (a) =
all xi
p(xi )
a
For instance, suppose X has a probability mass function given by p(1) = 1 , 2 p(2) = 1 , 3 p(3) =
1 6
then, the cumulative distribution function F of X is given by a<1 0, 1 2, 1 a<2 F (a) = 5 6, 2 a<3 1, 3 a This is graphically presented in Figure 2.1. Discrete random variables are often classified according to their probability mass functions. We now consider some of these random variables. 2.2.1. The Bernoulli Random Variable Suppose that a trial, or an experiment, whose outcome can be classified as either a "success" or as a "failure" is performed. If we let X equal 1 if the outcome is a success and 0 if it is a failure, then the probability mass function of X is given by p(0) = P {X = 0} = 1  p, p(1) = P {X = 1} = p where p, 0 p 1, is the probability that the trial is a "success." (2.2)
2.2.
Discrete Random Variables
29
A random variable X is said to be a Bernoulli random variable if its probability mass function is given by Equation (2.2) for some p (0, 1). 2.2.2. The Binomial Random Variable Suppose that n independent trials, each of which results in a "success" with probability p and in a "failure" with probability 1  p, are to be performed. If X represents the number of successes that occur in the n trials, then X is said to be a binomial random variable with parameters (n, p). The probability mass function of a binomial random variable having parameters (n, p) is given by p(i) = where n! n = i (n  i)! i! equals the number of different groups of i objects that can be chosen from a set of n objects. The validity of Equation (2.3) may be verified by first noting that the probability of any particular sequence of the n outcomes containing i successes and n  i failures is, by the assumed independence of trials, p i (1  p)ni . Equation (2.3) then follows since there are n different sequences of the n outcomes i leading to i successes and n  i failures. For instance, if n = 3, i = 2, then there are 3 = 3 ways in which the three trials can result in two successes. Namely, 2 any one of the three outcomes (s, s, f ), (s, f, s), (f, s, s), where the outcome (s, s, f ) means that the first two trials are successes and the third a failure. Since each of the three outcomes (s, s, f ), (s, f, s), (f, s, s) has a probability p 2 (1p) of occurring the desired probability is thus 3 p 2 (1  p). 2 Note that, by the binomial theorem, the probabilities sum to one, that is,
n
n i p (1  p)ni , i
i = 0, 1, . . . , n
(2.3)
p(i) =
i=0 i=0
n i p (1  p)ni = p + (1  p) i
n
=1
Example 2.6 Four fair coins are flipped. If the outcomes are assumed
independent, what is the probability that two heads and two tails are obtained? Solution: Letting X equal the number of heads ("successes") that appear, then X is a binomial random variable with parameters (n = 4, p = 1 ). 2
30
2
Random Variables
Hence, by Equation (2.3), P {X = 2} = 4 2 1 2
2
1 2
2
=
3 8
Example 2.7 It is known that any item produced by a certain machine will be defective with probability 0.1, independently of any other item. What is the probability that in a sample of three items, at most one will be defective?
Solution: If X is the number of defective items in the sample, then X is a binomial random variable with parameters (3, 0.1). Hence, the desired probability is given by P {X = 0} + P {X = 1} = 3 3 (0.1)1 (0.9)2 = 0.972 (0.1)0 (0.9)3 + 1 0
probability 1  p independently from engine to engine; suppose that the airplane will make a successful flight if at least 50 percent of its engines remain operative. For what values of p is a fourengine plane preferable to a twoengine plane? Solution: Because each engine is assumed to fail or function independently of what happens with the other engines, it follows that the number of engines remaining operative is a binomial random variable. Hence, the probability that a fourengine plane makes a successful flight is 4 3 4 4 4 2 p (1  p) + p (1  p)0 p (1  p)2 + 3 4 2 = 6p 2 (1  p)2 + 4p 3 (1  p) + p 4 whereas the corresponding probability for a twoengine plane is 2 2 2 p(1  p) + p = 2p(1  p) + p 2 1 2 Hence the fourengine plane is safer if 6p 2 (1  p)2 + 4p 3 (1  p) + p 4 or equivalently if 6p(1  p)2 + 4p 2 (1  p) + p 3 2p 2p(1  p) + p 2
Example 2.8 Suppose that an airplane engine will fail, when in flight, with
2.2.
Discrete Random Variables
31
which simplifies to 3p 3  8p 2 + 7p  2 which is equivalent to 3p  2 0 or p
2 3
0 or
(p  1)2 (3p  2)
0
Hence, the fourengine plane is safer when the engine success probability is at least as large as 2 , whereas the twoengine plane is safer when this probabil3 ity falls below 2 . 3
Example 2.9 Suppose that a particular trait of a person (such as eye color or left handedness) is classified on the basis of one pair of genes and suppose that d represents a dominant gene and r a recessive gene. Thus a person with dd genes is pure dominance, one with rr is pure recessive, and one with rd is hybrid. The pure dominance and the hybrid are alike in appearance. Children receive one gene from each parent. If, with respect to a particular trait, two hybrid parents have a total of four children, what is the probability that exactly three of the four children have the outward appearance of the dominant gene?
Solution: If we assume that each child is equally likely to inherit either of two genes from each parent, the probabilities that the child of two hybrid parents will have dd, rr, or rd pairs of genes are, respectively, 1 , 1 , 1 . Hence, 4 4 2 because an offspring will have the outward appearance of the dominant gene if its gene pair is either dd or rd, it follows that the number of such children is binomially distributed with parameters (4, 3 ). Thus the desired probability is 4 4 3 3 4
3
1 4
1
=
27 64
Remark on Terminology If X is a binomial random variable with parameters (n, p), then we say that X has a binomial distribution with parameters (n, p). 2.2.3. The Geometric Random Variable Suppose that independent trials, each having probability p of being a success, are performed until a success occurs. If we let X be the number of trials required until the first success, then X is said to be a geometric random variable with
32
2
Random Variables
parameter p. Its probability mass function is given by p(n) = P {X = n} = (1  p)n1 p, n = 1, 2, . . . (2.4)
Equation (2.4) follows since in order for X to equal n it is necessary and sufficient that the first n  1 trials be failures and the nth trial a success. Equation (2.4) follows since the outcomes of the successive trials are assumed to be independent. To check that p(n) is a probability mass function, we note that
p(n) = p
n=1 n=1
(1  p)n1 = 1
2.2.4. The Poisson Random Variable A random variable X, taking on one of the values 0, 1, 2, . . . , is said to be a Poisson random variable with parameter , if for some > 0, p(i) = P {X = i} = e i , i! i = 0, 1, . . . (2.5)
Equation (2.5) defines a probability mass function since
i=0
p(i) = e
i=0
i = e e = 1 i!
The Poisson random variable has a wide range of applications in a diverse number of areas, as will be seen in Chapter 5. An important property of the Poisson random variable is that it may be used to approximate a binomial random variable when the binomial parameter n is large and p is small. To see this, suppose that X is a binomial random variable with parameters (n, p), and let = np. Then P {X = i} = = = n! p i (1  p)ni (n  i)! i! n! (n  i)! i! n
i
1
n
ni
n(n  1) (n  i + 1) i (1  /n)n ni i! (1  /n)i
2.2.
Discrete Random Variables
33
Now, for n large and p small 1 n
n
e ,
n(n  1) (n  i + 1) 1, ni
1
n
i
1
Hence, for n large and p small, P {X = i} e i i!
Example 2.10 Suppose that the number of typographical errors on a single
page of this book has a Poisson distribution with parameter = 1. Calculate the probability that there is at least one error on this page. Solution: P {X 1} = 1  P {X = 0} = 1  e1 0.633
Example 2.11 If the number of accidents occurring on a highway each day
is a Poisson random variable with parameter = 3, what is the probability that no accidents occur today? Solution: P {X = 0} = e3 0.05
Example 2.12 Consider an experiment that consists of counting the number
of particles given off in a onesecond interval by one gram of radioactive material. If we know from past experience that, on the average, 3.2 such particles are given off, what is a good approximation to the probability that no more than two particles will appear? Solution: If we think of the gram of radioactive material as consisting of a large number n of atoms each of which has probability 3.2/n of disintegrating and sending off an particle during the second considered, then we see that, to a very close approximation, the number of particles given off will be a Poisson random variable with parameter = 3.2. Hence the desired probability is P {X 2} = e3.2 + 3.2e3.2 + (3.2)2 3.2 e 0.382 2
34
2
Random Variables
2.3.
Continuous Random Variables
In this section, we shall concern ourselves with random variables whose set of possible values is uncountable. Let X be such a random variable. We say that X is a continuous random variable if there exists a nonnegative function f (x), defined for all real x (, ), having the property that for any set B of real numbers P {X B} =
B
f (x) dx
(2.6)
The function f (x) is called the probability density function of the random variable X. In words, Equation (2.6) states that the probability that X will be in B may be obtained by integrating the probability density function over the set B. Since X must assume some value, f (x) must satisfy 1 = P {X (, )} =

f (x) dx
All probability statements about X can be answered in terms of f (x). For instance, letting B = [a, b], we obtain from Equation (2.6) that P {a X b} =
a b
f (x) dx
(2.7)
If we let a = b in the preceding, then P {X = a} =
a a
f (x) dx = 0
In words, this equation states that the probability that a continuous random variable will assume any particular value is zero. The relationship between the cumulative distribution F () and the probability density f () is expressed by F (a) = P {X (, a]} = Differentiating both sides of the preceding yields d F (a) = f (a) da That is, the density is the derivative of the cumulative distribution function. A somewhat more intuitive interpretation of the density function may be obtained
a 
f (x) dx
2.3.
Continuous Random Variables
35
from Equation (2.7) as follows: P a 2 X a+ = 2
a+/2 a/2
f (x) dx f (a)
when is small. In other words, the probability that X will be contained in an interval of length around the point a is approximately f (a). From this, we see that f (a) is a measure of how likely it is that the random variable will be near a. There are several important continuous random variables that appear frequently in probability theory. The remainder of this section is devoted to a study of certain of these random variables. 2.3.1. The Uniform Random Variable A random variable is said to be uniformly distributed over the interval (0, 1) if its probability density function is given by f (x) = 1, 0, 0< x <1 otherwise 0 and
Note that the preceding is a density function since f (x)

f (x) dx =
0
1
dx = 1
Since f (x) > 0 only when x (0, 1), it follows that X must assume a value in (0, 1). Also, since f (x) is constant for x (0, 1), X is just as likely to be "near" any value in (0, 1) as any other value. To check this, note that, for any 0 < a < b < 1, P {a X b} =
a b
f (x) dx = b  a
In other words, the probability that X is in any particular subinterval of (0, 1) equals the length of that subinterval. In general, we say that X is a uniform random variable on the interval (, ) if its probability density function is given by 1 , if < x < (2.8) f (x) =  0, otherwise
Example 2.13 Calculate the cumulative distribution function of a random
variable uniformly distributed over (, ).
36
2
Random Variables
Solution:
Since F (a) =
a  f (x)
dx, we obtain from Equation (2.8) that a ,
F (a) =
0, a   1,
<a< a
Example 2.14 If X is uniformly distributed over (0, 10), calculate the probability that (a) X < 3, (b) X > 7, (c) 1 < X < 6. Solution:
3 0 dx
P {X < 3} = P {X > 7} = P {1 < X < 6} =
10
10 7 dx
=
3 , 10 3 , 10
10
6 1 dx
= =
10
1 2
2.3.2. Exponential Random Variables A continuous random variable whose probability density function is given, for some > 0, by f (x) = ex , 0, if x 0 if x < 0
is said to be an exponential random variable with parameter . These random variables will be extensively studied in Chapter 5, so we will content ourselves here with just calculating the cumulative distribution function F :
a 0 x dx 0 e
F (a) =
ex = 1  ea ,
a
0
Note that F () =
= 1, as, of course, it must.
2.3.
Continuous Random Variables
37
2.3.3. Gamma Random Variables A continuous random variable whose density is given by x (x)1 e , if x 0 f (x) = () 0, if x < 0 for some > 0, > 0 is said to be a gamma random variable with parameters , . The quantity () is called the gamma function and is defined by () =
0
ex x 1 dx
It is easy to show by induction that for integral , say, = n, (n) = (n  1)! 2.3.4. Normal Random Variables We say that X is a normal random variable (or simply that X is normally distributed) with parameters and 2 if the density of X is given by 1 2 2 f (x) = e(x) /2 , 2  < x <
This density function is a bellshaped curve that is symmetric around (see Figure 2.2). An important fact about normal random variables is that if X is normally distributed with parameters and 2 then Y = X + is normally distributed with parameters + and 2 2 . To prove this, suppose first that > 0 and note that
Figure 2.2. Normal density function.
38
2
Random Variables
FY () the cumulative distribution function of the random variable Y is given by FY (a) = P {Y a} a} a
= P {X + =P X = FX = =
a 1 2 2 e(x) /2 dx 2 dv (2.9)
(a)/  a 
1 (v  ( + ))2 exp 2 2 2 2
where the last equality is obtained by the change in variables v = x + . Howa ever, since FY (a) =  fY (v) dv, it follows from Equation (2.9) that the probability density function fY () is given by 1 (v  ( + ))2 , fY (v) = exp 2( )2 2 <v<
Hence, Y is normally distributed with parameters + and ( )2 . A similar result is also true when < 0. One implication of the preceding result is that if X is normally distributed with parameters and 2 then Y = (X  )/ is normally distributed with parameters 0 and 1. Such a random variable Y is said to have the standard or unit normal distribution.
2.4.
Expectation of a Random Variable
2.4.1. The Discrete Case If X is a discrete random variable having a probability mass function p(x), then the expected value of X is defined by E[X] =
x:p(x)>0
When there is more than one random variable under consideration, we shall denote the cumulative distribution function of a random variable Z by Fz (). Similarly, we shall denote the density of Z by fz ().
xp(x)
2.4.
Expectation of a Random Variable
39
In other words, the expected value of X is a weighted average of the possible values that X can take on, each value being weighted by the probability that X assumes that value. For example, if the probability mass function of X is given by p(1) = then E[X] = 1( 1 ) + 2( 1 ) = 2 2
3 2 1 2
= p(2)
is just an ordinary average of the two possible values 1 and 2 that X can assume. On the other hand, if p(1) = 1 , 3 then E[X] = 1( 1 ) + 2( 2 ) = 3 3
5 3
p(2) =
2 3
is a weighted average of the two possible values 1 and 2 where the value 2 is given twice as much weight as the value 1 since p(2) = 2p(1).
Example 2.15 Find E[X] where X is the outcome when we roll a fair die.
Solution: Since p(1) = p(2) = p(3) = p(4) = p(5) = p(6) = 1 , we obtain 6
7 2
E[X] = 1( 1 ) + 2( 1 ) + 3( 1 ) + 4( 1 ) + 5( 1 ) + 6( 1 ) = 6 6 6 6 6 6
Example 2.16 (Expectation of a Bernoulli Random Variable) Calculate E[X]
when X is a Bernoulli random variable with parameter p. Solution: Since p(0) = 1  p, p(1) = p, we have E[X] = 0(1  p) + 1(p) = p Thus, the expected number of successes in a single trial is just the probability that the trial will be a success.
Example 2.17 (Expectation of a Binomial Random Variable) Calculate E[X]
when X is binomially distributed with parameters n and p.
40
2
Random Variables
Solution: E[X] =
n
ip(i)
i=0 n
=
i=0 n
i
n i p (1  p)ni i
=
i=1 n
in! p i (1  p)ni (n  i)! i! n! p i (1  p)ni (n  i)!(i  1)!
n
=
i=1
= np
i=1 n1
(n  1)! p i1 (1  p)ni (n  i)!(i  1)! n1 k p (1  p)n1k k
= np
k=0
= np[p + (1  p)]n1 = np where the second from the last equality follows by letting k = i  1. Thus, the expected number of successes in n independent trials is n multiplied by the probability that a trial results in a success.
Example 2.18 (Expectation of a Geometric Random Variable) Calculate the
expectation of a geometric random variable having parameter p. Solution: By Equation (2.4), we have
E[X] = =p
np(1  p)n1
n=1
nq n1
n=1
where q = 1  p, E[X] = p
n=1
d n (q ) dq
d =p dq
qn
n=1
2.4.
Expectation of a Random Variable
41
d q dq 1  q p = (1  q)2 =p = 1 p
In words, the expected number of independent trials we need to perform until we attain our first success equals the reciprocal of the probability that any one trial results in a success.
Example 2.19 (Expectation of a Poisson Random Variable) Calculate E[X]
if X is a Poisson random variable with parameter . Solution: From Equation (2.5), we have
E[X] =
i=0
ie i i! e i (i  1)!
i=1
=
i=1
= e

i1 (i  1)! k k!
= e = e = where we have used the identity 2.4.2. The Continuous Case e
k=0

k k=0 /k! = e .
We may also define the expected value of a continuous random variable. This is done as follows. If X is a continuous random variable having a probability density function f (x), then the expected value of X is defined by E[X] =

xf (x) dx
42
2
Random Variables
Example 2.20 (Expectation of a Uniform Random Variable) Calculate the
expectation of a random variable uniformly distributed over (, ). Solution: From Equation (2.8) we have E[X] =
x dx 
= =
2  2 2(  ) + 2
In other words, the expected value of a random variable uniformly distributed over the interval (, ) is just the midpoint of the interval.
Example 2.21 (Expectation of an Exponential Random Variable) Let X be
exponentially distributed with parameter . Calculate E[X]. Solution: E[X] =
0
xex dx
Integrating by parts yields E[X] = xex =0 = 1
0
+
0
ex dx
ex
0
Example 2.22 (Expectation of a Normal Random Variable) Calculate E[X]
when X is normally distributed with parameters and 2 . Solution: 1 E[X] = 2 Writing x as (x  ) + yields 1 E[X] = 2

xe(x)
2 /2 2
dx

(x  )e(x)
2 /2 2
dx +
1 2

e(x)
2 /2 2
dx
2.4.
Expectation of a Random Variable
43
Letting y = x  leads to 1 E[X] = 2

yey
2 /2 2
dy +

f (x) dx
where f (x) is the normal density. By symmetry, the first integral must be 0, and so E[X] =

f (x) dx =
2.4.3. Expectation of a Function of a Random Variable Suppose now that we are given a random variable X and its probability distribution (that is, its probability mass function in the discrete case or its probability density function in the continuous case). Suppose also that we are interested in calculating, not the expected value of X, but the expected value of some function of X, say, g(X). How do we go about doing this? One way is as follows. Since g(X) is itself a random variable, it must have a probability distribution, which should be computable from a knowledge of the distribution of X. Once we have obtained the distribution of g(X), we can then compute E[g(X)] by the definition of the expectation.
Example 2.23 Suppose X has the following probability mass function:
p(0) = 0.2, Calculate E[X 2 ]. Solution: Letting Y = X 2 , we have that Y is a random variable that can take on one of the values 02 , 12 , 22 with respective probabilities pY (0) = P {Y = 02 } = 0.2, pY (1) = P {Y = 12 } = 0.5, pY (4) = P {Y = 22 } = 0.3 Hence, E[X 2 ] = E[Y ] = 0(0.2) + 1(0.5) + 4(0.3) = 1.7 Note that 1.7 = E[X 2 ] = (E[X])2 = 1.21 p(1) = 0.5, p(2) = 0.3
44
2
Random Variables
Example 2.24 Let X be uniformly distributed over (0, 1). Calculate E[X3 ].
Solution: Letting Y = X 3 , we calculate the distribution of Y as follows. For 0 a 1, FY (a) = P {Y = P {X 3 = P {X = a 1/3 where the last equality follows since X is uniformly distributed over (0, 1). By differentiating FY (a), we obtain the density of Y , namely, fY (a) = 1 a 2/3 , 3 Hence, E[X 3 ] = E[Y ] = =
0  1
a} a} a 1/3 }
0
a
1
afY (a) da
a 1 a 2/3 da 3
1
= = =
1 3
a 1/3 da
0
1 3 4/3 1 3 4a 0 1 4
While the foregoing procedure will, in theory, always enable us to compute the expectation of any function of X from a knowledge of the distribution of X, there is, fortunately, an easier way to do this. The following proposition shows how we can calculate the expectation of g(X) without first determining its distribution.
Proposition 2.1 (a) If X is a discrete random variable with probability mass
function p(x), then for any realvalued function g, E[g(X)] =
x:p(x)>0
g(x)p(x)
2.4.
Expectation of a Random Variable
45
(b) If X is a continuous random variable with probability density function f (x), then for any realvalued function g, E[g(X)] =

g(x)f (x) dx
Example 2.25 Applying the proposition to Example 2.23 yields
E[X 2 ] = 02 (0.2) + (12 )(0.5) + (22 )(0.3) = 1.7 which, of course, checks with the result derived in Example 2.23.
Example 2.26 Applying the proposition to Example 2.24 yields
E[X 3 ] =
0 1
x 3 dx
(since f (x) = 1, 0 < x < 1)
=
1 4
A simple corollary of Proposition 2.1 is the following.
Corollary 2.2 If a and b are constants, then
E[aX + b] = aE[X] + b
Proof In the discrete case,
E[aX + b] =
x:p(x)>0
(ax + b)p(x) xp(x) + b
x:p(x)>0 x:p(x)>0
=a
p(x)
= aE[X] + b In the continuous case, E[aX + b] = =a

(ax + b)f (x) dx xf (x) dx + b


f (x) dx
= aE[X] + b
46
2
Random Variables
The expected value of a random variable X, E[X], is also referred to as the mean or the first moment of X. The quantity E[X n ], n 1, is called the nth moment of X. By Proposition 2.1, we note that x n p(x), dx, if X is discrete if X is continuous
E[X
n
x:p(x)>0 ]= n x f (x) 
Another quantity of interest is the variance of a random variable X, denoted by Var(X), which is defined by Var(X) = E (X  E[X])2 Thus, the variance of X measures the expected square of the deviation of X from its expected value.
Example 2.27 (Variance of the Normal Random Variable) Let X be normally
distributed with parameters and 2 . Find Var(X). Solution: Recalling (see Example 2.22) that E[X] = , we have that Var(X) = E[(X  )2 ] 1 = 2 Substituting y = (x  )/ yields 2 Var(X) = 2 Integrating by parts (u = y, dv = yey 2 Var(X) = 2 2 = 2 = 2 Another derivation of Var(X) will be given in Example 2.42. yey
 
2 /2

(x  )2 e(x)
2 /2 2
dx
y 2 ey
2 /2
dy
dy) gives +

2 /2

ey
2 /2
dy
ey
2 /2
dy
2.5.
Jointly Distributed Random Variables
47
Suppose that X is continuous with density f, and let E[X] = . Then, Var(X) = E[(X  )2 ] = E[X 2  2X + 2 ] = =
 
(x 2  2x + 2 )f (x) dx x 2 f (x) dx  2

xf (x) dx + 2

f (x) dx
= E[X 2 ]  2 + 2 = E[X 2 ]  2 A similar proof holds in the discrete case, and so we obtain the useful identity Var(X) = E[X 2 ]  (E[X])2
Example 2.28 Calculate Var(X) when X represents the outcome when a fair
die is rolled. Solution: E[X 2 ] = 1 Hence, Var(X) =
91 6
As previously noted in Example 2.15, E[X] = 7 . Also, 2
1 6
+ 22
1 6
+ 32
1 6
+ 42
1 6
+ 52
1 6
+ 62
1 6
=
1 6
(91)

7 2 2
=
35 12
2.5.
Jointly Distributed Random Variables
2.5.1. Joint Distribution Functions Thus far, we have concerned ourselves with the probability distribution of a single random variable. However, we are often interested in probability statements concerning two or more random variables. To deal with such probabilities, we define, for any two random variables X and Y , the joint cumulative probability distribution function of X and Y by F (a, b) = P {X a, Y b},  < a, b <
48
2
Random Variables
The distribution of X can be obtained from the joint distribution of X and Y as follows: FX (a) = P {X = P {X a} a, Y < }
= F (a, ) Similarly, the cumulative distribution function of Y is given by FY (b) = P {Y b} = F (, b)
In the case where X and Y are both discrete random variables, it is convenient to define the joint probability mass function of X and Y by p(x, y) = P {X = x, Y = y} The probability mass function of X may be obtained from p(x, y) by pX (x) =
y:p(x,y)>0
p(x, y)
Similarly, pY (y) =
x:p(x,y)>0
p(x, y)
We say that X and Y are jointly continuous if there exists a function f (x, y), defined for all real x and y, having the property that for all sets A and B of real numbers P {X A, Y B} =
B A
f (x, y) dx dy
The function f (x, y) is called the joint probability density function of X and Y . The probability density of X can be obtained from a knowledge of f (x, y) by the following reasoning: P {X A} = P {X A, Y (, )} = =
A  A
f (x, y) dx dy
fX (x) dx
2.5.
Jointly Distributed Random Variables
49
where fX (x) =

f (x, y) dy
is thus the probability density function of X. Similarly, the probability density function of Y is given by fY (y) =

f (x, y) dx
A variation of Proposition 2.1 states that if X and Y are random variables and g is a function of two variables, then E[g(X, Y )] =
y x
g(x, y)p(x, y) g(x, y)f (x, y) dx dy
in the discrete case in the continuous case
=
 
For example, if g(X, Y ) = X + Y , then, in the continuous case, E[X + Y ] = =
   
(x + y)f (x, y) dx dy xf (x, y) dx dy +
 
yf (x, y) dx dy
= E[X] + E[Y ] where the first integral is evaluated by using the variation of Proposition 2.1 with g(x, y) = x, and the second with g(x, y) = y. The same result holds in the discrete case and, combined with the corollary in Section 2.4.3, yields that for any constants a, b E[aX + bY ] = aE[X] + bE[Y ] (2.10)
Joint probability distributions may also be defined for n random variables. The details are exactly the same as when n = 2 and are left as an exercise. The corresponding result to Equation (2.10) states that if X1 , X2 , . . . , Xn are n random variables, then for any n constants a1 , a2 , . . . , an , E[a1 X1 + a2 X2 + + an Xn ] = a1 E[X1 ] + a2 E[X2 ] + + an E[Xn ] (2.11)
Example 2.29 Calculate the expected sum obtained when three fair dice are
rolled.
50
2
Random Variables
Solution: Let X denote the sum obtained. Then X = X1 + X2 + X3 where Xi represents the value of the ith die. Thus, E[X] = E[X1 ] + E[X2 ] + E[X3 ] = 3
7 2
=
21 2
Example 2.30 As another example of the usefulness of Equation (2.11), let
us use it to obtain the expectation of a binomial random variable having parameters n and p. Recalling that such a random variable X represents the number of successes in n trials when each trial has probability p of being a success, we have that X = X1 + X2 + + Xn where Xi = 1, 0, if the ith trial is a success if the ith trial is a failure
Hence, Xi is a Bernoulli random variable having expectation E[Xi ] = 1(p) + 0(1  p) = p. Thus, E[X] = E[X1 ] + E[X2 ] + + E[Xn ] = np This derivation should be compared with the one presented in Example 2.17.
Example 2.31 At a party N men throw their hats into the center of a room. The hats are mixed up and each man randomly selects one. Find the expected number of men who select their own hats.
Solution: Letting X denote the number of men that select their own hats, we can best compute E[X] by noting that X = X1 + X2 + + XN where Xi = 1, 0, if the ith man selects his own hat otherwise
Now, because the ith man is equally likely to select any of the N hats, it follows that P {Xi = 1} = P {ith man selects his own hat} = and so E[Xi ] = 1P {Xi = 1} + 0P {Xi = 0} = 1 N 1 N
2.5.
Jointly Distributed Random Variables
51
Hence, from Equation (2.11) we obtain that E[X] = E[X1 ] + + E[XN ] = 1 N =1 N
Hence, no matter how many people are at the party, on the average exactly one of the men will select his own hat.
Example 2.32 Suppose there are 25 different types of coupons and suppose
that each time one obtains a coupon, it is equally likely to be any one of the 25 types. Compute the expected number of different types that are contained in a set of 10 coupons. Solution: Let X denote the number of different types in the set of 10 coupons. We compute E[X] by using the representation X = X1 + + X25 where Xi = Now, E[Xi ] = P {Xi = 1} = P {at least one type i coupon is in the set of 10} = 1  P {no type i coupons are in the set of 10} =1
24 25 10
1, 0,
if at least one type i coupon is in the set of 10 otherwise
when the last equality follows since each of the 10 coupons will (independently) not be a type i with probability 24 . Hence, 25 E[X] = E[X1 ] + + E[X25 ] = 25 1  2.5.2. Independent Random Variables The random variables X and Y are said to be independent if, for all a, b, P {X a, Y b} = P {X a}P {Y b} (2.12)
24 10 25
In other words, X and Y are independent if, for all a and b, the events Ea = {X a} and Fb = {Y b} are independent.
52
2
Random Variables
In terms of the joint distribution function F of X and Y , we have that X and Y are independent if F (a, b) = FX (a)FY (b) for all a, b
When X and Y are discrete, the condition of independence reduces to p(x, y) = pX (x)pY (y) while if X and Y are jointly continuous, independence reduces to f (x, y) = fX (x)fY (y) (2.14) (2.13)
To prove this statement, consider first the discrete version, and suppose that the joint probability mass function p(x, y) satisfies Equation (2.13). Then P {X a, Y b} =
y bx a
p(x, y) pX (x)pY (y)
y bx a
= =
y b
pY (y)
x a
pX (x) a}
= P {Y
b}P {X
and so X and Y are independent. That Equation (2.14) implies independence in the continuous case is proven in the same manner and is left as an exercise. An important result concerning independence is the following.
Proposition 2.3 If X and Y are independent, then for any functions h and g
E[g(X)h(Y )] = E[g(X)]E[h(Y )]
Proof Suppose that X and Y are jointly continuous. Then
E[g(X)h(Y )] = = =
    
g(x)h(y)f (x, y) dx dy g(x)h(y)fX (x)fY (y) dx dy

h(y)fY (y) dy
g(x)fX (x) dx
= E[h(Y )]E[g(X)] The proof in the discrete case is similar.
2.5.
Jointly Distributed Random Variables
53
2.5.3. Covariance and Variance of Sums of Random Variables The covariance of any two random variables X and Y , denoted by Cov(X, Y ), is defined by Cov(X, Y ) = E[(X  E[X])(Y  E[Y ])] = E[XY  Y E[X]  XE[Y ] + E[X]E[Y ]] = E[XY ]  E[Y ]E[X]  E[X]E[Y ] + E[X]E[Y ] = E[XY ]  E[X]E[Y ] Note that if X and Y are independent, then by Proposition 2.3 it follows that Cov(X, Y ) = 0. Let us consider now the special case where X and Y are indicator variables for whether or not the events A and B occur. That is, for events A and B, define X= Then, Cov(X, Y ) = E[XY ]  E[X]E[Y ] and, because XY will equal 1 or 0 depending on whether or not both X and Y equal 1, we see that Cov(X, Y ) = P {X = 1, Y = 1}  P {X = 1}P {Y = 1} From this we see that Cov(X, Y ) > 0 P {X = 1, Y = 1} > P {X = 1}P {Y = 1} P {X = 1, Y = 1} > P {Y = 1} P {X = 1} 1, 0, if A occurs otherwise, Y= 1, 0, if B occurs otherwise
P {Y = 1X = 1} > P {Y = 1} That is, the covariance of X and Y is positive if the outcome X = 1 makes it more likely that Y = 1 (which, as is easily seen by symmetry, also implies the reverse). In general it can be shown that a positive value of Cov(X, Y ) is an indication that Y tends to increase as X does, whereas a negative value indicates that Y tends to decrease as X increases. The following are important properties of covariance.
54
2
Random Variables
Properties of Covariance For any random variables X, Y, Z and constant c, 1. 2. 3. 4. Cov(X, X) = Var(X), Cov(X, Y ) = Cov(Y, X), Cov(cX, Y ) = c Cov(X, Y ), Cov(X, Y + Z) = Cov(X, Y ) + Cov(X, Z).
Whereas the first three properties are immediate, the final one is easily proven as follows: Cov(X, Y + Z) = E[X(Y + Z)]  E[X]E[Y + Z] = E[XY ]  E[X]E[Y ] + E[XZ]  E[X]E[Z] = Cov(X, Y ) + Cov(X, Z) The fourth property listed easily generalizes to give the following result: Cov
n m
Xi ,
i=1 j =1
Yj =
n
m
Cov(Xi , Yj )
i=1 j =1
(2.15)
A useful expression for the variance of the sum of random variables can be obtained from Equation (2.15) as follows:
n
Var
i=1
Xi
= Cov
n n
n
n
Xi ,
i=1 j =1
Xj
=
i=1 j =1 n
Cov(Xi , Xj )
n
=
i=1 n
Cov(Xi , Xi ) +
i=1 j =i n
Cov(Xi , Xj )
=
i=1
Var(Xi ) + 2
i=1 j < i
Cov(Xi , Xj )
(2.16)
If Xi , i = 1, . . . , n are independent random variables, then Equation (2.16) reduces to
n n
Var
i=1
Xi =
i=1
Var(Xi )
2.5.
Jointly Distributed Random Variables
55
Definition 2.1 If X1 , . . . , Xn are independent and identically distributed,
then the random variable X =
n i=1 Xi /n
is called the sample mean.
The following proposition shows that the covariance between the sample mean and a deviation from that sample mean is zero. It will be needed in Section 2.6.1.
Proposition 2.4 Suppose that X1 , . . . , Xn are independent and identically
distributed with expected value and variance 2 . Then, (a) E[X] = . (b) Var(X) = 2 /n. (c) Cov(X, Xi  X) = 0, i = 1, . . . , n.
Proof Parts (a) and (b) are easily established as follows:
E[X] = Var(X) = 1 n
m
E[Xi ] = ,
i=1
1 n
2
n
Var
i=1
Xi =
1 n
2 n
Var(Xi ) =
i=1
2 n
To establish part (c) we reason as follows: Cov(X, Xi  X) = Cov(X, Xi )  Cov(X, X) = = = 1 Cov Xi + n Xj , Xi  Var(X)
j =i
1 1 Cov(Xi , Xi ) + Cov n n 2 2  =0 n n
Xj , Xi 
j =i
2 n
where the final equality used the fact that Xi and thus have covariance 0.
j =i
Xj are independent and
Equation (2.16) is often useful when computing variances.
Example 2.33 (Variance of a Binomial Random Variable) Compute the variance of a binomial random variable X with parameters n and p.
56
2
Random Variables
Solution: Since such a random variable represents the number of successes in n independent trials when each trial has a common probability p of being a success, we may write X = X1 + + Xn where the Xi are independent Bernoulli random variables such that Xi = 1, 0, if the ith trial is a success otherwise
Hence, from Equation (2.16) we obtain Var(X) = Var(X1 ) + + Var(Xn ) But
2 Var(Xi ) = E[Xi ]  (E[Xi ])2
= E[Xi ]  (E[Xi ])2 = p  p2 and thus Var(X) = np(1  p)
2 since Xi = Xi
Example 2.34 (Sampling from a Finite Population: The Hypergeometric)
Consider a population of N individuals, some of whom are in favor of a certain proposition. In particular suppose that Np of them are in favor and N  Np are opposed, where p is assumed to be unknown. We are interested in estimating p, the fraction of the population that is for the proposition, by randomly choosing and then determining the positions of n members of the population. In such situations as described in the preceding, it is common to use the fraction of the sampled population that is in favor of the proposition as an estimator of p. Hence, if we let Xi = 1, 0, if the ith person chosen is in favor otherwise
n i=1 Xi /n. n n
then the usual estimator of p is variance. Now E
i=1
Let us now compute its mean and
Xi =
1
E[Xi ]
2.5.
Jointly Distributed Random Variables
57
= np where the final equality follows since the ith person chosen is equally likely to be any of the N individuals in the population and so has probability Np/N of being in favor.
n n
Var
1
Xi =
1
Var(Xi ) + 2
i<j
Cov(Xi , Xj )
Now, since Xi is a Bernoulli random variable with mean p, it follows that Var(Xi ) = p(1  p) Also, for i = j , Cov(Xi , Xj ) = E[Xi Xj ]  E[Xi ]E[Xj ] = P {Xi = 1, Xj = 1}  p 2 = P {Xi = 1}P {Xj = 1  Xi = 1}  p 2 = Np (Np  1)  p2 N N 1
where the last equality follows since if the ith person to be chosen is in favor, then the j th person chosen is equally likely to be any of the other N  1 of which Np  1 are in favor. Thus, we see that
n
Var
1
Xi
= np(1  p) + 2 = np(1  p) 
n 2
p(Np  1)  p2 N 1
n(n  1)p(1  p) N 1
and so the mean and variance of our estimator are given by
n
E
1 n
Xi n Xi n
= p, p(1  p) (n  1)p(1  p)  n n(N  1)
Var
1
=
Some remarks are in order: As the mean of the estimator is the unknown value p, we would like its variance to be as small as possible (why is this?), and we see by the preceding that, as a function of the population size N , the variance increases as N increases. The limiting value, as N , of the variance is p(1  p)/n,
58
2
Random Variables
which is not surprising since for N large each of the Xi will be (approximately) independent random variables, and thus n Xi will have an (approximately) bi1 nomial distribution with parameters n and p. The random variable n Xi can be thought of as representing the number of 1 white balls obtained when n balls are randomly selected from a population consisting of Np white and N  Np black balls. (Identify a person who favors the proposition with a white ball and one against with a black ball.) Such a random variable is called hypergeometric and has a probability mass function given by
n
P
1
Xi = k =
Np k
N  Np nk N n
It is often important to be able to calculate the distribution of X + Y from the distributions of X and Y when X and Y are independent. Suppose first that X and Y are continuous, X having probability density f and Y having probability density g. Then, letting FX+Y (a) be the cumulative distribution function of X + Y , we have FX+Y (a) = P {X + Y = = = =
x+y a ay   ay   
a} f (x)g(y) dx dy f (x)g(y) dx dy f (x) dx g(y) dy (2.17)
FX (a  y)g(y) dy
The cumulative distribution function FX+Y is called the convolution of the distributions FX and FY (the cumulative distribution functions of X and Y , respectively). By differentiating Equation (2.17), we obtain that the probability density function fX+Y (a) of X + Y is given by fX+Y (a) = = = d da
  
FX (a  y)g(y) dy
d (FX (a  y))g(y) dy da f (a  y)g(y) dy (2.18)
2.5.
Jointly Distributed Random Variables
59
Example 2.35 (Sum of Two Independent Uniform Random Variables) If X
and Y are independent random variables both uniformly distributed on (0, 1), then calculate the probability density of X + Y . Solution: From Equation (2.18), since f (a) = g(a) = we obtain fX+Y (a) =
0 1
1, 0,
0<a<1 otherwise
f (a  y) dy
For 0
a
1, this yields fX+Y (a) =
0 a
dy = a
For 1 < a < 2, we get fX+Y (a) = Hence,
1 a1
dy = 2  a
a, fX+Y (a) = 2  a, 0,
0 a 1 1<a<2 otherwise
Rather than deriving a general expression for the distribution of X + Y in the discrete case, we shall consider an example.
Example 2.36 (Sums of Independent Poisson Random Variables) Let X and
Y be independent Poisson random variables with respective means 1 and 2 . Calculate the distribution of X + Y . Solution: Since the event {X + Y = n} may be written as the union of the disjoint events {X = k, Y = n  k}, 0 k n, we have
n
P {X + Y = n} =
k=0 n
P {X = k, Y = n  k} P {X = k}P {Y = n  k}
k=0
=
60
2
Random Variables
n
=
k=0
e1
k 2 nk 2 1 e k! (n  k)!
n k=0 n k=0
= e(1 +2 ) = = e(1 +2 ) n! e(1 +2 ) n!
k nk 1 2 k!(n  k)! n! k nk k!(n  k)! 1 2
(1 + 2 )n
In words, X1 + X2 has a Poisson distribution with mean 1 + 2 . The concept of independence may, of course, be defined for more than two random variables. In general, the n random variables X1 , X2 , . . . , Xn are said to be independent if, for all values a1 , a2 , . . . , an , P {X1 a1 , X 2 a2 , . . . , X n an } = P {X1 a1 }P {X2 a2 } P {Xn an }
Example 2.37 Let X1 , . . . , Xn be independent and identically distributed
continuous random variables with probability distribution F and density function F = f . If we let X(i) denote the ith smallest of these random variables, then X(1) , . . . , X(n) are called the order statistics. To obtain the distribution of X(i) , note that X(i) will be less than or equal to x if and only if at least i of the n random variables X1 , . . . , Xn are less than or equal to x. Hence,
n
P {X(i)
x} =
k=i
n (F (x))k (1  F (x))nk k
Differentiation yields that the density function of X(i) is as follows:
n
fX(i) (x) = f (x)
k=i n
n k(F (x))k1 (1  F (x))nk k n (n  k)(F (x))k (1  F (x))nk1 k
 f (x)
k=i n
= f (x)
k=i
n! (F (x))k1 (1  F (x))nk (n  k)!(k  1)! n! (F (x))k (1  F (x))nk1 (n  k  1)!k!
n1
 f (x)
k=i
2.5.
n
Jointly Distributed Random Variables
61
= f (x)
k=i
n! (F (x))k1 (1  F (x))nk (n  k)!(k  1)!
n
 f (x)
j =i+1
n! (F (x))j 1 (1  F (x))nj (n  j )!(j  1)!
=
n! f (x)(F (x))i1 (1  F (x))ni (n  i)!(i  1)!
The preceding density is quite intuitive, since in order for X(i) to equal x, i  1 of the n values X1 , . . . , Xn must be less than x; n  i of them must be greater than x; and one must be equal to x. Now, the probability density that every member of a specified set of i 1 of the Xj is less than x, every member of another specified set of n  i is greater than x, and the remaining value is equal to x is (F (x))i1 (1  F (x))ni f (x). Therefore, since there are n!/[(i  1)!(n  i)!] different partitions of the n random variables into the three groups, we obtain the preceding density function. 2.5.4. Joint Probability Distribution of Functions of Random Variables Let X1 and X2 be jointly continuous random variables with joint probability density function f (x1 , x2 ). It is sometimes necessary to obtain the joint distribution of the random variables Y1 and Y2 which arise as functions of X1 and X2 . Specifically, suppose that Y1 = g1 (X1 , X2 ) and Y2 = g2 (X1 , X2 ) for some functions g1 and g2 . Assume that the functions g1 and g2 satisfy the following conditions: 1. The equations y1 = g1 (x1 , x2 ) and y2 = g2 (x1 , x2 ) can be uniquely solved for x1 and x2 in terms of y1 and y2 with solutions given by, say, x1 = h1 (y1 , y2 ), x2 = h2 (y1 , y2 ). 2. The functions g1 and g2 have continuous partial derivatives at all points (x1 , x2 ) and are such that the following 2 2 determinant g1 x1 g2 x1 g1 x2 g2 x2
J (x1 , x2 ) =
g1 g2 g1 g2  =0 x1 x2 x2 x1
at all points (x1 , x2 ).
62
2
Random Variables
Under these two conditions it can be shown that the random variables Y1 and Y2 are jointly continuous with joint density function given by fY1 ,Y2 (y1 , y2 ) = fX1 ,X2 (x1 , x2 )J (x1 , x2 )1 where x1 = h1 (y1 , y2 ), x2 = h2 (y1 , y2 ). A proof of Equation (2.19) would proceed along the following lines: P {Y1 y1 , Y2 y2 } =
(x1 ,x2 ): g1 (x1 ,x2 ) y1 g2 (x1 ,x2 ) y2
(2.19)
fX1 , X2 (x1 , x2 ) dx1 dx2
(2.20)
The joint density function can now be obtained by differentiating Equation (2.20) with respect to y1 and y2 . That the result of this differentiation will be equal to the righthand side of Equation (2.19) is an exercise in advanced calculus whose proof will not be presented in the present text.
Example 2.38 If X and Y are independent gamma random variables with
parameters (, ) and (, ), respectively, compute the joint density of U = X + Y and V = X/(X + Y ). Solution: The joint density of X and Y is given by fX,Y (x, y) = = ex (x)1 ey (y)1 () () + e(x+y) x 1 y 1 () ()
Now, if g1 (x, y) = x + y, g2 (x, y) = x/(x + y), then g1 g1 = = 1, x y and so J (x, y) = 1 y (x + y)2 1 1 x = x +y (x + y)2 g2 y = , x (x + y)2 x g2 = y (x + y)2
2.5.
Jointly Distributed Random Variables
63
Finally, because the equations u = x + y, v = x/(x + y) have as their solutions x = uv, y = u(1  v), we see that fU,V (u, v) = fX,Y [uv, u(1  v)]u = eu (u)+1 v 1 (1  v)1 ( + ) ( + ) () ()
Hence X + Y and X/(X + Y ) are independent, with X + Y having a gamma distribution with parameters ( + , ) and X/(X + Y ) having density function fV (v) = ( + ) 1 v (1  v)1 , () () 0<v<1
This is called the beta density with parameters (, ). This result is quite interesting. For suppose there are n + m jobs to be performed, with each (independently) taking an exponential amount of time with rate for performance, and suppose that we have two workers to perform these jobs. Worker I will do jobs 1, 2, . . . , n, and worker II will do the remaining m jobs. If we let X and Y denote the total working times of workers I and II, respectively, then upon using the preceding result it follows that X and Y will be independent gamma random variables having parameters (n, ) and (m, ), respectively. Then the preceding result yields that independently of the working time needed to complete all n + m jobs (that is, of X + Y ), the proportion of this work that will be performed by worker I has a beta distribution with parameters (n, m). When the joint density function of the n random variables X1 , X2 , . . . , Xn is given and we want to compute the joint density function of Y1 , Y2 , . . . , Yn , where Y1 = g1 (X1 , . . . , Xn ), Yn = gn (X1 , . . . , Xn ) the approach is the same. Namely, we assume that the functions gi have continuous partial derivatives and that the Jacobian determinant J (x1 , . . . , xn ) = 0 at all points (x1 , . . . , xn ), where g1 x1 g2 J (x1 , . . . , xn ) = x1 gn x1 g1 x2 g2 x2 gn x2 g1 xn g2 xn gn xn Y2 = g2 (X1 , . . . , Xn ), ...,
64
2
Random Variables
Furthermore, we suppose that the equations y1 = g1 (x1 , . . . , xn ), y2 = g2 (x1 , . . . , xn ), . . . , yn = gn (x1 , . . . , xn ) have a unique solution, say, x1 = h1 (y1 , . . . , yn ), . . . , xn = hn (y1 , . . . , yn ). Under these assumptions the joint density function of the random variables Yi is given by fY1 ,...,Yn (y1 , . . . , yn ) = fX1 ,...,Xn (x1 , . . . , xn ) J (x1 , . . . , xn )1 where xi = hi (y1 , . . . , yn ), i = 1, 2, . . . , n.
2.6.
Moment Generating Functions
The moment generating function (t) of the random variable X is defined for all values t by (t) = E[etX ] etx p(x), x = tx e f (x) dx,

if X is discrete if X is continuous
We call (t) the moment generating function because all of the moments of X can be obtained by successively differentiating (t). For example, (t) = d E[etX ] dt d tX (e ) =E dt = E[XetX ] Hence, (0) = E[X] Similarly, (t) = d (t) dt d = E[XetX ] dt d =E (XetX ) dt = E[X 2 etX ]
2.6.
Moment Generating Functions
65
and so (0) = E[X 2 ] In general, the nth derivative of (t) evaluated at t = 0 equals E[X n ], that is, n (0) = E[X n ], n 1
We now compute (t) for some common distributions.
Example 2.39 (The Binomial Distribution with Parameters n and p)
(t) = E[etX ]
n
=
k=0 n
etk
n k p (1  p)nk k
=
k=0
n (pet )k (1  p)nk k
= (pet + 1  p)n Hence, (t) = n(pet + 1  p)n1 pet and so E[X] = (0) = np which checks with the result obtained in Example 2.17. Differentiating a second time yields (t) = n(n  1)(pet + 1  p)n2 (pet )2 + n(pet + 1  p)n1 pet and so E[X 2 ] = (0) = n(n  1)p 2 + np Thus, the variance of X is given Var(X) = E[X 2 ]  (E[X])2 = n(n  1)p 2 + np  n2 p 2 = np(1  p)
66
2
Random Variables
Example 2.40 (The Poisson Distribution with Mean )
(t) = E[etX ]
=
n=0
etn e n n!
n=0
= e
(et )n n!
= e ee
t
= exp{(et  1)} Differentiation yields (t) = et exp{(et  1)}, (t) = (et )2 exp{(et  1)} + et exp{(et  1)} and so E[X] = (0) = , E[X 2 ] = (0) = 2 + , Var(X) = E[X 2 ]  (E[X])2 = Thus, both the mean and the variance of the Poisson equal .
Example 2.41 (The Exponential Distribution with Parameter )
(t) = E[etX ] =
0
etx ex dx e(t)x dx for t <
=
0
=
t
2.6.
Moment Generating Functions
67
We note by the preceding derivation that, for the exponential distribution, (t) is only defined for values of t less than . Differentiation of (t) yields (t) = Hence, 1 E[X] = (0) = , The variance of X is thus given by Var(X) = E[X 2 ]  (E[X])2 = 1 2 E[X 2 ] = (0) = 2 2 , (  t)2 (t) = 2 (  t)3
Example 2.42 (The Normal Distribution with Parameters and 2 )
The moment generating function of a standard normal random variable Z is obtained as follows. 1 E[etZ ] = 2 1 = 2 = et = et
2 /2
 
etx ex e(x

2 /2
dx
2 2tx)/2
dx
1 2
e(xt)
2 /2
dx
2 /2
If Z is a standard normal, then X = Z + is normal with parameters and 2 ; therefore, (t) = E[etX ] = E[et ( Z+) ] = et E[et Z ] = exp By differentiating we obtain (t) = ( + t 2 ) exp (t) = ( + t 2 )2 exp 2t 2 + t , 2 2t 2 2t 2 + t + 2 exp + t 2 2 2t 2 + t 2
68 and so
2
Random Variables
E[X] = (0) = , E[X 2 ] = (0) = 2 + 2 implying that Var(X) = E[X 2 ]  E([X])2 = 2 Tables 2.1 and 2.2 give the moment generating function for some common distributions. An important property of moment generating functions is that the moment generating function of the sum of independent random variables is just the product of the individual moment generating functions. To see this, suppose that X and Y are independent and have moment generating functions X (t) and Y (t), respectively. Then X+Y (t), the moment generating function of X + Y , is given by X+Y (t) = E[et (X+Y ) ] = E[etX etY ] = E[etX ]E[etY ] = X (t)Y (t) where the next to the last equality follows from Proposition 2.3 since X and Y are independent.
Table 2.1 Discrete probability distribution Binomial with parameters n, p 0 p 1 Poisson with parameter >0 Geometric with parameter 0 p 1 Probability mass function, p(x)
n x nx , x p (1  p)
Moment generating function, (t) (pet + (1  p))n
Mean np
Variance np(1  p)
x = 0, 1, . . . , n x , x! x = 0, 1, 2, . . .
e
exp{(et  1)} pet 1  (1  p)et
1 p
1p p2
p(1  p)x1 , x = 1, 2, . . .
2.6.
Moment Generating Functions
69
Table 2.2
Continuous probability distribution Uniform over (a, b) Exponential with parameter > 0 Gamma with parameters (n, ) > 0 Normal with parameters (, 2 ) Probability density function, f (x) 1 , a<x<b f (x) = b  a 0, otherwise ex , x > 0 0, x<0 x (x)n1 e ,x 0 f (x) = (n  1)! 0, x<0 f (x) = f (x) = 1 Moment generating function, (t) etb  eta t (b  a) t t
n
Mean a+b 2 1 n
Variance (b  a)2 12 1 2 n 2 2
2 exp{(x  )2 /2 2 },  < x <
exp t +
2t 2 2
Another important result is that the moment generating function uniquely determines the distribution. That is, there exists a onetoone correspondence between the moment generating function and the distribution function of a random variable.
Example 2.43 Suppose the moment generating function of a random variable
X is given by (t) = e3(e 1) . What is P {X = 0}?
t
Solution: We see from Table 2.1 that (t) = e3(e 1) is the moment generating function of a Poisson random variable with mean 3. Hence, by the onetoone correspondence between moment generating functions and distribution functions, it follows that X must be a Poisson random variable with mean 3. Thus, P {X = 0} = e3 .
t
Example 2.44 (Sums of Independent Binomial Random Variables) If X and
Y are independent binomial random variables with parameters (n, p) and (m, p), respectively, then what is the distribution of X + Y ? Solution: The moment generating function of X + Y is given by X+Y (t) = X (t)Y (t) = (pet + 1  p)n (pet + 1  p)m = (pet + 1  p)m+n
70
2
Random Variables
But (pet + (1  p))m+n is just the moment generating function of a binomial random variable having parameters m + n and p. Thus, this must be the distribution of X + Y .
Example 2.45 (Sums of Independent Poisson Random Variables) Calculate
the distribution of X +Y when X and Y are independent Poisson random variables with means 1 and 2 , respectively. Solution: X+Y (t) = X (t) Y (t) = e1 (e 1) e2 (e 1)
t t
= e(1 +2 )(e 1)
t
Hence, X + Y is Poisson distributed with mean 1 + 2 , verifying the result given in Example 2.36.
Example 2.46 (Sums of Independent Normal Random Variables) Show that
2 if X and Y are independent normal random variables with parameters (1 , 1 ) 2 ), respectively, then X + Y is normal with mean + and variance and (2 , 2 1 2 2 2 1 + 2 .
Solution: X+Y (t) = X (t)Y (t) = exp = exp
2 1 t 2 2t 2 + 1 t exp 2 + 2 t 2 2 2 2 (1 + 2 )t 2 + (1 + 2 )t 2
which is the moment generating function of a normal random variable with 2 2 mean 1 + 2 and variance 1 + 2 . Hence, the result follows since the moment generating function uniquely determines the distribution.
Example 2.47 (The Poisson Paradigm) We showed in Section 2.2.4 that the
number of successes that occur in n independent trails, each of which results in a success with probability p is, when n is large and p small, approximately a Poisson random variable with parameter = np. This result, however, can be substantially strengthened. First it is not necessary that the trials have the same
2.6.
Moment Generating Functions
71
success probability, only that all the success probabilities are small. To see that this is the case, suppose that the trials are independent, with trial i resulting in a success with probability pi , where all the pi , i = 1, . . . , n are small. Letting Xi equal 1 if trial i is a success, and 0 otherwise, it follows that the number of successes, call it X, can be expressed as
n
X=
i=1
Xi
Using that Xi is a Bernoulli (or binary) random variable, its moment generating function is E[etXi ] = pi et + 1  pi = 1 + pi (et  1) Now, using the result that, for x small, ex 1 + x it follows, because pi (et  1) is small when pi is small, that E[etXi ] = 1 + pi (et  1) exp{pi (et  1)} Because the moment generating function of a sum of independent random variables is the product of their moment generating functions, the preceding implies that
n
E[etX ]
i=1
exp{pi (et  1)} = exp
i
pi (et  1)
But the right side of the preceding is the moment generating function of a Poisson random variable with mean i pi , thus arguing that this is approximately the distribution of X. Not only is it not necessary for the trials to have the same success probability for the number of successes to approximately have a Poisson distribution, they need not even be independent, provided that their dependence is weak. For instance, recall the matching problem (Example 2.31) where n people randomly select hats from a set consisting of one hat from each person. By regarding the random selections of hats as constituting n trials, where we say that trial i is a success if person i chooses his or her own hat, it follows that, with Ai being the event that trial i is a success, P (Ai ) = 1 n and P (Ai Aj ) = 1 , n1 j =i
Hence, whereas the trials are not independent, their dependence appears, for large n, to be weak. Because of this weak dependence, and the small trial success probabilities, it would seem that the number of matches should approximately have a
72
2
Random Variables
Poisson distribution with mean 1 when n is large, and this is shown to be the case in Example 3.23. The statement that "the number of successes in n trials that are either independent or at most weakly dependent is, when the trial success probabilities are all small, approximately a Poisson random variable" is known as the Poisson paradigm.
Remark For a nonnegative random variable X, it is often convenient to define
its Laplace transform g(t), t 0, by g(t) = (t) = E[etX ] That is, the Laplace transform evaluated at t is just the moment generating function evaluated at t. The advantage of dealing with the Laplace transform, rather than the moment generating function, when the random variable is nonnegative is that if X 0 and t 0, then 0 etX 1
That is, the Laplace transform is always between 0 and 1. As in the case of moment generating functions, it remains true that nonnegative random variables that have the same Laplace transform must also have the same distribution. It is also possible to define the joint moment generating function of two or more random variables. This is done as follows. For any n random variables X1 , . . . , Xn , the joint moment generating function, (t1 , . . . , tn ), is defined for all real values of t1 , . . . , tn by (t1 , . . . , tn ) = E[e(t1 X1 + + tn Xn ) ] It can be shown that (t1 , . . . , tn ) uniquely determines the joint distribution of X 1 , . . . , Xn .
Example 2.48 (The Multivariate Normal Distribution) Let Z1 , . . . , Zn be a
set of n independent standard normal random variables. If, for some constants aij , 1 i m, 1 j n, and i , 1 i m, X1 = a11 Z1 + + a1n Zn + 1 , X2 = a21 Z1 + + a2n Zn + 2 , . . . Xi = ai1 Z1 + + ain Zn + i , . . . Xm = am1 Z1 + + amn Zn + m
2.6.
Moment Generating Functions
73
then the random variables X1 , . . . , Xm are said to have a multivariate normal distribution. It follows from the fact that the sum of independent normal random variables is itself a normal random variable that each Xi is a normal random variable with mean and variance given by E[Xi ] = i ,
n
Var(Xi ) =
j =1
2 aij
Let us now determine (t1 , . . . , tm ) = E[exp{t1 X1 + + tm Xm }] the joint moment generating function of X1 , . . . , Xm . The first thing to note is that since m ti Xi is itself a linear combination of the independent normal random i=1 variables Z1 , . . . , Zn , it is also normally distributed. Its mean and variance are respectively
m m
E
i=1
ti X i =
i=1
ti i
and
m
ti X i = Cov
m m
m
m
tj X j
Var
i=1
ti X i ,
i=1 j =1
=
i=1 j =1
ti tj Cov(Xi , Xj )
Now, if Y is a normal random variable with mean and variance 2 , then E[eY ] = Y (t)t=1 = e+ Thus, we see that (t1 , . . . , tm ) = exp
m i=1
2 /2
1 ti i + 2
m
m
i=1 j =1
ti tj Cov(Xi , Xj )
which shows that the joint distribution of X1 , . . . , Xm is completely determined from a knowledge of the values of E[Xi ] and Cov(Xi , Xj ), i, j = 1, . . . , m.
74
2
Random Variables
2.6.1. The Joint Distribution of the Sample Mean and Sample Variance from a Normal Population Let X1 , . . . , Xn be independent and identically distributed random variables, each with mean and variance 2 . The random variable S 2 defined by
n
S =
2 i=1
(Xi  X)2 n1
is called the sample variance of these data. To compute E[S 2 ] we use the identity
n i=1
(Xi  X)2 =
n i=1
(Xi  )2  n(X  )2
(2.21)
which is proven as follows:
n i=1
(Xi  X) = =
n i=1 n i=1 n
(Xi  +  X)2 (Xi  )2 + n(  X)2 + 2(  X)
n
(Xi  )
i=1
=
i=1 n
(Xi  )2 + n(  X)2 + 2(  X)(nX  n) (Xi  )2 + n(  X)2  2n(  X)2
=
i=1
and Identity (2.21) follows. Using Identity (2.21) gives
n
E[(n  1)S 2 ] =
i=1
E[(Xi  )2 ]  nE[(X  )2 ]
= n 2  n Var(X) = (n  1) 2 Thus, we obtain from the preceding that E[S 2 ] = 2 We will now determine the joint distribution of the sample mean X = n 2 when the X have a normal distribution. i i=1 Xi /n and the sample variance S To begin we need the concept of a chisquared random variable. from Proposition 2.4(b)
2.6.
Moment Generating Functions
75
Definition 2.2 If Z1 , . . . , Zn are independent standard normal random vari
ables, then the random variable n Zi2 is said to be a chisquared random varii=1 able with n degrees of freedom. We shall now compute the moment generating function of n Zi2 . To begin, i=1 note that 1 E[exp{tZi2 }] = 2 1 = 2 = = (1  2t)1/2
 
etx ex
2
2 /2
dx where 2 = (1  2t)1
ex
2 /2 2
dx
Hence,
n n
E exp t
i=1
Zi2
=
i=1
E[exp{tZi2 }] = (1  2t)n/2
Now, let X1 , . . . , Xn be independent normal random variables, each with mean and variance 2 , and let X = n Xi /n and S 2 denote their sample mean i=1 and sample variance. Since the sum of independent normal random variables is also a normal random variable, it follows that X is a normal random variable with expected value and variance 2 /n. In addition, from Proposition 2.4, Cov(X, Xi  X) = 0, i = 1, . . . , n (2.22)
Also, since X, X1  X, X2  X, . . . , Xn  X are all linear combinations of the independent standard normal random variables (Xi  )/, i = 1, . . . , n, it follows that the random variables X, X1  X, X2  X, . . . , Xn  X have a joint distribution that is multivariate normal. However, if we let Y be a normal random variable with mean and variance 2 /n that is independent of X1 , . . . , Xn , then the random variables Y, X1  X, X2  X, . . . , Xn  X also have a multivariate normal distribution, and by Equation (2.22), they have the same expected values and covariances as the random variables X, Xi  X, i = 1, . . . , n. Thus, since a multivariate normal distribution is completely determined by its expected values and covariances, we can conclude that the random vectors Y, X1  X, X2  X, . . . , Xn  X and X1  X, X2  X, . . . , Xn  X have the same joint distribution; thus showing X, that X is independent of the sequence of deviations Xi  X, i = 1, . . . , n.
76
2
Random Variables
Since X is independent of the sequence of deviations Xi  X, i = 1, . . . , n, it follows that it is also independent of the sample variance
n
S2
i=1
(Xi  X)2 n1
To determine the distribution of S 2 , use Identity (2.21) to obtain
n
(n  1)S 2 =
i=1
(Xi  )2  n(X  )2
Dividing both sides of this equation by 2 yields (n  1)S 2 X + 2 / n
2 n
=
i=1
(Xi  )2 2
(2.23)
Now, n (Xi  )2 / 2 is the sum of the squares of n independent standard i=1 normal random variables, and so is a chisquared random variable with n degrees of freedom; it thus has moment generating function (1  2t)n/2 . Also [(X  )/(/ n)]2 is the square of a standard normal random variable and so is a chisquared random variable with one degree of freedom; and thus has moment generating function (1  2t)1/2 . In addition, we have previously seen that the two random variables on the left side of Equation (2.23) are independent. Therefore, because the moment generating function of the sum of independent random variables is equal to the product of their individual moment generating functions, we obtain that E[et (n1)S or E[et (n1)S
2 / 2 2 / 2
](1  2t)1/2 = (1  2t)n/2 ] = (1  2t)(n1)/2
But because (1  2t)(n1)/2 is the moment generating function of a chisquared random variable with n  1 degrees of freedom, we can conclude, since the moment generating function uniquely determines the distribution of the random variable, that this is the distribution of (n  1)S 2 / 2 . Summing up, we have shown the following.
Proposition 2.5 If X1 , . . . , Xn are independent and identically distributed
normal random variables with mean and variance 2 , then the sample mean X and the sample variance S 2 are independent. X is a normal random variable with mean and variance 2 /n; (n  1)S 2 / 2 is a chisquared random variable with n  1 degrees of freedom.
2.7.
Limit Theorems
77
2.7.
Limit Theorems
We start this section by proving a result known as Markov's inequality.
Proposition 2.6 (Markov's Inequality) If X is a random variable that takes
only nonnegative values, then for any value a > 0 P {X Proof a} E[X] a
We give a proof for the case where X is continuous with density f : E[X] =
0
xf (x) dx
a 0
=
xf (x) dx +
a
xf (x) dx
xf (x) dx
a
af (x) dx
a
=a
a
f (x) dx a}
= aP {X
and the result is proven. As a corollary, we obtain the following.
Proposition 2.7 (Chebyshev's Inequality) If X is a random variable with
mean and variance 2 , then, for any value k > 0, P {X   k} 2 k2
Proof Since (X  )2 is a nonnegative random variable, we can apply Markov's inequality (with a = k 2 ) to obtain P {(X  )2 k2} E[(X  )2 ] k2
78
2
Random Variables
But since (X  )2
k 2 if and only if X   P {X   k}
k, the preceding is equivalent to
E[(X  )2 ] 2 = 2 k2 k
and the proof is complete. The importance of Markov's and Chebyshev's inequalities is that they enable us to derive bounds on probabilities when only the mean, or both the mean and the variance, of the probability distribution are known. Of course, if the actual distribution were known, then the desired probabilities could be exactly computed, and we would not need to resort to bounds.
Example 2.49 Suppose we know that the number of items produced in a
factory during a week is a random variable with mean 500. (a) What can be said about the probability that this week's production will be at least 1000? (b) If the variance of a week's production is known to equal 100, then what can be said about the probability that this week's production will be between 400 and 600? Solution: Let X be the number of items that will be produced in a week.
(a) By Markov's inequality, P {X 1000} 500 1 E[X] = = 1000 1000 2
(b) By Chebyshev's inequality, P {X  500 Hence, 1 99 = 100 100 and so the probability that this week's production will be between 400 and 600 is at least 0.99. P {X  500 < 100} 1 The following theorem, known as the strong law of large numbers, is probably the most wellknown result in probability theory. It states that the average of a sequence of independent random variables having the same distribution will, with probability 1, converge to the mean of that distribution. 100} 2 1 = 2 100 (100)
2.7.
Limit Theorems
79
Theorem 2.1 (Strong Law of Large Numbers) Let X1 , X2 , . . . be a sequence of independent random variables having a common distribution, and let E[Xi ] = . Then, with probability 1, X1 + X2 + + Xn n as n
As an example of the preceding, suppose that a sequence of independent trials is performed. Let E be a fixed event and denote by P (E) the probability that E occurs on any particular trial. Letting Xi = 1, 0, if E occurs on the ith trial if E does not occur on the ith trial
we have by the strong law of large numbers that, with probability 1, X1 + + X n E[X] = P (E) n (2.24)
Since X1 + + Xn represents the number of times that the event E occurs in the first n trials, we may interpret Equation (2.24) as stating that, with probability 1, the limiting proportion of time that the event E occurs is just P (E). Running neck and neck with the strong law of large numbers for the honor of being probability theory's number one result is the central limit theorem. Besides its theoretical interest and importance, this theorem provides a simple method for computing approximate probabilities for sums of independent random variables. It also explains the remarkable fact that the empirical frequencies of so many natural "populations" exhibit a bellshaped (that is, normal) curve.
Theorem 2.2 (Central Limit Theorem) Let X1 , X2 , . . . be a sequence of independent, identically distributed random variables, each with mean and variance 2 . Then the distribution of X1 + X2 + + Xn  n n tends to the standard normal as n . That is, P as n . Note that like the other results of this section, this theorem holds for any distribution of the Xi 's; herein lies its power. X1 + X2 + + Xn  n n a 1 2
a 
ex
2 /2
dx
80
2
Random Variables
If X is binomially distributed with parameters n and p, then X has the same distribution as the sum of n independent Bernoulli random variables, each with parameter p. (Recall that the Bernoulli random variable is just a binomial random variable whose parameter n equals 1.) Hence, the distribution of X  np X  E[X] = np(1  p) Var(X) approaches the standard normal distribution as n approaches . The normal approximation will, in general, be quite good for values of n satisfying np(1  p) 10.
Example 2.50 (Normal Approximation to the Binomial) Let X be the number of times that a fair coin, flipped 40 times, lands heads. Find the probability that X = 20. Use the normal approximation and then compare it to the exact solution. Solution: Since the binomial is a discrete random variable, and the normal a continuous random variable, it leads to a better approximation to write the desired probability as P {X = 20} = P {19.5 < X < 20.5} =P 19.5  20 X  20 20.5  20 < < 10 10 10
X  20 = P 0.16 < < 0.16 10 where (0.16)  (0.16)
(x), the probability that the standard normal is less than x is given by 1 (x) = 2
x 
ey
2 /2
dy
By the symmetry of the standard normal distribution (0.16) = P {N (0, 1) > 0.16} = 1  (0.16)
where N(0, 1) is a standard normal random variable. Hence, the desired probability is approximated by P {X = 20} 2 (0.16)  1 Using Table 2.3, we obtain that P {X = 20} 0.1272
2.7.
Limit Theorems
81
Table 2.3 x 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 0.00 0.5000 0.5398 0.5793 0.6179 0.6554 0.6915 0.7257 0.7580 0.7881 0.8159 0.8413 0.8643 0.8849 0.9032 0.9192 0.9332 0.9452 0.9554 0.9641 0.9713 0.9772 0.9821 0.9861 0.9893 0.9918 0.9938 0.9953 0.9965 0.9974 0.9981 0.9987 0.9990 0.9993 0.9995 0.9997
Area
0.01 0.5040 0.5438 0.5832 0.6217 0.6591 0.6950 0.7291 0.7611 0.7910 0.8186 0.8438 0.8665 0.8869 0.9049 0.9207 0.9345 0.9463 0.9564 0.9649 0.9719 0.9778 0.9826 0.9864 0.9896 0.9920 0.9940 0.9955 0.9966 0.9975 0.9982 0.9987 0.9991 0.9993 0.9995 0.9997
(x) under the Standard Normal Curve to the Left of x
0.02 0.5080 0.5478 0.5871 0.6255 0.6628 0.6985 0.7324 0.7642 0.7939 0.8212 0.8461 0.8686 0.8888 0.9066 0.9222 0.9357 0.9474 0.9573 0.9656 0.9726 0.9783 0.9830 0.9868 0.9898 0.9922 0.9941 0.9956 0.9967 0.9976 0.9982 0.9987 0.9991 0.9994 0.9995 0.9997 0.03 0.5120 0.5517 0.5910 0.6293 0.6664 0.7019 0.7357 0.7673 0.7967 0.8238 0.8485 0.8708 0.8907 0.9082 0.9236 0.9370 0.9484 0.9582 0.9664 0.9732 0.9788 0.9834 0.9871 0.9901 0.9925 0.9943 0.9957 0.9968 0.9977 0.9983 0.9988 0.9991 0.9994 0.9996 0.9997 0.04 0.5160 0.5557 0.5948 0.6331 0.6700 0.7054 0.7389 0.7704 0.7995 0.8264 0.8508 0.8729 0.8925 0.9099 0.9251 0.9382 0.9495 0.9591 0.9671 0.9738 0.9793 0.9838 0.9875 0.9904 0.9927 0.9945 0.9959 0.9969 0.9977 0.9984 0.9988 0.9992 0.9994 0.9996 0.9997 0.05 0.5199 0.5597 0.5987 0.6368 0.6736 0.7088 0.7422 0.7734 0.8023 0.8289 0.8531 0.8749 0.8944 0.9115 0.9265 0.9394 0.9505 0.9599 0.9678 0.9744 0.9798 0.9842 0.9878 0.9906 0.9929 0.9946 0.9960 0.9970 0.9978 0.9984 0.9989 0.9992 0.9994 0.9996 0.9997 0.06 0.5239 0.5636 0.6026 0.6406 0.6772 0.7123 0.7454 0.7764 0.8051 0.8315 0.8554 0.8770 0.8962 0.9131 0.9279 0.9406 0.9515 0.9608 0.9686 0.9750 0.9803 0.9846 0.9881 0.9909 0.9931 0.9948 0.9961 0.9971 0.9979 0.9985 0.9989 0.9992 0.9994 0.9996 0.9997 0.07 0.5279 0.5675 0.6064 0.6443 0.6808 0.7157 0.7486 0.7794 0.8078 0.8340 0.8557 0.8790 0.8980 0.9147 0.9292 0.9418 0.9525 0.9616 0.9693 0.9756 0.9808 0.9850 0.9884 0.9911 0.9932 0.9949 0.9962 0.9972 0.9979 0.9985 0.9989 0.9992 0.9995 0.9996 0.9997 0.08 0.5319 0.5714 0.6103 0.6480 0.6844 0.7190 0.7517 0.7823 0.8106 0.8365 0.8599 0.8810 0.8997 0.9162 0.9306 0.9429 0.9535 0.9625 0.9699 0.9761 0.9812 0.9854 0.9887 0.9913 0.9934 0.9951 0.9963 0.9973 0.9980 0.9986 0.9990 0.9993 0.9995 0.9996 0.9997 0.09 0.5359 0.5753 0.6141 0.6517 0.6879 0.7224 0.7549 0.7852 0.8133 0.8389 0.8621 0.8830 0.9015 0.9177 0.9319 0.9441 0.9545 0.9633 0.9706 0.9767 0.9817 0.9857 0.9890 0.9916 0.9936 0.9952 0.9964 0.9974 0.9981 0.9986 0.9990 0.9993 0.9995 0.9997 0.9998
The exact result is P {X = 20} = which can be shown to equal 0.1268. 40 20 1 2
40
82
2
Random Variables
Example 2.51 Let Xi , i = 1, 2, . . . , 10 be independent random variables,
each being uniformly distributed over (0, 1). Estimate P { Solution: orem that Since E[Xi ] = 1 , Var(Xi ) = 2
10 1 12 10 1 Xi
> 7}.
we have by the central limit the
P
1
Xi > 7 = P
10 1 Xi
5
>
75 10
1 12
10 (2.2)
1 12
1
= 0.0139
Example 2.52 The lifetime of a special type of battery is a random variable
with mean 40 hours and standard deviation 20 hours. A battery is used until it fails, at which point it is replaced by a new one. Assuming a stockpile of 25 such batteries, the lifetimes of which are independent, approximate the probability that over 1100 hours of use can be obtained. Solution: If we let Xi denote the lifetime of the ith battery to be put in use, then we desire p = P {X1 + + X25 > 1100}, which is approximated as follows: p=P X1 + + X25  1000 1100  1000 > 20 25 20 25 (1)
P {N (0, 1) > 1} =1 0.1587 We now present a heuristic proof of the Central Limit theorem. Suppose first that the Xi have mean 0 and variance 1, and let E[etX ] denote their common moment generating function. Then, the moment generating function of X1 +n+ Xn is E exp t X1 + + Xn n = E etX1 /
n tX2 / n
e
etXn /
n
= E etX/
n
n
by independence
Now, for n large, we obtain from the Taylor series expansion of ey that etX/
n
tX t 2 X2 1+ + 2n n
2.8.
Stochastic Processes
83
Taking expectations shows that when n is large E etX/
n
tE[X] t 2 E[X 2 ] 1+ + 2n n =1+ t2 2n because E[X] = 0, E[X 2 ] = 1
Therefore, we obtain that when n is large E exp t X1 + + Xn n 1+ t2 2n
n
When n goes to the approximation can be shown to become exact and we have that
n
lim E exp t
X1 + + Xn n
= et
2 /2
Thus, the moment generating function of X1 +n+Xn converges to the moment generating function of a (standard) normal random variable with mean 0 and variance 1. Using this, it can be proven that the distribution function of the random variable X1 +n+Xn converges to the standard normal distribution function .
When the Xi have mean and variance 2 , the random variables mean 0 and variance 1. Thus, the preceding shows that P X1  + X2  + + Xn  n a (a)
Xi 
have
which proves the central limit theorem.
2.8.
Stochastic Processes
A stochastic process {X(t), t T } is a collection of random variables. That is, for each t T , X(t) is a random variable. The index t is often interpreted as time and, as a result, we refer to X(t) as the state of the process at time t. For example, X(t) might equal the total number of customers that have entered a supermarket by time t; or the number of customers in the supermarket at time t; or the total amount of sales that have been recorded in the market by time t; etc. The set T is called the index set of the process. When T is a countable set the stochastic process is said to be a discretetime process. If T is an interval of the real line, the stochastic process is said to be a continuoustime process. For instance, {Xn , n = 0, 1, . . .} is a discretetime stochastic process indexed by the
84
2
Random Variables
nonnegative integers; while {X(t), t 0} is a continuoustime stochastic process indexed by the nonnegative real numbers. The state space of a stochastic process is defined as the set of all possible values that the random variables X(t) can assume. Thus, a stochastic process is a family of random variables that describes the evolution through time of some (physical) process. We shall see much of stochastic processes in the following chapters of this text.
Example 2.53 Consider a particle that moves along a set of m + 1 nodes,
labeled 0, 1, . . . , m, that are arranged around a circle (see Figure 2.3). At each step the particle is equally likely to move one position in either the clockwise or counterclockwise direction. That is, if Xn is the position of the particle after its nth step then P {Xn+1 = i + 1Xn = i} = P {Xn+1 = i  1Xn = i} =
1 2
where i + 1 0 when i = m, and i  1 m when i = 0. Suppose now that the particle starts at 0 and continues to move around according to the preceding rules until all the nodes 1, 2, . . . , m have been visited. What is the probability that node i, i = 1, . . . , m, is the last one visited? Solution: Surprisingly enough, the probability that node i is the last node visited can be determined without any computations. To do so, consider the first time that the particle is at one of the two neighbors of node i, that is, the first time that the particle is at one of the nodes i  1 or i + 1 (with m + 1 0). Suppose it is at node i  1 (the argument in the alternative situation is identical). Since neither node i nor i + 1 has yet been visited, it follows that i will be the last node visited if and only if i + 1 is visited before i. This is so because in
Figure 2.3. Particle moving around a circle.
Exercises
85
order to visit i + 1 before i the particle will have to visit all the nodes on the counterclockwise path from i  1 to i + 1 before it visits i. But the probability that a particle at node i  1 will visit i + 1 before i is just the probability that a particle will progress m  1 steps in a specified direction before progressing one step in the other direction. That is, it is equal to the probability that a gambler who starts with one unit, and wins one when a fair coin turns up heads and loses one when it turns up tails, will have his fortune go up by m  1 before he goes broke. Hence, because the preceding implies that the probability that node i is the last node visited is the same for all i, and because these probabilities must sum to 1, we obtain P {i is the last node visited} = 1/m, i = 1, . . . , m
Remark The argument used in Example 2.53 also shows that a gambler who is
equally likely to either win or lose one unit on each gamble will be down n before being up 1 with probability 1/(n + 1); or equivalently P {gambler is up 1 before being down n} = n n+1
Suppose now we want the probability that the gambler is up 2 before being down n. Upon conditioning on whether he reaches up 1 before down n, we obtain that P {gambler is up 2 before being down n} = P {up 2 before down nup 1 before down n} = P {up 1 before down n + 1} = n n+1 n = n+2n+1 n+2 n n+k n n+1 n n+1
Repeating this argument yields that P {gambler is up k before being down n} =
Exercises
1. An urn contains five red, three orange, and two blue balls. Two balls are randomly selected. What is the sample space of this experiment? Let X represent the number of orange balls selected. What are the possible values of X? Calculate P {X = 0}.
86
2
Random Variables
2. Let X represent the difference between the number of heads and the number of tails obtained when a coin is tossed n times. What are the possible values of X? 3. In Exercise 2, if the coin is assumed fair, then, for n = 2, what are the probabilities associated with the values that X can take on? *4. Suppose a die is rolled twice. What are the possible values that the following random variables can take on? (i) (ii) (iii) (iv) The maximum value to appear in the two rolls. The minimum value to appear in the two rolls. The sum of the two rolls. The value of the first roll minus the value of the second roll.
5. If the die in Exercise 4 is assumed fair, calculate the probabilities associated with the random variables in (i)(iv). 6. Suppose five fair coins are tossed. Let E be the event that all coins land heads. Define the random variable IE IE = 1, 0, if E occurs if E c occurs
For what outcomes in the original sample space does IE equal 1? What is P {IE = 1}? 7. Suppose a coin having probability 0.7 of coming up heads is tossed three times. Let X denote the number of heads that appear in the three tosses. Determine the probability mass function of X. 8. Suppose the distribution function of X is given by b<0 0, 1 0 b<1 F (b) = 2 , 1, 1 b< What is the probability mass function of X? 9. If the distribution function of F is given by b<0 0, 1 , 0 b<1 2 3 , 1 b<2 5 F (b) = 4 5, 2 b<3 9 , 3 b < 3.5 10 1, b 3.5 calculate the probability mass function of X.
Exercises
87
10. Suppose three fair dice are rolled. What is the probability at most one six appears? *11. A ball is drawn from an urn containing three white and three black balls. After the ball is drawn, it is then replaced and another ball is drawn. This goes on indefinitely. What is the probability that of the first four balls drawn, exactly two are white? 12. On a multiplechoice exam with three possible answers for each of the five questions, what is the probability that a student would get four or more correct answers just by guessing? 13. An individual claims to have extrasensory perception (ESP). As a test, a fair coin is flipped ten times, and he is asked to predict in advance the outcome. Our individual gets seven out of ten correct. What is the probability he would have done at least this well if he had no ESP? (Explain why the relevant probability is P {X 7} and not P {X = 7}.) 14. Suppose X has a binomial distribution with parameters 6 and 1 . Show that 2 X = 3 is the most likely outcome. 15. Let X be binomially distributed with parameters n and p. Show that as k goes from 0 to n, P (X = k) increases monotonically, then decreases monotonically reaching its largest value (a) in the case that (n + 1)p is an integer, when k equals either (n + 1)p  1 or (n + 1)p, (b) in the case that (n + 1)p is not an integer, when k satisfies (n + 1)p  1 < k < (n + 1)p. Hint: Consider P {X = k}/P {X = k  1} and see for what values of k it is greater or less than 1. *16. An airline knows that 5 percent of the people making reservations on a certain flight will not show up. Consequently, their policy is to sell 52 tickets for a flight that can hold only 50 passengers. What is the probability that there will be a seat available for every passenger who shows up? 17. Suppose that an experiment can result in one of r possible outcomes, the ith outcome having probability pi , i = 1, . . . , r, r pi = 1. If n of these experii=1 ments are performed, and if the outcome of any one of the n does not affect the outcome of the other n  1 experiments, then show that the probability that the first outcome appears x1 times, the second x2 times, and the rth xr times is n! x p x1 p x2 pr r x1 ! x2 ! . . . xr ! 1 2 when x1 + x2 + + xr = n
This is known as the multinomial distribution.
88
2
Random Variables
18. Show that when r = 2 the multinomial reduces to the binomial. 19. In Exercise 17, let Xi denote the number of times the ith outcome appears, i = 1, . . . , r. What is the probability mass function of X1 + X2 + . . . + Xk ? 20. A television store owner figures that 50 percent of the customers entering his store will purchase an ordinary television set, 20 percent will purchase a color television set, and 30 percent will just be browsing. If five customers enter his store on a certain day, what is the probability that two customers purchase color sets, one customer purchases an ordinary set, and two customers purchase nothing? 21. In Exercise 20, what is the probability that our store owner sells three or more televisions on that day? 22. If a fair coin is successively flipped, find the probability that a head first appears on the fifth trial. *23. A coin having probability p of coming up heads is successively flipped until the rth head appears. Argue that X, the number of flips required, will be n, n r, with probability P {X = n} = n1 p r (1  p)nr , r 1 n r
This is known as the negative binomial distribution. Hint: How many successes must there be in the first n  1 trials? 24. The probability mass function of X is given by p(k) = r +k1 p r (1  p)k , r 1 k = 0, 1, . . .
Give a possible interpretation of the random variable X. Hint: See Exercise 23. In Exercises 25 and 26, suppose that two teams are playing a series of games, each of which is independently won by team A with probability p and by team B with probability 1  p. The winner of the series is the first team to win i games. 25. If i = 4, find the probability that a total of 7 games are played. Also show that this probability is maximized when p = 1/2. 26. Find the expected number of games that are played when (a) i = 2; (b) i = 3. In both cases, show that this number is maximized when p = 1/2.
Exercises
89
*27. A fair coin is independently flipped n times, k times by A and n  k times by B. Show that the probability that A and B flip the same number of heads is equal to the probability that there are a total of k heads. 28. Suppose that we want to generate a random variable X that is equally likely to be either 0 or 1, and that all we have at our disposal is a biased coin that, when flipped, lands on heads with some (unknown) probability p. Consider the following procedure: 1. Flip the coin, and let 01 , either heads or tails, be the result. 2. Flip the coin again, and let 02 be the result. 3. If 01 and 02 are the same, return to step 1. 4. If 02 is heads, set X = 0, otherwise set X = 1. (a) Show that the random variable X generated by this procedure is equally likely to be either 0 or 1. (b) Could we use a simpler procedure that continues to flip the coin until the last two flips are different, and then sets X = 0 if the final flip is a head, and sets X = 1 if it is a tail? 29. Consider n independent flips of a coin having probability p of landing heads. Say a changeover occurs whenever an outcome differs from the one preceding it. For instance, if the results of the flips are H H T H T H H T , then there are a total of five changeovers. If p = 1/2, what is the probability there are k changeovers? 30. Let X be a Poisson random variable with parameter . Show that P {X = i} increases monotonically and then decreases monotonically as i increases, reaching its maximum when i is the largest integer not exceeding . Hint: Consider P {X = i}/P {X = i  1}. 31. Compare the Poisson approximation with the correct binomial probability for the following cases: (i) (ii) (iii) (iv) P {X = 2} when n = 8, p = 0.1. P {X = 9} when n = 10, p = 0.95. P {X = 0} when n = 10, p = 0.1. P {X = 4} when n = 9, p = 0.2.
32. If you buy a lottery ticket in 50 lotteries, in each of which your chance of 1 winning a prize is 100 , what is the (approximate) probability that you will win a prize (a) at least once, (b) exactly once, (c) at least twice?
90
2
Random Variables
33. Let X be a random variable with probability density f (x) = c(1  x 2 ), 0, 1 < x < 1 otherwise
(a) What is the value of c? (b) What is the cumulative distribution function of X? 34. Let the probability density of X be given by f (x) = (a) What is the value of c? (b) P 1 < X < 3 = ? 2 2 35. The density of X is given by f (x) = 10/x 2 , 0, for x > 10 for x 10 c(4x  2x 2 ), 0, 0<x<2 otherwise
What is the distribution of X? Find P {X > 20}. 36. A point is uniformly distributed within the disk of radius 1. That is, its density is f (x, y) = C, 0 x2 + y2 1 x 1.
Find the probability that its distance from the origin is less than x, 0
37. Let X1 , X2 , . . . , Xn be independent random variables, each having a uniform distribution over (0,1). Let M = maximum (X1 , X2 , . . . , Xn ). Show that the distribution function of M, FM (), is given by FM (x) = x n , *38. If the density function of X equals f (x) = find c. What is P {X > 2}? 39. The random variable X has the following probability mass function p(1) = 1 , 2 Calculate E[X]. p(2) = 1 , 3 p(24) =
1 6
0
x
1
What is the probability density function of M? ce2x , 0, 0<x< x<0
Exercises
91
40. Suppose that two teams are playing a series of games, each of which is independently won by team A with probability p and by team B with probability 1  p. The winner of the series is the first team to win four games. Find the expected number of games that are played, and evaluate this quantity when p = 1/2. 41. Consider the case of arbitrary p in Exercise 29. Compute the expected number of changeovers. 42. Suppose that each coupon obtained is, independent of what has been previously obtained, equally likely to be any of m different types. Find the expected number of coupons one needs to obtain in order to have at least one of each type. Hint: Let X be the number needed. It is useful to represent X by
m
X=
i=1
Xi
where each Xi is a geometric random variable. 43. An urn contains n + m balls, of which n are red and m are black. They are withdrawn from the urn, one at a time and without replacement. Let X be the number of red balls removed before the first black ball is chosen. We are interested in determining E[X]. To obtain this quantity, number the red balls from 1 to n. Now define the random variables Xi , i = 1, . . . , n, by Xi = 1, 0, if red ball i is taken before any black ball is chosen otherwise
(a) Express X in terms of the Xi . (b) Find E[X]. 44. In Exercise 43, let Y denote the number of red balls chosen after the first but before the second black ball has been chosen. (a) Express Y as the sum of n random variables, each of which is equal to either 0 or 1. (b) Find E[Y ]. (c) Compare E[Y ] to E[X] obtained in Exercise 43. (d) Can you explain the result obtained in part (c)? 45. A total of r keys are to be put, one at a time, in k boxes, with each key independently being put in box i with probability pi , k pi = 1. Each time a i=1 key is put in a nonempty box, we say that a collision occurs. Find the expected number of collisions.
92
2
Random Variables
46. If X is a nonnegative integer valued random variable, show that
E[X] =
n=1
P {X
n} =
n=0
P {X > n} 1, by
Hint: Define the sequence of random variables In , n In = Now express X in terms of the In . 1, 0, if n X if n > X
*47. Consider three trials, each of which is either a success or not. Let X denote the number of successes. Suppose that E[X] = 1.8. (a) What is the largest possible value of P {X = 3}? (b) What is the smallest possible value of P {X = 3}? In both cases, construct a probability scenario that results in P {X = 3} having the desired value. 48. If X is uniformly distributed over (0,1), calculate E[X 2 ]. *49. Prove that E[X 2 ] (E[X])2 . When do we have equality? 50. Let c be a constant. Show that (i) Var(cX) = c2 Var(X); (ii) Var(c + X) = Var(X). 51. A coin, having probability p of landing heads, is flipped until head appears for the rth time. Let N denote the number of flips required. Calculate E[N ]. Hint: There is an easy way of doing this. It involves writing N as the sum of r geometric random variables. 52. (a) Calculate E[X] for the maximum random variable of Exercise 37. (b) Calculate E[X] for X as in Exercise 33. (c) Calculate E[X] for X as in Exercise 34. 53. If X is uniform over (0, 1), calculate E[X n ] and Var(X n ). 54. Let X and Y each take on either the value 1 or 1. Let p(1, 1) = P {X = 1, Y = 1}, p(1, 1) = P {X = 1, Y = 1}, p(1, 1) = P {X = 1, Y = 1}, p(1, 1) = P {X = 1, Y = 1}
Exercises
93
Suppose that E[X] = E[Y ] = 0. Show that (a) p(1, 1) = p(1, 1); (b) p(1, 1) = p(1, 1). Let p = 2p(1, 1). Find (c) Var(X); (d) Var(Y ); (e) Cov(X, Y ). 55. Let X be a positive random variable having density function f (x). If f (x) c for all x, show that, for a > 0, P {X > a} 1  ac
56. There are n types of coupons. Each newly obtained coupon is, independently, type i with probability pi , i = 1, . . . , n. Find the expected number and the variance of the number of distinct types obtained in a collection of k coupons. 57. Suppose that X and Y are independent binomial random variables with parameters (n, p) and (m, p). Argue probabilistically (no computations necessary) that X + Y is binomial with parameters (n + m, p). 58. An urn contains 2n balls, of which r are red. The balls are randomly removed in n successive pairs. Let X denote the number of pairs in which both balls are red. (a) Find E[X]. (b) Find Var(X). 59. Let X1 , X2 , X3 , and X4 be independent continuous random variables with a common distribution function F and let p = P {X1 < X2 > X3 < X4 } (a) Argue that the value of p is the same for all continuous distribution functions F . (b) Find p by integrating the joint density function over the appropriate region. (c) Find p by using the fact that all 4! possible orderings of X1 , . . . , X4 are equally likely. 60. Calculate the moment generating function of the uniform distribution on (0, 1). Obtain E[X] and Var[X] by differentiating. 61. Suppose that X takes on each of the values 1, 2, 3 with probability 1 . What 3 is the moment generating function? Derive E[X], E[X 2 ], and E[X 3 ] by differ
94
2
Random Variables
entiating the moment generating function and then compare the obtained result with a direct derivation of these moments. 62. In deciding upon the appropriate premium to charge, insurance companies sometimes use the exponential principle, defined as follows. With X as the random amount that it will have to pay in claims, the premium charged by the insurance company is P= 1 ln E[eaX ] a
where a is some specified positive constant. Find P when X is an exponential random variable with parameter , and a = , where 0 < < 1. 63. Calculate the moment generating function of a geometric random variable. *64. Show that the sum of independent identically distributed exponential random variables has a gamma distribution. 65. Consider Example 2.48. Find Cov(Xi , Xj ) in terms of the ars . 66. Use Chebyshev's inequality to prove the weak law of large numbers. Namely, if X1 , X2 , . . . are independent and identically distributed with mean and variance 2 then, for any > 0, P X1 + X2 + + Xn  > 0 n as n
67. Suppose that X is a random variable with mean 10 and variance 15. What can we say about P {5 < X < 15}? 68. Let X1 , X2 , . . . , X10 be independent Poisson random variables with mean 1. (i) Use the Markov inequality to get a bound on P {X1 + + X10 (ii) Use the central limit theorem to approximate P {X1 + + X10 15}. 15}.
69. If X is normally distributed with mean 1 and variance 4, use the tables to find P {2 < X < 3}. *70. Show that lim en
n k=0
n
1 nk = k! 2
Hint: Let Xn be Poisson with mean n. Use the central limit theorem to show that P {Xn n} 1 . 2 71. Let X denote the number of white balls selected when k balls are chosen at random from an urn containing n white and m black balls.
Exercises
95
(i) Compute P {X = i}. (ii) Let, for i = 1, 2, . . . , k; j = 1, 2, . . . , n, Xi = Yj = 1, 0, 1, 0, if the ith ball selected is white otherwise if white ball j is selected otherwise
Compute E[X] in two ways by expressing X first as a function of the Xi s and then of the Yj s. *72. Show that Var(X) = 1 when X is the number of men who select their own hats in Example 2.31. 73. For the multinomial distribution (Exercise 17), let Ni denote the number of times outcome i occurs. Find (i) (ii) (iii) (iv) E[Ni ]; Var(Ni ); Cov(Ni , Nj ); Compute the expected number of outcomes that do not occur.
74. Let X1 , X2 , . . . be a sequence of independent identically distributed continuous random variables. We say that a record occurs at time n if Xn > max(X1 , . . . , Xn1 ). That is, Xn is a record if it is larger than each of X1 , . . . , Xn1 . Show (i) (ii) (iii) (iv) P {a record occurs at time n} = 1/n; E[number of records by time n] = n 1/i; i=1 Var(number of records by time n) = n (i  1)/i 2 ; i=1 Let N = min{n: n > 1 and a record occurs at time n}. Show E[N ] = .
Hint: For (ii) and (iii) represent the number of records as the sum of indicator (that is, Bernoulli) random variables. 75. Let a1 < a2 < < an denote a set of n numbers, and consider any permutation of these numbers. We say that there is an inversion of ai and aj in the permutation if i < j and aj precedes ai . For instance the permutation 4, 2, 1, 5, 3 has 5 inversions(4, 2), (4, 1), (4, 3), (2, 1), (5, 3). Consider now a random permutation of a1 , a2 , . . . , an in the sense that each of the n! permutations is equally likely to be chosenand let N denote the number of inversions in this permutation. Also, let Ni = number of k : k < i, ai precedes ak in the permutation and note that N =
n i=1 Ni .
96
2
Random Variables
(i) Show that N1 , . . . , Nn are independent random variables. (ii) What is the distribution of Ni ? (iii) Compute E[N ] and Var(N ). 76. Let X and Y be independent random variables with means x and y and 2 2 variances x and y . Show that
2 2 2 2 Var(XY ) = x y + 2 x + 2 y y x
77. Let X and Y be independent normal random variables, each having parameters and 2 . Show that X + Y is independent of X  Y. Hint: Find their joint moment generating function. 78. Let (t1 , . . . , tn ) denote the joint moment generating function of X1 , . . . , Xn . (a) Explain how the moment generating function of Xi , Xi (ti ), can be obtained from (t1 , . . . , tn ). (b) Show that X1 , . . . , Xn are independent if and only if (t1 , . . . , tn ) = x1 (t1 ) Xn (tn )
References
1. W. Feller, "An Introduction to Probability Theory and Its Applications," Vol. I, John Wiley, New York, 1957. 2. M. Fisz, "Probability Theory and Mathematical Statistics," John Wiley, New York, 1963. 3. E. Parzen, "Modern Probability Theory and Its Applications," John Wiley, New York, 1960. 4. S. Ross, "A First Course in Probability," Seventh Edition, Prentice Hall, New Jersey, 2006.
Conditional Probability and Conditional Expectation
3
3.1. Introduction
One of the most useful concepts in probability theory is that of conditional probability and conditional expectation. The reason is twofold. First, in practice, we are often interested in calculating probabilities and expectations when some partial information is available; hence, the desired probabilities and expectations are conditional ones. Secondly, in calculating a desired probability or expectation it is often extremely useful to first "condition" on some appropriate random variable.
3.2.
The Discrete Case
Recall that for any two events E and F , the conditional probability of E given F is defined, as long as P (F ) > 0, by P (EF ) = P (EF ) P (F )
Hence, if X and Y are discrete random variables, then it is natural to define the conditional probability mass function of X given that Y = y, by pXY (xy) = P {X = xY = y} = = P {X = x, Y = y} P {Y = y} p(x, y) pY (y)
97
98
3
Conditional Probability and Conditional Expectation
for all values of y such that P {Y = y} > 0. Similarly, the conditional probability distribution function of X given that Y = y is defined, for all y such that P {Y = y} > 0, by FXY (xy) = P {X =
a x
xY = y}
pXY (ay)
Finally, the conditional expectation of X given that Y = y is defined by E[XY = y] =
x
xP {X = xY = y} xpXY (xy)
x
=
In other words, the definitions are exactly as before with the exception that everything is now conditional on the event that Y = y. If X is independent of Y , then the conditional mass function, distribution, and expectation are the same as the unconditional ones. This follows, since if X is independent of Y , then pXY (xy) = P {X = xY = y} = P {X = x}
Example 3.1 Suppose that p(x, y), the joint probability mass function of X
and Y , is given by p(1, 1) = 0.5, p(1, 2) = 0.1, p(2, 1) = 0.1, p(2, 2) = 0.3
Calculate the conditional probability mass function of X given that Y = 1. Solution: We first note that pY (1) =
x
p(x, 1) = p(1, 1) + p(2, 1) = 0.6
Hence, pXY (11) = P {X = 1Y = 1} = = = P {X = 1, Y = 1} P {Y = 1} p(1, 1) pY (1) 5 6
3.2.
The Discrete Case
99
Similarly, pXY (21) = p(2, 1) 1 = pY (1) 6
Example 3.2 If X1 and X2 are independent binomial random variables with
respective parameters (n1 , p) and (n2 , p), calculate the conditional probability mass function of X1 given that X1 + X2 = m. Solution: With q = 1  p, P {X1 = k, X1 + X2 = m} P {X1 + X2 = m} P {X1 = k, X2 = m  k} P {X1 + X2 = m} P {X1 = k}P {X2 = m  k} P {X1 + X2 = m} n1 k n1 k n2 p q p mk q n2 m+k k mk n1 + n2 m n1 +n2 m p q m
P {X1 = kX1 + X2 = m} = = =
=
where we have used that X1 + X2 is a binomial random variable with parameters (n1 + n2 , p) (see Example 2.44). Thus, the conditional probability mass function of X1 , given that X1 + X2 = m, is n2 n1 k mk n1 + n2 m
P {X1 = kX1 + X2 = m} =
(3.1)
The distribution given by Equation (3.1), first seen in Example 2.34, is known as the hypergeometric distribution. It is the distribution of the number of blue balls that are chosen when a sample of m balls is randomly chosen from an urn that contains n1 blue and n2 red balls. ( To intuitively see why the conditional distribution is hypergeometric, consider n1 + n2 independent trials that each result in a success with probability p; let X1 represent the number of successes in the first n1 trials and let X2 represent the number of successes in the final n2 trials. Because all trials have the same probability of being a success, each of the n1 +n2 subsets of m trials is equally likely to be the success trials; m thus, the number of the m success trials that are among the first n1 trials is a hypergeometric random variable.)
100
3
Conditional Probability and Conditional Expectation
Example 3.3 If X and Y are independent Poisson random variables with respective means 1 and 2 , calculate the conditional expected value of X given that X + Y = n. Solution: Let us first calculate the conditional probability mass function of X given that X + Y = n. We obtain P {X = kX + Y = n} = = = P {X = k, X + Y = n} P {X + Y = n} P {X = k, Y = n  k} P {X + Y = n} P {X = k}P {Y = n  k} P {X + Y = n}
where the last equality follows from the assumed independence of X and Y . Recalling (see Example 2.36) that X + Y has a Poisson distribution with mean 1 + 2 , the preceding equation equals P {X = kX + Y = n} = = = e1 k e2 nk e(1 +2 ) (1 + 2 )n 2 1 k! (n  k)! n! k nk n! 1 2 (n  k)!k! (1 + 2 )n n k 1 1 + 2
k 1
2 1 + 2
nk
In other words, the conditional distribution of X given that X + Y = n, is the binomial distribution with parameters n and 1 /(1 + 2 ). Hence, E{XX + Y = n} = n 1 1 + 2
Example 3.4 Consider an experiment which results in one of three possible
outcomes with outcome i occurring with probability pi , i = 1, 2, 3, 3 pi = 1. i=1 Suppose that n independent replications of this experiment are performed and let Xi , i = 1, 2, 3, denote the number of times outcome i appears. Determine the conditional expectation of X1 given that X2 = m.
3.2.
The Discrete Case
101
Solution:
For k
n  m, P {X1 = k, X2 = m} P {X2 = m}
P {X1 = kX2 = m} =
Now if X1 = k and X2 = m, then it follows that X3 = n  k  m. However, P {X1 = k, X2 = m, X3 = n  k  m} = n! (nkm) pk pm p k!m!(n  k  m)! 1 2 3 (3.2)
This follows since any particular sequence of the n experiments having outcome 1 appearing k times, outcome 2 m times, and outcome 3 (n  k m (nkm) of occurring. Since there are k  m) times has probability p1 p2 p3 n!/[k!m!(n  k  m)!] such sequences, Equation (3.2) follows. Therefore, we have n! k m (nkm) p 1 p 2 p3 k!m!(n  k  m)! P {X1 = kX2 = m} = n! p m (1  p2 )nm m!(n  m)! 2 where we have used the fact that X2 has a binomial distribution with parameters n and p2 . Hence, P {X1 = kX2 = m} = (n  m)! k!(n  m  k)! p1 1  p2
k
p3 1  p2
nmk
or equivalently, writing p3 = 1  p1  p2 , P {X1 = kX2 = m} = nm k p1 1  p2
k
1
p1 1  p2
nmk
In other words, the conditional distribution of X1 , given that X2 = m, is binomial with parameters n  m and p1 /(1  p2 ). Consequently, E[X1 X2 = m] = (n  m) p1 1  p2
Remarks (i) The desired conditional probability in Example 3.4 could also
have been computed in the following manner. Consider the n  m experiments
102
3
Conditional Probability and Conditional Expectation
that did not result in outcome 2. For each of these experiments, the probability that outcome 1 was obtained is given by P {outcome 1not outcome 2} = P {outcome 1, not outcome 2} P {not outcome 2} p1 = 1  p2
It therefore follows that, given X2 = m, the number of times outcome 1 occurs is binomially distributed with parameters n  m and p1 /(1  p2 ). (ii) Conditional expectations possess all of the properties of ordinary expectations. For instance, such identities as
n n
E
i=1
Xi Y = y =
i=1
E[Xi Y = y]
remain valid.
Example 3.5 There are n components. On a rainy day, component i will function with probability pi ; on a nonrainy day, component i will function with probability qi , for i = 1, . . . , n. It will rain tomorrow with probability . Calculate the conditional expected number of components that function tomorrow, given that it rains. Solution: Let Xi = 1, 0, if component i functions tomorrow otherwise
Then, with Y defined to equal 1 if it rains tomorrow, and 0 otherwise, the desired conditional expectation is obtained as follows.
n n
E
t=1
Xi Y = 1 =
i=1 n
E[Xi Y = 1]
=
i=1
pi
3.3.
The Continuous Case
If X and Y have a joint probability density function f (x, y), then the conditional probability density function of X, given that Y = y, is defined for all values of y
3.3.
The Continuous Case
103
such that fY (y) > 0, by fXY (xy) = f (x, y) fY (y)
To motivate this definition, multiply the left side by dx and the right side by (dx dy)/dy to get fXY (xy) dx = f (x, y) dx dy fY (y) dy P {x X x + dx, y Y y + dy} P {y Y y + dy} X x + dxy Y y + dy}
= P {x
In other words, for small values dx and dy, fXY (xy) dx is approximately the conditional probability that X is between x and x + dx given that Y is between y and y + dy. The conditional expectation of X, given that Y = y, is defined for all values of y such that fY (y) > 0, by E[XY = y] =

xfXY (xy) dx
Example 3.6 Suppose the joint density of X and Y is given by
f (x, y) = 6xy(2  x  y), 0, 0 < x < 1, 0 < y < 1 otherwise
Compute the conditional expectation of X given that Y = y, where 0 < y < 1. Solution: We first compute the conditional density fXY (xy) = = = = f (x, y) fY (y) 6xy(2  x  y)
1 0 6xy(2  x
 y) dx
6xy(2  x  y) y(4  3y) 6x(2  x  y) 4  3y
104
3
Conditional Probability and Conditional Expectation
Hence, E[XY = y] =
0 1 6x 2 (2  x
 y) dx 4  3y
6 4
= =
(2  y)2  4  3y 5  4y 8  6y
Example 3.7 Suppose the joint density of X and Y is given by
f (x, y) = Compute E[XY = y]. Solution: The conditional density of X, given that Y = y, is given by f (x, y) fY (y)
y
4y(x  y)e(x+y) , 0,
0 < x < , 0 otherwise
y
x
fXY (xy) = = = =
4y(x  y)e(x+y) , 4y(x  y)e(x+y) dx
x>y
(x  y)ex x dx y (x  y)e , (y+w) dw 0 we (x  y)ex x>y x>y
(by letting w = x  y)
= (x  y)e(xy) ,
where the final equality used that 0 wew dw is the expected value of an exponential random variable with mean 1. Therefore, with W being exponential with mean 1, E[XY = y] =
y
x(x  y)e(xy) dx
3.4.
Computing Expectations by Conditioning
105
=
0
(w + y)wew dw
= E[W 2 ] + yE[W ] =2+y
Example 3.8 The joint density of X and Y is given by
1 xy , 2 ye
f (x, y) =
0 < x < , 0 < y < 2 otherwise
0,
What is E[eX/2 Y = 1]? Solution: The conditional density of X, given that Y = 1, is given by fXY (x1) = = f (x, 1) fY (1)
1 x 2e 1 x 0 2e
dx
= ex
Hence, by Proposition 2.1, E[eX/2 Y = 1] =
0
ex/2 fXY (x1) dx ex/2 ex dx
=
0
=2
3.4.
Computing Expectations by Conditioning
Let us denote by E[XY ] that function of the random variable Y whose value at Y = y is E[XY = y]. Note that E[XY ] is itself a random variable. An extremely important property of conditional expectation is that for all random variables X
106 and Y
3
Conditional Probability and Conditional Expectation
E[X] = E E[XY ] If Y is a discrete random variable, then Equation (3.3) states that E[X] =
y
(3.3)
E[XY = y]P {Y = y}
(3.3a)
while if Y is continuous with density fY (y), then Equation (3.3) says that E[X] =

E[XY = y]fY (y) dy
(3.3b)
We now give a proof of Equation (3.3) in the case where X and Y are both discrete random variables.
Proof of Equation (3.3) When X and Y Are Discrete We must show
that E[X] =
y
E[XY = y]P {Y = y}
(3.4)
Now, the right side of the preceding can be written E[XY = y]P {Y = y} =
y y x
xP {X = xY = y}P {Y = y} x
y x
= =
y x
P {X = x, Y = y} P {Y = y} P {Y = y}
xP {X = x, Y = y} x
x y
= =
x
P {X = x, Y = y}
xP {X = x}
= E[X] and the result is obtained. One way to understand Equation (3.4) is to interpret it as follows. It states that to calculate E[X] we may take a weighted average of the conditional expected value of X given that Y = y, each of the terms E[XY = y] being weighted by the probability of the event on which it is conditioned. The following examples will indicate the usefulness of Equation (3.3).
3.4.
Computing Expectations by Conditioning
107
Example 3.9 Sam will read either one chapter of his probability book or one
chapter of his history book. If the number of misprints in a chapter of his probability book is Poisson distributed with mean 2 and if the number of misprints in his history chapter is Poisson distributed with mean 5, then assuming Sam is equally likely to choose either book, what is the expected number of misprints that Sam will come across? Solution: Letting X denote the number of misprints and letting Y= then E[X] = E[XY = 1]P {Y = 1} + E[XY = 2]P {Y = 2} =5 =
7 2 1 2
1, 2,
if Sam chooses his history book if Sam chooses his probability book
+2
1 2
Example 3.10 (The Expectation of the Sum of a Random Number of Random
Variables) Suppose that the expected number of accidents per week at an industrial plant is four. Suppose also that the numbers of workers injured in each accident are independent random variables with a common mean of 2. Assume also that the number of workers injured in each accident is independent of the number of accidents that occur. What is the expected number of injuries during a week? Solution: Letting N denote the number of accidents and Xi the number injured in the ith accident, i = 1, 2, . . . , then the total number of injuries can be expressed as N Xi . Now i=1
N N
E
1
Xi = E E
1
Xi N
But
N n
E
1
Xi N = n = E
1 n
Xi N = n
=E
1
Xi
by the independence of Xi and N
= nE[X]
108
3
Conditional Probability and Conditional Expectation
which yields that
N
E
i=1
Xi N = N E[X]
and thus
N
E
i=1
Xi = E N E[X] = E[N ]E[X]
Therefore, in our example, the expected number of injuries during a week equals 4 2 = 8. The random variable N Xi , equal to the sum of a random number N of i=1 independent and identically distributed random variables that are also independent of N , is called a compound random variable. As just shown in Example 3.10, the expected value of a compound random variable is E[X]E[N ]. Its variance will be derived in Example 3.17.
Example 3.11 (The Mean of a Geometric Distribution) A coin, having probability p of coming up heads, is to be successively flipped until the first head appears. What is the expected number of flips required? Solution: Let N be the number of flips required, and let Y= Now E[N] = E[N Y = 1]P {Y = 1} + E[NY = 0]P {Y = 0} = pE[NY = 1] + (1  p)E[N Y = 0] However, E[NY = 1] = 1, E[NY = 0] = 1 + E[N ] (3.6) (3.5) 1, 0, if the first flip results in a head if the first flip results in a tail
To see why Equation (3.6) is true, consider E[N Y = 1]. Since Y = 1, we know that the first flip resulted in heads and so, clearly, the expected number of flips required is 1. On the other hand if Y = 0, then the first flip resulted in tails. However, since the successive flips are assumed independent, it follows that, after the first tail, the expected additional number of flips until the first head is
3.4.
Computing Expectations by Conditioning
109
just E[N]. Hence E[NY = 0] = 1 + E[N ]. Substituting Equation (3.6) into Equation (3.5) yields E[N ] = p + (1  p)(1 + E[N ]) or E[N ] = 1/p Because the random variable N is a geometric random variable with probability mass function p(n) = p(1  p)n1 , its expectation could easily have been computed from E[N] = np(n) without recourse to conditional expectation. 1 However, if you attempt to obtain the solution to our next example without using conditional expectation, you will quickly learn what a useful technique "conditioning" can be.
Example 3.12 A miner is trapped in a mine containing three doors. The first
door leads to a tunnel that takes him to safety after two hours of travel. The second door leads to a tunnel that returns him to the mine after three hours of travel. The third door leads to a tunnel that returns him to his mine after five hours. Assuming that the miner is at all times equally likely to choose any one of the doors, what is the expected length of time until the miner reaches safety? Solution: Let X denote the time until the miner reaches safety, and let Y denote the door he initially chooses. Now E[X] = E[XY = 1]P {Y = 1} + E[XY = 2]P {Y = 2} + E[XY = 3]P {Y = 3} = However, E[XY = 1] = 2, E[XY = 2] = 3 + E[X], E[XY = 3] = 5 + E[X], (3.7) To understand why this is correct consider, for instance, E[XY = 2], and reason as follows. If the miner chooses the second door, then he spends three hours in the tunnel and then returns to the mine. But once he returns to the mine the problem is as before, and hence his expected additional time until safety is just E[X]. Hence E[XY = 2] = 3 + E[X]. The argument behind the other equalities in Equation (3.7) is similar. Hence E[X] =
1 3 1 3
E[XY = 1] + E[XY = 2] + E[XY = 3]
2 + 3 + E[X] + 5 + E[X]
or
E[X] = 10
110
3
Conditional Probability and Conditional Expectation
Example 3.13 (The Matching Rounds Problem) Suppose in Example 2.31
that those choosing their own hats depart, while the others (those without a match) put their selected hats in the center of the room, mix them up, and then reselect. Also, suppose that this process continues until each individual has his own hat. (a) Find E[Rn ] where Rn is the number of rounds that are necessary when n individuals are initially present. (b) Find E[Sn ] where Sn is the total number of selections made by the n individuals, n 2. (c) Find the expected number of false selections made by one of the n people, n 2. Solution: (a) It follows from the results of Example 2.31 that no matter how many people remain there will, on average, be one match per round. Hence, one might suggest that E[Rn ] = n. This turns out to be true, and an induction proof will now be given. Because it is obvious that E[R1 ] = 1, assume that E[Rk ] = k for k = 1, . . . , n  1. To compute E[Rn ], start by conditioning on Xn , the number of matches that occur in the first round. This gives
n
E[Rn ] =
i=0
E[Rn Xn = i]P {Xn = i}
Now, given a total of i matches in the initial round, the number of rounds needed will equal 1 plus the number of rounds that are required when n  i persons are to be matched with their hats. Therefore,
n
E[Rn ] =
i=0
(1 + E[Rni ])P {Xn = i}
n
= 1 + E[Rn ]P {Xn = 0} +
i=1 n
E[Rni ]P {Xn = i} (n  i)P {Xn = i}
i=1
= 1 + E[Rn ]P {Xn = 0} +
by the induction hypothesis = 1 + E[Rn ]P {Xn = 0} + n(1  P {Xn = 0})  E[Xn ] = E[Rn ]P {Xn = 0} + n(1  P {Xn = 0}) where the final equality used the result, established in Example 2.31, that E[Xn ] = 1. Since the preceding equation implies that E[Rn ] = n, the result is proven.
3.4.
Computing Expectations by Conditioning
111
(b) For n
2, conditioning on Xn , the number of matches in round 1, gives
n
E[Sn ] =
i=0 n
E[Sn Xn = i]P {Xn = i} (n + E[Sni ])P {Xn = i}
i=0 n
=
=n+
i=0
E[Sni ]P {Xn = i}
where E[S0 ] = 0. To solve the preceding equation, rewrite it as E[Sn ] = n + E[SnXn ] Now, if there were exactly one match in each round, then it would take a total of 1 + 2 + + n = n(n + 1)/2 selections. Thus, let us try a solution of the form E[Sn ] = an + bn2 . For the preceding equation to be satisfied by a solution of this type, for n 2, we need an + bn2 = n + E[a(n  Xn ) + b(n  Xn )2 ] or, equivalently,
2 an + bn2 = n + a(n  E[Xn ]) + b(n2  2nE[Xn ] + E[Xn ])
Now, using the results of Example 2.31 and Exercise 72 of Chapter 2 that E[Xn ]=Var(Xn ) = 1, the preceding will be satisfied if an + bn2 = n + an  a + bn2  2nb + 2b and this will be valid provided that b = 1/2, a = 1. That is, E[Sn ] = n + n2 /2 satisfies the recursive equation for E[Sn ]. The formal proof that E[Sn ] = n + n2 /2, n 2, is obtained by induction on n. It is true when n = 2 (since, in this case, the number of selections is twice the number of rounds and the number of rounds is a geometric random variable
112
3
Conditional Probability and Conditional Expectation
with parameter p = 1/2). Now, the recursion gives that
n
E[Sn ] = n + E[Sn ]P {Xn = 0} +
i=1
E[Sni ]P {Xn = i}
Hence, upon assuming that E[S0 ] = E[S1 ] = 0, E[Sk ] = k + k 2 /2, for k = 2, . . . , n  1 and using that P {Xn = n  1} = 0, we see that
n
E[Sn ] = n + E[Sn ]P {Xn = 0} +
i=1
[n  i + (n  i)2 /2]P {Xn = i}
= n + E[Sn ]P {Xn = 0} + (n + n2 /2)(1  P {Xn = 0})
2  (n + 1)E[Xn ] + E[Xn ]/2 2 Substituting the identities E[Xn ] = 1, E[Xn ] = 2 in the preceding shows that
E[Sn ] = n + n2 /2 and the induction proof is complete. (c) If we let Cj denote the number of hats chosen by person j, j = 1, . . . , n then
n
Cj = S n
j =1
Taking expectations, and using the fact that each Cj has the same mean, yields the result E[Cj ] = E[Sn ]/n = 1 + n/2 Hence, the expected number of false selections by person j is E[Cj  1] = n/2.
Example 3.14 Independent trials, each of which is a success with probability
p, are performed until there are k consecutive successes. What is the mean number of necessary trials? Solution: Let Nk denote the number of necessary trials to obtain k consecutive successes, and let Mk denote its mean. We will obtain a recursive equation
3.4.
Computing Expectations by Conditioning
113
for Mk by conditioning on Nk1 , the number of trials needed for k  1 consecutive successes. This yields Mk = E[Nk ] = E E[Nk Nk1 ] Now, E[Nk Nk1 ] = Nk1 + 1 + (1  p)E[Nk ] where the preceding follows since if it takes Nk1 trials to obtain k  1 consecutive successes, then either the next trial is a success and we have our k in a row or it is a failure and we must begin anew. Taking expectations of both sides of the preceding yields Mk = Mk1 + 1 + (1  p)Mk or Mk = 1 Mk1 + p p
Since N1 , the time of the first success, is geometric with parameter p, we see that M1 = and, recursively M2 = M3 = and, in general, Mk = 1 1 1 + + + k p p2 p 1 1 + , p p2 1 1 1 + 2+ 3 p p p 1 p
Example 3.15 (Analyzing the QuickSort Algorithm) Suppose we are given a set of n distinct valuesx1 , . . . , xn and we desire to put these values in increasing order or, as it is commonly called, to sort them. An efficient procedure for accomplishing this is the quicksort algorithm which is defined recursively as follows: When n = 2 the algorithm compares the two values and puts them in the appropriate order. When n > 2 it starts by choosing at random one of the n valuessay, xi and then compares each of the other n  1 values with xi , noting which are smaller and which are larger than xi . Letting Si denote the set of
114
3
Conditional Probability and Conditional Expectation
elements smaller than xi , and Si the set of elements greater than xi , the algorithm now sorts the set Si and the set Si . The final ordering, therefore, consists of the ordered set of the elements in Si , then xi , and then the ordered set of the elements in Si . For instance, suppose that the set of elements is 10, 5, 8, 2, 1, 4, 7. We start by choosing one of these values at random (that is, each of the 7 values has probability of 1 of being chosen). Suppose, for instance, that the value 4 is chosen. We 7 then compare 4 with each of the other six values to obtain {2, 1}, 4, {10, 5, 8, 7} We now sort the set {2, 1} to obtain 1, 2, 4, {10, 5, 8, 7} Next we choose a value at random from {10, 5, 8, 7}say 7 is chosenand compare each of the other three values with 7 to obtain 1, 2, 4, 5, 7, {10, 8} Finally, we sort {10, 8} to end up with 1, 2, 4, 5, 7, 8, 10 One measure of the effectiveness of this algorithm is the expected number of comparisons that it makes. Let us denote by Mn the expected number of comparisons needed by the quicksort algorithm to sort a set of n distinct values. To obtain a recursion for Mn we condition on the rank of the initial value selected to obtain:
n
Mn =
j =1
E[number of comparisonsvalue selected is jth smallest]
1 n
Now if the initial value selected is the j th smallest, then the set of values smaller than it is of size j  1, and the set of values greater than it is of size n  j . Hence, as n  1 comparisons with the initial value chosen must be made, we see that
n
Mn =
j =1
(n  1 + Mj 1 + Mnj ) 2 n
n1
1 n
=n1+
Mk
k=1
(since M0 = 0)
3.4.
Computing Expectations by Conditioning
115
or, equivalently,
n1
nMn = n(n  1) + 2
k=1
Mk
To solve the preceding, note that upon replacing n by n + 1 we obtain
n
(n + 1)Mn+1 = (n + 1)n + 2
k=1
Mk
Hence, upon subtraction, (n + 1)Mn+1  nMn = 2n + 2Mn or (n + 1)Mn+1 = (n + 2)Mn + 2n Therefore, 2n Mn Mn+1 = + n + 2 (n + 1)(n + 2) n + 1 Iterating this gives Mn+1 2n 2(n  1) Mn1 = + + n+2 (n + 1)(n + 2) n(n + 1) n =
n1
=2
k=0
nk (n + 1  k)(n + 2  k)
since M1 = 0
Hence,
n1
Mn+1 = 2(n + 2)
k=0 n
nk (n + 1  k)(n + 2  k) i , (i + 1)(i + 2) n 1
= 2(n + 2)
i=1
116
3
Conditional Probability and Conditional Expectation
Using the identity i/(i + 1)(i + 2) = 2/(i + 2)  1/(i + 1), we can approximate Mn+1 for large n as follows:
n
Mn+1 = 2(n + 2)
i=1
2  i +2
n i=1
1 i +1
n+1
2(n + 2)
3
n+2
2 dx  x
2
1 dx x
= 2(n + 2)[2 log(n + 2)  log(n + 1) + log 2  2 log 3] = 2(n + 2) log(n + 2) + log 2(n + 2) log(n + 2) Although we usually employ the conditional expectation identity to more easily enable us to compute an unconditional expectation, in our next example we show how it can sometimes be used to obtain the conditional expectation. n+2 + log 2  2 log 3 n+1
Example 3.16 In the match problem of Example 2.31 involving n, n > 1,
individuals, find the conditional expected number of matches given that the first person did not have a match. Solution: Let X denote the number of matches, and let X1 equal 1 if the first person has a match and let it equal 0 otherwise. Then, E[X] = E[XX1 = 0]P {X1 = 0} + E[XX1 = 1]P {X1 = 1} = E[XX1 = 0] But, from Example 2.31 E[X] = 1 Moreover, given that the first person has a match, the expected number of matches is equal to 1 plus the expected number of matches when n  1 people select among their own n  1 hats, showing that E[XX1 = 1] = 2 n1 1 + E[XX1 = 1] n n
3.4.
Computing Expectations by Conditioning
117
Therefore, we obtain the result E[XX1 = 0] = n2 n1
3.4.1. Computing Variances by Conditioning Conditional expectations can also be used to compute the variance of a random variable. Specifically, we can use that Var(X) = E[X 2 ]  (E[X])2 and then use conditioning to obtain both E[X] and E[X 2 ]. We illustrate this technique by determining the variance of a geometric random variable.
Example 3.17 (Variance of the Geometric Random Variable) Independent trials, each resulting in a success with probability p, are performed in sequence. Let N be the trial number of the first success. Find Var(N ).
Solution: wise. Let Y = 1 if the first trial results in a success, and Y = 0 other
Var(N ) = E(N 2 )  (E[N ])2 To calculate E[N 2 ] and E[N ] we condition on Y . For instance, E[N 2 ] = E E[N 2 Y ] However, E[N 2 Y = 1] = 1, E[N 2 Y = 0] = E[(1 + N )2 ] These two equations are true since if the first trial results in a success, then clearly N = 1 and so N 2 = 1. On the other hand, if the first trial results in a failure, then the total number of trials necessary for the first success will equal one (the first trial that results in failure) plus the necessary number of additional trials. Since this latter quantity has the same distribution as N , we
118
3
Conditional Probability and Conditional Expectation
get that E[N 2 Y = 0] = E[(1 + N )2 ]. Hence, we see that E[N 2 ] = E[N 2 Y = 1]P {Y = 1} + E[N 2 Y = 0]P {Y = 0} = p + E[(1 + N )2 ](1  p) = 1 + (1  p)E[2N + N 2 ] Since, as was shown in Example 3.11, E[N ] = 1/p, this yields E[N 2 ] = 1 + or E[N 2 ] = Therefore, Var(N ) = E[N 2 ]  (E[N])2 = = 2p 1  p p2 1p p2
2
2(1  p) + (1  p)E[N 2 ] p
2p p2
Another way to use conditioning to obtain the variance of a random variable is to apply the conditional variance formula. The conditional variance of X given that Y = y is defined by Var(XY = y) = E (X  E[XY = y])2 Y = y That is, the conditional variance is defined in exactly the same manner as the ordinary variance with the exception that all probabilities are determined conditional on the event that Y = y. Expanding the right side of the preceding and taking expectation term by term yield that Var(XY = y) = E[X 2 Y = y]  (E[XY = y])2 Letting Var(XY ) denote that function of Y whose value when Y = y is Var(XY = y), we have the following result.
3.4.
Computing Expectations by Conditioning
119
Proposition 3.1 The Conditional Variance Formula
Var(X) = E Var(XY ) + Var E[XY ] (3.8)
Proof
E Var(XY ) = E E[X 2 Y ]  (E[XY ])2 = E E[X 2 Y ]  E (E[XY ])2 = E[X 2 ]  E (E[XY ])2 and Var(E[XY ]) = E (E[XY ])2  E E[XY ] = E (E[XY ])2  (E[X])2 Therefore, E Var(XY ) + Var E[XY ] = E[X 2 ]  (E[X])2 which completes the proof.
2
Example 3.18 (The Variance of a Compound Random Variable) Let X1 ,
X2 , . . . be independent and identically distributed random variables with distribution F having mean and variance 2 , and assume that they are independent of the nonnegative integer valued random variable N. As noted in Example 3.10, where its expected value was determined, the random variable S = N Xi is i=1 called a compound random variable. Find its variance. Solution: Whereas we could obtain E[S 2 ] by conditioning on N , let us instead use the conditional variance formula. Now,
N
Var(SN = n) = Var
i=1 n
Xi N = n
= Var
i=1 n
Xi N = n
= Var
i=1
Xi
= n 2
120
3
Conditional Probability and Conditional Expectation
By the same reasoning, E[SN = n] = n Therefore, Var(SN ) = N 2 , E[SN] = N
and the conditional variance formula gives that Var(S) = E[N 2 ] + Var(N) = 2 E[N] + 2 Var(N ) If N is a Poisson random variable, then S = N Xi is called a compound i=1 Poisson random variable. Because the variance of a Poisson random variable is equal to its mean, it follows that for a compound Poisson random variable having E[N] = Var(S) = 2 + 2 = E[X 2 ] where X has the distribution F .
3.5.
Computing Probabilities by Conditioning
Not only can we obtain expectations by first conditioning on an appropriate random variable, but we may also use this approach to compute probabilities. To see this, let E denote an arbitrary event and define the indicator random variable X by X= 1, 0, if E occurs if E does not occur
It follows from the definition of X that E[X] = P (E), E[XY = y] = P (EY = y), for any random variable Y
Therefore, from Equations (3.3a) and (3.3b) we obtain P (E) =
y
P (EY = y)P (Y = y),

if Y is discrete
=
P (EY = y)fY (y) dy,
if Y is continuous
3.5.
Computing Probabilities by Conditioning
121
Example 3.19 Suppose that X and Y are independent continuous random variables having densities fX and fY , respectively. Compute P {X < Y }.
Solution: Conditioning on the value of Y yields P {X < Y } = = = = where FX (y) =
y     
P {X < Y Y = y}fY (y) dy P {X < yY = y}fY (y) dy P {X < y}fY (y) dy FX (y)fY (y) dy
fX (x) dx
Example 3.20 An insurance company supposes that the number of accidents
that each of its policyholders will have in a year is Poisson distributed, with the mean of the Poisson depending on the policyholder. If the Poisson mean of a randomly chosen policyholder has a gamma distribution with density function g() = e , 0
what is the probability that a randomly chosen policyholder has exactly n accidents next year? Solution: Let X denote the number of accidents that a randomly chosen policyholder has next year. Letting Y be the Poisson mean number of accidents for this policyholder, then conditioning on Y yields P {X = n} =
0
P {X = nY = }g() d e
=
0
n  e d n!
=
1 n!
n+1 e2 d
0
122
3
Conditional Probability and Conditional Expectation
However, because h() = 2e2 (2)n+1 , (n + 1)!
>0
is the density function of a gamma (n + 2, 2) random variable, its integral is 1. Therefore, 1=
0
2n+2 2e2 (2)n+1 d = (n + 1)! (n + 1)!
0
n+1 e2 d
showing that P {X = n} = n+1 2n+2
Example 3.21 Suppose that the number of people who visit a yoga studio
each day is a Poisson random variable with mean . Suppose further that each person who visits is, independently, female with probability p or male with probability 1  p. Find the joint probability that exactly n women and m men visit the academy today. Solution: Let N1 denote the number of women, and N2 the number of men, who visit the academy today. Also, let N = N1 + N2 be the total number of people who visit. Conditioning on N gives
P {N1 = n, N2 = m} =
i=0
P {N1 = n, N2 = mN = i} P {N = i}
Because P {N1 = n, N2 = mN = i} = 0 when i = n + m, the preceding equation yields that P {N1 = n, N2 = m} = P {N1 = n, N2 = mN = n + m}e n+m (n + m)!
Given that n + m people visit it follows, because each of these n + m is independently a woman with probability p, that the conditional probability that n of them are women (and m are men) is just the binomial probability of n
3.5.
Computing Probabilities by Conditioning
123
successes in n + m trials. Therefore, P {N1 = n, N2 = m} = = n+m n+m n p (1  p)m e (n + m)! n n m (n + m)! n p (1  p)m ep e(1p) n!m! (n + m)! (p)n (1p) ((1  p))m e n! m!
= ep
Because the preceding joint probability mass function factors into two products, one of which depends only on n and the other only on m, it follows that N1 and N2 are independent. Moreover, because
P {N1 = n} =
m=0
P {N1 = n, N2 = m} (p)n n!
m=0
= ep
e(1p)
((1  p))m (p)n = ep m! n!
and, similarly, P {N2 = m} = e(1p) ((1  p))m m!
we can conclude that N1 and N2 are independent Poisson random variables with respective means p and (1  p). Therefore, this example establishes the important result that when each of a Poisson number of events is independently classified either as being type 1 with probability p or type 2 with probability 1  p, then the numbers of type 1 and type 2 events are independent Poisson random variables. with Xi having parameter pi , i = 1, . . . , n. That is, P {Xi = 1} = pi , P {Xi = 0} = qi = 1  pi . Suppose we want to compute the probability mass function of their sum, X1 + + Xn . To do so, we will recursively obtain the probability mass function of X1 + + Xk , first for k = 1, then k = 2, and on up to k = n. To begin, let Pk (j ) = P {X1 + + Xk = j }
Example 3.22 Let X1 , . . . , Xn be independent Bernoulli random variables,
124
3
Conditional Probability and Conditional Expectation
and note that
k k
Pk (k) =
i=1
pi ,
Pk (0) =
i=1
qi
For 0 < j < k, conditioning on Xk yields the recursion Pk (j ) = P {X1 + + Xk = j Xk = 1}pk + P {X1 + + Xk = j Xk = 0}qk = P {X1 + + Xk1 = j  1Xk = 1}pk + P {X1 + + Xk1 = j Xk = 0}qk = P {X1 + + Xk1 = j  1}pk + P {X1 + + Xk1 = j }qk = pk Pk1 (j  1) + qk Pk1 (j ) Starting with P1 (1) = p1 , P1 (0) = q1 , the preceding equations can be recursively solved to obtain the functions P2 (j ), P3 (j ), up to Pn (j ).
Example 3.23 (The Best Prize Problem) Suppose that we are to be presented with n distinct prizes in sequence. After being presented with a prize we must immediately decide whether to accept it or reject it and consider the next prize. The only information we are given when deciding whether to accept a prize is the relative rank of that prize compared to ones already seen. That is, for instance, when the fifth prize is presented we learn how it compares with the first four prizes already seen. Suppose that once a prize is rejected it is lost, and that our objective is to maximize the probability of obtaining the best prize. Assuming that all n! orderings of the prizes are equally likely, how well can we do?
Solution: Rather surprisingly, we can do quite well. To see this, fix a value k, 0 k < n, and consider the strategy that rejects the first k prizes and then accepts the first one that is better than all of those first k. Let Pk (best) denote the probability that the best prize is selected when this strategy is employed. To compute this probability, condition on X, the position of the best prize. This gives
n
Pk (best) =
i=1
Pk (bestX = i)P (X = i) 1 n
n
=
Pk (bestX = i)
i=1
Now, if the overall best prize is among the first k, then no prize is ever selected under the strategy considered. On the other hand, if the best prize is in position i, where i > k, then the best prize will be selected if the best of the first
3.5.
Computing Probabilities by Conditioning
125
k prizes is also the best of the first i  1 prizes (for then none of the prizes in positions k + 1, k + 2, . . . , i  1 would be selected). Hence, we see that Pk (bestX = i) = 0, if i k
Pk (bestX = i) = P {best of first i  1 is among the first k} = k/(i  1), From the preceding, we obtain that k Pk (best) = n = Now, if we consider the function g(x) = then g (x) = and so g (x) = 0 log(n/x) = 1 x = n/e Thus, since Pk (best) g(k), we see that the best strategy of the type considered is to let the first n/e prizes go by and then accept the first one to appear that is better than all of those. In addition, since g(n/e) = 1/e, the probability that this strategy selects the best prize is approximately 1/e 0.36788. n 1 1 log  n x n n x log n x k n
n i=k+1 n1 k
if i > k
1 i 1 1 dx x
n1 k log n k n k log n k
126
3
Conditional Probability and Conditional Expectation
Remark Most students are quite surprised by the size of the probability of obtaining the best prize, thinking that this probability would be close to 0 when n is large. However, even without going through the calculations, a little thought reveals that the probability of obtaining the best prize can be made to be reasonably large. Consider the strategy of letting half of the prizes go by, and then selecting the first one to appear that is better than all of those. The probability that a prize is actually selected is the probability that the overall best is among the second half and this is 1/2. In addition, given that a prize is selected, at the time of selection that prize would have been the best of more than n/2 prizes to have appeared, and would thus have probability of at least 1/2 of being the overall best. Hence, the strategy of letting the first half of all prizes go by and then accepting the first one that is better than all of those prizes results in a probability greater than 1/4 of obtaining the best prize.
Example 3.24 At a party n men take off their hats. The hats are then mixed up and each man randomly selects one. We say that a match occurs if a man selects his own hat. What is the probability of no matches? What is the probability of exactly k matches?
Solution: Let E denote the event that no matches occur, and to make explicit the dependence on n, write Pn = P (E). We start by conditioning on whether or not the first man selects his own hatcall these events M and M c . Then Pn = P (E) = P (EM)P (M) + P (EM c )P (M c ) Clearly, P (EM) = 0, and so Pn = P (EM c ) n1 n (3.9)
Now, P (EM c ) is the probability of no matches when n  1 men select from a set of n  1 hats that does not contain the hat of one of these men. This can happen in either of two mutually exclusive ways. Either there are no matches and the extra man does not select the extra hat (this being the hat of the man that chose first), or there are no matches and the extra man does select the extra hat. The probability of the first of these events is just Pn1 , which is seen by regarding the extra hat as "belonging" to the extra man. Because the second event has probability [1/(n  1)]Pn2 , we have P (EM c ) = Pn1 + and thus, from Equation (3.9), Pn = n1 1 Pn1 + Pn2 n n 1 Pn2 n1
3.5.
Computing Probabilities by Conditioning
127
or, equivalently, 1 Pn  Pn1 =  (Pn1  Pn2 ) n (3.10)
However, because Pn is the probability of no matches when n men select among their own hats, we have P1 = 0, and so, from Equation (3.10), P3  P2 =  1 (P2  P1 ) = 3 3! 1 (P3  P2 ) P4  P3 =  = 4 4! or or 1 1  , 2! 3! 1 1 1 P4 =  + 2! 3! 4! P3 = P2 =
1 2
and, in general, we see that Pn = 1 1 (1)n 1  +  + 2! 3! 4! n!
To obtain the probability of exactly k matches, we consider any fixed group of k men. The probability that they, and only they, select their own hats is 1 (n  k)! 1 1 Pnk = Pnk nn1 n  (k  1) n! where Pnk is the conditional probability that the other n  k men, selecting among their own hats, have no matches. Because there are n choices of a set k of k men, the desired probability of exactly k matches is 1 1 (1)nk  + + Pnk 2! 3! (n  k)! = k! k! which, for n large, is approximately equal to e1 /k!.
Remark The recursive equation, Equation (3.10), could also have been obtained by using the concept of a cycle, where we say that the sequence of distinct individuals i1 , i2 , . . . , ik constitutes a cycle if i1 chooses i2 's hat, i2 chooses i3 's hat, . . . , ik1 chooses ik 's hat, and ik chooses i1 's hat. Note that every individual is part of a cycle, and that a cycle of size k = 1 occurs when someone chooses his
128
3
Conditional Probability and Conditional Expectation
or her own hat. With E being, as before, the event that no matches occur, it follows upon conditioning on the size of the cycle containing a specified person, say person 1, that
n
Pn = P (E) =
k=1
P (EC = k)P (C = k)
(3.11)
where C is the size of the cycle that contains person 1. Now call person 1 the first person, and note that C = k if the first person does not choose 1's hat; the person whose hat was chosen by the first personcall this person the second person does not choose 1's hat; the person whose hat was chosen by the second person call this person the third persondoes not choose 1's hat; . . . , the person whose hat was chosen by the (k  1)st person does choose 1's hat. Consequently, P (C = k) = nk+1 1 1 n1 n2 = n n1 nk+2 nk+1 n (3.12)
That is, the size of the cycle that contains a specified person is equally likely to be any of the values 1, 2, . . . , n. Moreover, since C = 1 means that 1 chooses his or her own hat, it follows that P (EC = 1) = 0 (3.13)
On the other hand, if C = k, then the set of hats chosen by the k individuals in this cycle is exactly the set of hats of these individuals. Hence, conditional on C = k, the problem reduces to determining the probability of no matches when n  k people randomly choose among their own n  k hats. Therefore, for k > 1 P (EC = k) = Pnk Substituting (3.12), (3.13), and (3.14) back into Equation (3.11) gives Pn = 1 n
n
Pnk
k=2
(3.14)
which is easily shown to be equivalent to Equation (3.10).
Example 3.25 (The Ballot Problem) In an election, candidate A receives n votes, and candidate B receives m votes where n > m. Assuming that all orderings are equally likely, show that the probability that A is always ahead in the count of votes is (n  m)/(n + m).
3.5.
Computing Probabilities by Conditioning
129
Solution: Let Pn,m denote the desired probability. By conditioning on which candidate receives the last vote counted we have Pn,m = P {A always aheadA receives last vote} n n+m m + P {A always aheadB receives last vote} n+m
Now given that A receives the last vote, we can see that the probability that A is always ahead is the same as if A had received a total of n  1 and B a total of m votes. Because a similar result is true when we are given that B receives the last vote, we see from the preceding that Pn,m = n m Pn1,m + Pn,m1 n+m m+n (3.15)
We can now prove that Pn,m = (n  m)/(n + m) by induction on n + m. As it is true when n + m = 1, that is, P1,0 = 1, assume it whenever n + m = k. Then when n + m = k + 1, we have by Equation (3.15) and the induction hypothesis that Pn,m = m nm+1 n n1m + n+m n1+m m+n n+m1 nm = n+m
and the result is proven. The ballot problem has some interesting applications. For example, consider successive flips of a coin that always land on "heads" with probability p, and let us determine the probability distribution of the first time, after beginning, that the total number of heads is equal to the total number of tails. The probability that the first time this occurs is at time 2n can be obtained by first conditioning on the total number of heads in the first 2n trials. This yields P{first time equal = 2n} = P {first time equal = 2nn heads in first 2n} 2n n p (1  p)n n
Now given a total of n heads in the first 2n flips we can see that all possible orderings of the n heads and n tails are equally likely, and thus the preceding conditional probability is equivalent to the probability that in an election, in which each candidate receives n votes, one of the candidates is always ahead in the counting until the last vote (which ties them). But by conditioning on whomever
130
3
Conditional Probability and Conditional Expectation
receives the last vote, we see that this is just the probability in the ballot problem when m = n  1. Hence P {first time equal = 2n} = Pn,n1 2n n p (1  p)n n
=
2n n p (1  p)n n 2n  1
Suppose now that we wanted to determine the probability that the first time there are i more heads than tails occurs after the (2n + i)th flip. Now, in order for this to be the case, the following two events must occur: (a) The first 2n + i tosses result in n + i heads and n tails; and (b) The order in which the n + i heads and n tails occur is such that the number of heads is never i more than the number of tails until after the final flip. Now, it is easy to see that event (b) will occur if and only if the order of appearance of the n + i heads and n tails is such that starting from the final flip and working backwards heads is always in the lead. For instance, if there are 4 heads and 2 tails (n = 2, i = 2), then the outcome _ _ _ _T H would not suffice because there would have been 2 more heads than tails sometime before the sixth flip (since the first 4 flips resulted in 2 more heads than tails). Now, the probability of the event specified in (a) is just the binomial probability of getting n + i heads and n tails in 2n + i flips of the coin. We must now determine the conditional probability of the event specified in (b) given that there are n + i heads and n tails in the first 2n + i flips. To do so, note first that given that there are a total of n + i heads and n tails in the first 2n + i flips, all possible orderings of these flips are equally likely. As a result, the conditional probability of (b) given (a) is just the probability that a random ordering of n + i heads and n tails will, when counted in reverse order, always have more heads than tails. Since all reverse orderings are also equally likely, it follows from the ballot problem that this conditional probability is i/(2n + i). That is, we have shown that P {a} = P {ba} = and so P {first time heads leads by i is after flip 2n + i} = 2n + i n+i i p (1  p)n 2n + i n 2n + i n+i p (1  p)n , n i 2n + i
3.5.
Computing Probabilities by Conditioning
131
Example 3.26 Let U1 , U2 , . . . be a sequence of independent uniform (0, 1)
random variables, and let N = min{n and M = min{n 1: U1 + + Un > 1} 2: Un > Un1 }
That is, N is the index of the first uniform random variable that is larger than its immediate predecessor, and M is the number of uniform random variables we need sum to exceed 1. Surprisingly, N and M have the same probability distribution, and their common mean is e! Solution: It is easy to find the distribution of N . Since all n! possible orderings of U1 , . . . , Un are equally likely, we have P {N > n} = P {U1 > U2 > > Un } = 1/n! To show that P {M > n} = 1/n!, we will use mathematical induction. However, to give ourselves a stronger result to use as the induction hypothesis, we will prove the stronger result that for 0 < x 1, P {M(x) > n} = x n /n!, n 1, where M(x) = min{n 1: U1 + + Un > x}
is the minimum number of uniforms that need be summed to exceed x. To prove that P {M(x) > n} = x n /n!, note first that it is true for n = 1 since P {M(x) > 1} = P {U1 x} = x
So assume that for all 0 < x 1, P {M(x) > n} = x n /n!. To determine P {M(x) > n + 1}, condition on U1 to obtain: P {M(x) > n + 1} =
0 1
P {M(x) > n + 1U1 = y} dy P {M(x) > n + 1U1 = y} dy P {M(x  y) > n} dy (x  y)n dy n! by the induction hypothesis
=
0
x
=
0
x
=
0
x
132
3
Conditional Probability and Conditional Expectation
x 0
= =
un du n!
x n+1 (n + 1)!
where the third equality of the preceding follows from the fact that given U1 = y, M(x) is distributed as 1 plus the number of uniforms that need be summed to exceed x  y. Thus, the induction is complete and we have shown that for 0 < x 1, n 1, P {M(x) > n} = x n /n! Letting x = 1 shows that N and M have the same distribution. Finally, we have that
E[M] = E[N ] =
n=0
P {N > n} =
n=0
1/n! = e
Example 3.27 Let X1 , X2 , . . . be independent continuous random variables
with a common distribution function F and density f = F , and suppose that they are to be observed one at a time in sequence. Let N = min{n and let M = min{n 2: Xn = second smallest of X1 , . . . , Xn } 2: Xn = second largest of X1 , . . . , Xn }
Which random variableXN , the first random variable which when observed is the second largest of those that have been seen, or XM , the first one that on observation is the second smallest to have been seentends to be larger? Solution: To calculate the probability density function of XN , it is natural to condition on the value of N ; so let us start by determining its probability mass function. Now, if we let Ai = {Xi = second largest of X1 , . . . , Xi }, then, for n 2, P {N = n} = P A2 A3 An1 Ac n Since the Xi are independent and identically distributed it follows that, for any m 1, knowing the rank ordering of the variables X1 , . . . , Xm yields no i 2
3.5.
Computing Probabilities by Conditioning
133
information about the set of m values {X1 , . . . , Xm }. That is, for instance, knowing that X1 < X2 gives us no information about the values of min(X1 , X2 ) or max(X1 , X2 ). It follows from this that the events Ai , i 2 are independent. Also, since Xi is equally likely to be the largest, or the second largest, . . . , or the ith largest of X1 , . . . , Xi it follows that P {Ai } = (i  1)/i, i 2. Therefore, we see that P {N = n} = n2 1 1 123 = 234 n  1 n n(n  1)
Hence, conditioning on N yields that the probability density function of XN is as follows:
fXN (x) =
n=2
1 fX N (xn) n(n  1) N
Now, since the ordering of the variables X1 , . . . , Xn is independent of the set of values {X1 , . . . , Xn }, it follows that the event {N = n} is independent of {X1 , . . . , Xn }. From this, it follows that the conditional distribution of XN given that N = n is equal to the distribution of the second largest from a set of n random variables having distribution F . Thus, using the results of Example 2.37 concerning the density function of such a random variable, we obtain that
fXN (x) =
n=2
n! 1 (F (x))n2 f (x)(1  F (x)) n(n  1) (n  2)!1!
= f (x)(1  F (x))
i=0
(F (x))i
= f (x) Thus, rather surprisingly, XN has the same distribution as X1 , namely, F . Also, if we now let Wi = Xi , i 1, then WM will be the value of the first Wi , which on observation is the second largest of all those that have been seen. Hence, by the preceding, it follows that WM has the same distribution as W1 . That is, XM has the same distribution as X1 , and so XM also has distribution F ! In other words, whether we stop at the first random variable that is the second largest of all those presently observed, or we stop at the first one that is the second smallest of all those presently observed, we will end up with a random variable having distribution F . Whereas the preceding result is quite surprising, it is a special case of a general result known as Ignatov's theorem, which yields even more surprises.
134
3
Conditional Probability and Conditional Expectation
For instance, for k
1, let k: Xn = kth largest of X1 , . . . , Xn }
Nk = min{n
Therefore, N2 is what we previously called N , and XNk is the first random variable that upon observation is the kth largest of all those observed up to this point. It can then be shown by a similar argument as used in the preceding that XNk has distribution function F for all k (see Exercise 82 at the end of this chapter). In addition, it can be shown that the random variables XNk , k 1 are independent. (A statement and proof of Ignatov's theorem in the case of discrete random variables are given in Section 3.6.6.) The use of conditioning can also result in a more computationally efficient solution than a direct calculation. This is illustrated by our next example.
Example 3.28 Consider n independent trials in which each trial results in one of the outcomes 1, . . . , k with respective probabilities p1 , . . . , pk , k pi = 1. i=1 Suppose further that n > k, and that we are interested in determining the probability that each outcome occurs at least once. If we let Ai denote the event that outcome i does not occur in any of the n trials, then the desired probability is 1  P ( k Ai ), and it can be obtained by using the inclusionexclusion theoi=1 rem as follows:
k k
P
i=1
Ai =
i=1
P (Ai ) 
i j >i
P (Ai Aj ) P (Ai Aj Ak )  + (1)k+1 P (A1 Ak )
+
i j >i k>j
where P (Ai ) = (1  pi )n P (Ai Aj ) = (1  pi  pj )n ,
n
i<j i<j <k
P (Ai Aj Ak ) = (1  pi  pj  pk ) ,
The difficulty with the preceding solution is that its computation requires the calculation of 2k  1 terms, each of which is a quantity raised to the power n. The preceding solution is thus computationally inefficient when k is large. Let us now see how to make use of conditioning to obtain an efficient solution. To begin, note that if we start by conditioning on Nk (the number of times that outcome k occurs) then when Nk > 0 the resulting conditional probability will equal the probability that all of the outcomes 1, . . . , k  1 occur at least once
3.5.
Computing Probabilities by Conditioning
135
when n  Nk trials are performed, and each results in outcome i with probability pi / k1 pj , i = 1, . . . , k  1. We could then use a similar conditioning step on j =1 these terms. To follow through on the preceding idea, let Am,r , for m n, r k, denote the event that each of the outcomes 1, . . . , r occurs at least once when m independent trials are performed, where each trial results in one of the outcomes 1, . . . , r with respective probabilities p1 /Pr , . . . , pr /Pr , where Pr = r =1 pj . Let P (m, r) = j P (Am,r ) and note that P (n, k) is the desired probability. To obtain an expression for P (m, r), condition on the number of times that outcome r occurs. This gives
m
P (m, r) =
j =0
P {Am,r r occurs j times}
mr+1
m j pr Pr
j
pr Pr
j
1 pr Pr
pr Pr
mj
=
j =1
P (m  j, r  1)
m j
mj
1
Starting with P (m, 1) = 1, P (m, 1) = 0, if m 1 if m = 0
we can use the preceding recursion to obtain the quantities P (m, 2), m = 2, . . . , n  (k  2), and then the quantities P (m, 3), m = 3, . . . , n  (k  3), and so on, up to P (m, k  1), m = k  1, . . . , n  1. At this point we can then use the recursion to compute P (n, k). It is not difficult to check that the amount of computation needed is a polynomial function of k, which will be much smaller than 2k when k is large. As noted previously, conditional expectations given that Y = y are exactly the same as ordinary expectations except that all probabilities are computed conditional on the event that Y = y. As such, conditional expectations satisfy all the properties of ordinary expectations. For instance, the analog of E[XW = w]P {W = w}, if W is discrete E[X] =
w
w
E[XW = w]fW (w) dw,
if W is continuous
is that E[XY = y] E[XW = w, Y = y]P {W = wY = y}, w = E[XW = w, Y = y]f W Y (wy) dw,
w
if W is discrete if W is continuous
136
3
Conditional Probability and Conditional Expectation
If E[XY, W ] is defined to be that function of Y and W that, when Y = y and W = w, is equal to E[XY = y, W = w], then the preceding can be written as E[XY ] = E E[XY, W ] Y
Example 3.29 An automobile insurance company classifies each of its pol
icyholders as being of one of the types i = 1, . . . , k. It supposes that the numbers of accidents that a type i policyholder has in successive years are independent Poisson random variables with mean i , i = 1, . . . , k. The probability that a newly insured policyholder is type i is pi , k pi = 1. Given that a policyi=1 holder had n accidents in her first year, what is the expected number that she has in her second year? What is the conditional probability that she has m accidents in her second year? Solution: Let Ni denote the number of accidents the policyholder has in year i, i = 1, 2. To obtain E[N2 N1 = n], condition on her risk type T .
k
E[N2 N1 = n] =
j =1 k
E[N2 T = j, N1 = n]P {T = j N1 = n}
=
j =1 k
E[N2 T = j ]P {T = j N1 = n}
=
j =1
j P {T = j N1 = n}
k j n+1 p j j =1 e j k j n p j =1 e j j
=
where the final equality used that P {T = j N1 = n} = = P {T = j, N1 = n} P {N1 = n} P {N1 = nT = j }P {T = j } k j =1 P {N1 = nT = j }P {T = j } pj ej n /n! j
k j n /n! j =1 pj e j
=
3.6.
Some Applications
137
The conditional probability that the policyholder has m accidents in year 2 given that she had n in year 1 can also be obtained by conditioning on her type.
k
P {N2 = mN1 = n} =
j =1 k
P {N2 = mT = j, N1 = n}P {T = j N1 = n} m j m!
=
j =1
ej
P {T = j N1 = n}
=
k 2j m+n p j j =1 e j k j n p m! j =1 e j j
Another way to calculate P {N2 = mN1 = n} is first to write P {N2 = mN1 = n} = P {N2 = m, N1 = n} P {N1 = n}
and then determine both the numerator and denominator by conditioning on T . This yields P {N2 = mN1 = n} =
k j =1 P {N2 = m, N1 = nT = j }pj k j =1 P {N1 = nT = j }pj
m k j j j =1 e m!
=
ej
n j n! pj
n k j j p j =1 e n! j
=
k 2j m+n p j j =1 e j k j n p m! j =1 e j j
3.6.
Some Applications
3.6.1. A List Model Consider n elementse1 , e2 , . . . , en that are initially arranged in some ordered list. At each unit of time a request is made for one of these elementsei being requested, independently of the past, with probability Pi . After being requested the element is then moved to the front of the list. That is, for instance, if the present ordering is e1 , e2 , e3 , e4 and if e3 is requested, then the next ordering is e3 , e1 , e2 , e4 .
138
3
Conditional Probability and Conditional Expectation
We are interested in determining the expected position of the element requested after this process has been in operation for a long time. However, before computing this expectation, let us note two possible applications of this model. In the first we have a stack of reference books. At each unit of time a book is randomly selected and is then returned to the top of the stack. In the second application we have a computer receiving requests for elements stored in its memory. The request probabilities for the elements may not be known, so to reduce the average time it takes the computer to locate the element requested (which is proportional to the position of the requested element if the computer locates the element by starting at the beginning and then going down the list), the computer is programmed to replace the requested element at the beginning of the list. To compute the expected position of the element requested, we start by conditioning on which element is selected. This yields E [ position of element requested ]
n
=
i=1 n
E [ positionei is selected ]Pi E [ position of ei ei is selected ]Pi
i=1 n
= =
i=1
E [ position of ei ]Pi
(3.16)
where the final equality used that the position of ei and the event that ei is selected are independent because, regardless of its position, ei is selected with probability Pi . Now position of ei = 1 +
j =i
Ij
where Ij = and so, E [ position of ei ] = 1 +
j =i
1, 0,
if ej precedes ei otherwise
E [Ij ] P {ej precedes ei }
j =i
=1+
(3.17)
3.6.
Some Applications
139
To compute P {ej precedes ei }, note that ej will precede ei if the most recent request for either of them was for ej . But given that a request is for either ei or ej , the probability that it is for ej is P {ej ei or ej } = and, thus, P {ej precedes ei } = Pj Pi + Pj Pj Pi + Pj
Hence from Equations (3.16) and (3.17) we see that
n
E{position of element requested} = 1 +
i=1
Pi
j =i
Pj Pi + Pj
This list model will be further analyzed in Section 4.8, where we will assume a different reordering rulenamely, that the element requested is moved one closer to the front of the list as opposed to being moved to the front of the list as assumed here. We will show there that the average position of the requested element is less under the onecloser rule than it is under the frontoftheline rule. 3.6.2. A Random Graph A graph consists of a set V of elements called nodes and a set A of pairs of elements of V called arcs. A graph can be represented graphically by drawing circles for nodes and drawing lines between nodes i and j whenever (i, j ) is an arc. For instance if V = {1, 2, 3, 4} and A = {(1, 2), (1, 4), (2, 3), (1, 2), (3, 3)}, then we can represent this graph as shown in Figure 3.1. Note that the arcs have no direction (a graph in which the arcs are ordered pairs of nodes is called a directed graph); and that in the figure there are multiple arcs connecting nodes 1 and 2, and a selfarc (called a selfloop) from node 3 to itself.
Figure 3.1. A graph.
140
3
Conditional Probability and Conditional Expectation
Figure 3.2. A disconnected graph.
Figure 3.3.
We say that there exists a path from node i to node j , i = j , if there exists a sequence of nodes i, i1 , . . . , ik , j such that (i, i1 ), (i1 , i2 ), . . . , (ik , j ) are all arcs. If there is a path between each of the n distinct pair of nodes we say that the 2 graph is connected. The graph in Figure 3.1 is connected but the graph in Figure 3.2 is not. Consider now the following graph where V = {1, 2, . . . , n} and A = {(i, X(i)), i = 1, . . . , n} where the X(i) are independent random variables such that 1 P {X(i) = j } = , n j = 1, 2, . . . , n
In other words from each node i we select at random one of the n nodes (including possibly the node i itself) and then join node i and the selected node with an arc. Such a graph is commonly referred to as a random graph. We are interested in determining the probability that the random graph so obtained is connected. As a prelude, starting at some nodesay, node 1let us follow the sequence of nodes, 1, X(1), X 2 (1), . . . , where X n (1) = X(X n1 (1)); and define N to equal the first k such that X k (1) is not a new node. In other words, N = 1st k such that X k (1) {1, X(1), . . . , X k1 (1)} We can represent this as shown in Figure 3.3 where the arc from X N 1 (1) goes back to a node previously visited. To obtain the probability that the graph is connected we first condition on N to obtain
n
P {graph is connected} =
k=1
P {connectedN = k}P {N = k}
(3.18)
3.6.
Some Applications
141
Now given that N = k, the k nodes 1, X(1), . . . , X k1 (1) are connected to each other, and there are no other arcs emanating out of these nodes. In other words, if we regard these k nodes as being one supernode, the situation is the same as if we had one supernode and n  k ordinary nodes with arcs emanating from the ordinary nodeseach arc going into the supernode with probability k/n. The solution in this situation is obtained from Lemma 3.2 by taking r = n  k.
Lemma 3.1 Given a random graph consisting of nodes 0, 1, . . . , r and r arcsnamely, (i, Yi ), i = 1, . . . , r, where
j 0 with probability with probability 1 , r +k k r +k j = 1, . . . , r
Yi =
then P {graph is connected} = k r +k
[In other words, for the preceding graph there are r + 1 nodesr ordinary nodes and one supernode. Out of each ordinary node an arc is chosen. The arc goes to the supernode with probability k/(r + k) and to each of the ordinary ones with probability 1/(r + k). There is no arc emanating out of the supernode.]
Proof The proof is by induction on r. As it is true when r = 1 for any k, assume it true for all values less than r. Now in the case under consideration, let us first condition on the number of arcs (j, Yj ) for which Yj = 0. This yields
P {connected}
r
=
i=0
P {connectedi of the Yj = 0}
r i
k r +k
i
r r +k
ri
(3.19)
Now given that exactly i of the arcs are into the supernode (see Figure 3.4), the situation for the remaining r  i arcs which do not go into the supernode is the same as if we had r  i ordinary nodes and one supernode with an arc going out of each of the ordinary nodesinto the supernode with probability i/r and into each ordinary node with probability 1/r. But by the induction hypothesis the probability that this would lead to a connected graph is i/r. Hence, P {connectedi of the Yj = 0} = i r
142
3
Conditional Probability and Conditional Expectation
Figure 3.4. The situation given that i of the r arcs are into the supernode.
and from Equation (3.19)
r
P {connected} =
i=0
i r r i
k r +k
i
r r +k
ri
k 1 = E binomial r, r r +k = k r +k
which completes the proof of the lemma. Hence as the situation given N =k is exactly as described by Lemma 3.2 when r = n  k, we see that, for the original graph, P {graph is connectedN = k} = and, from Equation (3.18), P {graph is connected} = To compute E(N ) we use the identity
k n
E(N) n
(3.20)
E(N ) =
i=1
P {N
i} 1, by
which can be proved by defining indicator variables Ii , i Ii = 1, 0, if i N
if i > N
3.6.
Some Applications
143
Hence,
N=
i=1
Ii
and so
E(N ) = E
i=1
Ii
=
i=1
E[Ii ] P {N
i=1
= Now the event {N Hence,
i}
(3.21)
i} occurs if the nodes 1, X(1), . . . , X i1 (1) are all distinct. (n  i + 1) (n  1) (n  2) n n n (n  1)! = (n  i)!ni1
P {N
i} =
and so, from Equations (3.20) and (3.21),
n
P {graph is connected} = (n  1)!
i=1
1 (n  i)!ni nj j! (by j = n  i) (3.22)
=
(n  1)! nn
n1 j =0
We can also use Equation (3.22) to obtain a simple approximate expression for the probability that the graph is connected when n is large. To do so, we first note that if X is a Poisson random variable with mean n, then P {X < n} = e
n n1 j =0
nj j!
Since a Poisson random variable with mean n can be regarded as being the sum of n independent Poisson random variables each with mean 1, it follows from the
144
3
Conditional Probability and Conditional Expectation
central limit theorem that for n large such a random variable has approximately a normal distribution and as such has probability 1 of being less than its mean. 2 That is, for n large P {X < n} and so for n large,
n1 j =0 1 2
en nj j! 2
Hence from Equation (3.22), for n large, P {graph is connected} en (n  1)! 2nn
By employing an approximation due to Stirling which states that for n large n! nn+1/2 en 2 We see that, for n large, P {graph is connected} and as lim n1 n
n
n1 e 2(n  1) n
n
n
= lim
n
1
1 n
n
= e1
We see that, for n large, P {graph is connected} 2(n  1)
Now a graph is said to consist of r connected components if its nodes can be partitioned into r subsets so that each of the subsets is connected and there are no arcs between nodes in different subsets. For instance, the graph in Figure 3.5 consists of three connected componentsnamely, {1, 2, 3}, {4, 5}, and {6}. Let C denote the number of connected components of our random graph and let Pn (i) = P {C = i}
3.6.
Some Applications
145
Figure 3.5. A graph having three connected components.
where we use the notation Pn (i) to make explicit the dependence on n, the number of nodes. Since a connected graph is by definition a graph consisting of exactly one component, from Equation (3.22) we have Pn (1) = P {C = 1} = (n  1)! nn
n1 j =0
nj j!
(3.23)
To obtain Pn (2), the probability of exactly two components, let us first fix attention on some particular nodesay, node 1. In order that a given set of k  1 other nodessay, nodes 2, . . . , kwill along with node 1 constitute one connected component, and the remaining n  k a second connected component, we must have (i) (ii) (iii) (iv) X(i) {1, 2, . . . , k}, for all i = 1, . . . , k. X(i) {k + 1, . . . , n}, for all i = k + 1, . . . , n. The nodes 1, 2, . . . , k form a connected subgraph. The nodes k + 1, . . . , n form a connected subgraph.
The probability of the preceding occurring is clearly k n and because there are 2 through n, we have
n1 k1 k
nk n
nk
Pk (1)Pnk (1)
ways of choosing a set of k  1 nodes from the nodes
n1
Pn (2) =
k=1
n1 k1
k n
k
nk n
nk
Pk (1)Pnk (1)
146
3
Conditional Probability and Conditional Expectation
Figure 3.6. A cycle.
and so Pn (2) can be computed from Equation (3.23). In general, the recursive formula for Pn (i) is given by
ni+1
Pn (i) =
k=1
n1 k1
k n
k
nk n
nk
Pk (1)Pnk (i  1)
To compute E[C], the expected number of connected components, first note that every connected component of our random graph must contain exactly one cycle [a cycle is a set of arcs of the form (i, i1 ), (i1 , i2 ), . . . , (ik1 , ik ), (ik , i) for distinct nodes i, i1 , . . . , ik ]. For example, Figure 3.6 depicts a cycle. The fact that every connected component of our random graph must contain exactly one cycle is most easily proved by noting that if the connected component consists of r nodes, then it must also have r arcs and, hence, must contain exactly one cycle (why?). Thus, we see that E[C] = E[number of cycles] =E
S
I (S) E[I (S)]
=
S
where the sum is over all subsets S {1, 2, . . . , n} and I (S) = 1, 0, if the nodes in S are all the nodes of a cycle otherwise
Now, if S consists of k nodes, say 1, . . . , k, then E[I (S)] = P {1, X(1), . . . , X k1 (1) are all distinct and contained in 1, . . . , k and X k (1) = 1} = 1 1 (k  1)! k1k2 = n n nn nk
3.6.
Some Applications
147
Hence, because there are
n k
subsets of size k we see that
n
E[C] =
k=1
n (k  1)! k nk
3.6.3. Uniform Priors, Polya's Urn Model, and BoseEinstein Statistics Suppose that n independent trials, each of which is a success with probability p, are performed. If we let X denote the total number of successes, then X is a binomial random variable such that P {X = kp} = n p k (1  p)nk , k k = 0, 1, . . . , n
However, let us now suppose that whereas the trials all have the same success probability p, its value is not predetermined but is chosen according to a uniform distribution on (0, 1). (For instance, a coin may be chosen at random from a huge bin of coins representing a uniform spread over all possible values of p, the coin's probability of coming up heads. The chosen coin is then flipped n times.) In this case, by conditioning on the actual value of p, we have that P {X = k} =
0 1
P {X = kp}f (p) dp n p k (1  p)nk dp k
=
0
1
Now, it can be shown that
1 0
p k (1  p)nk dp =
k!(n  k)! (n + 1)!
(3.24)
and thus P {X = k} = = n k!(n  k)! k (n + 1)! 1 , n+1 k = 0, 1, . . . , n (3.25)
In other words, each of the n + 1 possible values of X is equally likely.
148
3
Conditional Probability and Conditional Expectation
As an alternate way of describing the preceding experiment, let us compute the conditional probability that the (r + 1)st trial will result in a success given a total of k successes (and r  k failures) in the first r trials. P {(r + 1)st trial is a successk successes in first r} = = P {(r + 1)st is a success, k successes in first r trials} P {k successes in first r trials}
1 0 P {(r
+ 1)st is a success, k in first rp} dp 1/(r + 1)
1 0
= (r + 1) = (r + 1) = k+1 r +2
r p k+1 (1  p)rk dp k by Equation (3.24) (3.26)
r (k + 1)!(r  k)! (r + 2)! k
That is, if the first r trials result in k successes, then the next trial will be a success with probability (k + 1)/(r + 2). It follows from Equation (3.26) that an alternative description of the stochastic process of the successive outcomes of the trials can be described as follows: There is an urn which initially contains one white and one black ball. At each stage a ball is randomly drawn and is then replaced along with another ball of the same color. Thus, for instance, if of the first r balls drawn, k were white, then the urn at the time of the (r + 1)th draw would consist of k + 1 white and r  k + 1 black, and thus the next ball would be white with probability (k + 1)/(r + 2). If we identify the drawing of a white ball with a successful trial, then we see that this yields an alternate description of the original model. This latter urn model is called Polya's urn model.
Remarks (i) In the special case when k = r, Equation (3.26) is sometimes called Laplace's rule of succession, after the French mathematician Pierre de Laplace. In Laplace's era, this "rule" provoked much controversy, for people attempted to employ it in diverse situations where its validity was questionable. For instance, it was used to justify such propositions as "If you have dined twice at a restaurant and both meals were good, then the next meal also will be good with probability 3 ," and "Since the sun has risen the past 1,826,213 days, so will it rise 4 tomorrow with probability 1,826,214/1,826,215." The trouble with such claims resides in the fact that it is not at all clear the situation they are describing can be modeled as consisting of independent trials having a common probability of success which is itself uniformly chosen.
3.6.
Some Applications
149
(ii) In the original description of the experiment, we referred to the successive trials as being independent, and in fact they are independent when the success probability is known. However, when p is regarded as a random variable, the successive outcomes are no longer independent because knowing whether an outcome is a success or not gives us some information about p, which in turn yields information about the other outcomes. The preceding can be generalized to situations in which each trial has more than two possible outcomes. Suppose that n independent trials, each resulting in one of m possible outcomes 1, . . . , m, with respective probabilities p1 , . . . , pm are performed. If we let Xi denote the number of type i outcomes that result in the n trials, i = 1, . . . , m, then the vector X1 , . . . , Xm will have the multinomial distribution given by P {X1 = x1 , X2 = x2 , . . . , Xm = xm p} = n! x p x1 p x2 pmm x1 ! xm ! 1 2
where x1 , . . . , xm is any vector of nonnegative integers that sum to n. Now let us suppose that the vector p = (p1 , . . . , pm ) is not specified, but instead is chosen by a "uniform" distribution. Such a distribution would be of the form f (p1 , . . . , pm ) = c, 0, 0 pi 1, i = 1, . . . , m, otherwise
m 1 pi
=1
The preceding multivariate distribution is a special case of what is known as the Dirichlet distribution, and it is not difficult to show, using the fact that the distribution must integrate to 1, that c = (m  1)!. The unconditional distribution of the vector X is given by P {X1 = x1 , . . . , Xm = xm } = P {X1 = x1 , . . . , Xm = xm p1 , . . . , pm }
0 pi 1 m p =1 1 i
f (p1 , . . . , pm ) dp1 dpm =
(m  1)!n! x1 ! xm !
x x p1 1 pmm dp1 dpm
Now it can be shown that
0 pi 1 m p =1 1 i
x x p1 1 pmm dp1 dpm =
x1 ! xm ! m 1 xi + m  1
!
(3.27)
150
3
Conditional Probability and Conditional Expectation
m 1 xi
and thus, using the fact that
= n, we see that n!(m  1)! (n + m  1)! n+m1 m1
1
P {X1 = x1 , . . . , Xm = xm } = =
(3.28)
Hence, all of the n + m  1 possible outcomes [there are n + m  1 possible nonm1 m1 negative integer valued solutions of x1 + + xm = n] of the vector (X1 , . . . , Xm ) are equally likely. The probability distribution given by Equation (3.28) is sometimes called the BoseEinstein distribution. To obtain an alternative description of the foregoing, let us compute the conditional probability that the (n + 1)st outcome is of type j if the first n trials have resulted in xi type i outcomes, i = 1, . . . , m, m xi = n. This is given by 1 P {(n + 1)st is j xi type i in first n, i = 1, . . . , m} = P {(n + 1)st is j, xi type i in first n, i = 1, . . . , m} P {xi type i in first n, i = 1, . . . , m} n!(m  1)! x1 ! xm !
x p 1 1 pj j x +1 1 x pmm dp1 dpm
=
n+m1 m1
where the numerator is obtained by conditioning on the p vector and the denominator is obtained by using Equation (3.28). By Equation (3.27), we have that P {(n + 1)st is j xi type i in first n, i = 1, . . . , m} (xj + 1)n!(m  1)! (n + m)! = (m  1)!n! (n + m  1)! = xj + 1 n+m (3.29)
Using Equation (3.29), we can now present an urn model description of the stochastic process of successive outcomes. Namely, consider an urn that initially contains one of each of m types of balls. Balls are then randomly drawn and are replaced along with another of the same type. Hence, if in the first n drawings there have been a total of xj type j balls drawn, then the urn immediately before
3.6.
Some Applications
151
the (n+1)st draw will contain xj +1 type j balls out of a total of m+n, and so the probability of a type j on the (n + 1)st draw will be given by Equation (3.29).
Remark Consider a situation where n particles are to be distributed at random
among m possible regions; and suppose that the regions appear, at least before the experiment, to have the same physical characteristics. It would thus seem that the most likely distribution for the number of particles that fall into each of the regions is the multinomial distribution with pi 1/m. (This, of course, would correspond to each particle, independent of the others, being equally likely to fall in any of the m regions.) Physicists studying how particles distribute themselves observed the behavior of such particles as photons and atoms containing an even number of elementary particles. However, when they studied the resulting data, they were amazed to discover that the observed frequencies did not follow the multinomial distribution but rather seemed to follow the BoseEinstein distribution. They were amazed because they could not imagine a physical model for the distribution of particles which would result in all possible outcomes being equally likely. (For instance, if 10 particles are to distribute themselves between two regions, it hardly seems reasonable that it is just as likely that both regions will contain 5 particles as it is that all 10 will fall in region 1 or that all 10 will fall in region 2.) However, from the results of this section we now have a better understanding of the cause of the physicists' dilemma. In fact, two possible hypotheses present themselves. First, it may be that the data gathered by the physicists were actually obtained under a variety of different situations, each having its own characteristic p vector which gave rise to a uniform spread over all possible p vectors. A second possibility (suggested by the urn model interpretation) is that the particles select their regions sequentially and a given particle's probability of falling in a region is roughly proportional to the fraction of the landed particles that are in that region. (In other words, the particles presently in a region provide an "attractive" force on elements that have not yet landed.) 3.6.4. Mean Time for Patterns Let X = (X1 , X2 , . . .) be a sequence of independent and identically distributed discrete random variables such that pi = P {Xj = i} For a given subsequence, or pattern, i1 , . . . , in let T = T (i1 , . . . , in ) denote the number of random variables that we need to observe until the pattern appears. For instance, if the subsequence of interest is 3, 5, 1 and the sequence is X = (5, 3, 1, 3, 5, 3, 5, 1, 6, 2, . . .) then T = 8. We want to determine E[T ]. To begin, let us consider whether the pattern has an overlap, where we say that the pattern i1 , i2 , . . . , in has an overlap if for some k, 1 k < n, the sequence of
152
3
Conditional Probability and Conditional Expectation
its final k elements is the same as that of its first k elements. That is, it has an overlap if for some 1 k < n, (ink+1 , . . . , in ) = (i1 , . . . , ik ), k<n
For instance, the pattern 3, 5, 1 has no overlaps, whereas the pattern 3, 3, 3 does.
Case 1: The pattern has no overlaps.
In this case we will argue that T will equal j + n if and only if the pattern does not occur within the first j values, and the next n values are i1 , . . . , in . That is, T = j + n {T > j, (Xj +1 , . . . , Xj +n ) = (i1 , . . . , in )} (3.30)
To verify (3.30), note first that T = j + n clearly implies both that T > j and that (Xj +1 , . . . , Xj +n ) = (i1 , . . . , in ). On the other hand, suppose that T >j and (Xj +1 , . . . , Xj +n ) = (i1 , . . . , in ) (3.31) Let k < n. Because (i1 , . . . , ik ) = (ink+1 , . . . , in ), it follows that T = j + k. But (3.31) implies that T j + n, so we can conclude that T = j + n. Thus we have verified (3.30). Using (3.30), we see that P {T = j + n} = P {T > j, (Xj +1 , . . . , Xj +n ) = (i1 , . . . , in )} However, whether T > j is determined by the values X1 , . . . , Xj , and is thus independent of Xj +1 , . . . , Xj +n . Consequently, P {T = j + n} = P {T > j }P {(Xj +1 , . . . , Xj +n ) = (i1 , . . . , in )} = P {T > j }p where p = pi 1 pi 2 pi n Summing both sides of the preceding over all j yields
1=
j =0
P {T = j + n} = p
j =0
P {T > j } = pE[T ]
or E[T ] = 1 p
Case 2: The pattern has overlaps.
For patterns having overlaps there is a simple trick that will enable us to obtain E[T ] by making use of the result for nonoverlapping patterns. To make the analy
3.6.
Some Applications
153
sis more transparent, consider a specific pattern, say P = (3, 5, 1, 3, 5). Let x be a value that does not appear in the pattern, and let Tx denote the time until the pattern Px = (3, 5, 1, 3, 5, x) appears. That is, Tx is the time of occurrence of the new pattern that puts x at the end of the original pattern. Because x did not appear in the original pattern it follows that the new pattern has no overlaps; thus, E[Tx ] = 1 px p
2 2 where p = n=1 pij = p3 p5 p1 . Because the new pattern can occur only after the j original one, write
Tx = T + A where T is the time at which the pattern P = (3, 5, 1, 3, 5) occurs, and A is the additional time after the occurrence of the pattern P until Px occurs. Also, let E[Tx i1 , . . . ir ] denote the expected additional time after time r until the pattern Px appears given that the first r data values are i1 , . . . , ir . Conditioning on X, the next data value after the occurrence of the pattern (3, 5, 1, 3, 5), gives that if i = 1 1 + E[Tx 3, 5, 1], if i = 3 1 + E[Tx 3], E[AX = i] = if i = x 1, if i = 1, 3, x 1 + E[Tx ], Therefore, E[Tx ] = E[T ] + E[A] = E[T ] + 1 + E[Tx 3, 5, 1]p1 + E[Tx 3]p3 + E[Tx ](1  p1  p3  px ) (3.32) But E[Tx ] = E[T (3, 5, 1)] + E[Tx 3, 5, 1] giving that E[Tx 3, 5, 1] = E[Tx ]  E[T (3, 5, 1)] Similarly, E[Tx 3] = E[Tx ]  E[T (3)] Substituting back into Equation (3.32) gives px E[Tx ] = E[T ] + 1  p1 E[T (3, 5, 1)]  p3 E[T (3)]
154
3
Conditional Probability and Conditional Expectation
But, by the result in the nonoverlapping case, E[T (3, 5, 1)] = yielding the result E[T ] = px E[Tx ] + 1 1 1 = + p3 p5 p p3 p5 1 , p3 p5 p1 E[T (3)] = 1 p3
For another illustration of the technique, let us reconsider Example 3.14, which is concerned with finding the expected time until n consecutive successes occur in independent Bernoulli trials. That is, we want E[T ], when the pattern is P = (1, 1, . . . , 1). Then, with x = 1 we consider the nonoverlapping pattern Px = (1, . . . , 1, x), and let Tx be its occurrence time. With A and X as previously defined, we have that if i = 1 1 + E[A], if i = x E[AX = i] = 1, if i = 1, x 1 + E[Tx ], Therefore, E[A] = 1 + E[A]p1 + E[Tx ](1  p1  px ) or E[A] = Consequently, E[T ] = E[Tx ]  E[A] = = px E[Tx ]  1 1  p1 (1/p1 )n  1 1  p1 1 1  p1  px + E[Tx ] 1  p1 1  p1
where the final equality used that E[Tx ] = pn1px . 1 The mean occurrence time of any overlapping pattern P = (i1 , . . . , in ) can be obtained by the preceding method. Namely, let Tx be the time until the nonoverlapping pattern Px = (i1 , . . . , in , x) occurs; then use the identity E[Tx ] = E[T ] + E[A]
3.6.
Some Applications
155
to relate E[T ] and E[Tx ] = p 1 x ; then condition on the next data value after P p occurs to obtain an expression for E[A] in terms of quantities of the form E[Tx i1 , . . . , ir ] = E[Tx ]  E[T (i1 , . . . , ir )] If (i1 , . . . , ir ) is nonoverlapping, use the nonoverlapping result to obtain E[T (i1 , . . . , ir )]; otherwise, repeat the process on the subpattern (i1 , . . . , ir ).
Remark We can utilize the preceding technique even when the pattern
i1 , . . . , in includes all the distinct data values. For instance, in coin tossing the pattern of interest might be h, t, h. Even in such cases, we should let x be a data value that is not in the pattern and use the preceding technique (even though px = 0). p Because px will appear only in the final answer in the expression px E[Tx ] = pxxp , by interpreting this fraction as 1/p we obtain the correct answer. (A rigorous approach, yielding the same result, would be to reduce one of the positive pi by , take px = , solve for E[T ], and then let go to 0.) 3.6.5. The kRecord Values of Discrete Random Variables Let X1 , X2 , . . . be independent and identically distributed random variables whose set of possible values is the positive integers, and let P {X = j }, j 1, denote their common probability mass function. Suppose that these random variables are observed in sequence, and say that Xn is a krecord value if Xi Xn for exactly k of the values i, i = 1, . . . , n
That is, the nth value in the sequence is a krecord value if exactly k of the first n values (including Xn ) are at least as large as it. Let Rk denote the ordered set of krecord values. It is a rather surprising result that not only do the sequences of krecord values have the same probability distributions for all k, these sequences are also independent of each other. This result is known as Ignatov's theorem.
Ignatov's Theorem Rk , k
random vectors.
1, are independent and identically distributed
Proof Define a series of subsequences of the data sequence X1 , X2 , . . . by letting the ith subsequence consist of all data values that are at least as large as i, i 1. For instance, if the data sequence is 2, 5, 1, 6, 9, 8, 3, 4, 1, 5, 7, 8, 2, 1, 3, 4, 2, 5, 6, 1, . . .
156
3
Conditional Probability and Conditional Expectation
then the subsequences are as follows: 1: 2: 3: 2, 5, 1, 6, 9, 8, 3, 4, 1, 5, 7, 8, 2, 1, 3, 4, 2, 5, 6, 1, . . . 2, 5, 6, 9, 8, 3, 4, 5, 7, 8, 2, 3, 4, 2, 5, 6, . . . 5, 6, 9, 8, 3, 4, 5, 7, 8, 3, 4, 5, 6, . . .
and so on. i i Let Xj be the j th element of subsequence i. That is, Xj is the j th data value that is at least as large as i. An important observation is that i is a krecord value i if and only if Xk = i. That is, i will be a krecord value if and only if the kth value to be at least as large as i is equal to i. (For instance, for the preceding data, since the fifth value to be at least as large as 3 is equal to 3 it follows that 3 is a fiverecord value.) Now, it is not difficult to see that, independent of which values in the first subsequence are equal to 1, the values in the second subsequence are independent and identically distributed according to the mass function P {value in second subsequence = j } = P {X = j X 2}, j 2
Similarly, independent of which values in the first subsequence are equal to 1 and which values in the second subsequence are equal to 2, the values in the third subsequence are independent and identically distributed according to the mass function P {value in third subsequence = j } = P {X = j X
i and so on. It therefore follows that the events {Xj = i}, i pendent and
3}, 1, j
j
3 1, are inde
i P {i is a krecord value} = P {Xk = i} = P {X = iX
i}
i It now follows from the independence of the events {Xk = i}, i 1, and the fact that P {i is a krecord value} does not depend on k, that Rk has the same distribution for all k 1. In addition, it follows from the independence of the i events {Xk = 1}, that the random vectors Rk , k 1, are also independent.
Suppose now that the Xi , i 1 are independent finitevalued random variables with probability mass function pi = P {X = i}, and let T = min{n : Xi Xn for exactly k of the values i, i = 1, . . . , n} i = 1, . . . , m
denote the first krecord index. We will now determine its mean.
3.6.
Some Applications
157
Proposition 3.3 Let i = pi /
m j =i
pj , i = 1, . . . , m. Then
m1
E[T ] = k + (k  1)
i=1
i
Proof To begin, suppose that the observed random variables X1 X2 , . . . take
on one of the values i, i + 1, . . . , m with respective probabilities P {X = j } = pj , pi + + pm j = i, . . . , m
Let Ti denote the first krecord index when the observed data have the preceding mass function, and note that since the each data value is at least i it follows that the krecord value will equal i, and Ti will equal k, if Xk = i. As a result, E[Ti Xk = i] = k On the other hand, if Xk > i then the krecord value will exceed i, and so all data values equal to i can be disregarded when searching for the krecord value. In addition, since each data value greater than i will have probability mass function P {X = j X > i} = pj , pi+1 + + pm j = i + 1, . . . , m
it follows that the total number of data values greater than i that need be observed until a krecord value appears has the same distribution as Ti+1 . Hence, E[Ti Xk > i] = E[Ti+1 + Ni Xk > i] where Ti+1 is the total number of variables greater than i that we need observe to obtain a krecord, and Ni is the number of values equal to i that are observed in that time. Now, given that Xk > i and that Ti+1 = n (n k) it follows that the time to observe Ti+1 values greater than i has the same distribution as the number of trials to obtain n successes given that trial k is a success and that each trial is independently a success with probability 1  pi / j i pj = 1  i . Thus, since the number of trials needed to obtain a success is a geometric random variable with mean 1/(1  i ), we see that E[Ti Ti+1 , Xk > i] = 1 + Taking expectations gives that E[Ti Xk > i] = E Ti+1  i E[Ti+1 ]  i Xk > i = 1  i 1  i Ti+1  1 Ti+1  i = 1  i 1  i
158
3
Conditional Probability and Conditional Expectation
Thus, upon conditioning on whether Xk = i, we obtain E[Ti ] = E[Ti Xk = i]i + E[Ti Xk > i](1  i ) = (k  1)i + E[Ti+1 ] Starting with E[Tm ] = k, the preceding gives that E[Tm1 ] = (k  1)m1 + k E[Tm2 ] = (k  1)m2 + (k  1)m1 + k
m1
= (k  1)
j =m2
j + k
m1
E[Tm3 ] = (k  1)m3 + (k  1)
j =m2 m1
j + k
= (k  1)
j =m3
j + k
In general,
m1
E[Ti ] = (k  1)
j =i
j + k
and the result follows since T = T1 .
3.7.
An Identity for Compound Random Variables
Let X1 , X2 , . . . be a sequence of independent and identically distributed random variables, and let Sn = n Xi be the sum of the first n of them, n 0, where i=1 S0 = 0. Recall that if N is a nonnegative integer valued random variable that is independent of the sequence X1 , X2 , . . . then
N
SN =
i=1
Xi
is said to be a compound random variable, with the distribution of N called the compounding distribution. In this subsection we will first derive an identity involving such random variables. We will then specialize to where the Xi are positive integer valued random variables, prove a corollary of the identity, and then
3.7.
An Identity for Compound Random Variables
159
use this corollary to develop a recursive formula for the probability mass function of SN , for a variety of common compounding distributions. To begin, let M be a random variable that is independent of the sequence X1 , X2 , . . . , and which is such that P {M = n} = nP {N = n} , E[N ] n = 1, 2, . . .
Proposition 3.4 The Compound Random Variable Identity
For any function h E[SN h(SN )] = E[N ]E[X1 h(SM )]
Proof
N
E[SN h(SN )] = E[
i=1
Xi h(SN )]
N
=
n=0
E[
i=1 n
Xi h(SN )N = n]P {N = n}
(by conditioning on N ) =
n=0
E[
i=1 n
Xi h(Sn )N = n]P {N = n} Xi h(Sn )]P {N = n}
i=1
=
n=0
E[
(by independence of N and X1 , . . . , Xn )
n
=
n=0 i=1
E[Xi h(Sn )]P {N = n}
Now, because X1 , . . . , Xn are independent and identically distributed, and h(Sn ) = h(X1 + + Xn ) is a symmetric function of X1 , . . . , Xn , it follows that the distribution of Xi h(Sn ) is the same for all i = 1, . . . , n. Therefore, continuing the preceding string of equalities yields
E[SN h(SN )] =
n=0
nE[X1 h(Sn )]P {N = n}
= E[N ]
n=0
E[X1 h(Sn )]P {M = n}
(definition of M)
160
3
Conditional Probability and Conditional Expectation
= E[N]
n=0
E[X1 h(Sn )M = n]P {M = n}
(independence of M and X1 , . . . , Xn )
= E[N ]
n=0
E[X1 h(SM )M = n]P {M = n}
= E[N]E[X1 h(SM )] which proves the proposition. Suppose now that the Xi are positive integer valued random variables, and let j = P {X1 = j }, j >0
The successive values of P {SN = k} can often be obtained from the following corollary to Proposition 3.4.
Corollary 3.5
P {SN = 0} = P {N = 0} 1 P {SN = k} = E[N ] k
k
j j P {SM1 = k  j },
j =1
k>0
Proof For k fixed, let
h(x) = 1, 0, if x = k if x = k
and note that SN h(SN ) is either equal to k if SN = k or is equal to 0 otherwise. Therefore, E[SN h(SN )] = kP {SN = k} and the compound identity yields kP {SN = k} = E[N]E[X1 h(SM )]
= E[N]
j =1
E[X1 h(SM ))X1 = j ]j
3.7.
An Identity for Compound Random Variables
161
= E[N ]
j =1
j E[h(SM )X1 = j ]j
= E[N]
j =1
j P {SM = kX1 = j }j
(3.33)
Now,
M
P {SM = kX1 = j } = P
i=1
Xi = k X1 = j
M
=P j+
i=2 M
Xi = k X1 = j
=P j+
i=2
Xi = k
M1
=P j+
i=1
Xi = k
= P {SM1 = k  j } The next to last equality followed because X2 , . . . , XM and X1 , . . . , XM1 have the same joint distribution; namely that of M  1 independent random variables that all have the distribution of X1 , where M  1 is independent of these random variables. Thus the proof follows from Equation (3.33). When the distributions of M  1 and N are related, the preceding corollary can be a useful recursion for computing the probability mass function of SN , as is illustrated in the following subsections. 3.7.1. Poisson Compounding Distribution If N is the Poisson distribution with mean , then P {M  1 = n} = P {M = n + 1} = (n + 1)P {N = n + 1} E[N ]
162
3
Conditional Probability and Conditional Expectation
=
n+1 1 (n + 1)e (n + 1)! n n!
= e
Consequently, M  1 is also Poisson with mean . Thus, with Pn = P {SN = n} the recursion given by Corollary 3.5 can be written P0 = e Pk = k
k
j j Pkj ,
j =1
k>0
Remark When the Xi are identically 1, the preceding recursion reduces to the
wellknown identity for a Poisson random variable having mean : P {N = 0} = e P {N = n} = P {N = n  1}, n n 1
Example 3.30 Let S be a compound Poisson random variable with = 4 and
P {Xi = i} = 1/4, i = 1, 2, 3, 4
Let us use the recursion given by Corollary 3.5 to determine P {S = 5}. It gives P0 = e = e4 P1 = 1 P0 = e4 3 P2 = (1 P1 + 22 P0 ) = e4 2 2 13 P3 = (1 P2 + 22 P1 + 33 P0 ) = e4 3 6 73 P4 = (1 P3 + 22 P2 + 33 P1 + 44 P0 ) = e4 4 24 501 4 P5 = (1 P4 + 22 P3 + 33 P2 + 44 P1 + 55 P0 ) = e 5 120
3.7.
An Identity for Compound Random Variables
163
3.7.2. Binomial Compounding Distribution Suppose that N is a binomial random variable with parameters r and p. Then, P {M  1 = n} = = = = (n + 1)P {N = n + 1} E[N ] r n+1 p n+1 (1  p)rn1 rp n + 1 r! n+1 p n+1 (1  p)r1n rp (r  1  n)!(n + 1)! (r  1)! p n (1  p)r1n (r  1  n)!n!
Thus, M  1 is a binomial random variable with parameters r  1, p. Fixing p, let N(r) be a binomial random variable with parameters r and p, and let Pr (k) = P {SN (r) = k} Then, Corollary 3.5 yields that Pr (0) = (1  p)r rp Pr (k) = k
k
j j Pr1 (k  j ),
j =1
k>0
For instance, letting k equal 1, then 2, and then 3 gives Pr (1) = rp 1 (1  p)r1 rp [1 Pr1 (1) + 22 Pr1 (0)] Pr (2) = 2 rp 2 (r  1)p1 (1  p)r2 + 22 (1  p)r1 = 2 rp 1 Pr1 (2) + 22 Pr1 (1) + 33 Pr1 (0) Pr (3) = 3 1 rp (r  1)p 2 (r  2)p1 (1  p)r3 + 22 (1  p)r2 = 3 2 22 rp + (r  1)p 1 (1  p)r2 + 3 rp(1  p)r1 3
164
3
Conditional Probability and Conditional Expectation
3.7.3. A Compounding Distribution Related to the Negative Binomial Suppose, for a fixed value of p, 0 < p < 1, the compounding random variable N has a probability mass function P {N = n} = n+r 1 r p (1  p)n , r 1 n = 0, 1, . . .
Such a random variable can be thought of as being the number of failures that occur before a total of r successes have been amassed when each trial is independently a success with probability p. (There will be n such failures if the rth success occurs on trial n + r. Consequently, N + r is a negative binomial random variable with parameters r and p.) Using that the mean of the negative binomial random variable N + r is E[N + r] = r/p, we see that E[N ] = r 1p . p Regard p as fixed, and call N an NB(r) random variable. The random variable M  1 has probability mass function P {M  1 = n} = (n + 1)P {N = n + 1} E[N] (n + 1)p n + r r p (1  p)n+1 = r(1  p) r  1 (n + r)! r+1 p (1  p)n = r!n! n + r r+1 = p (1  p)n r
In other words, M  1 is an NB(r + 1) random variable. Letting, for an NB(r) random variable N , Pr (k) = P {SN = k} Corollary 3.5 yields that Pr (0) = p r Pr (k) = Thus, Pr (1) = r(1  p) 1 Pr+1 (0) p = rp r (1  p)1 , r(1  p) kp
k
j j Pr+1 (k  j ),
j =1
k>0
Exercises
165
Pr (2) = = Pr (3) = and so on.
r(1  p) 1 Pr+1 (1) + 22 Pr+1 (0) 2p r(1  p) 2 1 (r + 1)p r+1 (1  p) + 22 p r+1 2p r(1  p) 1 Pr+1 (2) + 22 Pr+1 (1) + 33 Pr+1 (0) 3p
Exercises
1. If X and Y are both discrete, show that pY (y) > 0.
x
pXY (xy) = 1 for all y such that
*2. Let X1 and X2 be independent geometric random variables having the same parameter p. Guess the value of P {X1 = iX1 + X2 = n} Hint: Suppose a coin having probability p of coming up heads is continually flipped. If the second head occurs on flip number n, what is the conditional probability that the first head was on flip number i, i = 1, . . . , n  1? Verify your guess analytically. 3. The joint probability mass function of X and Y , p(x, y), is given by p(1, 1) = 1 , 9 p(1, 2) = 1 , 9 p(1, 3) = 0, p(2, 1) = 1 , 3 p(2, 2) = 0, p(2, 3) = 1 , 6 p(3, 1) = 1 , 9 p(3, 2) = p(3, 3) =
1 18 , 1 9
Compute E[XY = i] for i = 1, 2, 3. 4. In Exercise 3, are the random variables X and Y independent? 5. An urn contains three white, six red, and five black balls. Six of these balls are randomly selected from the urn. Let X and Y denote respectively the number of white and black balls selected. Compute the conditional probability mass function of X given that Y = 3. Also compute E[XY = 1]. *6. Repeat Exercise 5 but under the assumption that when a ball is selected its color is noted, and it is then replaced in the urn before the next selection is made.
166
3
Conditional Probability and Conditional Expectation
7. Suppose p(x, y, z), the joint probability mass function of the random variables X, Y , and Z, is given by p(1, 1, 1) = 1 , 8 p(1, 1, 2) = 1 , 8 p(1, 2, 1) =
1 16 ,
p(2, 1, 1) = 1 , 4 p(2, 1, 2) = p(2, 2, 2) =
3 16 ,
p(2, 2, 1) = 0,
1 4
p(1, 2, 2) = 0,
What is E[XY = 2]? What is E[XY = 2, Z = 1]? 8. An unbiased die is successively rolled. Let X and Y denote, respectively, the number of rolls necessary to obtain a six and a five. Find (a) E[X], (b) E[XY = 1], (c) E[XY = 5]. 9. Show in the discrete case that if X and Y are independent, then E[XY = y] = E[X] for all y
10. Suppose X and Y are independent continuous random variables. Show that E[XY = y] = E[X] 11. The joint density of X and Y is f (x, y) = (y 2  x 2 ) y e , 8 0 < y < , y x y for all y
Show that E[XY = y] = 0. 12. The joint density of X and Y is given by f (x, y) = ex/y ey , y 0 < x < , 0<y<
Show E[XY = y] = y. *13. Let X be exponential with mean 1/; that is, fX (x) = ex , 0<x<
Find E[XX > 1]. 14. Let X be uniform over (0, 1). Find E[XX < 1 ]. 2 15. The joint density of X and Y is given by f (x, y) = Compute E[X 2 Y = y]. ey , y 0 < x < y, 0<y<
Exercises
167
16. The random variables X and Y are said to have a bivariate normal distribution if their joint density function is given by 1 1 exp  f (x, y) = 2 2(1  2 ) 2x y 1  x  x x
2

2(x  x )(y  y ) y  y + x y y
2
for  < x < ,  < y < , where x , y , x , y , and are constants such that 1 < < 1, x > 0, y > 0,  < x < ,  < y < .
2 (a) Show that X is normally distributed with mean x and variance x , and 2. Y is normally distributed with mean y and variance y (b) Show that the conditional density of X given that Y = y is normal with 2 mean x + (x /y )(y  y ) and variance x (1  2 ).
The quantity is called the correlation between X and Y . It can be shown that = = E[(X  x )(Y  y )] x y Cov(X, Y ) x y
17. Let Y be a gamma random variable with parameters (s, ). That is, its density is fY (y) = Cey y s1 , y>0
where C is a constant that does not depend on y. Suppose also that the conditional distribution of X given that Y = y is Poisson with mean y. That is, P {X = iY = y} = ey y i /i!, i 0
Show that the conditional distribution of Y given that X = i is the gamma distribution with parameters (s + i, + 1). 18. Let X1 , . . . , Xn be independent random variables having a common distribution function that is specified up to an unknown parameter . Let T = T (X) be a function of the data X = (X1 , . . . , Xn ). If the conditional distribution of X1 , . . . , Xn given T (X) does not depend on then T (X) is said to be a sufficient statistic for . In the following cases, show that T (X) = n Xi is a sufficient i=1 statistic for .
168 (a) (b) (c) (d)
3
Conditional Probability and Conditional Expectation
The Xi are normal with mean and variance 1. The density of Xi is f (x) = ex , x > 0. The mass function of Xi is p(x) = x (1  )1x , x = 0, 1, 0 < < 1. The Xi are Poisson random variables with mean .

*19. Prove that if X and Y are jointly continuous, then E[X] = E[XY = y]fY (y) dy
20. An individual whose level of exposure to a certain pathogen is x will contract the disease caused by this pathogen with probability P (x). If the exposure level of a randomly chosen member of the population has probability density function f , determine the conditional probability density of the exposure level of that member given that he or she (a) has the disease. (b) does not have the disease. (c) Show that when P (x) increases in x, then the ratio of the density of part (a) to that of part (b) also increases in x. 21. Consider Example 3.12 which refers to a miner trapped in a mine. Let N denote the total number of doors selected before the miner reaches safety. Also, let Ti denote the travel time corresponding to the ith choice, i 1. Again let X denote the time when the miner reaches safety. (a) (b) (c) (d) (e) Give an identity that relates X to N and the Ti . What is E[N]? What is E[TN ]? What is E[ N Ti N = n]? i=1 Using the preceding, what is E[X]?
22. Suppose that independent trials, each of which is equally likely to have any of m possible outcomes, are performed until the same outcome occurs k consecutive times. If N denotes the number of trials, show that E[N ] = mk  1 m1
Some people believe that the successive digits in the expansion of = 3.14159 . . . are "uniformly" distributed. That is, they believe that these digits have all the appearance of being independent choices from a distribution that is equally likely to be any of the digits from 0 through 9. Possible evidence against this hypothesis is the fact that starting with the 24,658,601st digit there is a run of nine successive 7s. Is this information consistent with the hypothesis of a uniform distribution? To answer this, we note from the preceding that if the uniform hypothesis were correct, then the expected number of digits until a run of nine of the same
Exercises
169
value occurs is (109  1)/9 = 111,111,111 Thus, the actual value of approximately 25 million is roughly 22 percent of the theoretical mean. However, it can be shown that under the uniformity assumption the standard deviation of N will be approximately equal to the mean. As a result, the observed value is approximately 0.78 standard deviations less than its theoretical mean and is thus quite consistent with the uniformity assumption. *23. A coin having probability p of coming up heads is successively flipped until two of the most recent three flips are heads. Let N denote the number of flips. (Note that if the first two flips are heads, then N = 2.) Find E[N ]. 24. A coin, having probability p of landing heads, is continually flipped until at least one head and one tail have been flipped. (a) Find the expected number of flips needed. (b) Find the expected number of flips that land on heads. (c) Find the expected number of flips that land on tails. (d) Repeat part (a) in the case where flipping is continued until a total of at least two heads and one tail have been flipped. 25. A gambler wins each game with probability p. In each of the following cases, determine the expected total number of wins. (a) The gambler will play n games; if he wins X of these games, then he will play an additional X games before stopping. (b) The gambler will play until he wins; if it takes him Y games to get this win, then he will play an additional Y games. 26. You have two opponents with whom you alternate play. Whenever you play A, you win with probability pA ; whenever you play B, you win with probability pB , where pB > pA . If your objective is to minimize the number of games you need to play to win two in a row, should you start with A or with B? Hint: Let E[Ni ] denote the mean number of games needed if you initially play i. Derive an expression for E[NA ] that involves E[NB ]; write down the equivalent expression for E[NB ] and then subtract. 27. A coin that comes up heads with probability p is continually flipped until the pattern T, T, H appears. (That is, you stop flipping when the most recent flip lands heads, and the two immediately preceding it lands tails.) Let X denote the number of flips made, and find E[X]. 28. Polya's urn model supposes that an urn initially contains r red and b blue balls. At each stage a ball is randomly selected from the urn and is then returned along with m other balls of the same color. Let Xk be the number of red balls drawn in the first k selections.
170
3
Conditional Probability and Conditional Expectation
(a) Find E[X1 ]. (b) Find E[X2 ]. (c) Find E[X3 ]. (d) Conjecture the value of E[Xk ], and then verify your conjecture by a conditioning argument. (e) Give an intuitive proof for your conjecture. Hint: Number the initial r red and b blue balls, so the urn contains one type i red ball, for each i = 1, . . . , r; as well as one type j blue ball, for each j = 1, . . . , b. Now suppose that whenever a red ball is chosen it is returned along with m others of the same type, and similarly whenever a blue ball is chosen it is returned along with m others of the same type. Now, use a symmetry argument to determine the probability that any given selection is red. 29. Two players take turns shooting at a target, with each shot by player i hitting the target with probability pi , i = 1, 2. Shooting ends when two consecutive shots hit the target. Let i denote the mean number of shots taken when player i shoots first, i = 1, 2. (a) Find 1 and 2 . (b) Let hi denote the mean number of times that the target is hit when player i shoots first, i = 1, 2. Find h1 and h2 . 30. Let Xi , i 0 be independent and identically distributed random variables with probability mass function
m
p(j ) = P {Xi = j },
j = 1, . . . , m,
j =1
P (j ) = 1
Find E[N], where N = min{n > 0 : Xn = X0 }. 31. Each element in a sequence of binary data is either 1 with probability p or 0 with probability 1  p. A maximal subsequence of consecutive values having identical outcomes is called a run. For instance, if the outcome sequence is 1, 1, 0, 1, 1, 1, 0, the first run is of length 2, the second is of length 1, and the third is of length 3. (a) Find the expected length of the first run. (b) Find the expected length of the second run. 32. Independent trials, each resulting in success with probability p, are performed. (a) Find the expected number of trials needed for there to have been both at least n successes and at least m failures.
Exercises
171
Hint: Is it useful to know the result of the first n + m trials? (b) Find the expected number of trials needed for there to have been either at least n successes and at least m failures. Hint: Make use of the result from part (a). 33. If Ri denotes the random amount that is earned in period i, then i1 Ri , i=1 where 0 < < 1 is a specified constant, is called the total discounted reward with discount factor . Let T be a geometric random variable with parameter 1  that is independent of the Ri . Show that the expected total discounted reward is equal to the expected total (undiscounted) reward earned by time T . That is, show that
T
E
i=1
i1 Ri = E
i=1
Ri
34. A set of n dice is thrown. All those that land on six are put aside, and the others are again thrown. This is repeated until all the dice have landed on six. Let N denote the number of throws needed. (For instance, suppose that n = 3 and that on the initial throw exactly two of the dice land on six. Then the other die will be thrown, and if it lands on six, then N = 2.) Let mn = E[N ]. (a) Derive a recursive formula for mn and use it to calculate mi , i = 2, 3, 4 and to show that m5 13.024. (b) Let Xi denote the number of dice rolled on the ith throw. Find E[ N Xi ]. i=1 35. Consider n multinomial trials, where each trial independently results in outcome i with probability pi , k pi = 1. With Xi equal to the number of trials i=1 that result in outcome i, find E[X1 X2 > 0]. 36. Let p0 = P {X = 0} and suppose that 0 < p0 < 1. Let = E[X] and 2 = Var(X). Find (a) E[XX = 0] and (b) Var(XX = 0). 37. A manuscript is sent to a typing firm consisting of typists A, B, and C. If it is typed by A, then the number of errors made is a Poisson random variable with mean 2.6; if typed by B, then the number of errors is a Poisson random variable with mean 3; and if typed by C, then it is a Poisson random variable with mean 3.4. Let X denote the number of errors in the typed manuscript. Assume that each typist is equally likely to do the work. (a) Find E[X]. (b) Find Var(X). 38. Let U be a uniform (0, 1) random variable. Suppose that n trials are to be performed and that conditional on U = u these trials will be independent with a
172
3
Conditional Probability and Conditional Expectation
common success probability u. Compute the mean and variance of the number of successes that occur in these trials. 39. A deck of n cards, numbered 1 through n, is randomly shuffled so that all n! possible permutations are equally likely. The cards are then turned over one at a time until card number 1 appears. These upturned cards constitute the first cycle. We now determine (by looking at the upturned cards) the lowest numbered card that has not yet appeared, and we continue to turn the cards face up until that card appears. This new set of cards represents the second cycle. We again determine the lowest numbered of the remaining cards and turn the cards until it appears, and so on until all cards have been turned over. Let mn denote the mean number of cycles. (a) Derive a recursive formula for mn in terms of mk , k = 1, . . . , n  1. (b) Starting with m0 = 0, use the recursion to find m1 , m2 , m3 , and m4 . (c) Conjecture a general formula for mn . (d) Prove your formula by induction on n. That is, show it is valid for n = 1, then assume it is true for any of the values 1, . . . , n  1 and show that this implies it is true for n. (e) Let Xi equal 1 if one of the cycles ends with card i, and let it equal 0 otherwise, i =1, . . . , n. Express the number of cycles in terms of these Xi . (f) Use the representation in part (e) to determine mn . (g) Are the random variables X1 , . . . , Xn independent? Explain. (h) Find the variance of the number of cycles. 40. A prisoner is trapped in a cell containing three doors. The first door leads to a tunnel that returns him to his cell after two days of travel. The second leads to a tunnel that returns him to his cell after three days of travel. The third door leads immediately to freedom. (a) Assuming that the prisoner will always select doors 1, 2, and 3 with probabilities 0.5, 0.3, 0.2, what is the expected number of days until he reaches freedom? (b) Assuming that the prisoner is always equally likely to choose among those doors that he has not used, what is the expected number of days until he reaches freedom? (In this version, for instance, if the prisoner initially tries door 1, then when he returns to the cell, he will now select only from doors 2 and 3.) (c) For parts (a) and (b) find the variance of the number of days until the prisoner reaches freedom. 41. A rat is trapped in a maze. Initially it has to choose one of two directions. If it goes to the right, then it will wander around in the maze for three minutes and will then return to its initial position. If it goes to the left, then with probability 1 3 it will depart the maze after two minutes of traveling, and with probability 2 it 3
Exercises
173
will return to its initial position after five minutes of traveling. Assuming that the rat is at all times equally likely to go to the left or the right, what is the expected number of minutes that it will be trapped in the maze? 42. A total of 11 people, including you, are invited to a party. The times at which people arrive at the party are independent uniform (0, 1) random variables. (a) Find the expected number of people who arrive before you. (b) Find the variance of the number of people who arrive before you. 43. The number of claims received at an insurance company during a week is a 2 random variable with mean 1 and variance 1 . The amount paid in each claim is 2 a random variable with mean 2 and variance 2 . Find the mean and variance of the amount of money paid by the insurance company each week. What independence assumptions are you making? Are these assumptions reasonable? 44. The number of customers entering a store on a given day is Poisson distributed with mean = 10. The amount of money spent by a customer is uniformly distributed over (0, 100). Find the mean and variance of the amount of money that the store takes in on a given day. 45. An individual traveling on the real line is trying to reach the origin. However, the larger the desired step, the greater is the variance in the result of that step. Specifically, whenever the person is at location x, he next moves to a location having mean 0 and variance x 2 . Let Xn denote the position of the individual after having taken n steps. Supposing that X0 = x0 , find (a) E[Xn ]; (b) Var(Xn ). 46. (a) Show that Cov(X, Y ) = Cov(X, E[Y  X]) (b) Suppose, that, for constants a and b, E[Y  X] = a + bX Show that b = Cov(X, Y )/Var(X) *47. If E[Y  X] = 1, show that Var(X Y ) Var(X)
174
3
Conditional Probability and Conditional Expectation
48. Give another proof of the result of Example 3.17 by computing the moment generating function of N Xi and then differentiating to obtain its moments. i=1 Hint: Let
N
(t) = E exp t
i=1
Xi
N
= E E exp t
i=1
Xi
N
Now,
N n
E exp t
i=1
Xi
N = n = E exp t
i=1
Xi
= (X (t))n
since N is independent of the Xs where X (t) = E[etX ] is the moment generating function for the Xs. Therefore, (t) = E (X (t))N Differentiation yields (t) = E N(X (t))N 1 X (t) , (t) = E N(N  1)(X (t))N 2 (X (t))2 + N (X (t))N 1 X (t) Evaluate at t = 0 to get the desired result. 49. A and B play a series of games with A winning each game with probability p. The overall winner is the first player to have won two more games than the other. (a) Find the probability that A is the overall winner. (b) Find the expected number of games played. 50. There are three coins in a barrel. These coins, when flipped, will come up heads with respective probabilities 0.3, 0.5, 0.7. A coin is randomly selected from among these three and is then flipped ten times. Let N be the number of heads obtained on the ten flips. Find (a) P {N = 0}. (b) P {N = n}, n = 0, 1, . . . , 10. (c) Does N have a binomial distribution? (d) If you win $1 each time a head appears and you lose $1 each time a tail appears, is this a fair game? Explain.
Exercises
175
51. Do Exercise 50 under the assumption that each time a coin is flipped, it is then put back in the barrel and another coin is randomly selected. Does N have a binomial distribution now? 52. Suppose that X and Y are independent random variables with probability density functions fX and fY . Determine a onedimensional integral expression for P {X + Y < x}. *53. Suppose X is a Poisson random variable with mean . The parameter is itself a random variable whose distribution is exponential with mean 1. Show that P {X = n} = ( 1 )n+1 . 2 54. A coin is randomly selected from a group of ten coins, the nth coin having a probability n/10 of coming up heads. The coin is then repeatedly flipped until a head appears. Let N denote the number of flips necessary. What is the probability distribution of N ? Is N a geometric random variable? When would N be a geometric random variable; that is, what would have to be done differently? 55. Suppose in Exercise 42 that, aside from yourself, the number of other people who are invited is a Poisson random variable with mean 10. (a) Find the expected number of people who arrive before you. (b) Find the probability that you are the nth person to arrive. 56. Data indicate that the number of traffic accidents in Berkeley on a rainy day is a Poisson random variable with mean 9, whereas on a dry day it is a Poisson random variable with mean 3. Let X denote the number of traffic accidents tomorrow. If it will rain tomorrow with probability 0.6, find (a) E[X]; (b) P {X = 0}; (c) Var(X). 57. The number of storms in the upcoming rainy season is Poisson distributed but with a parameter value that is uniformly distributed over (0, 5). That is, is uniformly distributed over (0, 5), and given that = , the number of storms is Poisson with mean . Find the probability there are at least three storms this season. 58. A collection of n coins is flipped. The outcomes are independent, and the ith coin comes up heads with probability i , i = 1, . . . , n. Suppose that for some value of j, 1 j n, j = 1 . Find the probability that the total number of heads 2 to appear on the n coins is an even number. 59. Let A and B be mutually exclusive events of an experiment. If independent replications of the experiment are continually performed, what is the probability that A occurs before B? *60. Two players alternate flipping a coin that comes up heads with probability p. The first one to obtain a head is declared the winner. We are interested in
176
3
Conditional Probability and Conditional Expectation
the probability that the first player to flip is the winner. Before determining this probability, which we will call f (p), answer the following questions. (a) Do you think that f (p) is a monotone function of p? If so, is it increasing or decreasing? (b) What do you think is the value of limp1 f (p)? (c) What do you think is the value of limp0 f (p)? (d) Find f (p). 61. Suppose in Exercise 29 that the shooting ends when the target has been hit twice. Let mi denote the mean number of shots needed for the first hit when player i shoots first, i = 1, 2. Also, let Pi , i = 1, 2, denote the probability that the first hit is by player 1, when player i shoots first. (a) Find m1 and m2 . (b) Find P1 and P2 . For the remainder of the problem, assume that player 1 shoots first. (c) (d) (e) (f) Find the probability that the final hit was by 1. Find the probability that both hits were by 1. Find the probability that both hits were by 2. Find the mean number of shots taken.
62. A, B, and C are evenly matched tennis players. Initially A and B play a set, and the winner then plays C. This continues, with the winner always playing the waiting player, until one of the players has won two sets in a row. That player is then declared the overall winner. Find the probability that A is the overall winner. 63. Suppose there are n types of coupons, and that the type of each new coupon obtained is independent of past selections and is equally likely to be any of the n types. Suppose one continues collecting until a complete set of at least one of each type is obtained. (a) Find the probability that there is exactly one type i coupon in the final collection. Hint: Condition on T , the number of types that are collected before the first type i appears. (b) Find the expected number of types that appear exactly once in the final collection. 64. A and B roll a pair of dice in turn, with A rolling first. A's objective is to obtain a sum of 6, and B's is to obtain a sum of 7. The game ends when either player reaches his or her objective, and that player is declared the winner. (a) Find the probability that A is the winner.
Exercises
177
(b) Find the expected number of rolls of the dice. (c) Find the variance of the number of rolls of the dice. 65. The number of red balls in an urn that contains n balls is a random variable that is equally likely to be any of the values 0, 1, . . . , n. That is, P {i red, n  i nonred} = 1 , n+1 i = 0, . . . , n
The n balls are then randomly removed one at a time. Let Yk denote the number of red balls in the first k selections, k = 1, . . . , n. (a) Find P {Yn = j }, j = 0, . . . , n. (b) Find P {Yn1 = j }, j = 0, . . . , n. (c) What do you think is the value of P {Yk = j }, j = 0, . . . , n? (d) Verify your answer to part (c) by a backwards induction argument. That is, check that your answer is correct when k = n, and then show that whenever it is true for k it is also true for k  1, k = 1, . . . , n. 66. The opponents of soccer team A are of two types: either they are a class 1 or a class 2 team. The number of goals team A scores against a class i opponent is a Poisson random variable with mean i , where 1 = 2, 2 = 3. This weekend the team has two games against teams they are not very familiar with. Assuming that the first team they play is a class 1 team with probability 0.6 and the second is, independently of the class of the first team, a class 1 team with probability 0.3, determine (a) the expected number of goals team A will score this weekend. (b) the probability that team A will score a total of five goals. *67. A coin having probability p of coming up heads is continually flipped. Let Pj (n) denote the probability that a run of j successive heads occurs within the first n flips. (a) Argue that Pj (n) = Pj (n  1) + p j (1  p)[1  Pj (n  j  1)] (b) By conditioning on the first nonhead to appear, derive another equation relating Pj (n) to the quantities Pj (n  k), k = 1, . . . , j . 68. In a knockout tennis tournament of 2n contestants, the players are paired and play a match. The losers depart, the remaining 2n1 players are paired, and they play a match. This continues for n rounds, after which a single player remains unbeaten and is declared the winner. Suppose that the contestants are numbered 1 through 2n , and that whenever two players contest a match, the lower numbered one wins with probability p. Also suppose that the pairings of the remaining players are always done at random so that all possible pairings for that round are equally likely.
178
3
Conditional Probability and Conditional Expectation
(a) What is the probability that player 1 wins the tournament? (b) What is the probability that player 2 wins the tournament? Hint: Imagine that the random pairings are done in advance of the tournament. That is, the firstround pairings are randomly determined; the 2n1 firstround pairs are then themselves randomly paired, with the winners of each pair to play in round 2; these 2n2 groupings (of four players each) are then randomly paired, with the winners of each grouping to play in round 3, and so on. Say that players i and j are scheduled to meet in round k if, provided they both win their first k  1 matches, they will meet in round k. Now condition on the round in which players 1 and 2 are scheduled to meet. 69. In the match problem, say that (i, j ), i < j , is a pair if i chooses j 's hat and j chooses i's hat. (a) Find the expected number of pairs. (b) Let Qn denote the probability that there are no pairs, and derive a recursive formula for Qn in terms of Qj , j < n. Hint: Use the cycle concept. (c) Use the recursion of part (b) to find Q8 . 70. Let N denote the number of cycles that result in the match problem. (a) Let Mn = E[N], and derive an equation for Mn in terms of M1 , . . . , Mn1 . (b) Let Cj denote the size of the cycle that contains person j . Argue that
n
N=
j =1
1/Cj
and use the preceding to determine E[N]. (c) Find the probability that persons 1, 2, . . . , k are all in the same cycle. (d) Find the probability that 1, 2, . . . , k is a cycle. 71. Use the equation following (3.14) to obtain Equation (3.10). Hint: First multiply both sides of Equation (3.14) by n, then write a new equation by replacing n with n  1, and then subtract the former from the latter. 72. In Example 3.25 show that the conditional distribution of N given that U1 = y is the same as the conditional distribution of M given that U1 = 1  y. Also, show that E[NU1 = y] = E[MU1 = 1  y] = 1 + ey
Exercises
179
Figure 3.7.
*73. Suppose that we continually roll a die until the sum of all throws exceeds 100. What is the most likely value of this total when you stop? 74. There are five components. The components act independently, with component i working with probability pi , i = 1, 2, 3, 4, 5. These components form a system as shown in Figure 3.7. The system is said to work if a signal originating at the left end of the diagram can reach the right end, where it can pass through a component only if that component is working. (For instance, if components 1 and 4 both work, then the system also works.) What is the probability that the system works? 75. This problem will present another proof of the ballot problem of Example 3.24. (a) Argue that Pn,m = 1  P {A and B are tied at some point} (b) Explain why P {A receives first vote and they are eventually tied} = P {B receives first vote and they are eventually tied} Hint: Any outcome in which they are eventually tied with A receiving the first vote corresponds to an outcome in which they are eventually tied with B receiving the first vote. Explain this correspondence. (c) Argue that P {eventually tied} = 2m/(n + m), and conclude that Pn,m = (n  m)/(n + m). 76. Consider a gambler who on each bet either wins 1 with probability 18/38 or loses 1 with probability 20/38. (These are the probabilities if the bet is that a roulette wheel will land on a specified color.) The gambler will quit either when he or she is winning a total of 5 or after 100 plays. What is the probability he or she plays exactly 15 times?
180
3
Conditional Probability and Conditional Expectation
77. Show that (a) E[XY Y = y] = yE[XY = y] (b) E[g(X, Y )Y = y] = E[g(X, y)Y = y] (c) E[XY ] = E[Y E[XY ]] 78. In the ballot problem (Example 3.24), compute P {A is never behind}. 79. An urn contains n white and m black balls which are removed one at a time. If n > m, show that the probability that there are always more white than black balls in the urn (until, of course, the urn is empty) equals (n  m)/(n + m). Explain why this probability is equal to the probability that the set of withdrawn balls always contains more white than black balls. [This latter probability is (n  m)/(n + m) by the ballot problem.] 80. A coin that comes up heads with probability p is flipped n consecutive times. What is the probability that starting with the first flip there are always more heads than tails that have appeared? 81. Let Xi , i fine N by 1, be independent uniform (0, 1) random variables, and deN = min{n: Xn < Xn1 } where X0 = x. Let f (x) = E[N ]. (a) (b) (c) (d) Derive an integral equation for f (x) by conditioning on X1 . Differentiate both sides of the equation derived in part (a). Solve the resulting equation obtained in part (b). For a second approach to determining f (x) argue that P {N (e) Use part (d) to obtain f (x). 82. Let X1 , X2 , . . . be independent continuous random variables with a common distribution function F and density f = F , and for k 1 let Nk = min{n k: Xn = kth largest of X1 , . . . , Xn }
k1 n(n1) , n
k} =
(1  x)k1 (k  1)!
(a) Show that P {Nk = n} = (b) Argue that
k.
i=0
fXNk (x) = f (x)(F (x))k1
i +k2 (F (x))i i
Exercises
181
(c) Prove the following identity:
a
1k
=
i=0
i +k2 (1  a)i , i
0 < a < 1, k
2
Hint: Use induction. First prove it when k = 2, and then assume it for k. To prove it for k + 1, use the fact that
i=1
i +k1 (1  a)i = i
i=1
i +k2 (1  a)i i i +k2 (1  a)i i 1
+
i=1
where the preceding used the combinatorial identity m m1 m1 = + i i i 1 Now, use the induction hypothesis to evaluate the first term on the right side of the preceding equation. (d) Conclude that XNk has distribution F . 83. An urn contains n balls, with ball i having weight wi , i = 1, . . . , n. The balls are withdrawn from the urn one at a time according to the following scheme: When S is the set of balls that remains, ball i, i S, is the next ball withdrawn with probability wi / j S wj . Find the expected number of balls that are withdrawn before ball i, i = 1, . . . , n. 84. In the list example of Section 3.6.1 suppose that the initial ordering at time t = 0 is determined completely at random; that is, initially all n! permutations are equally likely. Following the frontoftheline rule, compute the expected position of the element requested at time t. Hint: To compute P {ej precedes ei at time t} condition on whether or not either ei or ej has ever been requested prior to t. 85. In the list problem, when the Pi are known, show that the best ordering (best in the sense of minimizing the expected position of the element requested) is to place the elements in decreasing order of their probabilities. That is, if P1 > P2 > > Pn , show that 1, 2, . . . , n is the best ordering. 86. Consider the random graph of Section 3.6.2 when n = 5. Compute the probability distribution of the number of components and verify your solution by using
182
3
Conditional Probability and Conditional Expectation
it to compute E[C]and then comparing your solution with
5
E[C] =
k=1
5 (k  1)! k 5k
87.
(a) From the results of Section 3.6.3 we can conclude that there are nonnegative integer valued solutions of the equation x1 + +xm = n. Prove this directly. (b) How many positive integer valued solutions of x1 + + xm = n are there?
n+m1 m1
Hint: Let yi = xi  1. (c) For the BoseEinstein distribution, compute the probability that exactly k of the Xi are equal to 0. 88. In Section 3.6.3, we saw that if U is a random variable that is uniform on (0, 1) and if, conditional on U = p, X is binomial with parameters n and p, then P {X = i} = 1 , n+1 i = 0, 1, . . . , n
For another way of showing this result, let U, X1 , X2 , . . . , Xn be independent uniform (0, 1) random variables. Define X by X = #i: Xi < U That is, if the n + 1 variables are ordered from smallest to largest, then U would be in position X + 1. (a) What is P {X = i}? (b) Explain how this proves the result of Exercise 88. 89. Let I1 , . . . , In be independent random variables, each of which is equally likely to be either 0 or 1. A wellknown nonparametric statistical test (called the signed rank test) is concerned with determining Pn (k) defined by n j Ij k Pn (k) = P
j =1
Justify the following formula: Pn (k) = 1 Pn1 (k) + 1 Pn1 (k  n) 2 2 90. The number of accidents in each period is a Poisson random variable with mean 5. With Xn , n 1, equal to the number of accidents in period n, find E[N ] when
Exercises
183
(a) N = min(n: Xn2 = 2, Xn1 = 1, Xn = 0); (b) N = min(n: Xn3 = 2, Xn2 = 1, Xn1 = 0, Xn = 2). 91. Find the expected number of flips of a coin, which comes up heads with probability p, that are necessary to obtain the pattern h, t, h, h, t, h, t, h. 92. The number of coins that Josh spots when walking to work is a Poisson random variable with mean 6. Each coin is equally likely to be a penny, a nickel, a dime, or a quarter. Josh ignores the pennies but picks up the other coins. (a) Find the expected amount of money that Josh picks up on his way to work. (b) Find the variance of the amount of money that Josh picks up on his way to work. (c) Find the probability that Josh picks up exactly 25 cents on his way to work. *93. Consider a sequence of independent trials, each of which is equally likely to result in any of the outcomes 0, 1, . . . , m. Say that a round begins with the first trial, and that a new round begins each time outcome 0 occurs. Let N denote the number of trials that it takes until all of the outcomes 1, . . . , m  1 have occurred in the same round. Also, let Tj denote the number of trials that it takes until j distinct outcomes have occurred, and let Ij denote the j th distinct outcome to occur. (Therefore, outcome Ij first occurs at trial Tj .) (a) Argue that the random vectors (I1 , . . . , Im ) and (T1 , . . . , Tm ) are independent. (b) Define X by letting X = j if outcome 0 is the j th distinct outcome to occur. (Thus, IX = 0.) Derive an equation for E[N ] in terms of E[Tj ], j = 1, . . . , m  1 by conditioning on X. (c) Determine E[Tj ], j = 1, . . . , m  1. Hint: See Exercise 42 of Chapter 2. (d) Find E[N ]. 94. Let N be a hypergeometric random variable having the distribution of the number of white balls in a random sample of size r from a set of w white and b blue balls. That is, P {N = n} = where we use the convention that
m j w n b rn w+b r
= 0 if either j < 0 or j > m. Now, consider
a compound random variable SN = N Xi , where the Xi are positive integer i=1 valued random variables with j = P {Xi = j }.
184
3
Conditional Probability and Conditional Expectation
(a) With M as defined as in Section 3.7, find the distribution of M  1. (b) Suppressing its dependence on b, let Pw,r (k) = P {SN = k}, and derive a recursion equation for Pw,r (k). (c) Use the recursion of (b) to find Pw,r (2).
Markov Chains
4
4.1. Introduction
In this chapter, we consider a stochastic process {Xn , n = 0, 1, 2, . . .} that takes on a finite or countable number of possible values. Unless otherwise mentioned, this set of possible values of the process will be denoted by the set of nonnegative integers {0, 1, 2, . . .}. If Xn = i, then the process is said to be in state i at time n. We suppose that whenever the process is in state i, there is a fixed probability Pij that it will next be in state j . That is, we suppose that P {Xn+1 = j Xn = i, Xn1 = in1 , . . . , X1 = i1 , X0 = i0 } = Pij (4.1) for all states i0 , i1 , . . . , in1 , i, j and all n 0. Such a stochastic process is known as a Markov chain. Equation (4.1) may be interpreted as stating that, for a Markov chain, the conditional distribution of any future state Xn+1 given the past states X0 , X1 , . . . , Xn1 and the present state Xn , is independent of the past states and depends only on the present state. The value Pij represents the probability that the process will, when in state i, next make a transition into state j . Since probabilities are nonnegative and since the process must make a transition into some state, we have that
Pij
0,
i, j
0;
j =0
Pij = 1,
i = 0, 1, . . .
Let P denote the matrix of onestep transition probabilities Pij , so that P00 P10 . . P= . Pi0 . . . P01 P11 . . . Pi1 . . . P02 P12 . . . Pi2 . . .
185
186
4
Markov Chains
Example 4.1 (Forecasting the Weather) Suppose that the chance of rain tomorrow depends on previous weather conditions only through whether or not it is raining today and not on past weather conditions. Suppose also that if it rains today, then it will rain tomorrow with probability ; and if it does not rain today, then it will rain tomorrow with probability . If we say that the process is in state 0 when it rains and state 1 when it does not rain, then the preceding is a twostate Markov chain whose transition probabilities are given by P= 1 1
Example 4.2 (A Communications System) Consider a communications system which transmits the digits 0 and 1. Each digit transmitted must pass through several stages, at each of which there is a probability p that the digit entered will be unchanged when it leaves. Letting Xn denote the digit entering the nth stage, then {Xn , n = 0, 1, . . .} is a twostate Markov chain having a transition probability matrix P= p 1p 1p p
Example 4.3 On any given day Gary is either cheerful (C), soso (S), or glum
(G). If he is cheerful today, then he will be C, S, or G tomorrow with respective probabilities 0.5, 0.4, 0.1. If he is feeling soso today, then he will be C, S, or G tomorrow with probabilities 0.3, 0.4, 0.3. If he is glum today, then he will be C, S, or G tomorrow with probabilities 0.2, 0.3, 0.5. Letting Xn denote Gary's mood on the nth day, then {Xn , n 0} is a threestate Markov chain (state 0 = C, state 1 = S, state 2 = G) with transition probability matrix 0.5 P = 0.3 0.2 0.4 0.4 0.3 0.1 0.3 0.5
Example 4.4 (Transforming a Process into a Markov Chain) Suppose that
whether or not it rains today depends on previous weather conditions through the last two days. Specifically, suppose that if it has rained for the past two days, then it will rain tomorrow with probability 0.7; if it rained today but not yesterday, then it will rain tomorrow with probability 0.5; if it rained yesterday but not today, then it will rain tomorrow with probability 0.4; if it has not rained in the past two days, then it will rain tomorrow with probability 0.2.
4.1.
Introduction
187
If we let the state at time n depend only on whether or not it is raining at time n, then the preceding model is not a Markov chain (why not?). However, we can transform this model into a Markov chain by saying that the state at any time is determined by the weather conditions during both that day and the previous day. In other words, we can say that the process is in state 0 state 1 state 2 state 3 if it rained both today and yesterday, if it rained today but not yesterday, if it rained yesterday but not today, if it did not rain either yesterday or today.
The preceding would then represent a fourstate Markov chain having a transition probability matrix 0.7 0.5 P= 0 0 0 0 0.4 0.2 0.3 0.5 0 0 0 0 0.6 0.8
You should carefully check the matrix P, and make sure you understand how it was obtained.
Example 4.5 (A Random Walk Model) A Markov chain whose state space is given by the integers i = 0, 1, 2, . . . is said to be a random walk if, for some number 0 < p < 1,
Pi,i+1 = p = 1  Pi,i1 , i = 0, 1, . . .
The preceding Markov chain is called a random walk for we may think of it as being a model for an individual walking on a straight line who at each point of time either takes one step to the right with probability p or one step to the left with probability 1  p.
Example 4.6 (A Gambling Model) Consider a gambler who, at each play of
the game, either wins $1 with probability p or loses $1 with probability 1  p. If we suppose that our gambler quits playing either when he goes broke or he attains a fortune of $N , then the gambler's fortune is a Markov chain having transition probabilities Pi,i+1 = p = 1  Pi,i1 , P00 = PN N = 1 i = 1, 2, . . . , N  1,
States 0 and N are called absorbing states since once entered they are never left. Note that the preceding is a finite state random walk with absorbing barriers (states 0 and N ).
188
4
Markov Chains
Example 4.7 In most of Europe and Asia annual automobile insurance premiums are determined by use of a Bonus Malus (Latin for GoodBad) system. Each policyholder is given a positive integer valued state and the annual premium is a function of this state (along, of course, with the type of car being insured and the level of insurance). A policyholder's state changes from year to year in response to the number of claims made by that policyholder. Because lower numbered states correspond to lower annual premiums, a policyholder's state will usually decrease if he or she had no claims in the preceding year, and will generally increase if he or she had at least one claim. (Thus, no claims is good and typically results in a decreased premium, while claims are bad and typically result in a higher premium.) For a given Bonus Malus system, let si (k) denote the next state of a policyholder who was in state i in the previous year and who made a total of k claims in that year. If we suppose that the number of yearly claims made by a particular policyholder is a Poisson random variable with parameter , then the successive states of this policyholder will constitute a Markov chain with transition probabilities
Pi,j =
k:si (k)=j
e
k , k!
j
0
Whereas there are usually many states (20 or so is not atypical), the following table specifies a hypothetical Bonus Malus system having four states. Next state if State 1 2 3 4 Annual Premium 200 250 400 600 0 claims 1 1 2 3 1 claim 2 3 4 4 2 claims 3 4 4 4 3 claims 4 4 4 4
Thus, for instance, the table indicates that s2 (0) = 1; s2 (1) = 3; s2 (k) = 4, k 2. Consider a policyholder whose annual number of claims is a Poisson random variable with parameter . If ak is the probability that such a policyholder makes k claims in a year, then ak = e k , k!
k
0
4.2.
ChapmanKolmogorov Equations
189
For the Bonus Malus system specified in the preceding table, the transition probability matrix of the successive states of this policyholder is a0 a0 P= 0 0 a1 0 a0 0 a2 a1 0 a0 1  a0  a1  a2 1  a0  a1 1  a0 1  a0
4.2.
ChapmanKolmogorov Equations
We have already defined the onestep transition probabilities Pij . We now define n the nstep transition probabilities Pij to be the probability that a process in state i will be in state j after n additional transitions. That is,
n Pij = P {Xn+k = j Xk = i},
n
0, i, j
0
1 Of course Pij = Pij . The ChapmanKolmogorov equations provide a method for computing these nstep transition probabilities. These equations are n+m Pij = k=0 n m and are most easily understood by noting that Pik Pkj represents the probability that starting in i the process will go to state j in n + m transitions through a path which takes it into state k at the nth transition. Hence, summing over all intermediate states k yields the probability that the process will be in state j after n + m transitions. Formally, we have n+m Pij = P {Xn+m = j X0 = i} n m Pik Pkj
for all n, m
0, all i, j
(4.2)
=
k=0
P {Xn+m = j, Xn = kX0 = i} P {Xn+m = j Xn = k, X0 = i}P {Xn = kX0 = i}
k=0
= =
k=0
m n Pkj Pik
190
4
Markov Chains
n If we let P(n) denote the matrix of nstep transition probabilities Pij , then Equation (4.2) asserts that
P(n+m) = P(n) P(m) where the dot represents matrix multiplication. Hence, in particular, P(2) = P(1+1) = P P = P2 and by induction P(n) = P(n1+1) = Pn1 P = Pn That is, the nstep transition matrix may be obtained by multiplying the matrix P by itself n times.
Example 4.8 Consider Example 4.1 in which the weather is considered as a twostate Markov chain. If = 0.7 and = 0.4, then calculate the probability that it will rain four days from today given that it is raining today.
Solution: The onestep transition probability matrix is given by P= Hence, P(2) = P2 = = P(4) = (P2 )2 = = 0.7 0.4 0.61 0.52 0.61 0.52 0.5749 0.5668 0.7 0.3 0.4 0.6 0.39 , 0.48 0.61 0.39 0.52 0.48 0.4251 0.4332 0.39 0.48 0.3 0.6 0.7 0.4 0.3 0.6
4 and the desired probability P00 equals 0.5749.
If A is an N M matrix whose element in the ith row and j th column is a and B is an M K ij matrix whose element in the ith row and j th column is bij , then A B is defined to be the N K matrix whose element in the ith row and j th column is M aik bkj . k=1
4.2.
ChapmanKolmogorov Equations
191
Example 4.9 Consider Example 4.4. Given that it rained on Monday and
Tuesday, what is the probability that it will rain on Thursday? Solution: The twostep transition matrix is given by 0 0 0.4 0.2 0.12 0.20 0.12 0.16 0.3 0.5 0 0 0.7 0 0.5 0 0 0.6 0 0.8 0.18 0.30 0.48 0.64 0 0 0.4 0.2 0.3 0.5 0 0 0 0 0.6 0.8
0.7 0.5 P(2) = P2 = 0 0 0.49 0.35 = 0.20 0.10
0.21 0.15 0.20 0.10
Since rain on Thursday is equivalent to the process being in either state 0 or 2 2 state 1 on Thursday, the desired probability is given by P00 + P01 = 0.49 + 0.12 = 0.61. So far, all of the probabilities we have considered are conditional probabilities. n For instance, Pij is the probability that the state at time n is j given that the initial state at time 0 is i. If the unconditional distribution of the state at time n is desired, it is necessary to specify the probability distribution of the initial state. Let us denote this by
i P {X0 = i},
i
0
i=0
i = 1
All unconditional probabilities may be computed by conditioning on the initial state. That is,
P {Xn = j } =
i=0
P {Xn = j X0 = i}P {X0 = i}
=
i=0
n Pij i
For instance, if 0 = 0.4, 1 = 0.6, in Example 4.8, then the (unconditional) probability that it will rain four days after we begin keeping weather records is
4 4 P {X4 = 0} = 0.4P00 + 0.6P10
= (0.4)(0.5749) + (0.6)(0.5668) = 0.5700
192
4
Markov Chains
Suppose now that you want to determine the probability that a Markov chain enters any of a specified set of states A by time n. One way to accomplish this is to reset the transition probabilities out of states in A to 1, 0, if i A , j = i if i A , j = i
P {Xm+1 = j Xm = i} =
That is, transform all states in A into absorbing states which once entered can never be left. Because the original and transformed Markov chain follows identical probabilities until a state in A is entered, it follows that the probability the original Markov chain enters a state in A by time n is equal to the probability that the transformed Markov chain is in one of the states of A at time n.
Example 4.10 A pensioner receives 2 (thousand dollars) at the beginning of
each month. The amount of money he needs to spend during a month is independent of the amount he has and is equal to i with probability Pi , i = 1, 2, 3, 4, 4 i=1 Pi = 1. If the pensioner has more than 3 at the end of a month, he gives the amount greater than 3 to his son. If, after receiving his payment at the beginning of a month, the pensioner has a capital of 5, what is the probability that his capital is ever 1 or less at any time within the following four months? Solution: To find the desired probability, we consider a Markov chain with the state equal to the amount the pensioner has at the end of a month. Because we are interested in whether this amount ever falls as low as 1, we will let 1 mean that the pensioner's endofmonth fortune has ever been less than or equal to 1. Because the pensioner will give any endofmonth amount greater than 3 to his son, we need only consider the Markov chain with states 1, 2, 3 and transition probability matrix Q = [Qi,j ] given by 1 P3 + P4 P4 0 P2 P3 0 P1 P1 + P2
To understand the preceding, consider Q2,1 , the probability that a month that ends with the pensioner having the amount 2 will be followed by a month that ends with the pensioner having less than or equal to 1. Because the pensioner will begin the new month with the amount 2 + 2 = 4, his ending capital will be less than or equal to 1 if his expenses are either 3 or 4. Thus, Q2,1 = P3 + P4 . The other transition probabilities are similarly explained.
4.3.
Classification of States
193
Suppose now that Pi = 1/4, i = 1, 2, 3, 4. The transition probability matrix is 1 1/2 1/4 0 1/4 1/4 0 1/4 1/2
Squaring this matrix and then squaring the result gives the matrix 1
222 256 201 256
0
13 256 21 256
0
21 256 34 256
Because the pensioner's initial end of month capital was 3, the desired answer is Q4 = 201/256. 3,1 Let {Xn , n 0} be a Markov chain with transition probabilities Pi,j . If we let Qi,j denote the transition probabilities that transform all states in A into absorbing states, then if i A , j = i 1, if i A , j = i Qi,j = 0, otherwise Pi,j , For i, j A , the n stage transition probability Qn represents the probability / i,j that the original chain, starting in state i, will be in state j at time n without ever having entered any of the states in A . For instance, in Example 4.10, starting with 5 at the beginning of January, the probability that the pensioner's capital is 4 at the beginning of May without ever having been less than or equal to 1 in that time is Q4 = 21/256. 3,2 We can also compute the conditional probability of Xn given that the chain starts in state i and has not entered any state in A by time n, as follows. For i, j A , / P {Xn = j X0 = i, Xk A , k = 1, . . . , n} / = / P {Xn = j, Xk A , k = 1, . . . , nX0 = i} = P {Xk A , k = 1, . . . , nX0 = i} / Qn i,j
r A /
Qn i,r
4.3.
Classification of States
n State j is said to be accessible from state i if Pij > 0 for some n 0. Note that this implies that state j is accessible from state i if and only if, starting in i,
194
4
Markov Chains
it is possible that the process will ever enter state j . This is true since if j is not accessible from i, then
P {ever enterj start in i} = P
{Xn = j } X0 = i
n=0
P {Xn = j X0 = i}
n=0
=
n=0
n Pij
=0 Two states i and j that are accessible to each other are said to communicate, and we write i j . Note that any state communicates with itself since, by definition,
0 Pii = P {X0 = iX0 = i} = 1
The relation of communication satisfies the following three properties: (i) State i communicates with state i, all i 0. (ii) If state i communicates with state j , then state j communicates with state i. (iii) If state i communicates with state j , and state j communicates with state k, then state i communicates with state k. Properties (i) and (ii) follow immediately from the definition of communication. To prove (iii) suppose that i communicates with j , and j communicates with k. n Thus, there exist integers n and m such that Pij > 0, Pjm > 0. Now by the k ChapmanKolmogorov equations, we have that
n+m Pik = r=0 n m Pir Prk n Pij Pjm > 0 k
Hence, state k is accessible from state i. Similarly, we can show that state i is accessible from state k. Hence, states i and k communicate. Two states that communicate are said to be in the same class. It is an easy consequence of (i), (ii), and (iii) that any two classes of states are either identical or disjoint. In other words, the concept of communication divides the state space up into a number of separate classes. The Markov chain is said to be irreducible if there is only one class, that is, if all states communicate with each other.
4.3.
Classification of States
195
Example 4.11 Consider the Markov chain consisting of the three states 0, 1,
2 and having transition probability matrix
1 2 1 2 1 2 1 4 1 3
0
1 4 2 3
P=
0
It is easy to verify that this Markov chain is irreducible. For example, it is possible to go from state 0 to state 2 since 012 That is, one way of getting from state 0 to state 2 is to go from state 0 to state 1 (with probability 1 ) and then go from state 1 to state 2 (with probability 1 ). 2 4
Example 4.12 Consider a Markov chain consisting of the four states 0, 1, 2, 3
and having transition probability matrix
1 2 1 2 1 4 1 2 1 2 1 4
0 0
1 4
0 0
1 4
P=
0
0
0
1
The classes of this Markov chain are {0, 1}, {2}, and {3}. Note that while state 0 (or 1) is accessible from state 2, the reverse is not true. Since state 3 is an absorbing state, that is, P33 = 1, no other state is accessible from it. For any state i we let fi denote the probability that, starting in state i, the process will ever reenter state i. State i is said to be recurrent if fi = 1 and transient if fi < 1. Suppose that the process starts in state i and i is recurrent. Hence, with probability 1, the process will eventually reenter state i. However, by the definition of a Markov chain, it follows that the process will be starting over again when it reenters state i and, therefore, state i will eventually be visited again. Continual repetition of this argument leads to the conclusion that if state i is recurrent then, starting in state i, the process will reenter state i again and again and againin fact, infinitely often. On the other hand, suppose that state i is transient. Hence, each time the process enters state i there will be a positive probability, namely, 1  fi , that it will never again enter that state. Therefore, starting in state i, the probability that the process will be in state i for exactly n time periods equals fin1 (1  fi ), n 1. In other words, if state i is transient then, starting in state i, the number of time periods
196
4
Markov Chains
that the process will be in state i has a geometric distribution with finite mean 1/(1  fi ). From the preceding two paragraphs, it follows that state i is recurrent if and only if, starting in state i, the expected number of time periods that the process is in state i is infinite. But, letting In = we have that state i. Also,
n=0 In
1, 0,
if Xn = i if Xn = i
represents the number of periods that the process is in
E
n=0
In X0 = i =
n=0
E[In X0 = i] P {Xn = iX0 = i}
n=0
= =
n=0
n Pii
We have thus proven the following.
Proposition 4.1 State i is
recurrent if
n=1
n Pii = ,
transient if
n=1
n Pii <
The argument leading to the preceding proposition is doubly important because it also shows that a transient state will only be visited a finite number of times (hence the name transient). This leads to the conclusion that in a finitestate Markov chain not all states can be transient. To see this, suppose the states are 0, 1, . . . , M and suppose that they are all transient. Then after a finite amount of time (say, after time T0 ) state 0 will never be visited, and after a time (say, T1 ) state 1 will never be visited, and after a time (say, T2 ) state 2 will never be visited, and so on. Thus, after a finite time T = max{T0 , T1 , . . . , TM } no states will be visited. But as the process must be in some state after time T we arrive at a contradiction, which shows that at least one of the states must be recurrent. Another use of Proposition 4.1 is that it enables us to show that recurrence is a class property.
4.3.
Classification of States
197
Corollary 4.2 If state i is recurrent, and state i communicates with state j ,
then state j is recurrent.
Proof To prove this we first note that, since state i communicates with state j , k there exist integers k and m such that Pij > 0, Pjm > 0. Now, for any integer n i
m+n+k Pjj n k Pjm Pii Pij i
This follows since the left side of the preceding is the probability of going from j to j in m+n+k steps, while the right side is the probability of going from j to j in m + n + k steps via a path that goes from j to i in m steps, then from i to i in an additional n steps, then from i to j in an additional k steps. From the preceding we obtain, by summing over n, that
m+n+k Pjj n=1 k Pjm Pij i n=1 n Pii =
k n since Pjm Pij > 0 and Pii is infinite since state i is recurrent. Thus, by n=1 i Proposition 4.1 it follows that state j is also recurrent.
Remarks (i) Corollary 4.2 also implies that transience is a class property. For
if state i is transient and communicates with state j , then state j must also be transient. For if j were recurrent then, by Corollary 4.2, i would also be recurrent and hence could not be transient. (ii) Corollary 4.2 along with our previous result that not all states in a finite Markov chain can be transient leads to the conclusion that all states of a finite irreducible Markov chain are recurrent.
Example 4.13 Let the Markov chain consisting of the states 0, 1, 2, 3 have
the transition probability matrix 0 P= 1 0 0 0 0 1 1
1 2 1 2
0 0 0
0 0 0
Determine which states are transient and which are recurrent. Solution: It is a simple matter to check that all states communicate and, hence, since this is a finite chain, all states must be recurrent.
198
4
Markov Chains
Example 4.14 Consider the Markov chain having states 0, 1, 2, 3, 4 and
1 2 1 2 1 2 1 2
0 0
1 2 1 2
0 0
1 2 1 2
0 0 0 0
1 2
P= 0 0
1 4
0 0
1 4
0
0
Determine the recurrent state. Solution: This chain consists of the three classes {0, 1}, {2, 3}, and {4}. The first two classes are recurrent and the third transient.
Example 4.15 (A Random Walk) Consider a Markov chain whose state
space consists of the integers i = 0, 1, 2, . . . , and have transition probabilities given by Pi,i+1 = p = 1  Pi,i1 , i = 0, 1, 2, . . .
where 0 < p < 1. In other words, on each transition the process either moves one step to the right (with probability p) or one step to the left (with probability 1p). One colorful interpretation of this process is that it represents the wanderings of a drunken man as he walks along a straight line. Another is that it represents the winnings of a gambler who on each play of the game either wins or loses one dollar. Since all states clearly communicate, it follows from Corollary 4.2 that they are either all transient or all recurrent. So let us consider state 0 and attempt to n determine if P00 is finite or infinite. n=1 Since it is impossible to be even (using the gambling model interpretation) after an odd number of plays we must, of course, have that
2n1 P00 = 0,
n = 1, 2, . . .
On the other hand, we would be even after 2n trials if and only if we won n of these and lost n of these. Because each play of the game results in a win with probability p and a loss with probability 1  p, the desired probability is thus the binomial probability
2n P00 =
2n n (2n)! (p(1  p))n , p (1  p)n = n n!n!
n = 1, 2, 3, . . .
By using an approximation, due to Stirling, which asserts that n! nn+1/2 en 2
(4.3)
4.3.
Classification of States
199
where we say that an bn when limn an /bn = 1, we obtain
2n P00
(4p(1  p))n n
Now it is easy to verify, for positive an , bn , that if an bn , then n an < if n and only if n bn < . Hence, P00 will converge if and only if n=1
n=1
(4p(1  p))n n
does. However, 4p(1  p) 1 with equality holding if and only if p = 1 . Hence, 2 n P00 = if and only if p = 1 . Thus, the chain is recurrent when p = 1 and n=1 2 2 transient if p = 1 . 2 When p = 1 , the preceding process is called a symmetric random walk. We 2 could also look at symmetric random walks in more than one dimension. For instance, in the twodimensional symmetric random walk the process would, at each transition, either take one step to the left, right, up, or down, each having probability 1 . That is, the state is the pair of integers (i, j ) and the transition 4 probabilities are given by P(i,j ),(i+1,j ) = P(i,j ),(i1,j ) = P(i,j ),(i,j +1) = P(i,j ),(i,j 1) =
1 4
By using the same method as in the onedimensional case, we now show that this Markov chain is also recurrent. Since the preceding chain is irreducible, it follows that all states will be recur2n rent if state 0 = (0, 0) is recurrent. So consider P00 . Now after 2n steps, the chain will be back in its original location if for some i, 0 i n, the 2n steps consist of i steps to the left, i to the right, n  i up, and n  i down. Since each step will be either of these four types with probability 1 , it follows that the desired probability 4 is a multinomial probability. That is,
n 2n P00
=
i=0 n
1 (2n)! i!i!(n  i)!(n  i)! 4
2n
=
i=0
n! n! 1 (2n)! n!n! (n  i)!i! (n  i)!i! 4
2n
2n
= =
1 4 1 4
2n n 2n n
n i=0
n i
n ni (4.4)
2n
2n n
200
4
Markov Chains
where the last equality uses the combinatorial identity 2n = n
n i=0
n i
n ni
which follows upon noting that both sides represent the number of subgroups of size n one can select from a set of n white and n black objects. Now, (2n)! 2n = n n!n!
(2n)2n+1/2 e2n 2 n2n+1 e2n (2)
by Stirling's approximation
4n = n Hence, from Equation (4.4) we see that
2n P00
1 n
2n which shows that n P00 = , and thus all states are recurrent. Interestingly enough, whereas the symmetric random walks in one and two dimensions are both recurrent, all higherdimensional symmetric random walks turn out to be transient. (For instance, the threedimensional symmetric random walk is at each transition equally likely to move in any of six wayseither to the left, right, up, down, in, or out.)
Remarks For the onedimensional random walk of Example 4.15 here is a direct argument for establishing recurrence in the symmetric case, and for determining the probability that it ever returns to state 0 in the nonsymmetric case. Let
= P {ever return to 0} To determine , start by conditioning on the initial transition to obtain = P {ever return to 0X1 = 1}p + P {ever return to 0X1 = 1}(1  p) (4.5) Now, let denote the probability that the Markov chain will ever return to state 0 given that it is currently in state 1. Because the Markov chain will always increase by 1 with probability p or decrease by 1 with probability 1  p no matter what its current state, note that is also the probability that the Markov chain currently in state i will ever enter state i  1, for any i. To obtain an equation for , condition on the next transition to obtain
4.3.
Classification of States
201
= P {every returnX1 = 1, X2 = 0}(1  p) + P {ever returnX1 = 1, X2 = 2}p = 1  p + P {ever returnX1 = 1, X2 = 2}p = 1  p + p 2 where the final equation follows by noting that in order for the chain to ever go from state 2 to state 0 it must first go to state 1and the probability of that ever happening is and if it does eventually go to state 1 then it must still go to state 0and the conditional probability of that ever happening is also . Therefore, = 1  p + p 2 The two roots of this equation are = 1 and = (1  p)/p. Consequently, in the case of the symmetric random walk where p = 1/2 we can conclude that = 1. By symmetry, the probability that the symmetric random walk will ever enter state 0 given that it is currently in state 1 is also 1, proving that the symmetric random walk is recurrent. Suppose now that p > 1/2. In this case, it can be shown (see Exercise 17 at the end of this chapter) that P {ever return toX1 = 1} = 1. Consequently, Equation (4.5) reduces to = p + 1  p Because the random walk is transient in this case we know that < 1, showing that = 1. Therefore, = (1  p)/p, yielding that = 2(1  p), p > 1/2
Similarly, when p < 1/2 we can show that = 2p. Thus, in general P {ever return to 0} = 2 min(p, 1  p)
Example 4.16 (On the Ultimate Instability of the Aloha Protocol) Consider
a communications facility in which the numbers of messages arriving during each of the time periods n = 1, 2, . . . are independent and identically distributed random variables. Let ai = P {i arrivals}, and suppose that a0 + a1 < 1. Each arriving message will transmit at the end of the period in which it arrives. If exactly one message is transmitted, then the transmission is successful and the message leaves the system. However, if at any time two or more messages simultaneously transmit, then a collision is deemed to occur and these messages remain in the system. Once a message is involved in a collision it will, independently of all else, transmit at the end of each additional period with probability pthe socalled Aloha
202
4
Markov Chains
protocol (because it was first instituted at the University of Hawaii). We will show that such a system is asymptotically unstable in the sense that the number of successful transmissions will, with probability 1, be finite. To begin let Xn denote the number of messages in the facility at the beginning of the nth period, and note that {Xn , n 0} is a Markov chain. Now for k 0 define the indicator variables Ik by if the first time that the chain departs state k it 1, directly goes to state k  1 Ik = 0, otherwise and let it be 0 if the system is never in state k, k 0. (For instance, if the successive states are 0, 1, 3, 4, . . . , then I3 = 0 since when the chain first departs state 3 it goes to state 4; whereas, if they are 0, 3, 3, 2, . . . , then I3 = 1 since this time it goes to state 2.) Now,
E
k=0
Ik =
k=0
E[Ik ] P {Ik = 1}
k=0
=
P {Ik = 1k is ever visited}
k=0
(4.6)
Now, P {Ik = 1k is ever visited} is the probability that when state k is departed the next state is k  1. That is, it is the conditional probability that a transition from k is to k  1 given that it is not back into k, and so P {Ik = 1k is ever visited} = Because Pk,k1 = a0 kp(1  p)k1 , Pk,k = a0 [1  kp(1  p)k1 ] + a1 (1  p)k which is seen by noting that if there are k messages present on the beginning of a day, then (a) there will be k  1 at the beginning of the next day if there are no new messages that day and exactly one of the k messages transmits; and (b) there will be k at the beginning of the next day if either Pk,k1 1  Pkk
4.3.
Classification of States
203
(i) there are no new messages and it is not the case that exactly one of the existing k messages transmits, or (ii) there is exactly one new message (which automatically transmits) and none of the other k messages transmits. Substitution of the preceding into Equation (4.6) yields
E
k=0
Ik
k=0
a0 kp(1  p)k1 1  a0 [1  kp(1  p)k1 ]  a1 (1  p)k
< where the convergence follows by noting that when k is large the denominator of the expression in the preceding sum converges to 1  a0 and so the convergence or divergence of the sum is determined by whether or not the sum of the terms in the numerator converge and k(1  p)k1 < . k=0 Hence, E[ Ik ] < , which implies that Ik < with probability 1 k=0 k=0 (for if there was a positive probability that Ik could be , then its mean k=0 would be ). Hence, with probability 1, there will be only a finite number of states that are initially departed via a successful transmission; or equivalently, there will be some finite integer N such that whenever there are N or more messages in the system, there will never again be a successful transmission. From this (and the fact that such higher states will eventually be reachedwhy?) it follows that, with probability 1, there will only be a finite number of successful transmissions.
Remarks For a (slightly less than rigorous) probabilistic proof of Stirling's
approximation, let X1 X2 , . . . be independent Poisson random variables each having mean 1. Let Sn = n Xi , and note that both the mean and variance of i=1 Sn are equal to n. Now, P {Sn = n} = P {n  1 < Sn n} = P {1/ n < (Sn  n)/ n
0 1/ n
0} when n is large, by the central limit theorem
(2)1/2 ex
2 /2
dx
(2)1/2 (1/ n) = (2n)1/2 But Sn is Poisson with mean n, and so P {Sn = n} = en nn n!
204
4
Markov Chains
Hence, for n large en nn (2n)1/2 n! or, equivalently n! nn+1/2 en 2
which is Stirling's approximation.
4.4.
Limiting Probabilities
In Example 4.8, we calculated P(4) for a twostate Markov chain; it turned out to be P(4) = 0.5749 0.5668 0.4251 0.4332
From this it follows that P(8) = P(4) P(4) is given (to three significant places) by P(8) = 0.572 0.570 0.428 0.430
Note that the matrix P(8) is almost identical to the matrix P(4) , and secondly, that n each of the rows of P(8) has almost identical entries. In fact it seems that Pij is converging to some value (as n ) which is the same for all i. In other words, there seems to exist a limiting probability that the process will be in state j after a large number of transitions, and this value is independent of the initial state. To make the preceding heuristics more precise, two additional properties of the states of a Markov chain need to be considered. State i is said to have period d n if Pii = 0 whenever n is not divisible by d, and d is the largest integer with this property. For instance, starting in i, it may be possible for the process to enter state i only at the times 2, 4, 6, 8, . . . , in which case state i has period 2. A state with period 1 is said to be aperiodic. It can be shown that periodicity is a class property. That is, if state i has period d, and states i and j communicate, then state j also has period d. If state i is recurrent, then it is said to be positive recurrent if, starting in i, the expected time until the process returns to state i is finite. It can be shown that positive recurrence is a class property. While there exist recurrent states that are not positive recurrent, it can be shown that in a finitestate Markov chain all recurrent states are positive recurrent. Positive recurrent, aperiodic states are called ergodic.
Such states are called null recurrent.
4.4.
Limiting Probabilities
205
We are now ready for the following important theorem which we state without proof.
n Theorem 4.1 For an irreducible ergodic Markov chain limn Pij exists
and is independent of i. Furthermore, letting
n j = lim Pij , n
j
0
then j is the unique nonnegative solution of
j =
i=0
i Pij ,
j
0,
j = 1
j =0
(4.7)
tial state i, it is not difficult to (heuristically) see that the 's must satisfy Equation (4.7). Let us derive an expression for P {Xn+1 = j } by conditioning on the state at time n. That is,
n Remarks (i) Given that j = limn Pij exists and is independent of the ini
P {Xn+1 = j } =
i=0
P {Xn+1 = j Xn = i}P {Xn = i} Pij P {Xn = i}
i=0
=
Letting n , and assuming that we can bring the limit inside the summation, leads to
j =
i=0
Pij i
(ii) It can be shown that j , the limiting probability that the process will be in state j at time n, also equals the longrun proportion of time that the process will be in state j . (iii) If the Markov chain is irreducible, then there will be a solution to j =
i
i Pij ,
j
0,
j = 1
j
if and only if the Markov chain is positive recurrent. If a solution exists then it will be unique, and j will equal the long run proportion of time that the Markov
206
4
Markov Chains
chain is in state j . If the chain is aperiodic, then j is also the limiting probability that the chain is in state j .
Example 4.17 Consider Example 4.1, in which we assume that if it rains today, then it will rain tomorrow with probability ; and if it does not rain today, then it will rain tomorrow with probability . If we say that the state is 0 when it rains and 1 when it does not rain, then by Equation (4.7) the limiting probabilities 0 and 1 are given by
0 = 0 + 1 , 1 = (1  )0 + (1  )1 , 0 + 1 = 1 which yields that 0 = , 1+  1 = 1 1+ 
For example if = 0.7 and = 0.4, then the limiting probability of rain is 0 = 4 7 = 0.571.
Example 4.18 Consider Example 4.3 in which the mood of an individual is
considered as a threestate Markov chain having a transition probability matrix 0.5 P = 0.3 0.2 0.4 0.4 0.3 0.1 0.3 0.5
In the long run, what proportion of time is the process in each of the three states? Solution: The limiting probabilities i , i = 0, 1, 2, are obtained by solving the set of equations in Equation (4.1). In this case these equations are 0 = 0.50 + 0.31 + 0.22 , 1 = 0.40 + 0.41 + 0.32 , 2 = 0.10 + 0.31 + 0.52 , 0 + 1 + 2 = 1 Solving yields 0 =
21 62 ,
1 =
23 62 ,
2 =
18 62
4.4.
Limiting Probabilities
207
Example 4.19 (A Model of Class Mobility) A problem of interest to sociologists is to determine the proportion of society that has an upper or lowerclass occupation. One possible mathematical model would be to assume that transitions between social classes of the successive generations in a family can be regarded as transitions of a Markov chain. That is, we assume that the occupation of a child depends only on his or her parent's occupation. Let us suppose that such a model is appropriate and that the transition probability matrix is given by 0.45 P = 0.05 0.01 0.48 0.70 0.50 0.07 0.25 0.49
(4.8)
That is, for instance, we suppose that the child of a middleclass worker will attain an upper, middle, or lowerclass occupation with respective probabilities 0.05, 0.70, 0.25. The limiting probabilities i , thus satisfy 0 = 0.450 + 0.051 + 0.012 , 1 = 0.480 + 0.701 + 0.502 , 2 = 0.070 + 0.251 + 0.492 , 0 + 1 + 2 = 1 Hence, 0 = 0.07, 1 = 0.62, 2 = 0.31
In other words, a society in which social mobility between classes can be described by a Markov chain with transition probability matrix given by Equation (4.8) has, in the long run, 7 percent of its people in upperclass jobs, 62 percent of its people in middleclass jobs, and 31 percent in lowerclass jobs.
Example 4.20 (The HardyWeinberg Law and a Markov Chain in Genetics)
Consider a large population of individuals, each of whom possesses a particular pair of genes, of which each individual gene is classified as being of type A or type a. Assume that the proportions of individuals whose gene pairs are AA, aa, or Aa are, respectively, p0 , q0 , and r0 (p0 + q0 + r0 = 1). When two individuals mate, each contributes one of his or her genes, chosen at random, to the resultant offspring. Assuming that the mating occurs at random, in that each individual is equally likely to mate with any other individual, we are interested in determining the proportions of individuals in the next generation whose genes are AA, aa, or Aa. Calling these proportions p, q, and r, they are easily obtained by focusing
208
4
Markov Chains
attention on an individual of the next generation and then determining the probabilities for the gene pair of that individual. To begin, note that randomly choosing a parent and then randomly choosing one of its genes is equivalent to just randomly choosing a gene from the total gene population. By conditioning on the gene pair of the parent, we see that a randomly chosen gene will be type A with probability P {A} = P {AAA}p0 + P {Aaa}q0 + P {AAa}r0 = p0 + r0 /2 Similarly, it will be type a with probability P {a} = q0 + r0 /2 Thus, under random mating a randomly chosen member of the next generation will be type AA with probability p, where p = P {A}P {A} = (p0 + r0 /2)2 Similarly, the randomly chosen member will be type aa with probability q = P {a}P {a} = (q0 + r0 /2)2 and will be type Aa with probability r = 2P {A}P {a} = 2(p0 + r0 /2)(q0 + r0 /2) Since each member of the next generation will independently be of each of the three gene types with probabilities p, q, r, it follows that the percentages of the members of the next generation that are of type AA, aa, or Aa are respectively p, q, and r. If we now consider the total gene pool of this next generation, then p + r/2, the fraction of its genes that are A, will be unchanged from the previous generation. This follows either by arguing that the total gene pool has not changed from generation to generation or by the following simple algebra: p + r/2 = (p0 + r0 /2)2 + (p0 + r0 /2)(q0 + r0 /2) = (p0 + r0 /2)[p0 + r0 /2 + q0 + r0 /2] = p0 + r0 /2 = P {A} since p0 + r0 + q0 = 1 (4.9)
Thus, the fractions of the gene pool that are A and a are the same as in the initial generation. From this it follows that, under random mating, in all successive generations after the initial one the percentages of the population having gene pairs AA, aa, and Aa will remain fixed at the values p, q, and r. This is known as the HardyWeinberg law.
4.4.
Limiting Probabilities
209
Suppose now that the gene pair population has stabilized in the percentages p, q, r, and let us follow the genetic history of a single individual and her descendants. (For simplicity, assume that each individual has exactly one offspring.) So, for a given individual, let Xn denote the genetic state of her descendant in the nth generation. The transition probability matrix of this Markov chain, namely, AA AA p + aa Aa 0 p r + 2 4 r 2 aa 0 q+ r 2 Aa q+ p+ r 2 r 2
q r + 2 4
p q r + + 2 2 2
is easily verified by conditioning on the state of the randomly chosen mate. It is quite intuitive (why?) that the limiting probabilities for this Markov chain (which also equal the fractions of the individual's descendants that are in each of the three genetic states) should just be p, q, and r. To verify this we must show that they satisfy Equation (4.7). Because one of the equations in Equation (4.7) is redundant, it suffices to show that p=p p+ q =q q+ p+q +r =1 But this follows from Equation (4.9), and thus the result is established. r p r +r + 2 2 4 q r r +r + 2 2 4 = p+ = q+ r 2 r 2
2
,
2
,
Example 4.21 Suppose that a production process changes states in accordance with an irreducible, positive recurrent Markov chain having transition probabilities Pij , i, j = 1, . . . , n, and suppose that certain of the states are considered acceptable and the remaining unacceptable. Let A denote the acceptable states and Ac the unacceptable ones. If the production process is said to be "up" when in an acceptable state and "down" when in an unacceptable state, determine
1. the rate at which the production process goes from up to down (that is, the rate of breakdowns); 2. the average length of time the process remains down when it goes down; and 3. the average length of time the process remains up when it goes up.
210
4
Markov Chains
Solution: Let k , k = 1, . . . , n, denote the longrun proportions. Now for i A and j Ac the rate at which the process enters state j from state i is rate enter j from i = i Pij and so the rate at which the production process enters state j from an acceptable state is rate enter j from A =
iA
i Pij
Hence, the rate at which it enters an unacceptable state from an acceptable one (which is the rate at which breakdowns occur) is rate breakdowns occur =
j Ac iA
i Pij
(4.10)
Now let U and D denote the average time the process remains up when it goes up and down when it goes down. Because there is a single breakdown every U + D time units on the average, it follows heuristically that rate at which breakdowns occur = and, so from Equation (4.10), 1 i Pij = U + D j Ac iA (4.11) 1 U +D
To obtain a second equation relating U and D, consider the percentage of time the process is up, which, of course, is equal to iA i . However, since the process is up on the average U out of every U + D time units, it follows (again somewhat heuristically) that the proportion of up time = and so U i = +D U iA (4.12) U U +D
4.4.
Limiting Probabilities
211
Hence, from Equations (4.11) and (4.12) we obtain U= D= =
iA i j Ac iA i Pij iA i iA i Pij iAc j Ac
,
1
j Ac
i iA i Pij
For example, suppose the transition probability matrix is
1 4 1 4 1 4 1 4 1 4 1 2 1 2 1 4
0
1 4 1 4 1 2
P=
0
1 4 1 4
0
where the acceptable (up) states are 1, 2 and the unacceptable (down) ones are 3, 4. The limiting probabilities satisfy
1 1 = 1 4 + 3 1 + 4 1 , 4 4 1 2 = 1 4 + 2 1 + 3 1 + 4 1 , 4 4 4 1 3 = 1 2 + 2 1 + 3 1 , 2 4
1 + 2 + 3 + 4 = 1 These solve to yield 1 = and thus rate of breakdowns = 1 (P13 + P14 ) + 2 (P23 + P24 ) = U=
9 32 , 14 9 3 16 ,
2 = 1 , 4
3 =
14 48 ,
4 =
13 48
and
D=2
9 Hence, on the average, breakdowns occur about 32 (or 28 percent) of the time. They last, on the average, 2 time units, and then there follows a stretch of (on the average) 14 time units when the system is up. 9
212
4
Markov Chains
0, are often called stationary probabilities. The reason being that if the initial state is chosen according to the probabilities j , j 0, then the probability of being in state j at any time n is also equal to j . That is, if P {X0 = j } = j , then P {Xn = j } = j for all n, j 0 The preceding is easily proven by induction, for if we suppose it true for n  1, then writing P {Xn = j } =
i
Remarks (i) The long run proportions j , j
j
0
P {Xn = j Xn1 = i}P {Xn1 = i} Pij i
i
= = j
by the induction hypothesis by Equation (4.7)
(ii) For state j , define mjj to be the expected number of transitions until a Markov chain, starting in state j , returns to that state. Since, on the average, the chain will spend 1 unit of time in state j for every mjj units of time, it follows that 1 j = mjj In words, the proportion of time in state j equals the inverse of the mean time between visits to j . (The preceding is a special case of a general result, sometimes called the strong law for renewal processes, which will be presented in Chapter 7.)
Example 4.22 (Mean Pattern Times in Markov Chain Generated Data) Consider an irreducible Markov chain {Xn , n 0} with transition probabilities Pi,j and stationary probabilities j , j 0. Starting in state r, we are interested in determining the expected number of transitions until the pattern i1 , i2 , . . . , ik appears. That is, with N(i1 , i2 , . . . , ik ) = min{n we are interested in E[N (i1 , i2 , . . . , ik )X0 = r] Note that even if i1 = r, the initial state X0 is not considered part of the pattern sequence. Let (i, i1 ) be the mean number of transitions for the chain to enter state i1 , given that the initial state is i, i 0. The quantities (i, i1 ) can be determined as k: Xnk+1 = i1 , . . . , Xn = ik }
4.4.
Limiting Probabilities
213
the solution of the following set of equations, obtained by conditioning on the first transition out of state i: (i, i1 ) = 1 +
j =i1
Pi,j (j, i1 ),
i
0
For the Markov chain {Xn , n 0} associate a corresponding Markov chain, which we will refer to as the kchain, whose state at any time is the sequence of the most recent k states of the original chain. (For instance, if k = 3 and X2 = 4, X3 = 1, X4 = 1, then the state of the kchain at time 4 is (4, 1, 1).) Let (j1 , . . . , jk ) be the stationary probabilities for the kchain. Because (j1 , . . . , jk ) is the proportion of time that the state of the original Markov chain k units ago was j1 and the following k  1 states, in sequence, were j2 , . . . , jk , we can conclude that (j1 , . . . , jk ) = j1 Pj1 ,j2 Pjk1 ,jk Moreover, because the mean number of transitions between successive visits of the kchain to the state i1 , i2 , . . . , ik is equal to the inverse of the stationary probability of that state, we have that E[number of transitions between visits to i1 , i2 , . . . , ik ] = 1 (i1 , . . . , ik ) (4.13)
Let A(i1 , . . . , im ) be the additional number of transitions needed until the pattern appears, given that the first m transitions have taken the chain into states X1 = i1 , . . . , Xm = im . We will now consider whether the pattern has overlaps, where we say that the pattern i1 , i2 , . . . , ik has an overlap of size j, j < k, if the sequence of its final j elements is the same as that of its first j elements. That is, it has an overlap of size j if (ikj +1 , . . . , ik ) = (i1 , . . . , ij ), Case 1: The pattern i1 , i2 , . . . , ik has no overlaps. Because there is no overlap, Equation (4.13) yields that E[N(i1 , i2 , . . . , ik )X0 = ik ] = 1 (i1 , . . . , ik ) j <k
Because the time until the pattern occurs is equal to the time until the chain enters state i1 plus the additional time, we may write E[N(i1 , i2 , . . . , ik )X0 = ik ] = (ik , i1 ) + E[A(i1 )]
214
4
Markov Chains
The preceding two equations imply E[A(i1 )] = Using that E[N(i1 , i2 , . . . , ik )X0 = r] = (r, i1 ) + E[A(i1 )] gives the result E[N(i1 , i2 , . . . , ik )X0 = r] = (r, i1 ) + where (i1 , . . . , ik ) = i1 Pi1 ,i2 Pik1 ,ik Case 2: Now suppose that the pattern has overlaps and let its largest overlap be of size s. In this case the number of transitions between successive visits of the kchain to the state i1 , i2 , . . . , ik is equal to the additional number of transitions of the original chain until the pattern appears given that it has already made s transitions with the results X1 = i1 , . . . , Xs = is . Therefore, from Equation (4.13) E[A(i1 , . . . , is )] = But because N(i1 , i2 , . . . , ik ) = N (i1 , . . . , is ) + A(i1 , . . . , is ) we have E[N(i1 , i2 , . . . , ik )X0 = r] = E[N (i1 , i2 , . . . , is )X0 = r] + 1 (i1 , . . . , ik ) 1 (i1 , . . . , ik ) 1  (ik , i1 ) (i1 , . . . , ik ) 1  (ik , i1 ) (i1 , . . . , ik )
We can now repeat the same procedure on the pattern i1 , . . . , is , continuing to do so until we reach one that has no overlap, and then apply the result from Case 1.
4.4.
Limiting Probabilities
215
For instance, suppose the desired pattern is 1, 2, 3, 1, 2, 3, 1, 2. Then E[N(1, 2, 3, 1, 2, 3, 1, 2)X0 = r] = E[N (1, 2, 3, 1, 2)X0 = r] + 1 (1, 2, 3, 1, 2, 3, 1, 2)
Because the largest overlap of the pattern (1, 2, 3, 1, 2) is of size 2, the same argument as in the preceding gives E[N(1, 2, 3, 1, 2)X0 = r] = E[N (1, 2)X0 = r] + 1 (1, 2, 3, 1, 2)
Because the pattern (1, 2) has no overlap, we obtain from Case 1 that E[N(1, 2)X0 = r] = (r, 1) + Putting it together yields E[N(1, 2, 3, 1, 2, 3, 1, 2)X0 = r] = (r, 1) + + 1  (2, 1) 1 P1,2 1  (2, 1) (1, 2)
1 1 + 2 3 2 2 1 P1,2 P2,3 P3,1 1 P1,2 P2,3 P3,1
If the generated data is a sequence of independent and identically distributed random variables, with each value equal to j with probability Pj , then the Markov chain has Pi,j = Pj . In this case, j = Pj . Also, because the time to go from state i to state j is a geometric random variable with parameter Pj , we have (i, j ) = 1/Pj . Thus, the expected number of data values that need be generated before the pattern 1, 2, 3, 1, 2, 3, 1, 2 appears would be 1 1 1 1 1 +  + 2 2 + 3 3 2 P1 P1 P2 P1 P1 P2 P3 P1 P2 P3 = 1 1 1 + 2 2 + 3 3 2 P1 P2 P1 P2 P3 P1 P2 P3
The following result is quite useful.
Proposition 4.3 Let {Xn , n
tionary probabilities j , j Then, with probability 1, lim
1} be an irreducible Markov chain with sta0, and let r be a bounded function on the state space.
N n=1 r(Xn )
N
N
=
j =0
r(j )j
216
4
Markov Chains
Proof If we let aj (N ) be the amount of time the Markov chain spends in state
j during time periods 1, . . . , N , then
N
r(Xn ) =
n=1 j =0
aj (N)r(j )
Since aj (N)/N j the result follows from the preceding upon dividing by N and then letting N . If we suppose that we earn a reward r(j ) whenever the chain is in state j , then Proposition 4.3 states that our average reward per unit time is j r(j )j .
Example 4.23 For the four state Bonus Malus automobile insurance system
specified in Example 4.7, find the average annual premium paid by a policyholder whose yearly number of claims is a Poisson random variable with mean 1/2. Solution: With ak = e1/2 (1/2) , we have k! a0 = 0.6065, a1 = 0.3033, a2 = 0.0758
k
Therefore, the Markov chain of successive states has the following transition probability matrix. 0.6065 0.6065 0.0000 0.0000 0.3033 0.0000 0.6065 0.0000 0.0758 0.3033 0.0000 0.6065 0.0144 0.0902 0.3935 0.3935
The stationary probabilities are given as the solution of 1 = 0.60651 + 0.60652 , 2 = 0.30331 + 0.60653 , 3 = 0.07581 + 0.30332 + 0.60654 , 1 + 2 + 3 + 4 = 1 Rewriting the first three of these equations gives 1  0.6065 1 , 0.6065 2  0.30331 , 3 = 0.6065 3  0.07581  0.30332 4 = 0.6065 2 =
4.5.
Some Applications
217
or 2 = 0.64881 , 3 = 0.56971 , 4 = 0.49001 Using that
4 i=1 i
= 1 gives the solution (rounded to four decimal places) 2 = 0.2395, 3 = 0.2103, 4 = 0.1809
1 = 0.3692,
Therefore, the average annual premium paid is 2001 + 2502 + 4003 + 6004 = 326.375
4.5.
Some Applications
4.5.1. The Gambler's Ruin Problem Consider a gambler who at each play of the game has probability p of winning one unit and probability q = 1  p of losing one unit. Assuming that successive plays of the game are independent, what is the probability that, starting with i units, the gambler's fortune will reach N before reaching 0? If we let Xn denote the player's fortune at time n, then the process {Xn , n = 0, 1, 2, . . .} is a Markov chain with transition probabilities P00 = PN N = 1, Pi,i+1 = p = 1  Pi,i1 , i = 1, 2, . . . , N  1
This Markov chain has three classes, namely, {0}, {1, 2, . . . , N  1}, and {N }; the first and third class being recurrent and the second transient. Since each transient state is visited only finitely often, it follows that, after some finite amount of time, the gambler will either attain his goal of N or go broke. Let Pi , i = 0, 1, . . . , N , denote the probability that, starting with i, the gambler's fortune will eventually reach N . By conditioning on the outcome of the initial play of the game we obtain Pi = pPi+1 + qPi1 , or equivalently, since p + q = 1, pPi + qPi = pPi+1 + qPi1 i = 1, 2, . . . , N  1
218 or
4
Markov Chains
Pi+1  Pi =
q (Pi  Pi1 ), p
i = 1, 2, . . . , N  1
Hence, since P0 = 0, we obtain from the preceding line that P2  P1 = P3  P2 = . . . Pi  Pi1 = . . . PN  PN 1 = q (PN 1  PN 2 ) = p q p
N 1
q q (P1  P0 ) = P1 , p p q (P2  P1 ) = p q p
2
P1 ,
q (Pi1  Pi2 ) = p
q p
i1
P1 ,
P1
Adding the first i  1 of these equations yields Pi  P1 = P1 or 1  (q/p)i P1 , Pi = 1  (q/p) iP1 , Now, using the fact that PN = 1, we obtain that 1  (q/p) , 1  (q/p)N P1 = 1 , N if p = 1 2 1 if p = 2 if q =1 p q if = 1 p q p + q p
2
+ +
q p
i1
4.5.
Some Applications
219
and hence
1  (q/p)i , N Pi = 1  (q/p) i , N 1  0,
if p =
1 2 1 if p = 2
(4.14)
Note that, as N , q p
i
Pi
,
if p > if p
1 2 1 2
Thus, if p > 1 , there is a positive probability that the gambler's fortune will in2 crease indefinitely; while if p 1 , the gambler will, with probability 1, go broke 2 against an infinitely rich adversary.
Example 4.24 Suppose Max and Patty decide to flip pennies; the one coming
closest to the wall wins. Patty, being the better player, has a probability 0.6 ofwinning on each flip. (a) If Patty starts with five pennies and Max with ten, what is the probability that Patty will wipe Max out? (b) What if Patty starts with 10 and Max with 20? Solution: (a) The desired probability is obtained from Equation (4.14) by letting i = 5, N = 15, and p = 0.6. Hence, the desired probability is 1 1 (b) The desired probability is 1 1
2 10 3 2 30 3 2 5 3 2 15 3
0.87
0.98
For an application of the gambler's ruin problem to drug testing, suppose that two new drugs have been developed for treating a certain disease. Drug i has a cure rate Pi , i = 1, 2, in the sense that each patient treated with drug i will be cured with probability Pi . These cure rates, however, are not known, and suppose we are interested in a method for deciding whether P1 > P2 or P2 > P1 . To decide upon one of these alternatives, consider the following test: Pairs of patients are treated sequentially with one member of the pair receiving drug 1 and the other
220
4
Markov Chains
drug 2. The results for each pair are determined, and the testing stops when the cumulative number of cures using one of the drugs exceeds the cumulative number of cures when using the other by some fixed predetermined number. More formally, let Xj = Yj = 1, 0, 1, 0, if the patient in the j th pair to receive drug number 1 is cured otherwise if the patient in the j th pair to receive drug number 2 is cured otherwise
For a predetermined positive integer M the test stops after pair N where N is the first value of n such that either X1 + + Xn  (Y1 + + Yn ) = M or X1 + + Xn  (Y1 + + Yn ) = M In the former case we then assert that P1 > P2 , and in the latter that P2 > P1 . In order to help ascertain whether the preceding is a good test, one thing we would like to know is the probability of it leading to an incorrect decision. That is, for given P1 and P2 where P1 > P2 , what is the probability that the test will incorrectly assert that P2 > P1 ? To determine this probability, note that after each pair is checked the cumulative difference of cures using drug 1 versus drug 2 will either go up by 1 with probability P1 (1  P2 )since this is the probability that drug 1 leads to a cure and drug 2 does notor go down by 1 with probability (1  P1 )P2 , or remain the same with probability P1 P2 + (1  P1 )(1  P2 ). Hence, if we only consider those pairs in which the cumulative difference changes, then the difference will go up 1 with probability p = P {up 1up1 or down 1} = and down 1 with probability q =1p= P2 (1  P1 ) P1 (1  P2 ) + (1  P1 )P2 P1 (1  P2 ) P1 (1  P2 ) + (1  P1 )P2
Hence, the probability that the test will assert that P2 > P1 is equal to the probability that a gambler who wins each (one unit) bet with probability p will go down
4.5.
Some Applications
221
M before going up M. But Equation (4.14) with i = M, N = 2M, shows that this probability is given by P {test asserts that P2 > P1 } = 1  = 1  (q/p)M 1  (q/p)2M
1 1 + (p/q)M
Thus, for instance, if P1 = 0.6 and P2 = 0.4 then the probability of an incorrect decision is 0.017 when M = 5 and reduces to 0.0003 when M = 10. 4.5.2. A Model for Algorithmic Efficiency The following optimization problem is called a linear program: minimize cx, subject to Ax = b, x 0
where A is an m n matrix of fixed constants; c = (c1 , . . . , cn ) and b = (b1 , . . . , bm ) are vectors of fixed constants; and x = (x1 , . . . , xn ) is the nvector of nonnegative values that is to be chosen to minimize cx n ci xi . Supposing i=1 that n > m, it can be shown that the optimal x can always be chosen to have at least n  m components equal to 0that is, it can always be taken to be one of the socalled extreme points of the feasibility region. The simplex algorithm solves this linear program by moving from an extreme point of the feasibility region to a better (in terms of the objective function cx) extreme point (via the pivot operation) until the optimal is reached. Because there n can be as many as N m such extreme points, it would seem that this method might take many iterations, but, surprisingly to some, this does not appear to be the case in practice. To obtain a feel for whether or not the preceding statement is surprising, let us consider a simple probabilistic (Markov chain) model as to how the algorithm moves along the extreme points. Specifically, we will suppose that if at any time the algorithm is at the j th best extreme point then after the next pivot the resulting extreme point is equally likely to be any of the j  1 best. Under this assumption, we show that the time to get from the N th best to the best extreme point has approximately, for large N , a normal distribution with mean and variance equal to the logarithm (base e) of N .
222
4
Markov Chains
Consider a Markov chain for which P11 = 1 and Pij = 1 , i1 j = 1, . . . , i  1, i > 1
and let Ti denote the number of transitions needed to go from state i to state 1. A recursive formula for E[Ti ] can be obtained by conditioning on the initial transition: 1 E[Ti ] = 1 + i 1
i1
E[Tj ]
j =1
Starting with E[T1 ] = 0, we successively see that E[T2 ] = 1, E[T3 ] = 1 + 1 , 2 E[T4 ] = 1 + 1 (1 + 1 + 1 ) = 1 + 3 2
1 2
+
1 3
and it is not difficult to guess and then prove inductively that
i1
E[Ti ] =
j =1
1/j
However, to obtain a more complete description of TN , we will use the representation
N 1
TN =
j =1
Ij
where Ij = 1, 0, if the process ever enters j otherwise
The importance of the preceding representation stems from the following:
Proposition 4.4 I1 , . . . , IN 1 are independent and
P {Ij = 1} = 1/j, 1 j N 1
Proof Given Ij +1 , . . . , IN , let n = min{i: i > j, Ii = 1} denote the lowest numbered state, greater than j , that is entered. Thus we know that the process enters
4.5.
Some Applications
223
state n and the next state entered is one of the states 1, 2, . . . , j . Hence, as the next state from state n is equally likely to be any of the lower number states 1, 2, . . . , n  1 we see that P {Ij = 1Ij +1 , . . . , IN } = 1/(n  1) = 1/j j/(n  1)
Hence, P {Ij = 1} = 1/j , and independence follows since the preceding conditional probability does not depend on Ij +1 , . . . , IN .
Corollary 4.5
(i) E[TN ] = (ii) Var(TN ) = (iii) For N large, TN has approximately a normal distribution with mean log N and variance log N .
N 1 j =1 1/j . N 1 j =1 (1/j )(1  1/j ).
Proof Parts (i) and (ii) follow from Proposition 4.4 and the representation
TN =
N 1 j =1 Ij .
Part (iii) follows from the central limit theorem since
N 1
dx < x
N 1
1/j < 1 +
1 1
N 1
dx x
or
N 1
log N <
1
1/j < 1 + log(N  1)
and so
N 1
log N
j =1
1/j
Returning to the simplex algorithm, if we assume that n, m, and n  m are all large, we have by Stirling's approximation that N= and so, letting c = n/m, log N mc +
1 2 1 2
n nn+1/2 m (n  m)nm+1/2 mm+1/2 2
log(mc)  m(c  1) + log m  1 log(2) 2
1 2
log(m(c  1))
 m+
224 or
4
Markov Chains
log N m c log
c + log(c  1) c1
Now, as limx x log[x/(x  1)] = 1, it follows that, when c is large, log N m[1 + log(c  1)] Thus, for instance, if n = 8000, m = 1000, then the number of necessary transitions is approximately normally distributed with mean and variance equal to 1000(1 + log 7) 3000. Hence, the number of necessary transitions would be roughly between 3000 2 3000 or roughly 3000 110 95 percent of the time. 4.5.3. Using a Random Walk to Analyze a Probabilistic Algorithm for the Satisfiability Problem Consider a Markov chain with states 0, 1, . . . , n having P0,1 = 1, Pi,i+1 = p, Pi,i1 = q = 1  p, 1 i n
and suppose that we are interested in studying the time that it takes for the chain to go from state 0 to state n. One approach to obtaining the mean time to reach state n would be to let mi denote the mean time to go from state i to state n, i = 0, . . . , n  1. If we then condition on the initial transition, we obtain the following set of equations: m0 = 1 + m1 , mi = E[time to reach nnext state is i + 1]p + E[time to reach nnext state is i  1]q = (1 + mi+1 )p + (1 + mi1 )q = 1 + pmi+1 + qmi1 , i = 1, . . . , n  1
Whereas the preceding equations can be solved for mi , i = 0, . . . , n  1, we do not pursue their solution; we instead make use of the special structure of the Markov chain to obtain a simpler set of equations. To start, let Ni denote the number of additional transitions that it takes the chain when it first enters state i until it enters
4.5.
Some Applications
225
state i + 1. By the Markovian property, it follows that these random variables Ni , i = 0, . . . , n  1 are independent. Also, we can express N0,n , the number of transitions that it takes the chain to go from state 0 to state n, as
n1
N0,n =
i=0
Ni
(4.15)
Letting i = E[Ni ] we obtain, upon conditioning on the next transition after the chain enters state i, that for i = 1, . . . , n  1 i = 1 + E[number of additional transitions to reach i + 1chain to i  1]q Now, if the chain next enters state i  1, then in order for it to reach i + 1 it must first return to state i and must then go from state i + 1. Hence, we have from the preceding that
i = 1 + E[Ni1 + Ni ]q where Ni1 and Ni are, respectively, the additional number of transitions to return to state i from i  1 and the number to then go from i to i + 1. Now, it follows from the Markovian property that these random variables have, respectively, the same distributions as Ni1 and Ni . In addition, they are independent (although we will only use this when we compute the variance of N0,n ). Hence, we see that
i = 1 + q(i1 + i ) or i = q 1 + i1 , p p i = 1, . . . , n  1
Starting with 0 = 1, and letting = q/p, we obtain from the preceding recursion that 1 = 1/p + , 2 = 1/p + (1/p + ) = 1/p + /p + 2 , 3 = 1/p + (1/p + /p + 2 ) = 1/p + /p + 2 /p + 3 In general, we see that i = 1 p
i1
j + i ,
j =0
i = 1, . . . , n  1
(4.16)
226
4
Markov Chains
Using Equation (4.15), we now get E[N0,n ] = 1 + 1 p
n1 i1 n1
j +
i=1 j =0 i=1
i
When p = 1 , and so = 1, we see from the preceding that 2 E[N0,n ] = 1 + (n  1)n + n  1 = n2 When p = 1 , we obtain that 2 E[N0,n ] = 1 + 1 p(1  )
n1
(1  i ) +
i=1
 n 1
=1+ =1+
(  n )  n 1+ n1 + 1 1 1 2 n+1  (n + 1) 2 + n  1 (1  )2
where the second equality used the fact that p = 1/(1 + ). Therefore, we see that when > 1, or equivalently when p < 1 , the expected number of transitions to 2 reach n is an exponentially increasing function of n. On the other hand, when p = 1 1 2 2 , E[N0,n ] = n , and when p > 2 , E[N0,n ] is, for large n, essentially linear in n. Let us now compute Var(N0,n ). To do so, we will again make use of the representation given by Equation (4.15). Letting vi = Var(Ni ), we start by determining the vi recursively by using the conditional variance formula. Let Si = 1 if the first transition out of state i is into state i + 1, and let Si = 1 if the transition is into state i  1, i = 1, . . . , n  1. Then, given that Si = 1: given that Si = 1: Hence, E[Ni Si = 1] = 1, E[Ni Si = 1] = 1 + i1 + i N1 = 1
Ni = 1 + Ni1 + Ni
4.5.
Some Applications
227
implying that Var(E[Ni Si ]) = Var(E[Ni Si ]  1) = (i1 + i )2 q  (i1 + i )2 q 2 = qp(i1 + i )2
Also, since Ni1 and Ni , the numbers of transitions to return from state i  1 to i and to then go from state i to state i + 1 are, by the Markovian property, independent random variables having the same distributions as Ni1 and Ni , respectively, we see that
Var(Ni Si = 1) = 0, Var(Ni Si = 1) = vi1 + vi Hence, E[Var(Ni Si )] = q(vi1 + vi ) From the conditional variance formula, we thus obtain that vi = pq(i1 + i )2 + q(vi1 + vi ) or, equivalently, vi = q(i1 + i )2 + vi1 , i = 1, . . . , n  1
Starting with v0 = 0, we obtain from the preceding recursion that v1 = q(0 + 1 )2 , v2 = q(1 + 2 )2 + q(0 + 1 )2 , v3 = q(2 + 3 )2 + q(1 + 2 )2 + 2 q(0 + 1 )2 In general, we have for i > 0,
i
vi = q
j =1
ij (j 1 + j )2
(4.17)
Therefore, we see that
n1 n1 i
Var(N0,n ) =
i=0
vi = q
i=1 j =1
ij (j 1 + j )2
where j is given by Equation (4.16).
228
4
Markov Chains
We see from Equations (4.16) and (4.17) that when p 1 , and so 1, that i 2 and vi , the mean and variance of the number of transitions to go from state i to i + 1, do not increase too rapidly in i. For instance, when p = 1 it follows from 2 Equations (4.16) and (4.17) that i = 2i + 1 and vi = 1 2
i i
(4j )2 = 8
j =1 j =1
j2
Hence, since N0,n is the sum of independent random variables, which are of roughly similar magnitudes when p 1 , it follows in this case from the cen2 tral limit theorem that N0,n is, for large n, approximately normally distributed. In particular, when p = 1 , N0,n is approximately normal with mean n2 and variance 2
n1 i
Var(N0,n ) = 8
i=1 j =1 n1 n1
j2
=8
j =1 i=j n1
j2
=8
j =1
(n  j )j 2
n1 1
8
2 4 3n
(n  x)x 2 dx
Example 4.25 (The Satisfiability Problem) A Boolean variable x is one that takes on either of two values: TRUE or FALSE. If xi , i 1 are Boolean variables, then a Boolean clause of the form
x1 + x2 + x3 is TRUE if x1 is TRUE, or if x2 is FALSE, or if x3 is TRUE. That is, the symbol "+" means "or" and x is TRUE if x is FALSE and vice versa. A Boolean formula is a combination of clauses such as (x1 + x2 ) (x1 + x3 ) (x2 + x3 ) (x1 + x2 ) (x1 + x2 ) In the preceding, the terms between the parentheses represent clauses, and the formula is TRUE if all the clauses are TRUE, and is FALSE otherwise. For a
4.5.
Some Applications
229
given Boolean formula, the satisfiability problem is either to determine values for the variables that result in the formula being TRUE, or to determine that the formula is never true. For instance, one set of values that makes the preceding formula TRUE is to set x1 = TRUE, x2 = FALSE, and x3 = FALSE. Consider a formula of the n Boolean variables x1 , . . . , xn and suppose that each clause in this formula refers to exactly two variables. We will now present a probabilistic algorithm that will either find values that satisfy the formula or determine to a high probability that it is not possible to satisfy it. To begin, start with an arbitrary setting of values. Then, at each stage choose a clause whose value is FALSE, and randomly choose one of the Boolean variables in that clause and change its value. That is, if the variable has value TRUE then change its value to FALSE, and vice versa. If this new setting makes the formula TRUE then stop, otherwise continue in the same fashion. If you have not stopped after n2 (1 + 4 2 ) repeti3 tions, then declare that the formula cannot be satisfied. We will now argue that if there is a satisfiable assignment then this algorithm will find such an assignment with a probability very close to 1. Let us start by assuming that there is a satisfiable assignment of truth values and let A be such an assignment. At each stage of the algorithm there is a certain assignment of values. Let Yj denote the number of the n variables whose values at the j th stage of the algorithm agree with their values in A . For instance, suppose that n = 3 and A consists of the settings x1 = x2 = x3 = TRUE. If the assignment of values at the j th step of the algorithm is x1 = TRUE, x2 = x3 = FALSE, then Yj = 1. Now, at each stage, the algorithm considers a clause that is not satisfied, thus implying that at least one of the values of the two variables in this clause does not agree with its value in A . As a result, when we randomly choose one of the variables in this clause then there is a probability of at least 1 that Yj +1 = Yj + 1 2 and at most 1 that Yj +1 = Yj  1. That is, independent of what has previously 2 transpired in the algorithm, at each stage the number of settings in agreement with those in A will either increase or decrease by 1 and the probability of an increase is at least 1 (it is 1 if both variables have values different from their values in A ). 2 Thus, even though the process Yj , j 0 is not itself a Markov chain (why not?) it is intuitively clear that both the expectation and the variance of the number of stages of the algorithm needed to obtain the values of A will be less than or equal to the expectation and variance of the number of transitions to go from state 0 to state n in the Markov chain of Section 4.5.2. Hence, if the algorithm has not yet terminated because it found a set of satisfiable values different from that of A , it will do so within an expected time of at most n2 and with a standard deviation of at most n2 2 . In addition, since the time for the Markov chain to go from 0 to n 3 is approximately normal when n is large we can be quite certain that a satisfiable assignment will be reached by n2 + 4(n2 2 ) stages, and thus if one has not been 3 found by this number of stages of the algorithm we can be quite certain that there is no satisfiable assignment.
230
4
Markov Chains
Our analysis also makes it clear why we assumed that there are only two variables in each clause. For if there were k, k > 2, variables in a clause then as any clause that is not presently satisfied may have only one incorrect setting, a randomly chosen variable whose value is changed might only increase the number of values in agreement with A with probability 1/k and so we could only conclude from our prior Markov chain results that the mean time to obtain the values in A is an exponential function of n, which is not an efficient algorithm when n is large.
4.6.
Mean Time Spent in Transient States
Consider now a finite state Markov chain and suppose that the states are numbered so that T = {1, 2, . . . , t} denotes the set of transient states. Let P11 P12 P1t . . . . . . . PT = . . . . . Pt1 Pt2 Ptt and note that since PT specifies only the transition probabilities from transient states into transient states, some of its row sums are less than 1 (otherwise, T would be a closed class of states). For transient states i and j , let sij denote the expected number of time periods that the Markov chain is in state j , given that it starts in state i. Let i,j = 1 when i = j and let it be 0 otherwise. Condition on the initial transition to obtain sij = i,j +
k t
Pik skj
= i,j +
k=1
Pik skj
(4.18)
where the final equality follows since it is impossible to go from a recurrent to a transient state, implying that skj = 0 when k is a recurrent state. Let S denote the matrix of values sij , i, j = 1, . . . , t. That is, s11 s12 s1t . . . . . . . S= . . . . . st1 st2 stt In matrix notation, Equation (4.18) can be written as S = I + PT S
4.6.
Mean Time Spent in Transient States
231
where I is the identity matrix of size t. Because the preceding equation is equivalent to (I  PT )S = I we obtain, upon multiplying both sides by (I  PT )1 , S = (I  PT )1 That is, the quantities sij , i T , j T , can be obtained by inverting the matrix I  PT . (The existence of the inverse is easily established.)
Example 4.26 Consider the gambler's ruin problem with p = 0.4 and N = 7.
Starting with 3 units, determine (a) the expected amount of time the gambler has 5 units, (b) the expected amount of time the gambler has 2 units. Solution: follows: The matrix PT , which specifies Pij , i, j {1, 2, 3, 4, 5, 6}, is as 1 1 2 3 4 5 6 0 0.6 0 0 0 0 2 0.4 0 0.6 0 0 0 3 0 0.4 0 0.6 0 0 4 0 0 0.4 0 0.6 0 5 0 0 0 0.4 0 0.6 6 0 0 0 0 0.4 0
PT =
Inverting I  PT gives 1.6149 1.5372 1.4206 1 S = (I  PT ) = 1.2458 0.9835 0.5901 Hence, s3,5 = 0.9228, s3,2 = 2.3677 1.0248 2.5619 2.3677 2.0763 1.6391 0.9835 0.6314 1.5784 2.9990 2.6299 2.0763 1.2458 0.3691 0.9228 1.7533 2.9990 2.3677 1.4206 0.1943 0.4857 0.9228 1.5784 2.5619 1.5372 0.0777 0.1943 0.3691 0.6314 1.0248 1.6149
232
4
Markov Chains
For i T , j T , the quantity fij , equal to the probability that the Markov chain ever makes a transition into state j given that it starts in state i, is easily determined from PT . To determine the relationship, let us start by deriving an expression for sij by conditioning on whether state j is ever entered. This yields sij = E[time in j start in i, ever transit to j ]fij + E[time in j start in i, never transit to j ](1  fij ) = (i,j + sjj )fij + i,j (1  fi,j ) = i,j + fij sjj since sjj is the expected number of additional time periods spent in state j given that it is eventually entered from state i. Solving the preceding equation yields fij = sij  i,j sjj
Example 4.27 In Example 4.26, what is the probability that the gambler ever
has a fortune of 1? Solution: Since s3,1 = 1.4206 and s1,1 = 1.6149, then f3,1 = s3,1 = 0.8797 s1,1
As a check, note that f3,1 is just the probability that a gambler starting with 3 reaches 1 before 7. That is, it is the probability that the gambler's fortune will go down 2 before going up 4; which is the probability that a gambler starting with 2 will go broke before reaching 6. Therefore, f3,1 =  1  (0.6/0.4)2 = 0.8797 1  (0.6/0.4)6
which checks with our earlier answer. Suppose we are interested in the expected time until the Markov chain enters some sets of states A, which need not be the set of recurrent states. We can reduce this back to the previous situation by making all states in A absorbing states. That is, reset the transition probabilities of states in A to satisfy. Pi,i = 1, iA
This transforms the states of A into recurrent states, and transforms any state outside of A from which an eventual transition into A is possible into a transient state. Thus, our previous approach can be used.
4.7.
Branching Processes
233
4.7.
Branching Processes
In this section we consider a class of Markov chains, known as branching processes, which have a wide variety of applications in the biological, sociological, and engineering sciences. Consider a population consisting of individuals able to produce offspring of the same kind. Suppose that each individual will, by the end of its lifetime, have produced j new offspring with probability Pj , j 0, independently of the numbers produced by other individuals. We suppose that Pj < 1 for all j 0. The number of individuals initially present, denoted by X0 , is called the size of the zeroth generation. All offspring of the zeroth generation constitute the first generation and their number is denoted by X1 . In general, let Xn denote the size of the nth generation. It follows that {Xn , n = 0, 1, . . .} is a Markov chain having as its state space the set of nonnegative integers. Note that state 0 is a recurrent state, since clearly P00 = 1. Also, if P0 > 0, all i other states are transient. This follows since Pi0 = P0 , which implies that starting i with i individuals there is a positive probability of at least P0 that no later generation will ever consist of i individuals. Moreover, since any finite set of transient states {1, 2, . . . , n} will be visited only finitely often, this leads to the important conclusion that, if P0 > 0, then the population will either die out or its size will converge to infinity. Let
=
j =0
j Pj
denote the mean number of offspring of a single individual, and let
2 =
j =0
(j  )2 Pj
be the variance of the number of offspring produced by a single individual. Let us suppose that X0 = 1, that is, initially there is a single individual present. We calculate E[Xn ] and Var(Xn ) by first noting that we may write
Xn1
Xn =
i=1
Zi
where Zi represents the number of offspring of the ith individual of the (n  1)st generation. By conditioning on Xn1 , we obtain
234
4
Markov Chains
E[Xn ] = E[E[Xn Xn1 ]]
Xn1
=E E
i=1
Zi Xn1
= E[Xn1 ] = E[Xn1 ] where we have used the fact that E[Zi ] = . Since E[X0 ] = 1, the preceding yields E[X1 ] = , E[X2 ] = E[X1 ] = 2 , . . . E[Xn ] = E[Xn1 ] = n Similarly, Var(Xn ) may be obtained by using the conditional variance formula Var(Xn ) = E[Var(Xn Xn1 )] + Var(E[Xn Xn1 ]) Now, given Xn1 , Xn is just the sum of Xn1 independent random variables each having the distribution {Pj , j 0}. Hence, E[Xn Xn1 ] = Xn1 , Var(Xn Xn1 ) = Xn1 2
The conditional variance formula now yields Var(Xn ) = E[Xn1 2 ] + Var(Xn1 ) = 2 n1 + 2 Var(Xn1 ) = 2 n1 + 2 2 n2 + 2 Var(Xn2 ) = 2 (n1 + n ) + 4 Var(Xn2 ) = 2 (n1 + n ) + 4 2 n3 + 2 Var(Xn3 ) = 2 (n1 + n + n+1 ) + 6 Var(Xn3 ) = = 2 (n1 + n + + 2n2 ) + 2n Var(X0 ) = 2 (n1 + n + + 2n2 )
4.7.
Branching Processes
235
Therefore, Var(Xn ) = 2 n1 n 2 ,
1n 1
,
if = 1 if = 1
(4.19)
Let 0 denote the probability that the population will eventually die out (under the assumption that X0 = 1). More formally, 0 = lim P {Xn = 0X0 = 1}
n
The problem of determining the value of 0 was first raised in connection with the extinction of family surnames by Galton in 1889. We first note that 0 = 1 if < 1. This follows since
= E[Xn ] =
n j =1
j P {Xn = j }
1 P {Xn = j }
j =1
= P {Xn
1}
Since n 0 when < 1, it follows that P {Xn 1} 0, and hence P {Xn = 0} 1. In fact, it can be shown that 0 = 1 even when = 1. When > 1, it turns out that 0 < 1, and an equation determining 0 may be derived by conditioning on the number of offspring of the initial individual, as follows: 0 = P {population dies out}
=
j =0
P {population dies outX1 = j }Pj
Now, given that X1 = j , the population will eventually die out if and only if each of the j families started by the members of the first generation eventually dies out. Since each family is assumed to act independently, and since the probability that any particular family dies out is just 0 , this yields P {population dies outX1 = j } = 0 and thus 0 satisfies
j
0 =
j =0
0 Pj
j
(4.20)
236
4
Markov Chains
In fact when > 1, it can be shown that 0 is the smallest positive number satisfying Equation (4.20).
Example 4.28 If P0 = 1 , P1 = 1 , P2 = 1 , then determine 0 . 2 4 4
Solution: Since =
3 4
1, it follows that 0 = 1.
Example 4.29 If P0 = 1 , P1 = 1 , P2 = 1 , then determine 0 . 4 4 2
Solution: 0 satisfies 0 = or
2 20  30 + 1 = 0 1 4 2 + 1 0 + 1 0 4 2
The smallest positive solution of this quadratic equation is 0 = 1 . 2
Example 4.30 In Examples 4.28 and 4.29, what is the probability that the
population will die out if it initially consists of n individuals? Solution: Since the population will die out if and only if the families of each n of the members of the initial generation die out, the desired probability is 0 . n = 1, and for Example 4.29, n = ( 1 )n . For Example 4.28 this yields 0 0 2
4.8.
Time Reversible Markov Chains
Consider a stationary ergodic Markov chain (that is, an ergodic Markov chain that has been in operation for a long time) having transition probabilities Pij and stationary probabilities i , and suppose that starting at some time we trace the sequence of states going backward in time. That is, starting at time n, consider the sequence of states Xn , Xn1 , Xn2 , . . . . It turns out that this sequence of states is itself a Markov chain with transition probabilities Qij defined by Qij = P {Xm = j Xm+1 = i} = = = P {Xm = j, Xm+1 = i} P {Xm+1 = i} P {Xm = j }P {Xm+1 = iXm = j } P {Xm+1 = i} j Pj i i
4.8.
Time Reversible Markov Chains
237
To prove that the reversed process is indeed a Markov chain, we must verify that P {Xm = j Xm+1 = i, Xm+2 , Xm+3 , . . .} = P {Xm = j Xm+1 = i} To see that this is so, suppose that the present time is m + 1. Now, since X0 , X1 , X2 , . . . is a Markov chain, it follows that the conditional distribution of the future Xm+2 , Xm+3 , . . . given the present state Xm+1 is independent of the past state Xm . However, independence is a symmetric relationship (that is, if A is independent of B, then B is independent of A), and so this means that given Xm+1 , Xm is independent of Xm+2 , Xm+3 , . . . . But this is exactly what we had to verify. Thus, the reversed process is also a Markov chain with transition probabilities given by Qij = j Pj i i
If Qij = Pij for all i, j , then the Markov chain is said to be time reversible. The condition for time reversibility, namely, Qij = Pij , can also be expressed as i Pij = j Pj i for all i, j (4.21)
The condition in Equation (4.21) can be stated that, for all states i and j , the rate at which the process goes from i to j (namely, i Pij ) is equal to the rate at which it goes from j to i (namely, j Pj i ). It is worth noting that this is an obvious necessary condition for time reversibility since a transition from i to j going backward in time is equivalent to a transition from j to i going forward in time; that is, if Xm = i and Xm1 = j , then a transition from i to j is observed if we are looking backward, and one from j to i if we are looking forward in time. Thus, the rate at which the forward process makes a transition from j to i is always equal to the rate at which the reverse process makes a transition from i to j ; if time reversible, this must equal the rate at which the forward process makes a transition from i to j . If we can find nonnegative numbers, summing to one, that satisfy Equation (4.21), then it follows that the Markov chain is time reversible and the numbers represent the limiting probabilities. This is so since if xi Pij = xj Pj i then summing over i yields xi Pij = xj
i i
for all i, j,
i
xi = 1
(4.22)
Pj i = xj ,
i
xi = 1
and, because the limiting probabilities i are the unique solution of the preceding, it follows that xi = i for all i.
238
4
Markov Chains
Example 4.31 Consider a random walk with states 0, 1, . . . , M and transition
probabilities Pi,i+1 = i = 1  Pi,i1 , P0,1 = 0 = 1  P0,0 , PM,M = M = 1  PM,M1 Without the need for any computations, it is possible to argue that this Markov chain, which can only make transitions from a state to one of its two nearest neighbors, is time reversible. This follows by noting that the number of transitions from i to i + 1 must at all times be within 1 of the number from i + 1 to i. This is so because between any two transitions from i to i +1 there must be one from i +1 to i (and conversely) since the only way to reenter i from a higher state is via state i + 1. Hence, it follows that the rate of transitions from i to i + 1 equals the rate from i + 1 to i, and so the process is time reversible. We can easily obtain the limiting probabilities by equating for each state i = 0, 1, . . . , M  1 the rate at which the process goes from i to i + 1 with the rate at which it goes from i + 1 to i. This yields 0 0 = 1 (1  1 ), 1 1 = 2 (1  2 ), . . . i i = i+1 (1  i+1 ), Solving in terms of 0 yields 1 = 0 0 , 1  1 1 1 0 0 2 = 1 = 1  2 (1  2 )(1  1 ) i = 0, 1, . . . , M  1 i = 1, . . . , M  1,
and, in general, i = Since
M 0 i
i1 0 0 , (1  i ) (1  1 )
i = 1, 2, . . . , M
= 1, we obtain
M
0 1 +
j =1
j 1 0 =1 (1  j ) (1  1 )
4.8.
Time Reversible Markov Chains
239
or
M
0 = 1 +
j =1
j 1 0 (1  j ) (1  1 )
1
(4.23)
and i = i1 0 0 , (1  i ) (1  1 ) i = 1, . . . , M (4.24)
For instance, if i , then
M
0 = 1 +
j =1
1
j 1
= and, in general, i = where
1 1  M+1
i (1  ) , 1  M+1
i = 0, 1, . . . , M
=
1
Another special case of Example 4.31 is the following urn model, proposed by the physicists P. and T. Ehrenfest to describe the movements of molecules. Suppose that M molecules are distributed among two urns; and at each time point one of the molecules is chosen at random, removed from its urn, and placed in the other one. The number of molecules in urn I is a special case of the Markov chain of Example 4.31 having i = M i , M i = 0, 1, . . . , M
240
4
Markov Chains
Hence, using Equations (4.23) and (4.24) the limiting probabilities in this case are
M
0 = 1 +
j =1 M
(M  j + 1) (M  1)M j (j  1) 1
1
1
=
j =0
M j
M
=
1 2
where we have used the identity 1= =
j =0
1 1 + 2 2
M
M
M j
1 2
M
Hence, from Equation (4.24) i = M i 1 2
M
,
i = 0, 1, . . . , M
Because the preceding are just the binomial probabilities, it follows that in the long run, the positions of each of the M balls are independent and each one is equally likely to be in either urn. This, however, is quite intuitive, for if we focus on any one ball, it becomes quite clear that its position will be independent of the positions of the other balls (since no matter where the other M  1 balls are, the ball under consideration at each stage will be moved with probability 1/M) and by symmetry, it is equally likely to be in either urn.
Example 4.32 Consider an arbitrary connected graph (see Section 3.6 for definitions) having a number wij associated with arc (i, j ) for each arc. One instance of such a graph is given by Figure 4.1. Now consider a particle moving from node to node in this manner: If at any time the particle resides at node i, then it will next move to node j with probability Pij where
Pij = wij j wij
and where wij is 0 if (i, j ) is not an arc. For instance, for the graph of Figure 4.1, P12 = 3/(3 + 1 + 2) = 1 . 2
4.8.
Time Reversible Markov Chains
241
Figure 4.1. A connected graph with arc weights.
The time reversibility equations i Pij = j Pj i reduce to i or, equivalently, since wij = wj i i = j wij which is equivalent to i =c j wij or i = c
j
wij = j j wij
wj i i wj i
j i wj i
wij
or, since 1 =
i
i i =
i j
wij
j
wij
Because the i s given by this equation satisfy the time reversibility equations, it follows that the process is time reversible with these limiting probabilities. For the graph of Figure 4.1 we have that 1 =
6 32 ,
2 =
3 32 ,
3 =
6 32 ,
4 =
5 32 ,
5 =
12 32
242
4
Markov Chains
If we try to solve Equation (4.22) for an arbitrary Markov chain with states 0, 1, . . . , M, it will usually turn out that no solution exists. For example, from Equation (4.22), xi Pij = xj Pj i , xk Pkj = xj Pj k implying (if Pij Pj k > 0) that Pj i Pkj xi = xk Pij Pj k which in general need not equal Pki /Pik . Thus, we see that a necessary condition for time reversibility is that Pik Pkj Pj i = Pij Pj k Pki for all i, j, k (4.25) which is equivalent to the statement that, starting in state i, the path i k j i has the same probability as the reversed path i j k i. To understand the necessity of this, note that time reversibility implies that the rate at which a sequence of transitions from i to k to j to i occurs must equal the rate of ones from i to j to k to i (why?), and so we must have i Pik Pkj Pj i = i Pij Pj k Pki implying Equation (4.25) when i > 0. In fact, we can show the following.
Theorem 4.2 An ergodic Markov chain for which Pij = 0 whenever Pj i = 0
is time reversible if and only if starting in state i, any path back to i has the same probability as the reversed path. That is, if Pi,i1 Pi1 ,i2 Pik ,i = Pi,ik Pik ,ik1 Pi1 ,i for all states i, i1 , . . . , ik . (4.26)
Proof We have already proven necessity. To prove sufficiency, fix states i and j
and rewrite (4.26) as Pi,i1 Pi1 ,i2 Pik ,j Pj i = Pij Pj,ik Pi1 ,i Summing the preceding over all states i1 , . . . , ik yields
k+1 Pij Pj i = Pij Pjk+1 i
Letting k yields j Pj i = Pij i which proves the theorem.
4.8.
Time Reversible Markov Chains
243
Example 4.33 Suppose we are given a set of n elements, numbered 1 through n, which are to be arranged in some ordered list. At each unit of time a request is made to retrieve one of these elements, element i being requested (independently of the past) with probability Pi . After being requested, the element then is put back but not necessarily in the same position. In fact, let us suppose that the element requested is moved one closer to the front of the list; for instance, if the present list ordering is 1, 3, 4, 2, 5 and element 2 is requested, then the new ordering becomes 1, 3, 2, 4, 5. We are interested in the longrun average position of the element requested. For any given probability vector P = (P1 , . . . , Pn ), the preceding can be modeled as a Markov chain with n! states, with the state at any time being the list order at that time. We shall show that this Markov chain is time reversible and then use this to show that the average position of the element requested when this onecloser rule is in effect is less than when the rule of always moving the requested element to the front of the line is used. The time reversibility of the resulting Markov chain when the onecloser reordering rule is in effect easily follows from Theorem 4.2. For instance, suppose n = 3 and consider the following path from state (1, 2, 3) to itself:
(1, 2, 3) (2, 1, 3) (2, 3, 1) (3, 2, 1) (3, 1, 2) (1, 3, 2) (1, 2, 3) The product of the transition probabilities in the forward direction is
2 2 2 P2 P3 P3 P1 P1 P2 = P1 P2 P3
whereas in the reverse direction, it is
2 2 2 P3 P3 P2 P2 P1 P1 = P1 P2 P3
Because the general result follows in much the same manner, the Markov chain is indeed time reversible. [For a formal argument note that if fi denotes the number of times element i moves forward in the path, then as the path goes from a fixed state back to itself, it follows that element i will also move backward fi times. Therefore, since the backward moves of element i are precisely the times that it moves forward in the reverse path, it follows that the product of the transition probabilities for both the path and its reversal will equal Pi
i fi +ri
where ri is equal to the number of times that element i is in the first position and the path (or the reverse path) does not change states.]
244
4
Markov Chains
For any permutation i1 , i2 , . . . , in of 1, 2, . . . , n, let (i1 , i2 , . . . , in ) denote the limiting probability under the onecloser rule. By time reversibility we have Pij +1 (i1 , . . . , ij , ij +1 , . . . , in ) = Pij (i1 , . . . , ij +1 , ij , . . . , in ) (4.27)
for all permutations. Now the average position of the element requested can be expressed (as in Section 3.6.1) as Average position =
i
Pi E[Position of element i] Pi 1 +
i j =i
= =1+
P {element j precedes element i} Pi P {ej precedes ei }
i
j =i
=1+
i<j
[Pi P {ej precedes ei } + Pj P {ei precedes ej }] [Pi P {ej precedes ei } + Pj (1  P {ej precedes ei })]
i<j
=1+ =1+
(Pi  Pj )P {ej precedes ei } +
i<j i<j
Pj
Hence, to minimize the average position of the element requested, we would want to make P {ej precedes ei } as large as possible when Pj > Pi and as small as possible when Pi > Pj . Now under the frontoftheline rule we showed in Section 3.6.1 that P {ej precedes ei } = Pj Pj + Pi
(since under the frontoftheline rule element j will precede element i if and only if the last request for either i or j was for j ). Therefore, to show that the onecloser rule is better than the frontoftheline rule, it suffices to show that under the onecloser rule P {ej precedes ei } > Pj Pj + Pi when Pj > Pi
Now consider any state where element i precedes element j , say, (. . . , i, i1 , . . . , ik , j, . . .). By successive transpositions using Equation (4.27),
4.8.
Time Reversible Markov Chains
245
we have (. . . , i, i1 , . . . , ik , j, . . .) = For instance, (1, 2, 3) = = P2 P1 P2 (1, 3, 2) = (3, 1, 2) P3 P3 P3 P2 P1 P1 (3, 2, 1) = P3 P3 P2 P1 P3
2
Pi Pj
k+1
(. . . , j, i1 , . . . , ik , i, . . .)
(4.28)
(3, 2, 1)
Now when Pj > Pi , Equation (4.28) implies that (. . . , i, i1 , . . . , ik , j, . . .) < Pi (. . . , j, i1 , . . . , ik , i, . . .) Pj
Letting (i,j ) = P {ei precedes ej }, we see by summing over all states for which i precedes j and by using the preceding that (i, j ) < Pi (j, i) Pj
which, since (i, j ) = 1  (j, i), yields (j, i) > Pj Pj + Pi
Hence, the average position of the element requested is indeed smaller under the onecloser rule than under the frontoftheline rule. The concept of the reversed chain is useful even when the process is not time reversible. To illustrate this, we start with the following proposition whose proof is left as an exercise.
Proposition 4.6 Consider an irreducible Markov chain with transition probabilities Pij . If we can find positive numbers i , i 0, summing to one, and a transition probability matrix Q = [Qij ] such that
i Pij = j Qj i (4.29)
then the Qij are the transition probabilities of the reversed chain and the i are the stationary probabilities both for the original and reversed chain. The importance of the preceding proposition is that, by thinking backward, we can sometimes guess at the nature of the reversed chain and then use the set of equations (4.29) to obtain both the stationary probabilities and the Qij .
246
4
Markov Chains
Example 4.34 A single bulb is necessary to light a given room. When the
bulb in use fails, it is replaced by a new one at the beginning of the next day. Let Xn equal i if the bulb in use at the beginning of day n is in its ith day of use (that is, if its present age is i). For instance, if a bulb fails on day n  1, then a new bulb will be put in use at the beginning of day n and so Xn = 1. If we suppose that each bulb, independently, fails on its ith day of use with probability pi , i 1, then it is easy to see that {Xn , n 1} is a Markov chain whose transition probabilities are as follows: Pi,1 = P { bulb, on its ith day of use, fails} = P {life of bulb = ilife of bulb = P {L = i} P {L i} i}
where L, a random variable representing the lifetime of a bulb, is such that P {L = i} = pi . Also, Pi,i+1 = 1  Pi,1 Suppose now that this chain has been in operation for a long (in theory, an infinite) time and consider the sequence of states going backward in time. Since, in the forward direction, the state is always increasing by 1 until it reaches the age at which the item fails, it is easy to see that the reverse chain will always decrease by 1 until it reaches 1 and then it will jump to a random value representing the lifetime of the (in real time) previous bulb. Thus, it seems that the reverse chain should have transition probabilities given by Qi,i1 = 1, Q1,i = pi , i>1 i 1
To check this, and at the same time determine the stationary probabilities, we must see if we can find, with the Qi,j as previously given, positive numbers {i } such that i Pi,j = j Qj,i To begin, let j = 1 and consider the resulting equations: i Pi,1 = 1 Q1,i This is equivalent to i P {L = i} = 1 P {L = i} P {L i}
4.9.
Markov Chain Monte Carlo Methods
247
or i = 1 P {L Summing over all i yields
i}
1=
i=1
i = 1
i=1
P {L
i} = 1 E[L]
and so, for the preceding Qij to represent the reverse transition probabilities, it is necessary for the stationary probabilities to be i = P {L i} , E[L] i 1
To finish the proof that the reverse transition probabilities and stationary probabilities are as given, all that remains is to show that they satisfy i Pi,i+1 = i+1 Qi+1,i which is equivalent to P {L = i} P {L i} 1 E[L] P {L i} and which is true since P {L = P {L i + 1} E[L] i + 1}.
i}  P {L = i} = P {L
4.9.
Markov Chain Monte Carlo Methods
Let X be a discrete random vector whose set of possible values is xj , j 1. Let the probability mass function of X be given by P {X = xj }, j 1, and suppose that we are interested in calculating
= E[h(X)] =
j =1
h(xj )P {X = xj }
for some specified function h. In situations where it is computationally difficult to evaluate the function h(xj ), j 1, we often turn to simulation to approximate . The usual approach, called Monte Carlo simulation, is to use random numbers to generate a partial sequence of independent and identically distributed random vectors X1 , X2 , . . . , Xn having the mass function P {X = xj }, j 1 (see Chap
248
4
Markov Chains
ter 11 for a discussion as to how this can be accomplished). Since the strong law of large numbers yields
n n
lim
i=1
h(Xi ) = n
(4.30)
it follows that we can estimate by letting n be large and using the average of the values of h(Xi ), i = 1, . . . , n as the estimator. It often, however, turns out that it is difficult to generate a random vector having the specified probability mass function, particularly if X is a vector of dependent random variables. In addition, its probability mass function is sometimes given in the form P {X = xj } = Cbj , j 1, where the bj are specified, but C must be computed, and in many applications it is not computationally feasible to sum the bj so as to determine C. Fortunately, however, there is another way of using simulation to estimate in these situations. It works by generating a sequence, not of independent random vectors, but of the successive states of a vectorvalued Markov chain X1 , X2 , . . . whose stationary probabilities are P {X = xj }, j 1. If this can be accomplished, then it would follow from Proposition 4.3 that Equation (4.30) remains valid, implying that we can then use n h(Xi )/n as an estimator of . i=1 We now show how to generate a Markov chain with arbitrary stationary probabilities that may only be specified up to a multiplicative constant. Let b(j ), j = 1, 2, . . . be positive numbers whose sum B = b(j ) is finite. The folj =1 lowing, known as the HastingsMetropolis algorithm, can be used to generate a time reversible Markov chain whose stationary probabilities are (j ) = b(j )/B, j = 1, 2, . . .
To begin, let Q be any specified irreducible Markov transition probability matrix on the integers, with q(i, j ) representing the row i column j element of Q. Now define a Markov chain {Xn , n 0} as follows. When Xn = i, generate a random variable Y such that P {Y = j } = q(i, j ), j = 1, 2, . . . . If Y = j , then set Xn+1 equal to j with probability (i, j ), and set it equal to i with probability 1 (i, j ). Under these conditions, it is easy to see that the sequence of states constitutes a Markov chain with transition probabilities Pi,j given by Pi,j = q(i, j )(i, j ), Pi,i = q(i, i) +
k=i
if j = i
q(i, k)(1  (i, k))
This Markov chain will be time reversible and have stationary probabilities (j ) if (i)Pi,j = (j )Pj,i for j = i
4.9.
Markov Chain Monte Carlo Methods
249
which is equivalent to (i)q(i, j )(i, j ) = (j )q(j, i)(j, i) But if we take j = b(j )/B and set (i, j ) = min (j )q(j, i) ,1 (i)q(i, j ) (4.32) (4.31)
then Equation (4.31) is easily seen to be satisfied. For if (i, j ) = (j )q(j, i) (i)q(i, j )
then (j, i) = 1 and Equation (4.31) follows, and if (i,j ) = 1 then (j, i) = (i)q(i, j ) (j )q(j, i)
and again Equation (4.31) holds, thus showing that the Markov chain is time reversible with stationary probabilities (j ). Also, since (j ) = b(j )/B, we see from (4.32) that (i, j ) = min b(j )q(j, i) ,1 b(i)q(i, j )
which shows that the value of B is not needed to define the Markov chain, because the values b(j ) suffice. Also, it is almost always the case that (j ), j 1 will not only be stationary probabilities but will also be limiting probabilities. (Indeed, a sufficient condition is that Pi,i > 0 for some i.)
Example 4.35 Suppose that we want to generate a uniformly distributed ele
ment in S , the set of all permutations (x1 , . . . , xn ) of the numbers (1, . . . , n) for which n=1 j xj > a for a given constant a. To utilize the HastingsMetropolis j algorithm we need to define an irreducible Markov transition probability matrix on the state space S . To accomplish this, we first define a concept of "neighboring" elements of S , and then construct a graph whose vertex set is S . We start by putting an arc between each pair of neighboring elements in S , where any two permutations in S are said to be neighbors if one results from an interchange of two of the positions of the other. That is, (1, 2, 3, 4) and (1, 2, 4, 3) are neighbors whereas (1, 2, 3, 4) and (1, 3, 4, 2) are not. Now, define the q transition probability function as follows. With N (s) defined as the set of neighbors of s, and N (s)
250
4
Markov Chains
equal to the number of elements in the set N (s), let q(s, t) = 1 N (s) if t N (s)
That is, the candidate next state from s is equally likely to be any of its neighbors. Since the desired limiting probabilities of the Markov chain are (s) = C, it follows that (s) = (t), and so (s, t) = min(N (s)/N (t), 1) That is, if the present state of the Markov chain is s then one of its neighbors is randomly chosen, say, t. If t is a state with fewer neighbors than s (in graph theory language, if the degree of vertex t is less than that of vertex s), then the next state is t. If not, a uniform (0,1) random number U is generated and the next state is t if U < (N (s)/N(t) and is s otherwise. The limiting probabilities of this Markov chain are (s) = 1/S , where S  is the (unknown) number of permutations in S . The most widely used version of the HastingsMetropolis algorithm is the Gibbs sampler. Let X = (X1 , . . . , Xn ) be a discrete random vector with probability mass function p(x) that is only specified up to a multiplicative constant, and suppose that we want to generate a random vector whose distribution is that of X. That is, we want to generate a random vector having mass function p(x) = Cg(x) where g(x) is known, but C is not. Utilization of the Gibbs sampler assumes that for any i and values xj , j = i, we can generate a random variable X having the probability mass function P {X = x} = P {Xi = xXj = xj , j = i} It operates by using the HastingMetropolis algorithm on a Markov chain with states x = (x1 , . . . , xn ), and with transition probabilities defined as follows. Whenever the present state is x, a coordinate that is equally likely to be any of 1, . . . , n is chosen. If coordinate i is chosen, then a random variable X with probability mass function P {X = x} = P {Xi = xXj = xj , j = i} is generated. If X = x, then the state y = (x1 , . . . xi1 , x, xi+1 , . . . , xn ), is considered as the candidate next state. In other words, with x and y as given, the Gibbs sampler uses
4.9.
Markov Chain Monte Carlo Methods
251
the HastingsMetropolis algorithm with 1 p(y) q(x, y) = P {Xi = xXj = xj , j = i} = n nP {Xj = xj , j = i} Because we want the limiting mass function to be p, we see from Equation (4.32) that the vector y is then accepted as the new state with probability (x, y) = min = min =1 Hence, when utilizing the Gibbs sampler, the candidate state is always accepted as the next state of the chain. p(y)q(y, x) ,1 p(x)q(x, y) p(y)p(x) ,1 p(x)p(y)
Example 4.36 Suppose that we want to generate n uniformly distributed points in the circle of radius 1 centered at the origin, conditional on the event that no two points are within a distance d of each other, when the probability of this conditioning event is small. This can be accomplished by using the Gibbs sampler as follows. Start with any n points x1 , . . . , xn in the circle that have the property that no two of them are within d of the other; then generate the value of I , equally likely to be any of the values 1, . . . , n. Then continually generate a random point in the circle until you obtain one that is not within d of any of the other n  1 points excluding xI . At this point, replace xI by the generated point and then repeat the operation. After a large number of iterations of this algorithm, the set of n points will approximately have the desired distribution. Example 4.37 Let Xi , i = 1, . . . , n, be independent exponential random variables with respective rates i , i = 1, . . . , n. Let S = n Xi , and suppose that we i=1 want to generate the random vector X = (X1 , . . . , Xn ), conditional on the event that S > c for some large positive constant c. That is, we want to generate the value of a random vector whose density function is f (x1 , . . . , xn ) = 1 P {S > c}
n i=1
i ei xi ,
n
xi
0,
i=1
xi > c
This is easily accomplished by starting with an initial vector x = (x1 , . . . , xn ) satisfying xi > 0, i = 1, . . . , n, n xi > c. Then generate a random variable I i=1 that is equally likely to be any of 1, . . . , n. Next, generate an exponential random
252
4
Markov Chains
variable X with rate I conditional on the event that X + j =I xj > c. This latter step, which calls for generating the value of an exponential random variable given that it exceeds c  j =I xj , is easily accomplished by using the fact that an exponential conditioned to be greater than a positive constant is distributed as the constant plus the exponential. Consequently, to obtain X, first generate an exponential random variable Y with rate I , and then set X=Y + c
j =I +
xj
The value of xI should then be reset as X and a new iteration of the algorithm begun.
Remark As can be seen by Examples 4.36 and 4.37, although the theory for
the Gibbs sampler was represented under the assumption that the distribution to be generated was discrete, it also holds when this distribution is continuous.
4.10.
Markov Decision Processes
Consider a process that is observed at discrete time points to be in any one of M possible states, which we number by 1, 2, . . . , M. After observing the state of the process, an action must be chosen, and we let A, assumed finite, denote the set of all possible actions. If the process is in state i at time n and action a is chosen, then the next state of the system is determined according to the transition probabilities Pij (a). If we let Xn denote the state of the process at time n and an the action chosen at time n, then the preceding is equivalent to stating that P {Xn+1 = j X0 , a0 , X1 , a1 , . . . , Xn = i, an = a} = Pij (a) Thus, the transition probabilities are functions only of the present state and the subsequent action. By a policy, we mean a rule for choosing actions. We shall restrict ourselves to policies which are of the form that the action they prescribe at any time depends only on the state of the process at that time (and not on any information concerning prior states and actions). However, we shall allow the policy to be "randomized" in that its instructions may be to choose actions according to a probability distribution. In other words, a policy is a set of numbers = {i (a), a A, i = 1, . . . , M} with the interpretation that if the process is in
4.10.
Markov Decision Processes
253
state i, then action a is to be chosen with probability i (a). Of course, we need have that 0 i (a)
a
1,
for all i, a for all i
i (a) = 1,
Under any given policy , the sequence of states {Xn , n = 0, 1, . . .} constitutes a Markov chain with transition probabilities Pij () given by Pij () = P {Xn+1 = j Xn = i} =
a
Pij (a)i (a)
where the last equality follows by conditioning on the action chosen when in state i. Let us suppose that for every choice of a policy , the resultant Markov chain {Xn , n = 0, 1, . . .} is ergodic. For any policy , let ia denote the limiting (or steadystate) probability that the process will be in state i and action a will be chosen if policy is employed. That is, ia = lim P {Xn = i, an = a}
n
The vector = (ia ) must satisfy (i) ia 0 for all i, a, (ii) i a ia = 1, (iii) j a = i a ia Pij (a) for all j a
(4.33)
Equations (i) and (ii) are obvious, and Equation (iii) which is an analogue of Equation (4.7) follows as the lefthand side equals the steadystate probability of being in state j and the righthand side is the same probability computed by conditioning on the state and action chosen one stage earlier. Thus for any policy , there is a vector = (ia ) which satisfies (i)(iii) and with the interpretation that ia is equal to the steadystate probability of being in state i and choosing action a when policy is employed. Moreover, it turns out that the reverse is also true. Namely, for any vector = (ia ) which satisfies (i)(iii), there exists a policy such that if is used, then the steadystate probability of being in i and choosing action a equals ia . To verify this last statement,
We use the notation P to signify that the probability is conditional on the fact that policy is
used.
254
4
Markov Chains
suppose that = (ia ) is a vector which satisfies (i)(iii). Then, let the policy = (i (a)) be i (a) = P { chooses astate is i} ia = a ia Now let Pia denote the limiting probability of being in i and choosing a when policy is employed. We need to show that Pia = ia . To do so, first note that {Pia , i = 1, . . . , M, a A} are the limiting probabilities of the twodimensional Markov chain {(Xn , an ), n 0}. Hence, by the fundamental Theorem 4.1, they are the unique solution of (i ) Pia 0, (ii ) i a Pia = 1, (iii ) Pj a = i a Pia Pij (a )j (a) where (iii ) follows since P {Xn+1 = j, an+1 = aXn = i, an = a } = Pij (a )j (a) Since j (a) = we see that (Pia ) is the unique solution of Pia
a
j a a j a
0,
Pia = 1,
i
Pj a =
i a
Pia Pij (a )
j a a j a
Hence, to show that Pia = ia , we need show that ia
a
0,
ia = 1,
i
j a =
i a
ia Pij (a )
j a a j a
4.10.
Markov Decision Processes
255
The top two equations follow from (i) and (ii) of Equation (4.33), and the third, which is equivalent to j a =
a i a
ia Pij (a )
follows from condition (iii) of Equation (4.33). Thus we have shown that a vector = (ia ) will satisfy (i), (ii), and (iii) of Equation (4.33) if and only if there exists a policy such that ia is equal to the steadystate probability of being in state i and choosing action a when is used. In fact, the policy is defined by i (a) = ia / a ia . The preceding is quite important in the determination of "optimal" policies. For instance, suppose that a reward R(i, a) is earned whenever action a is chosen in state i. Since R(Xi , ai ) would then represent the reward earned at time i, the expected average reward per unit time under policy can be expressed as expected average reward under = lim E
n n i=1 R(Xi , ai )
n
Now, if ia denotes the steadystate probability of being in state i and choosing action a, it follows that the limiting expected reward at time n equals
n
lim E[R(Xn , an )] =
i a
ia R(i, a)
which implies that expected average reward under =
i a
ia R(i, a)
Hence, the problem of determining the policy that maximizes the expected average reward is maximize
=(ia ) i a
ia R(i, a) 0, for all i, a,
subject to ia
a
ia = 1,
i
j a =
a i a
ia Pij (a),
for all j
(4.34)
However, the preceding maximization problem is a special case of what is known as a linear program and can be solved by a standard linear programming algorithm
256
4
Markov Chains
known as the simplex algorithm. If = (ia ) maximizes the preceding, then the optimal policy will be given by where
i (a) =
ia a ia
Remarks (i) It can be shown that there is a maximizing Equation (4.34)
that has the property that for each i, ia is zero for all but one value of a, which implies that the optimal policy is nonrandomized. That is, the action it prescribes when in state i is a deterministic function of i. (ii) The linear programming formulation also often works when there are restrictions placed on the class of allowable policies. For instance, suppose there is a restriction on the fraction of time the process spends in some state, say, state 1. Specifically, suppose that we are allowed to consider only policies having the property that their use results in the process being in state 1 less than 100 percent of time. To determine the optimal policy subject to this requirement, we add to the linear programming problem the additional constraint
1a
a
since
a 1a
represents the proportion of time that the process is in state 1.
4.11.
Hidden Markov Chains
Let {Xn , n = 1, 2, . . .} be a Markov chain with transition probabilities Pi,j and initial state probabilities pi = P {X1 = i}, i 0. Suppose that there is a finite set S of signals, and that a signal from S is emitted each time the Markov chain enters a state. Further, suppose that when the Markov chain enters state j then, independently of previous Markov chain states and signals, the signal emitted is s with probability p(sj ), sS p(sj ) = 1. That is, if Sn represents the nth signal emitted, then P {S1 = sX1 = j } = p(sj ), P {Sn = sX1 , S1 , . . . , Xn1 , Sn1 , Xn = j } = p(sj ) A model of the preceding type in which the sequence of signals S1 , S2 , . . . is observed, while the sequence of underlying Markov chain states X1 , X2 , . . . is unobserved, is called a hidden Markov chain model.
i a R(i, a)ia and the constraints are all linear functions of the ia . For a heuristic analysis of the simplex algorithm, see 4.5.2. It is called a linear program since the objective function
4.11.
Hidden Markov Chains
257
Example 4.38 Consider a production process that in each period is either in a good state (state 1) or in a poor state (state 2). If the process is in state 1 during a period then, independent of the past, with probability 0.9 it will be in state 1 during the next period and with probability 0.1 it will be in state 2. Once in state 2, it remains in that state forever. Suppose that a single item is produced each period and that each item produced when the process is in state 1 is of acceptable quality with probability 0.99, while each item produced when the process is in state 2 is of acceptable quality with probability 0.96. If the status, either acceptable or unacceptable, of each successive item is observed, while the process states are unobservable, then the preceding is a hidden Markov chain model. The signal is the status of the item produced, and has value either a or u, depending on whether the item is acceptable or unacceptable. The signal probabilities are
p(u1) = 0.01, p(u2) = 0.04, p(a1) = 0.99, p(a2) = 0.96
while the transition probabilities of the underlying Markov chain are P1,1 = 0.9 = 1  P1,2 , P2,2 = 1
Although {Sn , n 1} is not a Markov chain, it should be noted that, conditional on the current state Xn , the sequence Sn , Xn+1 , Sn+1 , . . . of future signals and states is independent of the sequence X1 , S1 , . . . , Xn1 , Sn1 of past states and signals. Let Sn = (S1 , . . . , Sn ) be the random vector of the first n signals. For a fixed sequence of signals s1 , . . . , sn , let sk = (s1 , . . . , sk ), k n. To begin, let us determine the conditional probability of the Markov chain state at time n given that Sn = sn . To obtain this probability, let Fn (j ) = P {Sn = sn , Xn = j } and note that P {Xn = j Sn = sn } = = P {Sn = sn , Xn = j } P {Sn = sn } Fn (j ) i Fn (i)
258 Now,
4
Markov Chains
Fn (j ) = P {Sn1 = sn1 , Sn = sn , Xn = j } =
i
P {Sn1 = sn1 , Xn1 = i, Xn = j, Sn = sn } Fn1 (i)P {Xn = j, Sn = sn Sn1 = sn1 , Xn1 = i}
i
= =
i
Fn1 (i)P {Xn = j, Sn = sn Xn1 = i} Fn1 (i)Pi,j p(sn j )
i
=
= p(sn j )
i
Fn1 (i)Pi,j
(4.35)
where the preceding used that P {Xn = j, Sn = sn Xn1 = i} = P {Xn = j Xn1 = i} P {Sn = sn Xn = j, Xn1 = i} = Pi,j P {Sn = sn Xn = j } = Pi,j p(sn j ) Starting with F1 (i) = P {X1 = i, S1 = s1 } = pi p(s1 i) we can use Equation (4.35) to recursively determine the functions F2 (i), F3 (i), . . . , up to Fn (i).
Example 4.39 Suppose in Example 4.38 that P {X1 = 1} = 0.8. Given that
the successive conditions of the first 3 items produced are a, u, a, (i) what is the probability that the process was in its good state when the third item was produced; (ii) what is the probability that X4 is 1; (iii) what is the probability that the next item produced is acceptable?
4.11.
Hidden Markov Chains
259
Solution:
With s3 = (a, u, a), we have F1 (1) = (0.8)(0.99) = 0.792, F1 (2) = (0.2)(0.96) = 0.192 F2 (1) = 0.01[0.792(0.9) + 0.192(0)] = 0.007128, F2 (2) = 0.04[0.792(0.1) + (0.192)(1)] = 0.010848 F3 (1) = 0.99[(0.007128)(0.9)] 0.006351, F3 (2) = 0.96[(0.007128)(0.1) + 0.010848] 0.011098
Therefore, the answer to part (i) is 0.006351 0.364 0.006351 + 0.011098 To compute P {X4 = 1s3 }, condition on X3 to obtain P {X3 = 1s3 } P {X4 = 1s3 } = P {X4 = 1X3 = 1, s3 }P {X3 = 1s3 } + P {X4 = 1X3 = 2, s3 }P {X3 = 2s3 } = P {X4 = 1X3 = 1, s3 }(0.364) + P {X4 = 1X3 = 2, s3 }(0.636) = 0.364P1,1 + 0.636P2,1 = 0.3276 To compute P {S4 = as3 }, condition on X4 P {S4 = as3 } = P {S4 = aX4 = 1, s3 }P {X4 = 1s3 } + P {S4 = aX4 = 2, s3 }P {X4 = 2s3 } = P {S4 = aX4 = 1}(0.3276) + P {S4 = aX4 = 2}(1  0.3276) = (0.99)(0.3276) + (0.96)(0.6724) = 0.9698 To compute P {Sn = sn }, use the identity P {Sn = sn } = i Fn (i) along with the recursion (4.35). If there are N states of the Markov chain, this requires computing nN quantities Fn (i), with each computation requiring a summation over N terms. This can be compared with a computation of P {Sn = sn } based on conditioning on the first n states of the Markov chain to obtain P {Sn = sn } =
i1 ,...,in
P {Sn = sn X1 = i1 , . . . , Xn = in }P {X1 = i1 , . . . , Xn = in } p(s1 i1 ) p(sn in )pi1 Pi1 ,i2 Pi2 ,i3 Pin1 ,in
i1 ,...,in
=
260
4
Markov Chains
The use of the preceding identity to compute P {Sn = sn } would thus require a summation over N n terms, with each term being a product of 2n values, indicating that it is not competitive with the previous approach. The computation of P {Sn = sn } by recursively determining the functions Fk (i) is known as the forward approach. There also is a backward approach, which is based on the quantities Bk (i), defined by Bk (i) = P {Sk+1 = sk+1 , . . . , Sn = sn Xk = i} A recursive formula for Bk (i) can be obtained by conditioning on Xk+1 . Bk (i) =
j
P {Sk+1 = sk+1 , . . . , Sn = sn Xk = i, Xk+1 = j }P {Xk+1 = j Xk = i} P {Sk+1 = sk+1 , . . . , Sn = sn Xk+1 = j }Pi,j
j
= =
j
P {Sk+1 = sk+1 Xk+1 = j } P {Sk+2 = sk+2 , . . . , Sn = sn Sk+1 = sk+1 , Xk+1 = j }Pi,j
=
j
p(sk+1 j )P {Sk+2 = sk+2 , . . . , Sn = sn Xk+1 = j }Pi,j p(sk+1 j )Bk+1 (j )Pi,j
j
=
(4.36)
Starting with Bn1 (i) = P {Sn = sn Xn1 = i} =
j
Pi,j p(sn j )
we would then use Equation (4.36) to determine the function Bn2 (i), then Bn3 (i), and so on, down to B1 (i). This would then yield P {Sn = sn } via P {Sn = sn } =
i
P {S1 = s1 , . . . , Sn = sn X1 = i}pi P {S1 = s1 X1 = i}P {S2 = s2 , . . . , Sn = sn S1 = s1 , X1 = i}pi
i
=
4.11.
Hidden Markov Chains
261
=
i
p(s1 i)P {S2 = s2 , . . . , Sn = sn X1 = i}pi p(s1 i)B1 (i)pi
i
=
Another approach to obtaining P {Sn = sn } is to combine both the forward and backward approaches. Suppose that for some k we have computed both functions Fk (j ) and Bk (j ). Because P {Sn = sn , Xk = j } = P {Sk = sk , Xk = j } P {Sk+1 = sk+1 , . . . , Sn = sn Sk = sk , Xk = j } = P {Sk = sk , Xk = j }P {Sk+1 = sk+1 , . . . , Sn = sn Xk = j } = Fk (j )Bk (j ) we see that P {Sn = sn } =
j
Fk (j )Bk (j )
The beauty of using the preceding identity to determine P {Sn = sn } is that we may simultaneously compute the sequence of forward functions, starting with F1 , as well as the sequence of backward functions, starting at Bn1 . The parallel computations can then be stopped once we have computed both Fk and Bk for some k. 4.11.1. Predicting the States Suppose the first n observed signals are sn = (s1 , . . . , sn ), and that given this data we want to predict the first n states of the Markov chain. The best predictor depends on what we are trying to accomplish. If our objective is to maximize the expected number of states that are correctly predicted, then for each k = 1, . . . , n we need to compute P {Xk = j Sn = sn } and then let the value of j that maximizes this quantity be the predictor of Xk . (That is, we take the mode of the conditional probability mass function of Xk , given the sequence of signals, as the predictor of Xk .) To do so, we must first compute this conditional probability mass function, which is accomplished as follows. For k n P {Xk = j Sn = sn } = = P {Sn = sn , Xk = j } P {Sn = sn } Fk (j )Bk (j ) j Fk (j )Bk (j )
Thus, given that Sn = sn , the optimal predictor of Xk is the value of j that maximizes Fk (j )Bk (j ).
262
4
Markov Chains
A different variant of the prediction problem arises when we regard the sequence of states as a single entity. In this situation, our objective is to choose that sequence of states whose conditional probability, given the sequence of signals, is maximal. For instance, in signal processing, while X1 , . . . , Xn might be the actual message sent, S1 , . . . , Sn would be what is received, and so the objective would be to predict the actual message in its entirety. Letting Xk = (X1 , . . . , Xk ) be the vector of the first k states, the problem of interest is to find the sequence of states i1 , . . . , in that maximizes P {Xn = (i1 , . . . , in )Sn = sn }. Because P {Xn = (i1 , . . . , in )Sn = sn } = P {Xn = (i1 , . . . , in ), Sn = sn } P {Sn = ss }
this is equivalent to finding the sequence of states i1 , . . . , in that maximizes P {Xn = (i1 , . . . , in ), Sn = sn }. To solve the preceding problem let, for k n, Vk (j ) = max P {Xk1 = (i1 , . . . , ik1 ), Xk = j, Sk = sk }
i1 ,...,ik1
To recursively solve for Vk (j ), use that Vk (j ) = max max P {Xk2 = (i1 , . . . , ik2 ), Xk1 = i, Xk = j, Sk = sk }
i i1 ,...,ik2 i1 ,...,ik2
= max max P {Xk2 = (i1 , . . . , ik2 ), Xk1 = i, Sk1 = sk1 ,
i
Xk = j, Sk = sk } = max max P {Xk2 = (i1 , . . . , ik2 ), Xk1 = i, Sk1 = sk1 }
i i1 ,...,ik2
P {Xk = j, Sk = sk Xk2 = (i1 , . . . , ik2 ), Xk1 = i, Sk1 = sk1 } = max max P {Xk2 = (i1 , . . . , ik2 ), Xk1 = i, Sk1 = sk1 }
i i1 ,...,ik2
P {Xk = j, Sk = sk Xk1 = i} = max P {Xk = j, Sk = sk Xk1 = i}
i
max P {Xk2 = (i1 , . . . , ik2 ), Xk1 = i, Sk1 = sk1 }
i1 ,...,ik2
= max Pi,j p(sk j )Vk1 (i)
i
= p(sk j ) max Pi,j Vk1 (i)
i
(4.37)
Exercises
263
Starting with V1 (j ) = P {X1 = j, S1 = s1 } = pj p(s1 j ) we now use the recursive identity (4.37) to determine V2 (j ) for each j ; then V3 (j ) for each j ; and so on, up to Vn (j ) for each j . To obtain the maximizing sequence of states, we work in the reverse direction. Let jn be the value (or any of the values if there are more than one) of j that maximizes Vn (j ). Thus jn is the final state of a maximizing state sequence. Also, for k < n, let ik (j ) be a value of i that maximizes Pi,j Vk (i). Then
i1 ,...,in
max P {Xn = (i1 , . . . , in ), Sn = sn } = max Vn (j )
j
= Vn (jn ) = max P {Xn = (i1 , . . . , in1 , jn ), Sn = sn }
i1 ,...,in1
= p(sn jn ) max Pi,jn Vn1 (i)
i
= p(sn jn )Pin1 (jn ),jn Vn1 (in1 (jn )) Thus, in1 (jn ) is the next to last state of the maximizing sequence. Continuing in this manner, the second from the last state of the maximizing sequence is in2 (in1 (jn )), and so on. The preceding approach to finding the most likely sequence of states given a prescribed sequence of signals is known as the Viterbi Algorithm.
Exercises
*1. Three white and three black balls are distributed in two urns in such a way that each contains three balls. We say that the system is in state i, i = 0, 1, 2, 3, if the first urn contains i white balls. At each step, we draw one ball from each urn and place the ball drawn from the first urn into the second, and conversely with the ball from the second urn. Let Xn denote the state of the system after the nth step. Explain why {Xn , n = 0, 1, 2, . . .} is a Markov chain and calculate its transition probability matrix. 2. Suppose that whether or not it rains today depends on previous weather conditions through the last three days. Show how this system may be analyzed by using a Markov chain. How many states are needed?
264
4
Markov Chains
3. In Exercise 2, suppose that if it has rained for the past three days, then it will rain today with probability 0.8; if it did not rain for any of the past three days, then it will rain today with probability 0.2; and in any other case the weather today will, with probability 0.6, be the same as the weather yesterday. Determine P for this Markov chain. *4. Consider a process {Xn , n = 0, 1, . . .} which takes on the values 0, 1, or 2. Suppose P {Xn+1 = j Xn = i, Xn1 = in1 , . . . , X0 = i0 } =
I Pij , II Pij ,
when n is even when n is odd
I II where 2 =0 Pij = 2 =0 Pij = 1, i = 0, 1, 2. Is {Xn , n 0} a Markov chain? j j If not, then show how, by enlarging the state space, we may transform it into a Markov chain. 5. A Markov chain {Xn , n 0} with states 0, 1, 2, has the transition probability matrix 1 1 1
0
1 2
2
3 1 3
0
6 2 3 1 2
If P {X0 = 0} = P {X0 = 1} = 1 , find E[X3 ]. 4 6. Let the transition probability matrix of a twostate Markov chain be given, as in Example 4.2, by P= p 1p 1p p
Show by mathematical induction that P(n) =
1 2 1 2
+ 1 (2p  1)n 2  1 (2p  1)n 2
1 2 1 2
 1 (2p  1)n 2 + 1 (2p  1)n 2
7. In Example 4.4 suppose that it has rained neither yesterday nor the day before yesterday. What is the probability that it will rain tomorrow? 8. Suppose that coin 1 has probability 0.7 of coming up heads, and coin 2 has probability 0.6 of coming up heads. If the coin flipped today comes up heads, then we select coin 1 to flip tomorrow, and if it comes up tails, then we select coin 2 to flip tomorrow. If the coin initially flipped is equally likely to be coin 1 or coin 2, then what is the probability that the coin flipped on the third day after the initial flip is coin 1?
Exercises
265
9. Suppose in Exercise 8 that the coin flipped on Monday comes up heads. What is the probability that the coin flipped on Friday of the same week also comes up heads? 10. In Example 4.3, Gary is currently in a cheerful mood. What is the probability that he is not in a glum mood on any of the following three days? 11. In Example 4.3, Gary was in a glum mood four days ago. Given that he hasn't felt cheerful in a week, what is the probability he is feeling glum today? 12. For a Markov chain {Xn , n 0} with transition probabilities Pi,j , consider the conditional probability that Xn = m given that the chain started at time 0 in state i and has not yet entered state r by time n, where r is a specified state not equal to either i or m. We are interested in whether this conditional probability is equal to the n stage transition probability of a Markov chain whose state space does not include state r and whose transition probabilities are Qi,j = Either prove the equality P {Xn = mX0 = i, Xk = r, k = 1, . . . , n} = Qn i,m or construct a counterexample. 13. Let P be the transition probability matrix of a Markov chain. Argue that if for some positive integer r, Pr has all positive entries, then so does Pn , for all integers n r. 14. Specify the classes of the following Markov chains, and determine whether they are transient or recurrent: 0 P1 =
1 2 1 2 1 2 1 4 1 2 1 2 1 2 1 2
Pi,j , 1  Pi,r
i, j = r
0
1 2
,
P2 =
0 0
1 2
0 0
1 2
0 0 0 1 0 0 1
1 3
1 1 0 0 0 0 0
2 3
,
0
1 2 1 4 1 2
0 0 0 0
1 2 1 2
0
3 4 1 2
0
1 2
0 0 0 ,
1 2 1 2
1 4 1 2
0 0 0 0 0
P3 =
0 0 0
P4 = 0 0 1
0 0 0
0 0
0 0
0
0
15. Prove that if the number of states in a Markov chain is M, and if state j can be reached from state i, then it can be reached in M steps or less.
266
4
Markov Chains
*16. Show that if state i is recurrent and state i does not communicate with state j , then Pij = 0. This implies that once a process enters a recurrent class of states it can never leave that class. For this reason, a recurrent class is often referred to as a closed class. 17. For the random walk of Example 4.15 use the strong law of large numbers to give another proof that the Markov chain is transient when p = 1 . 2 Hint: Note that the state at time n can be written as n Yi where the Yi s i=1 are independent and P {Yi = 1} = p = 1  P {Yi = 1}. Argue that if p > 1 , 2 then, by the strong law of large numbers, n Yi as n and hence 1 the initial state 0 can be visited only finitely often, and hence must be transient. A similar argument holds when p < 1 . 2 18. Coin 1 comes up heads with probability 0.6 and coin 2 with probability 0.5. A coin is continually flipped until it comes up tails, at which time that coin is put aside and we start flipping the other one. (a) What proportion of flips use coin 1? (b) If we start the process with coin 1 what is the probability that coin 2 is used on the fifth flip? 19. For Example 4.4, calculate the proportion of days that it rains. 20. A transition probability matrix P is said to be doubly stochastic if the sum over each column equals one; that is, Pij = 1,
i
for all j
If such a chain is irreducible and aperiodic and consists of M + 1 states 0, 1, . . . , M, show that the limiting probabilities are given by j = 1 , M +1 j = 0, 1, . . . , M
*21. A DNA nucleotide has any of 4 values. A standard model for a mutational change of the nucleotide at a specific location is a Markov chain model that supposes that in going from period to period the nucleotide does not change with probability 1  3, and if it does change then it is equally likely to change to any of the other 3 values, for some 0 < < 1 . 3
n (a) Show that P1,1 = 1 + 3 (1  4)n . 4 4 (b) What is the long run proportion of time the chain is in each state?
22. Let Yn be the sum of n independent rolls of a fair die. Find
n
lim P {Yn is a multiple of 13}
Exercises
267
Hint: Define an appropriate Markov chain and apply the results of Exercise 20. 23. Trials are performed in sequence. If the last two trials were successes, then the next trial is a success with probability 0.8; otherwise the next trial is a success with probability 0.5. In the long run, what proportion of trials are successes? 24. Consider three urns, one colored red, one white, and one blue. The red urn contains 1 red and 4 blue balls; the white urn contains 3 white balls, 2 red balls, and 2 blue balls; the blue urn contains 4 white balls, 3 red balls, and 2 blue balls. At the initial stage, a ball is randomly selected from the red urn and then returned to that urn. At every subsequent stage, a ball is randomly selected from the urn whose color is the same as that of the ball previously selected and is then returned to that urn. In the long run, what proportion of the selected balls are red? What proportion are white? What proportion are blue? 25. Each morning an individual leaves his house and goes for a run. He is equally likely to leave either from his front or back door. Upon leaving the house, he chooses a pair of running shoes (or goes running barefoot if there are no shoes at the door from which he departed). On his return he is equally likely to enter, and leave his running shoes, either by the front or back door. If he owns a total of k pairs of running shoes, what proportion of the time does he run barefooted? 26. Consider the following approach to shuffling a deck of n cards. Starting with any initial ordering of the cards, one of the numbers 1, 2, . . . , n is randomly chosen in such a manner that each one is equally likely to be selected. If number i is chosen, then we take the card that is in position i and put it on top of the deckthat is, we put that card in position 1. We then repeatedly perform the same operation. Show that, in the limit, the deck is perfectly shuffled in the sense that the resultant ordering is equally likely to be any of the n! possible orderings. *27. Determine the limiting probabilities j for the model presented in Exercise 1. Give an intuitive explanation of your answer. 28. For a series of dependent trials the probability of success on any trial is (k + 1)/(k + 2) where k is equal to the number of successes on the previous two trials. Compute limn P {success on the nth trial}. 29. An organization has N employees where N is a large number. Each employee has one of three possible job classifications and changes classifications (independently) according to a Markov chain with transition probabilities 0.7 0.2 0.1 0.2 0.6 0.2 0.1 0.4 0.5 What percentage of employees are in each classification?
268
4
Markov Chains
30. Three out of every four trucks on the road are followed by a car, while only one out of every five cars is followed by a truck. What fraction of vehicles on the road are trucks? 31. A certain town never has two sunny days in a row. Each day is classified as being either sunny, cloudy (but dry), or rainy. If it is sunny one day, then it is equally likely to be either cloudy or rainy the next day. If it is rainy or cloudy one day, then there is one chance in two that it will be the same the next day, and if it changes then it is equally likely to be either of the other two possibilities. In the long run, what proportion of days are sunny? What proportion are cloudy? *32. Each of two switches is either on or off during a day. On day n, each switch will independently be on with probability [1 + number of on switches during day n  1]/4 For instance, if both switches are on during day n  1, then each will independently be on during day n with probability 3/4. What fraction of days are both switches on? What fraction are both off? 33. A professor continually gives exams to her students. She can give three possible types of exams, and her class is graded as either having done well or badly. Let pi denote the probability that the class does well on a type i exam, and suppose that p1 = 0.3, p2 = 0.6, and p3 = 0.9. If the class does well on an exam, then the next exam is equally likely to be any of the three types. If the class does badly, then the next exam is always type 1. What proportion of exams are type i, i = 1, 2, 3? 34. A flea moves around the vertices of a triangle in the following manner: Whenever it is at vertex i it moves to its clockwise neighbor vertex with probability pi and to the counterclockwise neighbor with probability qi = 1  pi , i = 1, 2, 3. (a) Find the proportion of time that the flea is at each of the vertices. (b) How often does the flea make a counterclockwise move which is then followed by five consecutive clockwise moves? 35. Consider a Markov chain with states 0, 1, 2, 3, 4. Suppose P0,4 = 1; and suppose that when the chain is in state i, i > 0, the next state is equally likely to be any of the states 0, 1, . . . , i  1. Find the limiting probabilities of this Markov chain. 36. The state of a process changes daily according to a twostate Markov chain. If the process is in state i during one day, then it is in state j the follow
Exercises
269
ing day with probability Pi,j , where P0,0 = 0.4, P0,1 = 0.6, P1,0 = 0.2, P1,1 = 0.8
Every day a message is sent. If the state of the Markov chain that day is i then the message sent is "good" with probability pi and is "bad" with probability qi = 1  pi , i = 0, 1 (a) If the process is in state 0 on Monday, what is the probability that a good message is sent on Tuesday? (b) If the process is in state 0 on Monday, what is the probability that a good message is sent on Friday? (c) In the long run, what proportion of messages are good? (d) Let Yn equal 1 if a good message is sent on day n and let it equal 2 otherwise. Is {Yn , n 1} a Markov chain? If so, give its transition probability matrix. If not, briefly explain why not. 37. Show that the stationary probabilities for the Markov chain having transition probabilities Pi,j are also the stationary probabilities for the Markov chain whose transition probabilities Qi,j are given by
k Qi,j = Pi,j
for any specified positive integer k. 38. Recall that state i is said to be positive recurrent if mi,i < , where mi,i is the expected number of transitions until the Markov chain, starting in state i, makes a transition back into that state. Because i , the long run proportion of time the Markov chain, starting in state i, spends in state i, satisfies i = 1 mi,i
it follows that state i is positive recurrent if and only if i > 0. Suppose that state i is positive recurrent and that state i communicates with state j . Show that state j is also positive recurrent by arguing that there is an integer n such that j
n i Pi,j > 0
39. Recall that a recurrent state that is not positive recurrent is called null recurrent. Use the result of Exercise 38 to prove that null recurrence is a class property. That is, if state i is null recurrent and state i communicates with state j, show that state j is also null recurrent.
270
4
Markov Chains
40. It follows from the argument made in Exercise 38 that state i is null recurrent if it is recurrent and i = 0. Consider the onedimensional symmetric random walk of Example 4.15. (a) Argue that i = 0 for all i. (b) Argue that all states are null recurrent. *41. Let i denote the longrun proportion of time a given irreducible Markov chain is in state i. (a) Explain why i is also the proportion of transitions that are into state i as well as being the proportion of transitions that are from state i. (b) i Pij represents the proportion of transitions that satisfy what property? (c) i i Pij represent the proportion of transitions that satisfy what property? (d) Using the preceding explain why j =
i
i Pij
42. Let A be a set of states, and let Ac be the remaining states. (a) What is the interpretation of i Pij ?
iA j Ac
(b) What is the interpretation of i Pij ?
iAc j A
(c) Explain the identity i Pij =
iA j Ac iAc j A
i Pij
43. Each day, one of n possible elements is requested, the ith one with probability Pi , i 1, n Pi = 1. These elements are at all times arranged in an ordered 1 list which is revised as follows: The element selected is moved to the front of the list with the relative positions of all the other elements remaining unchanged. Define the state at any time to be the list ordering at that time and note that there are n! possible states. (a) Argue that the preceding is a Markov chain.
Exercises
271
(b) For any state i1 , . . . , in (which is a permutation of 1, 2, . . . , n), let (i1 , . . . , in ) denote the limiting probability. In order for the state to be i1 , . . . , in , it is necessary for the last request to be for i1 , the last noni1 request for i2 , the last noni1 or i2 request for i3 , and so on. Hence, it appears intuitive that (i1 , . . . , in ) = Pi1 Pin1 Pi2 Pi3 1  Pi1 1  Pi1  Pi2 1  Pi1   Pin2
Verify when n = 3 that the preceding are indeed the limiting probabilities. 44. Suppose that a population consists of a fixed number, say, m, of genes in any generation. Each gene is one of two possible genetic types. If any generation has exactly i (of its m) genes being type 1, then the next generation will have j type 1 (and m  j type 2) genes with probability m j i m
j
mi m
mj
,
j = 0, 1, . . . , m
Let Xn denote the number of type 1 genes in the nth generation, and assume that X0 = i. (a) Find E[Xn ]. (b) What is the probability that eventually all the genes will be type 1? 45. Consider an irreducible finite Markov chain with states 0, 1, . . . , N . (a) Starting in state i, what is the probability the process will ever visit state j ? Explain! (b) Let xi = P {visit state N before state 0start in i}. Compute a set of linear equations which the xi satisfy, i = 0, 1, . . . , N . (c) If j j Pij = i for i = 1, . . . , N  1, show that xi = i/N is a solution to the equations in part (b) 46. An individual possesses r umbrellas which he employs in going from his home to office, and vice versa. If he is at home (the office) at the beginning (end) of a day and it is raining, then he will take an umbrella with him to the office (home), provided there is one to be taken. If it is not raining, then he never takes an umbrella. Assume that, independent of the past, it rains at the beginning (end) of a day with probability p. (i) Define a Markov chain with r + 1 states which will help us to determine the proportion of time that our man gets wet. (Note: He gets wet if it is raining, and all umbrellas are at his other location.)
272
4
Markov Chains
(ii) Show that the limiting probabilities are given by q if i = 0 r + q , where q = 1  p i = 1 , if i = 1, . . . , r r +q (iii) What fraction of time does our man get wet? (iv) When r = 3, what value of p maximizes the fraction of time he gets wet *47. Let {Xn , n 0} denote an ergodic Markov chain with limiting probabilities i . Define the process {Yn , n 1} by Yn = (Xn1 , Xn ). That is, Yn keeps track of the last two states of the original chain. Is {Yn , n 1} a Markov chain? If so, determine its transition probabilities and find
n
lim P {Yn = (i, j )}
48. Verify the transition probability matrix given in Example 4.20. 49. Let P (1) and P (2) denote transition probability matrices for ergodic Markov chains having the same state space. Let 1 and 2 denote the stationary (limiting) probability vectors for the two chains. Consider a process defined as follows: (i) X0 = 1. A coin is then flipped and if it comes up heads, then the remaining states X1 , . . . are obtained from the transition probability matrix P (1) and if tails from the matrix P (2) . Is {Xn , n 0} a Markov chain? If p = P {coin comes up heads}, what is limn P (Xn = i)? (ii) X0 = 1. At each stage the coin is flipped and if it comes up heads, then the next state is chosen according to P (1) and if tails comes up, then it is chosen according to P (2) . In this case do the successive states constitute a Markov chain? If so, determine the transition probabilities. Show by a counterexample that the limiting probabilities are not the same as in part (i). 50. In Exercise 8, if today's flip lands heads, what is the expected number of additional flips needed until the pattern t, t, h, t, h, t, t occurs? 51. In Example 4.3, Gary is in a cheerful mood today. Find the expected number of days until he has been glum for three consecutive days. 52. A taxi driver provides service in two zones of a city. Fares picked up in zone A will have destinations in zone A with probability 0.6 or in zone B with probability 0.4. Fares picked up in zone B will have destinations in zone A with probability 0.3 or in zone B with probability 0.7. The driver's expected profit for a trip entirely in zone A is 6; for a trip entirely in zone B is 8; and for a trip that involves both zones is 12. Find the taxi driver's average profit per trip.
Exercises
273
53. Find the average premium received per policyholder of the insurance company of Example 4.23 if = 1/4 for onethird of its clients, and = 1/2 for twothirds of its clients. 54. Consider the Ehrenfest urn model in which M molecules are distributed between two urns, and at each time point one of the molecules is chosen at random and is then removed from its urn and placed in the other one. Let Xn denote the number of molecules in urn 1 after the nth switch and let n = E[Xn ]. Show that (i) n+1 = 1 + (1  2/M)n . (ii) Use (i) to prove that n = M 2 M + 2 M
n
E[X0 ] 
M 2
55. Consider a population of individuals each of whom possesses two genes which can be either type A or type a. Suppose that in outward appearance type A is dominant and type a is recessive. (That is, an individual will have only the outward characteristics of the recessive gene if its pair is aa.) Suppose that the population has stabilized, and the percentages of individuals having respective gene pairs AA, aa, and Aa are p, q, and r. Call an individual dominant or recessive depending on the outward characteristics it exhibits. Let S11 denote the probability that an offspring of two dominant parents will be recessive; and let S10 denote the probability that the offspring of one dominant and one re2 cessive parent will be recessive. Compute S11 and S10 to show that S11 = S10 . (The quantities S10 and S11 are known in the genetics literature as Snyder's ratios.) 56. Suppose that on each play of the game a gambler either wins 1 with probability p or loses 1 with probability 1  p. The gambler continues betting until she or he is either winning n or losing m. What is the probability that the gambler quits a winner? 57. A particle moves among n + 1 vertices that are situated on a circle in the following manner. At each step it moves one step either in the clockwise direction with probability p or the counterclockwise direction with probability q = 1  p. Starting at a specified state, call it state 0, let T be the time of the first return to state 0. Find the probability that all states have been visited by time T . Hint: Condition on the initial transition and then use results from the gambler's ruin problem.
274
4
Markov Chains
58. In the gambler's ruin problem of Section 4.5.1, suppose the gambler's fortune is presently i, and suppose that we know that the gambler's fortune will eventually reach N (before it goes to 0). Given this information, show that the probability he wins the next gamble is p[1  (q/p)i+1 ] , 1  (q/p)i i+1 , 2i Hint: The probability we want is P {Xn+1 = i + 1Xn = i, lim Xm = N}
m
if p = if p =
1 2 1 2
=
P {Xn+1 = i + 1, limm Xm = N Xn = i} P {limm Xm = NXn = i}
59. For the gambler's ruin model of Section 4.5.1, let Mi denote the mean number of games that must be played until the gambler either goes broke or reaches a fortune of N , given that he starts with i, i = 0, 1, . . . , N . Show that Mi satisfies M0 = MN = 0; Mi = 1 + pMi+1 + qMi1 , i = 1, . . . , N  1
60. Solve the equations given in Exercise 59 to obtain Mi = i(N  i), = i N 1  (q/p)i ,  q  p q  p 1  (q/p)N if p = if p =
1 2 1 2
61. Suppose in the gambler's ruin problem that the probability of winning a bet depends on the gambler's present fortune. Specifically, suppose that i is the probability that the gambler wins a bet when his or her fortune is i. Given that the gambler's initial fortune is i, let P (i) denote the probability that the gambler's fortune reaches N before 0. (a) Derive a formula that relates P (i) to P (i  1) and P (i + 1). (b) Using the same approach as in the gambler's ruin problem, solve the equation of part (a) for P (i). (c) Suppose that i balls are initially in urn 1 and N  i are in urn 2, and suppose that at each stage one of the N balls is randomly chosen, taken from whichever urn it is in, and placed in the other urn. Find the probability that the first urn becomes empty before the second.
Exercises
275
*62. In Exercise 21, (a) what is the expected number of steps the particle takes to return to the starting position? (b) what is the probability that all other positions are visited before the particle returns to its starting state? 63. For the Markov chain with states 1, 2, 3, 4 whose transition probability matrix P is as specified below find fi3 and si3 for i = 1, 2, 3. 0.4 0.2 0.1 0.3 0.1 0.5 0.2 0.2 P= 0.3 0.4 0.2 0.1 0 0 0 1 64. Consider a branching process having < 1. Show that if X0 = 1, then the expected number of individuals that ever exist in this population is given by 1/(1  ). What if X0 = n? 65. In a branching process having X0 = 1 and > 1, prove that 0 is the smallest positive number satisfying Equation (4.16). Hint: Let be any solution of = j Pj . Show by mathematical inj =0 duction that P {Xn = 0} for all n, and let n . In using the induction argue that
P {Xn = 0} =
j =0
(P {Xn1 = 0})j Pj
66. For a branching process, calculate 0 when (a) P0 = 1 , P2 = 3 . 4 4 (b) P0 = 1 , P1 = 1 , P2 = 1 . 4 2 4 (c) P0 = 1 , P1 = 1 , P3 = 1 . 6 2 3 67. At all times, an urn contains N ballssome white balls and some black balls. At each stage, a coin having probability p, 0 < p < 1, of landing heads is flipped. If heads appears, then a ball is chosen at random from the urn and is replaced by a white ball; if tails appears, then a ball is chosen from the urn and is replaced by a black ball. Let Xn denote the number of white balls in the urn after the nth stage. (a) Is {Xn , n 0} a Markov chain? If so, explain why. (b) What are its classes? What are their periods? Are they transient or recurrent?
276
4
Markov Chains
(c) Compute the transition probabilities Pij . (d) Let N = 2. Find the proportion of time in each state. (e) Based on your answer in part (d) and your intuition, guess the answer for the limiting probability in the general case. (f) Prove your guess in part (e) either by showing that Equation (4.7) is satisfied or by using the results of Example 4.31. (g) If p = 1, what is the expected time until there are only white balls in the urn if initially there are i white and N  i black? *68. (a) Show that the limiting probabilities of the reversed Markov chain are the same as for the forward chain by showing that they satisfy the equations j =
i
i Qij
(b) Give an intuitive explanation for the result of part (a). 69. M balls are initially distributed among m urns. At each stage one of the balls is selected at random, taken from whichever urn it is in, and then placed, at random, in one of the other M  1 urns. Consider the Markov chain whose state at any time is the vector (n1 , . . . , nm ) where ni denotes the number of balls in urn i. Guess at the limiting probabilities for this Markov chain and then verify your guess and show at the same time that the Markov chain is time reversible. 70. A total of m white and m black balls are distributed among two urns, with each urn containing m balls. At each stage, a ball is randomly selected from each urn and the two selected balls are interchanged. Let Xn denote the number of black balls in urn 1 after the nth interchange. (a) Give the transition probabilities of the Markov chain Xn , n 0. (b) Without any computations, what do you think are the limiting probabilities of this chain? (c) Find the limiting probabilities and show that the stationary chain is time reversible. 71. It follows from Theorem 4.2 that for a time reversible Markov chain Pij Pj k Pki = Pik Pkj Pj i , for all i, j, k
It turns out that if the state space is finite and Pij > 0 for all i, j , then the preceding is also a sufficient condition for time reversibility. [That is, in this case, we need only check Equation (4.26) for paths from i to i that have only two intermediate states.] Prove this.
Exercises
277
Hint: Fix i and show that the equations j Pj k = k Pkj are satisfied by j = cPij /Pj i , where c is chosen so that
j
j = 1.
72. For a time reversible Markov chain, argue that the rate at which transitions from i to j to k occur must equal the rate at which transitions from k to j to i occur. 73. Show that the Markov chain of Exercise 31 is time reversible. 74. A group of n processors is arranged in an ordered list. When a job arrives, the first processor in line attempts it; if it is unsuccessful, then the next in line tries it; if it too is unsuccessful, then the next in line tries it, and so on. When the job is successfully processed or after all processors have been unsuccessful, the job leaves the system. At this point we are allowed to reorder the processors, and a new job appears. Suppose that we use the onecloser reordering rule, which moves the processor that was successful one closer to the front of the line by interchanging its position with the one in front of it. If all processors were unsuccessful (or if the processor in the first position was successful), then the ordering remains the same. Suppose that each time processor i attempts a job then, independently of anything else, it is successful with probability pi . (a) Define an appropriate Markov chain to analyze this model. (b) Show that this Markov chain is time reversible. (c) Find the longrun probabilities. 75. A Markov chain is said to be a tree process if (i) Pij > 0 whenever Pj i > 0, (ii) for every pair of states i and j , i = j , there is a unique sequence of distinct states i = i0 , i1 , . . . , in1 , in = j such that Pik ,ik+1 > 0, k = 0, 1, . . . , n  1
In other words, a Markov chain is a tree process if for every pair of distinct states i and j there is a unique way for the process to go from i to j without reentering a state (and this path is the reverse of the unique path from j to i). Argue that an ergodic tree process is time reversible. 76. On a chessboard compute the expected number of plays it takes a knight, starting in one of the four corners of the chessboard, to return to its initial position if we assume that at each play it is equally likely to choose any of its legal moves. (No other pieces are on the board.)
278
4
Markov Chains
Hint: Make use of Example 4.32. 77. In a Markov decision problem, another criterion often used, different than the expected average return per unit time, is that of the expected discounted return. In this criterion we choose a number , 0 < < 1, and try to choose a policy so as to maximize E[ i R(Xi , ai )] (that is, rewards at time n are discounted i=0 at rate n ). Suppose that the initial state is chosen according to the probabilities bi . That is, P {X0 = i} = bi , i = 1, . . . , n
For a given policy let yj a denote the expected discounted time that the process is in state j and action a is chosen. That is,
yj a = E
n=0
n I{Xn =j,an =a}
where for any event A the indicator variable IA is defined by IA = (a) Show that
1, 0,
if A occurs otherwise
yj a = E
a n=0
n I{Xn =j }
or, in other words, der . (b) Show that
a yj a
is the expected discounted time in state j un
yj a =
j a
1 , 1 yia Pij (a)
i a
yj a = bj +
a
Hint: For the second equation, use the identity I{Xn+1 =j } =
i a
I{Xn=i ,an=a } I{Xn+1 =j }
Take expectations of the preceding to obtain E IXn+1 =j } =
i a
E I{Xn=i ,an=a } Pij (a)
Exercises
279
(c) Let {yj a } be a set of numbers satisfying yj a =
j a
1 , 1 yia Pij (a)
i a
yj a = bj +
a
(4.38)
Argue that yj a can be interpreted as the expected discounted time that the process is in state j and action a is chosen when the initial state is chosen according to the probabilities bj and the policy , given by yia i (a) = a yia is employed. Hint: Derive a set of equations for the expected discounted times when policy is used and show that they are equivalent to Equation (4.38). (d) Argue that an optimal policy with respect to the expected discounted return criterion can be obtained by first solving the linear program maximize
j a
yj a R(j, a), yj a =
j a
such that
1 , 1 yia Pij (a),
i a
yj a = bj +
a
yj a and then defining the policy by i (a) =
0,
yia a yia
all j, a;
where the yj a are the solutions of the linear program. 78. For the Markov chain of Exercise 5, suppose that p(sj ) is the probability that signal s is emitted when the underlying Markov chain state is j , j = 0, 1, 2. (a) What proportion of emissions are signal s? (b) What proportion of those times in which signal s is emitted is 0 the underlying state? 79. In Example 4.39, what is the probability that the first 4 items produced are all acceptable?
280
4
Markov Chains
References
1. K. L. Chung, "Markov Chains with Stationary Transition Probabilities," Springer, Berlin, 1960. 2. S. Karlin and H. Taylor, "A First Course in Stochastic Processes," Second Edition, Academic Press, New York, 1975. 3. J. G. Kemeny and J. L. Snell, "Finite Markov Chains," Van Nostrand Reinhold, Princeton, New Jersey, 1960. 4. S. M. Ross, "Stochastic Processes," Second Edition, John Wiley, New York, 1996. 5. S. M. Ross, "Probability Models for Computer Science," Academic Press, 2002.
The Exponential Distribution and the Poisson Process
5
5.1. Introduction
In making a mathematical model for a realworld phenomenon it is always necessary to make certain simplifying assumptions so as to render the mathematics tractable. On the other hand, however, we cannot make too many simplifying assumptions, for then our conclusions, obtained from the mathematical model, would not be applicable to the realworld situation. Thus, in short, we must make enough simplifying assumptions to enable us to handle the mathematics but not so many that the mathematical model no longer resembles the realworld phenomenon. One simplifying assumption that is often made is to assume that certain random variables are exponentially distributed. The reason for this is that the exponential distribution is both relatively easy to work with and is often a good approximation to the actual distribution. The property of the exponential distribution that makes it easy to analyze is that it does not deteriorate with time. By this we mean that if the lifetime of an item is exponentially distributed, then an item that has been in use for ten (or any number of) hours is as good as a new item in regards to the amount of time remaining until the item fails. This will be formally defined in Section 5.2 where it will be shown that the exponential is the only distribution which possesses this property. In Section 5.3 we shall study counting processes with an emphasis on a kind of counting process known as the Poisson process. Among other things we shall discover about this process is its intimate connection with the exponential distribution.
281
282
5
The Exponential Distribution and the Poisson Process
5.2.
The Exponential Distribution
5.2.1. Definition A continuous random variable X is said to have an exponential distribution with parameter , > 0, if its probability density function is given by f (x) = ex , 0, x 0 x<0
or, equivalently, if its cdf is given by F (x) =
x 
f (y) dy =
1  ex , 0,
x 0 x<0
The mean of the exponential distribution, E[X], is given by E[X] = =
 0
xf (x) dx xex dx
Integrating by parts (u = x, dv = ex dx) yields E[X] = xex
+ 0 0
ex dx =
1
The moment generating function (t) of the exponential distribution is given by (t) = E[etX ] =
0
etx ex dx for t < (5.1)
=
t
All the moments of X can now be obtained by differentiating Equation (5.1). For example, E[X 2 ] = d2 (t) dt 2
t=0
2 = (  t)3 2 = 2
t=0
5.2.
The Exponential Distribution
283
Consequently, Var(X) = E[X 2 ]  (E[X])2 2 1  2 2 1 = 2 =
Example 5.1 (Exponential Random Variables and Expected Discounted Returns) Suppose that you are receiving rewards at randomly changing rates continuously throughout time. Let R(x) denote the random rate at which you are receiving rewards at time x. For a value 0, called the discount rate, the quantity
R=
0
ex R(x) dx
represents the total discounted reward. (In certain applications, is a continuously compounded interest rate, and R is the present value of the infinite flow of rewards.) Whereas E[R] = E
0
ex R(x) dx =
0
ex E[R(x)] dx
is the expected total discounted reward, we will show that it is also equal to the expected total reward earned up to an exponentially distributed random time with rate . Let T be an exponential random variable with rate , that is independent of all the random variables R(x). We want to argue that
0
ex E[R(x)] dx = E
0
T
R(x) dx
To show this, define for each x
0, a random variable I (x) by 1, 0, if x T if x > T
I (x) = and note that
T 0
R(x) dx =
0
R(x)I (x) dx
284 Thus,
5
The Exponential Distribution and the Poisson Process
T
E
0
R(x) dx = E
0
R(x)I (x) dx
=
0
E[R(x)I (x)] dx
=
0
E[R(x)]E[I (x)] dx
0
by independence
= =
0
E[R(x)]P {T
x} dx
ex E[R(x)] dx
Therefore, the expected total discounted reward is equal to the expected total (undiscounted) reward earned by a random time that is exponentially distributed with a rate equal to the discount factor. 5.2.2. Properties of the Exponential Distribution A random variable X is said to be without memory, or memoryless, if P {X > s + t  X > t} = P {X > s} for all s, t 0 (5.2)
If we think of X as being the lifetime of some instrument, then Equation (5.2) states that the probability that the instrument lives for at least s + t hours given that it has survived t hours is the same as the initial probability that it lives for at least s hours. In other words, if the instrument is alive at time t, then the distribution of the remaining amount of time that it survives is the same as the original lifetime distribution; that is, the instrument does not remember that it has already been in use for a time t. The condition in Equation (5.2) is equivalent to P {X > s + t, X > t} = P {X > s} P {X > t} or P {X > s + t} = P {X > s}P {X > t} (5.3)
Since Equation (5.3) is satisfied when X is exponentially distributed (for e(s+t) = es et ), it follows that exponentially distributed random variables are memoryless.
5.2.
The Exponential Distribution
285
Example 5.2 Suppose that the amount of time one spends in a bank is expo1 nentially distributed with mean ten minutes, that is, = 10 . What is the probability that a customer will spend more than fifteen minutes in the bank? What is the probability that a customer will spend more than fifteen minutes in the bank given that she is still in the bank after ten minutes?
Solution: If X represents the amount of time that the customer spends in the bank, then the first probability is just P {X > 15} = e15 = e3/2 0.220 The second question asks for the probability that a customer who has spent ten minutes in the bank will have to spend at least five more minutes. However, since the exponential distribution does not "remember" that the customer has already spent ten minutes in the bank, this must equal the probability that an entering customer spends at least five minutes in the bank. That is, the desired probability is just P {X > 5} = e5 = e1/2 0.604
Example 5.3 Consider a post office that is run by two clerks. Suppose that when Mr. Smith enters the system he discovers that Mr. Jones is being served by one of the clerks and Mr. Brown by the other. Suppose also that Mr. Smith is told that his service will begin as soon as either Jones or Brown leaves. If the amount of time that a clerk spends with a customer is exponentially distributed with mean 1/, what is the probability that, of the three customers, Mr. Smith is the last to leave the post office?
Solution: The answer is obtained by this reasoning: Consider the time at which Mr. Smith first finds a free clerk. At this point either Mr. Jones or Mr. Brown would have just left and the other one would still be in service. However, by the lack of memory of the exponential, it follows that the amount of time that this other man (either Jones or Brown) would still have to spend in the post office is exponentially distributed with mean 1/. That is, it is the same as if he were just starting his service at this point. Hence, by symmetry, the probability that he finishes before Smith must equal 1 . 2
Example 5.4 The dollar amount of damage involved in an automobile accident is an exponential random variable with mean 1000. Of this, the insurance company only pays that amount exceeding (the deductible amount of) 400. Find the expected value and the standard deviation of the amount the insurance company pays per accident.
286
5
The Exponential Distribution and the Poisson Process
Solution: If X is the dollar amount of damage resulting from an accident, then the amount paid by the insurance company is (X  400)+ , (where a + is defined to equal a if a > 0 and to equal 0 if a 0). Whereas we could certainly determine the expected value and variance of (X  400)+ from first principles, it is easier to condition on whether X exceeds 400. So, let I= 1, 0, if X > 400 if X 400
Let Y = (X  400)+ be the amount paid. By the lack of memory property of the exponential, it follows that if a damage amount exceeds 400, then the amount by which it exceeds it is exponential with mean 1000. Therefore, E[Y I = 1] = 1000 E[Y I = 0] = 0 Var(Y I = 1) = (1000)2 Var(Y I = 0) = 0 which can be conveniently written as E[Y I ] = 103 I, Var(Y I ) = 106 I
Because I is a Bernoulli random variable that is equal to 1 with probability e0.4 , we obtain E[Y ] = E E[Y I ] = 103 E[I ] = 103 e0.4 670.32 and, by the conditional variance formula Var(Y ) = E Var(Y I ) + Var E[Y I ] = 106 e0.4 + 106 e0.4 (1  e0.4 ) where the final equality used that the variance of a Bernoulli random variable with parameter p is p(1  p). Consequently, Var(Y ) 944.09
5.2.
The Exponential Distribution
287
It turns out that not only is the exponential distribution "memoryless," but it is the unique distribution possessing this property. To see this, suppose that X is memoryless and let F (x) = P {X > x}. Then by Equation (5.3) it follows that F (s + t) = F (s)F (t) That is, F (x) satisfies the functional equation g(s + t) = g(s)g(t) However, it turns out that the only right continuous solution of this functional equation is g(x) = ex and since a distribution function is always right continuous we must have F (x) = ex or F (x) = P {X x} = 1  ex
which shows that X is exponentially distributed.
Example 5.5 Suppose that the amount of time that a lightbulb works before
burning itself out is exponentially distributed with mean ten hours. Suppose that a person enters a room in which a lightbulb is burning. If this person desires to work for five hours, then what is the probability that she will be able to complete her work without the bulb burning out? What can be said about this probability when the distribution is not exponential?
This is proven as follows: If g(s + t) = g(s)g(t), then
g
2 n
=g
1 1 + n n
= g2
1 n
and repeating this yields g(m/n) = g m (1/n). Also g(1) = g 1 1 1 + + + n n n = gn 1 n or g 1 n = (g(1))1/n
Hence g(m/n) = (g(1))m/n , which implies, since g is right continuous, that g(x) = (g(1))x . Since g(1) = (g( 1 ))2 0 we obtain g(x) = ex , where =  log(g(1)). 2
288
5
The Exponential Distribution and the Poisson Process
Solution: Since the bulb is burning when the person enters the room it follows, by the memoryless property of the exponential, that its remaining lifetime is exponential with mean ten. Hence the desired probability is P {remaining lifetime > 5} = 1  F (5) = e5 = e1/2 However, if the lifetime distribution F is not exponential, then the relevant probability is P {lifetime > t + 5  lifetime > t} = 1  F (t + 5) 1  F (t)
where t is the amount of time that the bulb had been in use prior to the person entering the room. That is, if the distribution is not exponential then additional information is needed (namely, t) before the desired probability can be calculated. In fact, it is for this reason, namely, that the distribution of the remaining lifetime is independent of the amount of time that the object has already survived, that the assumption of an exponential distribution is so often made. The memoryless property is further illustrated by the failure rate function (also called the hazard rate function) of the exponential distribution. Consider a continuous positive random variable X having distribution function F and density f . The failure (or hazard) rate function r(t) is defined by r(t) = f (t) 1  F (t) (5.4)
To interpret r(t), suppose that an item, having lifetime X, has survived for t hours, and we desire the probability that it does not survive for an additional time dt. That is, consider P {X (t, t + dt)X > t}. Now P {X (t, t + dt)X > t} = = P {X (t, t + dt), X > t} P {X > t} P {X (t, t + dt)} P {X > t} f (t) dt = r(t) dt 1  F (t)
That is, r(t) represents the conditional probability density that a tyearold item will fail. Suppose now that the lifetime distribution is exponential. Then, by the memoryless property, it follows that the distribution of remaining life for a tyearold
5.2.
The Exponential Distribution
289
item is the same as for a new item. Hence r(t) should be constant. This checks out since r(t) = = f (t) 1  F (t) et = et
Thus, the failure rate function for the exponential distribution is constant. The parameter is often referred to as the rate of the distribution. (Note that the rate is the reciprocal of the mean, and vice versa.) It turns out that the failure rate function r(t) uniquely determines the distribution F . To prove this, we note by Equation (5.4) that r(t) = Integrating both sides yields log(1  F (t)) = 
0 t d dt F (t)
1  F (t)
r(t) dt + k
or 1  F (t) = ek exp 
0 t
r(t) dt
Letting t = 0 shows that k = 0 and thus F (t) = 1  exp 
0 t
r(t) dt
The preceding identity can also be used to show that exponential random variables are the only ones that are memoryless. Because if X is memoryless, then its failure rate function must be constant. But if r(t) = c, then by the preceding equation 1  F (t) = ect showing that the random variable is exponential.
Example 5.6 Let X1 , . . . , Xn be independent exponential random variables
with respective rates 1 , . . . , n , where i = j when i = j . Let T be independent
290
5
The Exponential Distribution and the Poisson Process
of these random variables and suppose that
n
Pj = 1
j =1
where Pj = P {T = j }
The random variable XT is said to be a hyperexponential random variable. To see how such a random variable might originate, imagine that a bin contains n different types of batteries, with a type j battery lasting for an exponential distributed time with rate j , j = 1, . . . , n. Suppose further that Pj is the proportion of batteries in the bin that are type j for each j = 1, . . . , n. If a battery is randomly chosen, in the sense that it is equally likely to be any of the batteries in the bin, then the lifetime of the battery selected will have the hyperexponential distribution specified in the preceding. To obtain the distribution function F of X = XT , condition on T . This yields 1  F (t) = P {X > t}
n
=
i=1 n
P {X > tT = i}P {T = i} Pi ei t
=
i=1
Differentiation of the preceding yields f , the density function of X.
n
f (t) =
i=1
i Pi ei t
Consequently, the failure rate function of a hyperexponential random variable is r(t) = By noting that P {T = j X > t} = = P {X > tT = j }P {T = j } P {X > t} Pj ej t n i t i=1 Pi e
n j t j =1 Pj j e n i t i=1 Pi e
we see that the failure rate function r(t) can also be written as
n
r(t) =
j =1
j P {T = j X > t}
5.2.
The Exponential Distribution
291
If 1 < i , for all i > 1, then P {T = 1X > t} = = P1 e1 t P1 e1 t + n Pi ei t i=2 P1 + P1 n (i 1 )t i=2 Pi e as t
1
Similarly, P {T = iX > t} 0 when i = 1, thus showing that
t
lim r(t) = min i
i
That is, as a randomly chosen battery ages its failure rate converges to the failure rate of the exponential type having the smallest failure rate, which is intuitive since the longer the battery lasts, the more likely it is a battery type with the smallest failure rate. 5.2.3. Further Properties of the Exponential Distribution Let X1 , . . . , Xn be independent and identically distributed exponential random variables having mean 1/. It follows from the results of Example 2.38 that X1 + + Xn has a gamma distribution with parameters n and . Let us now give a second verification of this result by using mathematical induction. Because there is nothing to prove when n = 1, let us start by assuming that X1 + + Xn1 has density given by fX1 ++Xn1 (t) = et Hence, fX1 + +Xn1 +Xn (t) = =
0 0 t
(t)n2 (n  2)!
fXn (t  s)fX1 + +Xn1 (s) ds (s)n2 ds (n  2)!
e(ts) es (t)n1 (n  1)!
= et
which proves the result. Another useful calculation is to determine the probability that one exponential random variable is smaller than another. That is, suppose that X1 and X2 are independent exponential random variables with respective means 1/1 and 1/2 ;
292
5
The Exponential Distribution and the Poisson Process
what is P {X1 < X2 }? This probability is easily calculated by conditioning on X1 : P {X1 < X2 } =
0
P {X1 < X2 X1 = x}1 e1 x dx P {x < X2 }1 e1 x dx e2 x 1 e1 x dx 1 e(1 +2 )x dx (5.5)
=
0
=
0
=
0
=
1 1 + 2
Suppose that X1 , X2 , . . . , Xn are independent exponential random variables, with Xi having rate i , i = 1, . . . , n. It turns out that the smallest of the Xi is exponential with a rate equal to the sum of the i . This is shown as follows: P {minimum(X1 , . . . , Xn ) > x} = P {Xi > x for each i = 1, . . . , n}
n
=
i=1 n
P {Xi > x} ei x
n
(by independence)
=
i=1
= exp 
i=1
i x
(5.6)
Example 5.7 (Analyzing Greedy Algorithms for the Assignment Problem)
A group of n people is to be assigned to a set of n jobs, with one person assigned to each job. For a given set of n2 values Cij , i, j = 1, . . . , n, a cost Cij is incurred when person i is assigned to job j . The classical assignment problem is to determine the set of assignments that minimizes the sum of the n costs incurred. Rather than trying to determine the optimal assignment, let us consider two heuristic algorithms for solving this problem. The first heuristic is as follows. Assign person 1 to the job that results in the least cost. That is, person 1 is assigned to job j1 where C(1, j1 ) = minimumj C(1, j ). Now eliminate that job from consideration and assign person 2 to the job that results in the least cost. That is, person 2 is assigned to job j2 where C(2, j2 ) = minimumj =j1 C(2, j ). This procedure is then continued until all n persons are assigned. Since this procedure always selects the best job for the person under consideration, we will call it Greedy Algorithm A.
5.2.
The Exponential Distribution
293
The second algorithm, which we call Greedy Algorithm B, is a more "global" version of the first greedy algorithm. It considers all n2 cost values and chooses the pair i1 , j1 for which C(i, j ) is minimal. It then assigns person i1 to job j1 . It then eliminates all cost values involving either person i1 or job j1 [so that (n  1)2 values remain] and continues in the same fashion. That is, at each stage it chooses the person and job that have the smallest cost among all the unassigned people and jobs. Under the assumption that the Cij constitute a set of n2 independent exponential random variables each having mean 1, which of the two algorithms results in a smaller expected total cost? Solution: Suppose first that Greedy Algorithm A is employed. Let Ci denote the cost associated with person i, i = 1, . . . , n. Now C1 is the minimum of n independent exponentials each having rate 1; so by Equation (5.6) it will be exponential with rate n. Similarly, C2 is the minimum of n  1 independent exponentials with rate 1, and so is exponential with rate n  1. Indeed, by the same reasoning Ci will be exponential with rate n  i + 1, i = 1, . . . , n. Thus, the expected total cost under Greedy Algorithm A is EA [total cost] = E[C1 + + Cn ]
n
=
i=1
1/i
Let us now analyze Greedy Algorithm B. Let Ci be the cost of the ith personjob pair assigned by this algorithm. Since C1 is the minimum of all the n2 values Cij , it follows from Equation (5.6) that C1 is exponential with rate n2 . Now, it follows from the lack of memory property of the exponential that the amounts by which the other Cij exceed C1 will be independent exponentials with rates 1. As a result, C2 is equal to C1 plus the minimum of (n  1)2 independent exponentials with rate 1. Similarly, C3 is equal to C2 plus the minimum of (n  2)2 independent exponentials with rate 1, and so on. Therefore, we see that E[C1 ] = 1/n2 , E[C2 ] = E[C1 ] + 1/(n  1)2 , E[C3 ] = E[C2 ] + 1/(n  2)2 , . . . E[Cj ] = E[Cj 1 ] + 1/(n  j + 1)2 , . . . E[Cn ] = E[Cn1 ] + 1
294
5
The Exponential Distribution and the Poisson Process
Therefore, E[C1 ] = 1/n2 , E[C2 ] = 1/n2 + 1/(n  1)2 , E[C3 ] = 1/n2 + 1/(n  1)2 + 1/(n  2)2 , . . . E[Cn ] = 1/n2 + 1/(n  1)2 + 1/(n  2)2 + + 1 Adding up all the E[Ci ] yields that EB [total cost] = n/n2 + (n  1)/(n  1)2 + (n  2)/(n  2)2 + + 1
n
=
i=1
1 i
The expected cost is thus the same for both greedy algorithms. Let X1 , . . . , Xn be independent exponential random variables, with respective rates 1 , . . . , n . A useful result, generalizing Equation (5.5), is that Xi is the smallest of these with probability i / j j . This is shown as follows: P Xi = min Xj = P Xi < min Xj
j j =i
=
i n j =1 j
where the final equality uses Equation (5.5) along with the fact that minj =i Xj is exponential with rate j =i j . Another important fact is that mini Xi and the rank ordering of the Xi are independent. To see why this is true, consider the conditional probability that Xi1 < Xi2 < < Xin given that the minimal value is greater than t. Because mini Xi > t means that all the Xi are greater than t, it follows from the lack of memory property of exponential random variables that their remaining lives beyond t remain independent exponential random variables with their original rates. Consequently, P Xi1 < < Xin min Xi > t = P Xi1  t < < Xin  t min Xi > t
i i
= P {Xi1 < < Xin } which proves the result.
5.2.
The Exponential Distribution
295
Example 5.8 Suppose you arrive at a post office having two clerks at a moment when both are busy but there is no one else waiting in line. You will enter service when either clerk becomes free. If service times for clerk i are exponential with rate i , i = 1, 2, find E[T ], where T is the amount of time that you spend in the post office. Solution: Let Ri denote the remaining service time of the customer with clerk i, i = 1, 2, and note, by the lack of memory property of exponentials, that R1 and R2 are independent exponential random variables with respective rates 1 and 2 . Conditioning on which of R1 or R2 is the smallest yields E[T ] = E[T R1 < R2 ]P {R1 < R2 } + E[T R2 = E[T R1 < R2 ] 1 + E[T R2 1 + 2 R1 ] R1 ]P {R2 2 1 + 2 R1 }
Now, with S denoting your service time E[T R1 < R2 ] = E[R1 + SR1 < R2 ] = E[R1 R1 < R2 ] + E[SR1 < R2 ] = E[R1 R1 < R2 ] + = 1 1 + 1 + 2 1 1 1
The final equation used that conditional on R1 < R2 the random variable R1 is the minimum of R1 and R2 and is thus exponential with rate 1 + 2 ; and also that conditional on R1 < R2 you are served by server 1. As we can show in a similar fashion that E[T R2 R1 ] = 1 1 + 1 + 2 2
we obtain the result E[T ] = 3 1 + 2
296
5
The Exponential Distribution and the Poisson Process
Another way to obtain E[T ] is to write T as a sum, take expectations, and then condition where needed. This approach yields E[T ] = E[min(R1 , R2 ) + S] = E[min(R1 , R2 )] + E[S] = 1 + E[S] 1 + 2
To compute E[S], we condition on which of R1 and R2 is smallest. E[S] = E[SR1 < R2 ] = 2 1 + 2 1 + E[SR2 1 + 2 R1 ] 2 1 + 2
Example 5.9 There are n cells in the body, of which cells 1, . . . , k are target
cells. Associated with each cell is a weight, with wi being the weight associated with cell i, i = 1, . . . , n. The cells are destroyed one at a time in a random order which is such that if S is the current set of surviving cells then, independent of the order in which the cells not in S have been destroyed, the next cell killed is i, i S, with probability wi / j S wj . In other words, the probability that a given surviving cell is the next one to be killed is the weight of that cell divided by the sum of the weights of all still surviving cells. Let A denote the total number of cells that are still alive at the moment when all the cells 1, 2, . . . , k have been killed, and find E[A]. Solution: Although it would be quite difficult to solve this problem by a direct combinatorial argument, a nice solution can be obtained by relating the order in which cells are killed to a ranking of independent exponential random variables. To do so, let X1 , . . . , Xn be independent exponential random variables, with Xi having rate wi , i = 1, . . . , n. Note that Xi will be the smallest of these exponentials with probability wi / j wj ; further, given that Xi is the smallest, Xr will be the next smallest with probability wr / j =i wj ; further, given that Xi and Xr are, respectively, the first and second smallest, Xs , s = i, r, will be the third smallest with probability ws / j =i,r wj ; and so on. Consequently, if we let Ij be the index of the j th smallest of X1 , . . . , Xn so that XI1 < XI2 < < XIn then the order in which the cells are destroyed has the same distribution as I1 , . . . , In . So, let us suppose that the order in which the cells are killed is determined by the ordering of X1 , . . . , Xn . (Equivalently, we can suppose that all cells will eventually be killed, with cell i being killed at time Xi , i = 1, . . . , n.)
5.2.
The Exponential Distribution
297
If we let Aj equal 1 if cell j is still alive at the moment when all the cells 1, . . . , k have been killed, and let it equal 0 otherwise, then
n
A=
j =k+1
Aj
Because cell j will be alive at the moment when all the cells 1, . . . , k have been killed if Xj is larger than all the values X1 , . . . , Xk , we see that for j > k E[Aj ] = P {Aj = 1} = P {Xj > max Xi }
i=1,...,k
=
0
P Xj > max Xi Xj = x wj ewj x dx
i=1,...,k
=
0
P {Xi < x for all i = 1, . . . , k}wj ewj x dx (1  ewi x ) wj ewj x dx
=
0
k i=1 1 k 0 i=1
=
(1  y wi /wj ) dy
where the final equality follows from the substitution y = ewj x . Thus, we obtain the result
n
E[A] =
1 k
(1  y wi /wj ) dy =
1
n
k
(1  y wi /wj ) dy
j =k+1 0 i=1
0 j =k+1 i=1
Example 5.10 Suppose that customers are in line to receive service that is provided sequentially by a server; whenever a service is completed, the next person in line enters the service facility. However, each waiting customer will only wait an exponentially distributed time with rate ; if its service has not yet begun by this time then it will immediately depart the system. These exponential times, one for each waiting customer, are independent. In addition, the service times are independent exponential random variables with rate . Suppose that someone is presently being served and consider the person who is nth in line.
(a) Find Pn , the probability that this customer is eventually served. (b) Find Wn , the conditional expected amount of time this person spends waiting in line given that she is eventually served.
298
5
The Exponential Distribution and the Poisson Process
Solution: Consider the n + 1 random variables consisting of the remaining service time of the person in service along with the n additional exponential departure times with rate of the first n in line. (a) Given that the smallest of these n + 1 independent exponentials is the departure time of the nth person in line, the conditional probability that this person will be served is 0; on the other hand, given that this person's departure time is not the smallest, the conditional probability that this person will be served is the same as if it were initially in position n  1. Since the probability that a given departure time is the smallest of the n + 1 exponentials is /(n + ), we obtain that Pn = (n  1) + Pn1 n +
Using the preceding with n  1 replacing n gives Pn = (n  1) + (n  2) + (n  2) + Pn2 = Pn2 n + (n  1) + n +
Continuing in this fashion yields the result Pn = + P1 = n + n +
(b) To determine an expression for Wn , we use the fact that the minimum of independent exponentials is, independent of their rank ordering, exponential with a rate equal to the sum of the rates. Since the time until the nth person in line enters service is the minimum of these n + 1 random variables plus the additional time thereafter, we see, upon using the lack of memory property of exponential random variables, that Wn = 1 + Wn1 n +
Repeating the preceding argument with successively smaller values of n yields the solution:
n
Wn =
i=1
1 i +
5.2.4. Convolutions of Exponential Random Variables Let Xi , i = 1, . . . , n, be independent exponential random variables with respective rates i , i = 1, . . . , n, and suppose that i = j for i = j . The random vari
5.2.
The Exponential Distribution
299
able n Xi is said to be a hypoexponential random variable. To compute its i=1 probability density function, let us start with the case n = 2. Now, fX1 +X2 (t) = =
0 t 0 t
fX1 (s)fX2 (t  s) ds 1 e1 s 2 e2 (ts) ds
t 0
= 1 2 e2 t = =
e(1 2 )s ds
1 2 e2 t (1  e(1 2 )t ) 1  2 2 1 2 e2 t + 1 e1 t 1  2 2  1
Using the preceding, a similar computation yields, when n = 3,
3
fX1 +X2 +X3 (t) =
i=1
i ei t
j =i
j j  i
which suggests the general result:
n
fX1 + +Xn (t) =
i=1
Ci,n i ei t
where Ci,n =
j =i
j j  i
We will now prove the preceding formula by induction on n. Since we have already established it for n = 2, assume it for n and consider n + 1 arbitrary independent exponentials Xi with distinct rates i , i = 1, . . . , n + 1. If necessary, renumber X1 and Xn+1 so that n+1 < 1 . Now, fX1 + +Xn+1 (t) = =
i=1 t 0 n
fX1 + +Xn (s)n+1 en+1 (ts) ds
t
Ci,n
0
i ei s n+1 en+1 (ts) ds
300
5
The Exponential Distribution and the Poisson Process
n
=
i=1
Ci,n
i n+1 n+1 en+1 t + i ei t i  n+1 n+1  i
n i=1
= Kn+1 n+1 en+1 t +
Ci,n+1 i ei t
(5.7)
where Kn+1 = n Ci,n i /(i  n+1 ) is a constant that does not depend on t. i=1 But, we also have that fX1 ++Xn+1 (t) =
t 0
fX2 ++Xn+1 (s)1 e1 (ts) ds
which implies, by the same argument that resulted in Equation (5.7), that for a constant K1 fX1 ++Xn+1 (t) = K1 1 e1 t +
n+1 i=2
Ci,n+1 i ei t
Equating these two expressions for fX1 ++Xn+1 (t) yields Kn+1 n+1 en+1 t + C1,n+1 1 e1 t = K1 1 e1 t + Cn+1,n+1 n+1 en+1 t Multiplying both sides of the preceding equation by en+1 t and then letting t yields [since e(1 n+1 )t 0 as t ] Kn+1 = Cn+1,n+1 and this, using Equation (5.7), completes the induction proof. Thus, we have shown that if S = n Xi , then i=1
n
fs (t) =
i=1
Ci,n i ei t
(5.8)
where Ci,n =
j =i
j j  i
Integrating both sides of the expression for fS from t to yields that the tail distribution function of S is given by
n
P {S > t} =
i=1
Ci,n ei t
(5.9)
5.2.
The Exponential Distribution
301
Hence, we obtain from Equations (5.8) and (5.9) that rS (t), the failure rate function of S, is as follows: rS (t) =
n i t i=1 Ci,n i e n i t i=1 Ci,n e
If we let j = min(1 , . . . , n ), then it follows, upon multiplying the numerator and denominator of rS (t) by ej t , that
t
lim rS (t) = j
From the preceding, we can conclude that the remaining lifetime of a hypoexponentially distributed item that has survived to age t is, for t large, approximately that of an exponentially distributed random variable with a rate equal to the minimum of the rates of the random variables whose sums make up the hypoexponential.
Remark Although
1=
0 n n
fS (t) dt =
i=1
Ci,n =
i=1 j =i
j j  i
it should not be thought that the Ci,n , i = 1, . . . , n are probabilities, because some of them will be negative. Thus, while the form of the hypoexponential density is similar to that of the hyperexponential density (see Example 5.6) these two random variables are very different.
Example 5.11 Let X1 , . . . , Xm be independent exponential random variables
with respective rates 1 , . . . , m , where i = j when i = j . Let N be independent of these random variables and suppose that m Pn = 1, where Pn = n=1 P {N = n}. The random variable
N
Y=
j =1
Xj
is said to be a Coxian random variable. Conditioning on N gives its density function:
m
fY (t) =
n=1 m
fY (tN = n)Pn fX1 + +Xn (tN = n)Pn
n=1
=
302
5
The Exponential Distribution and the Poisson Process
m
=
n=1 m
fX1 + +Xn (t)Pn
n
=
n=1
Pn
i=1
Ci,n i ei t
Let r(n) = P {N = nN n}
If we interpret N as a lifetime measured in discrete time periods, then r(n) denotes the probability that an item will die in its nth period of use given that it has survived up to that time. Thus, r(n) is the discrete time analog of the failure rate function r(t), and is correspondingly referred to as the discrete time failure (or hazard) rate function. Coxian random variables often arise in the following manner. Suppose that an item must go through m stages of treatment to be cured. However, suppose that after each stage there is a probability that the item will quit the program. If we suppose that the amounts of time that it takes the item to pass through the successive stages are independent exponential random variables, and that the probability that an item that has just completed stage n quits the program is (independent of how long it took to go through the n stages) equal to r(n), then the total time that an item spends in the program is a Coxian random variable.
5.3.
The Poisson Process
5.3.1. Counting Processes A stochastic process {N(t), t 0} is said to be a counting process if N (t) represents the total number of "events" that occur by time t. Some examples of counting processes are the following: (a) If we let N(t) equal the number of persons who enter a particular store at or prior to time t, then {N (t), t 0} is a counting process in which an event corresponds to a person entering the store. Note that if we had let N (t) equal the number of persons in the store at time t, then {N (t), t 0} would not be a counting process (why not?). (b) If we say that an event occurs whenever a child is born, then {N (t), t 0} is a counting process when N (t) equals the total number of people who were born by time t. [Does N (t) include persons who have died by time t? Explain why it must.]
5.3.
The Poisson Process
303
(c) If N(t) equals the number of goals that a given soccer player scores by time t, then {N(t), t 0} is a counting process. An event of this process will occur whenever the soccer player scores a goal. From its definition we see that for a counting process N (t) must satisfy: (i) (ii) (iii) (iv) N(t) 0. N(t) is integer valued. If s < t, then N(s) N (t). For s < t, N (t)  N (s) equals the number of events that occur in the interval (s, t].
A counting process is said to possess independent increments if the numbers of events that occur in disjoint time intervals are independent. For example, this means that the number of events that occur by time 10 [that is, N (10)] must be independent of the number of events that occur between times 10 and 15 [that is, N(15)  N(10)]. The assumption of independent increments might be reasonable for example (a), but it probably would be unreasonable for example (b). The reason for this is that if in example (b) N (t) is very large, then it is probable that there are many people alive at time t; this would lead us to believe that the number of new births between time t and time t + s would also tend to be large [that is, it does not seem reasonable that N(t) is independent of N (t + s)  N (t), and so {N (t), t 0} would not have independent increments in example (b)]. The assumption of independent increments in example (c) would be justified if we believed that the soccer player's chances of scoring a goal today do not depend on "how he's been going." It would not be justified if we believed in "hot streaks" or "slumps." A counting process is said to possess stationary increments if the distribution of the number of events that occur in any interval of time depends only on the length of the time interval. In other words, the process has stationary increments if the number of events in the interval (s, s + t) has the same distribution for all s. The assumption of stationary increments would only be reasonable in example (a) if there were no times of day at which people were more likely to enter the store. Thus, for instance, if there was a rush hour (say, between 12 P. M. and 1 P. M.) each day, then the stationarity assumption would not be justified. If we believed that the earth's population is basically constant (a belief not held at present by most scientists), then the assumption of stationary increments might be reasonable in example (b). Stationary increments do not seem to be a reasonable assumption in example (c) since, for one thing, most people would agree that the soccer player would probably score more goals while in the age bracket 2530 than he would while in the age bracket 3540. It may, however, be reasonable over a smaller time horizon, such as one year.
304
5
The Exponential Distribution and the Poisson Process
5.3.2. Definition of the Poisson Process One of the most important counting processes is the Poisson process which is defined as follows:
Definition 5.1 The counting process {N (t), t
process having rate , > 0, if
0} is said to be a Poisson
(i) N(0) = 0. (ii) The process has independent increments. (iii) The number of events in any interval of length t is Poisson distributed with mean t. That is, for all s, t 0 P {N(t + s)  N (s) = n} = et (t)n , n! n = 0, 1, . . .
Note that it follows from condition (iii) that a Poisson process has stationary increments and also that E[N (t)] = t which explains why is called the rate of the process. To determine if an arbitrary counting process is actually a Poisson process, we must show that conditions (i), (ii), and (iii) are satisfied. Condition (i), which simply states that the counting of events begins at time t = 0, and condition (ii) can usually be directly verified from our knowledge of the process. However, it is not at all clear how we would determine that condition (iii) is satisfied, and for this reason an equivalent definition of a Poisson process would be useful. As a prelude to giving a second definition of a Poisson process we shall define the concept of a function f () being o(h).
Definition 5.2
The function f () is said to be o(h) if f (h) =0 h0 h lim
Example 5.12
(i) The function f (x) = x 2 is o(h) since f (h) h2 = lim = lim h = 0 h0 h h0 h h0 lim
5.3.
The Poisson Process
305
(ii) The function f (x) = x is not o(h) since lim f (h) h = lim = lim 1 = 1 = 0 h0 h h0 h
h0
(iii) If f () is o(h) and g() is o(h), then so is f () + g(). This follows since lim f (h) + g(h) f (h) g(h) = lim + lim =0+0=0 h0 h h0 h h
h0
(iv) If f () is o(h), then so is g() = cf (). This follows since f (h) cf (h) = c lim =c0=0 h0 h h lim (v) From (iii) and (iv) it follows that any finite linear combination of functions, each of which is o(h), is o(h). In order for the function f () to be o(h) it is necessary that f (h)/ h go to zero as h goes to zero. But if h goes to zero, the only way for f (h)/ h to go to zero is for f (h) to go to zero faster than h does. That is, for h small, f (h) must be small compared with h. We are now in a position to give an alternate definition of a Poisson process.
Definition 5.3 The counting process {N (t), t
process having rate , > 0, if (i) (ii) (iii) (iv)
0} is said to be a Poisson
N(0) = 0. The process has stationary and independent increments. P {N(h) = 1} = h + o(h). P {N(h) 2} = o(h).
Theorem 5.1 Definitions 5.1 and 5.3 are equivalent. Proof We show that Definition 5.3 implies Definition 5.1, and leave it to you
to prove the reverse. To start, fix u 0 and let g(t) = E[exp{uN(t)}] We derive a differential equation for g(t) as follows: g(t + h) = E[exp{uN(t + h)}] = E[exp{uN(t)} exp{u(N(t + h)  N (t))}]
306
5
The Exponential Distribution and the Poisson Process
= E[exp{uN(t)}]E[exp{u(N(t + h)  N (t))}] by independent increments = g(t) E[exp{uN (h)}] Now, assumptions (iii) and (iv) imply that P {N (h) = 0} = 1  h + o(h) Hence, conditioning on whether N (h) = 0 or N (h) = 1 or N (h) 2 yields by stationary increments (5.10)
E[exp{uN (h)}] = 1  h + o(h) + eu (h + o(h)) + o(h) = 1  h + eu h + o(h) Therefore, from Equations (5.10) and (5.11) we obtain that g(t + h) = g(t)(1  h + eu h) + o(h) implying that g(t + h)  g(t) o(h) = g(t)(eu  1) + h h Letting h 0 gives g (t) = g(t)(eu  1) or, equivalently, g (t) = (eu  1) g(t) Integrating, and using g(0) = 1, shows that log(g(t)) = t (eu  1) or g(t) = exp{t (eu  1)} That is, the Laplace transform of N (t) evaluated at u is et (e 1) . Since that is also the Laplace transform of a Poisson random variable with mean t, the result follows from the fact that the distribution of a nonnegative random variable is uniquely determined by its Laplace transform.
u
(5.11)
5.3.
The Poisson Process
307
Figure 5.1.
Remarks (i) The result that N (t) has a Poisson distribution is a consequence
of the Poisson approximation to the binomial distribution (see Section 2.2.4). To see this, subdivide the interval [0, t] into k equal parts where k is very large (Figure 5.1). Now it can be shown using axiom (iv) of Definition 5.3 that as k increases to the probability of having two or more events in any of the k subintervals goes to 0. Hence, N (t) will (with a probability going to 1) just equal the number of subintervals in which an event occurs. However, by stationary and independent increments this number will have a binomial distribution with parameters k and p = t/k + o(t/k). Hence, by the Poisson approximation to the binomial we see by letting k approach that N (t) will have a Poisson distribution with mean equal to t t lim k + o k k = t + lim = t by using the definition of o(h) and the fact that t/k 0 as k . (ii) The explicit assumption that the process has stationary increments can be eliminated from Definition 5.3 provided that we change assumptions (iii) and (iv) to require that for any t the probability of one event in the interval (t, t + h) is h + o(h) and the probability of two or more events in that interval is o(h). That is, assumptions (ii), (iii), and (iv) of Definition 5.3 can be replaced by (iii) The process has independent increments. (iv) P {N(t + h)  N(t) = 1} = h + o(h). (v) P {N(t + h)  N(t) 2} = o(h). 5.3.3. Interarrival and Waiting Time Distributions Consider a Poisson process, and let us denote the time of the first event by T1 . Further, for n > 1, let Tn denote the elapsed time between the (n  1)st and the nth event. The sequence {Tn , n = 1, 2, . . .} is called the sequence of interarrival times. For instance, if T1 = 5 and T2 = 10, then the first event of the Poisson process would have occurred at time 5 and the second at time 15. We shall now determine the distribution of the Tn . To do so, we first note that the event {T1 > t} takes place if and only if no events of the Poisson process occur to(t/k) t/k
k
k
308
5
The Exponential Distribution and the Poisson Process
in the interval [0, t] and thus, P {T1 > t} = P {N (t) = 0} = et Hence, T1 has an exponential distribution with mean 1/. Now, P {T2 > t} = E[P {T2 > tT1 }] However, P {T2 > t  T1 = s} = P {0 events in (s, s + t]  T1 = s} = P {0 events in (s, s + t]} = et (5.12)
where the last two equations followed from independent and stationary increments. Therefore, from Equation (5.12) we conclude that T2 is also an exponential random variable with mean 1/ and, furthermore, that T2 is independent of T1 . Repeating the same argument yields the following.
Proposition 5.1 Tn , n = 1, 2, . . . , are independent identically distributed exponential random variables having mean 1/.
Remark The proposition should not surprise us. The assumption of stationary
and independent increments is basically equivalent to asserting that, at any point in time, the process probabilistically restarts itself. That is, the process from any point on is independent of all that has previously occurred (by independent increments), and also has the same distribution as the original process (by stationary increments). In other words, the process has no memory, and hence exponential interarrival times are to be expected. Another quantity of interest is Sn , the arrival time of the nth event, also called the waiting time until the nth event. It is easily seen that
n
Sn =
i=1
Ti ,
n
1
and hence from Proposition 5.1 and the results of Section 2.2 it follows that Sn has a gamma distribution with parameters n and . That is, the probability density of Sn is given by fSn (t) = et (t)n1 , (n  1)! t 0 (5.13)
Equation (5.13) may also be derived by noting that the nth event will occur prior to or at time t if and only if the number of events occurring by time t is at least n.
5.3.
The Poisson Process
309
That is, N (t) Hence,
n
Sn
t
FSn (t) = P {Sn
t} = P {N (t)
n} =
j =n
et
(t)j j!
which, upon differentiation, yields
fSn (t) = 
j =n
et
(t)j + j!
j =n
et
(t)j 1 (j  1)!
j =n
= et = et
(t)n1 + (n  1)! (t)n1 (n  1)!
j =n+1
et
(t)j 1  (j  1)!
et
(t)j j!
Example 5.13 Suppose that people immigrate into a territory at a Poisson
rate = 1 per day. (a) What is the expected time until the tenth immigrant arrives? (b) What is the probability that the elapsed time between the tenth and the eleventh arrival exceeds two days? Solution: (a) E[S10 ] = 10/ = 10 days. (b) P {T11 > 2} = e2 = e2 0.133. Proposition 5.1 also gives us another way of defining a Poisson process. Suppose we start with a sequence {Tn , n 1} of independent identically distributed exponential random variables each having mean 1/. Now let us define a counting process by saying that the nth event of this process occurs at time S n T1 + T2 + + Tn The resultant counting process {N (t), t 0} will be Poisson with rate .
t} where S0 0.
A formal definition of N (t) is given by N (t) max{n: S n
310
5
The Exponential Distribution and the Poisson Process
Remark Another way of obtaining the density function of Sn is to note that
because Sn is the time of the nth event, P {t < Sn < t + h} = P {N (t) = n  1, one event in (t, t + h)} + o(h) = P {N (t) = n  1}P {one event in (t, t + h)} + o(h) = et (t)n1 [h + o(h)] + o(h) (n  1)! (t)n1 h + o(h) (n  1)!
= et
where the first equality uses the fact that the probability of 2 or more events in (t, t + h) is o(h). If we now divide both sides of the preceding equation by h and then let h 0, we obtain fSn (t) = et (t)n1 (n  1)!
5.3.4. Further Properties of Poisson Processes Consider a Poisson process {N (t), t 0} having rate , and suppose that each time an event occurs it is classified as either a type I or a type II event. Suppose further that each event is classified as a type I event with probability p or a type II event with probability 1  p, independently of all other events. For example, suppose that customers arrive at a store in accordance with a Poisson process having rate ; and suppose that each arrival is male with probability 1 and female with 2 probability 1 . Then a type I event would correspond to a male arrival and a type II 2 event to a female arrival. Let N1 (t) and N2 (t) denote respectively the number of type I and type II events occurring in [0, t]. Note that N (t) = N1 (t) + N2 (t).
Proposition 5.2 {N1 (t), t
0} and {N2 (t), t 0} are both Poisson processes having respective rates p and (1  p). Furthermore, the two processes are independent. 0} is a Poisson process with rate p by verifying that it satisfies Definition 5.3. N1 (0) = 0 follows from the fact that N (0) = 0. It is easy to see that {N1 (t), t 0} inherits the stationary and independent increment properties of the process {N (t), t 0}. This is true because the distribution of the number of type I events in an interval can be obtained
Proof It is easy to verify that {N1 (t), t
5.3.
The Poisson Process
311
by conditioning on the number of events in that interval, and the distribution of this latter quantity depends only on the length of the interval and is independent of what has occurred in any nonoverlapping interval. P {N1 (h) = 1} = P {N1 (h) = 1  N (h) = 1}P {N (h) = 1} + P {N1 (h) = 1  N (h) 2}P {N (h) 2} = p(h + o(h)) + o(h) = ph + o(h) P {N1 (h) 2} P {N (h) 2} = o(h)
Thus we see that {N1 (t), t 0} is a Poisson process with rate p and, by a similar argument, that {N2 (t), t 0} is a Poisson process with rate (1  p). Because the probability of a type I event in the interval from t to t + h is independent of all that occurs in intervals that do not overlap (t, t + h), it is independent of knowledge of when type II events occur, showing that the two Poisson processes are independent. (For another way of proving independence, see Example 3.20.)
Example 5.14 If immigrants to area A arrive at a Poisson rate of ten per
1 week, and if each immigrant is of English descent with probability 12 , then what is the probability that no people of English descent will emigrate to area A during the month of February?
Solution: By the previous proposition it follows that the number of Englishmen emigrating to area A during the month of February is Poisson distributed 1 with mean 4 10 12 = 10 . Hence the desired probability is e10/3 . 3
Example 5.15 Suppose nonnegative offers to buy an item that you want to
sell arrive according to a Poisson process with rate . Assume that each offer is the value of a continuous random variable having density function f (x). Once the offer is presented to you, you must either accept it or reject it and wait for the next offer. We suppose that you incur costs at a rate c per unit time until the item is sold, and that your objective is to maximize your expected total return, where the total return is equal to the amount received minus the total cost incurred. Suppose you employ the policy of accepting the first offer that is greater than some specified value y. (Such a type of policy, which we call a ypolicy, can be shown to be optimal.) What is the best value of y? Solution: Let us compute the expected total return when you use the ypolicy, and then choose the value of y that maximizes this quantity. Let X de note the value of a random offer, and let F (x) = P {X > x} = x f (u) du be its tail distribution function. Because each offer will be greater than y with prob ability F (y), it follows that such offers occur according to a Poisson process with rate F (y). Hence, the time until an offer is accepted is an exponential
312
5
The Exponential Distribution and the Poisson Process
random variable with rate F (y). Letting R(y) denote the total return from the policy that accepts the first offer that is greater than y, we have E[R(y)] = E[accepted offer]  cE[time to accept] c = E[XX > y]  (y) F =
0
xfXX>y (x) dx  x
c F (y)
=
y
f (x) c dx  F (y) F (y)  c/ F (y)
y
= Differentiation yields that
y xf (x) dx
d E[R(y)] = 0 F (y)yf (y) + dy Therefore, the optimal value of y satisfies y F (y) =
y
xf (x) dx 
c f (y) = 0
xf (x) dx 
y
c c (5.14)
or
y
y
f (x) dx =
y
xf (x) dx  c
or
(x  y)f (x) dx =
We now argue that the lefthand side of the preceding is a nonincreasing function of y. To do so, note that, with a + defined to equal a if a > 0 or to equal 0 otherwise, we have
y
(x  y)f (x) dx = E[(X  y)+ ]
Because (X  y)+ is a nonincreasing function of y, so is its expectation, thus showing that the left hand side of Equation (5.14) is a nonincreasing function of y. Consequently, if E[X] < c/in which case there is no solution of Equation (5.14)then it is optimal to accept any offer; otherwise, the optimal value y is the unique solution of Equation (5.14). It follows from Proposition 5.2 that if each of a Poisson number of individuals is independently classified into one of two possible groups with respective prob
5.3.
The Poisson Process
313
abilities p and 1  p, then the number of individuals in each of the two groups will be independent Poisson random variables. Because this result easily generalizes to the case where the classification is into any one of r possible groups, we have the following application to a model of employees moving about in an organization.
Example 5.16 Consider a system in which individuals at any time are
classified as being in one of r possible states, and assume that an individual changes states in accordance with a Markov chain having transition probabilities Pij , i, j = 1, . . . , r. That is, if an individual is in state i during a time period then, independently of its previous states, it will be in state j during the next time period with probability Pij . The individuals are assumed to move through the system independently of each other. Suppose that the numbers of people initially in states 1, 2, . . . , r are independent Poisson random variables with respective means 1 , 2 , . . . , r . We are interested in determining the joint distribution of the numbers of individuals in states 1, 2, . . . , r at some time n. Solution: For fixed i, let Nj (i), j = 1, . . . , r denote the number of those individuals, initially in state i, that are in state j at time n. Now each of the (Poisson distributed) number of people initially in state i will, independently of n n each other, be in state j at time n with probability Pij , where Pij is the nstage transition probability for the Markov chain having transition probabilities Pij . Hence, the Nj (i), j = 1, . . . , r will be independent Poisson random variables n with respective means i Pij , j = 1, . . . , r. Because the sum of independent Poisson random variables is itself a Poisson random variable, it follows that the number of individuals in state j at time nnamely r Nj (i)will be i=1 n independent Poisson random variables with respective means i i Pij , for j = 1, . . . , r.
Example 5.17 (The Coupon Collecting Problem) There are m different types
of coupons. Each time a person collects a coupon it is, independently of ones previously obtained, a type j coupon with probability pj , m=1 pj = 1. Let N j denote the number of coupons one needs to collect in order to have a complete collection of at least one of each type. Find E[N ]. Solution: If we let Nj denote the number one must collect to obtain a type j coupon, then we can express N as N = max Nj
1 j m
However, even though each Nj is geometric with parameter pj , the foregoing representation of N is not that useful, because the random variables Nj are not independent.
314
5
The Exponential Distribution and the Poisson Process
We can, however, transform the problem into one of determining the expected value of the maximum of independent random variables. To do so, suppose that coupons are collected at times chosen according to a Poisson process with rate = 1. Say that an event of this Poisson process is of type j , 1 j m, if the coupon obtained at that time is a type j coupon. If we now let Nj (t) denote the number of type j coupons collected by time t, then it follows from Proposition 5.2 that {Nj (t), t 0}, j = 1, . . . , m are independent Poisson processes with respective rates pj = pj . Let Xj denote the time of the first event of the j th process, and let X = max Xj
1 j m
denote the time at which a complete collection is amassed. Since the Xj are independent exponential random variables with respective rates pj , it follows that P {X < t} = P {max Xj < t} = P {Xj < t, for j = 1, . . . , m}
m
= Therefore, E[X] =
0
(1  epj t )
j =1
P {X > t} dt
m
=
0
1
j =1
(1  epj t ) dt
(5.15)
It remains to relate E[X], the expected time until one has a complete set, to E[N], the expected number of coupons it takes. This can be done by letting Ti denote the ith interarrival time of the Poisson process that counts the number of coupons obtained. Then it is easy to see that
N
X=
i=1
Ti
Since the Ti are independent exponentials with rate 1, and N is independent of the Ti , we see that E[XN ] = N E[Ti ] = N
5.3.
The Poisson Process
315
Therefore, E[X] = E[N ] and so E[N ] is as given in Equation (5.15). Let us now compute the expected number of types that appear only once in the complete collection. Letting Ii equal 1 if there is only a single type i coupon in the final set, and letting it equal 0 otherwise, we thus want
m m
E
i=1
Ii =
i=1 m
E[Ii ] P {Ii = 1}
i=1
=
Now there will be a single type i coupon in the final set if a coupon of each type has appeared before the second coupon of type i is obtained. Thus, letting Si denote the time at which the second type i coupon is obtained, we have P {Ii = 1} = P {Xj < Si , for all j = i} Using that Si has a gamma distribution with parameters (2, pi ), this yields P {Ii = 1} =
0
P {Xj < Si for all j = iSi = x}pi epi x pi x dx
2 P {Xj < x, for all j = i}pi x epi x dx 2 (1  epj x )pi xepi x dx j =i
=
0
=
0
Therefore, we have the result
m
E
i=1
Ii =
0
m i=1 j =i m
2 (1  epj x )pi xepi x dx m 2 pi i=1
=
0
x
j =1
(1  epj x )
epi x dx 1  epi x
The next probability calculation related to Poisson processes that we shall determine is the probability that n events occur in one Poisson process before m events have occurred in a second and independent Poisson process. More formally let {N1 (t), t 0} and {N2 (t), t 0} be two independent Poisson processes 1 having respective rates 1 and 2 . Also, let Sn denote the time of the nth event of
316
5
The Exponential Distribution and the Poisson Process
2 the first process, and Sm the time of the mth event of the second process. We seek 1 2 P Sn < Sm
Before attempting to calculate this for general n and m, let us consider the 1 special case n = m = 1. Since S1 , the time of the first event of the N1 (t) process, 2 , the time of the first event of the N (t) process, are both exponentially and S1 2 distributed random variables (by Proposition 5.1) with respective means 1/1 and 1/2 , it follows from Section 5.2.3 that
1 2 P S1 < S1 =
1 1 + 2
(5.16)
Let us now consider the probability that two events occur in the N1 (t) process 1 2 before a single event has occurred in the N2 (t) process. That is, P {S2 < S1 }. To calculate this we reason as follows: In order for the N1 (t) process to have two events before a single event occurs in the N2 (t) process, it is first necessary for the initial event that occurs to be an event of the N1 (t) process [and this occurs, by Equation (5.16), with probability 1 /(1 + 2 )]. Now given that the initial event is 1 2 from the N1 (t) process, the next thing that must occur for S2 to be less than S1 is for the second event also to be an event of the N1 (t) process. However, when the first event occurs both processes start all over again (by the memoryless property of Poisson processes) and hence this conditional probability is also 1 /(1 + 2 ); thus, the desired probability is given by
1 2 P S2 < S1 =
1 1 + 2
2
In fact this reasoning shows that each event that occurs is going to be an event of the N1 (t) process with probability 1 /(1 + 2 ) or an event of the N2 (t) process with probability 2 /(1 + 2 ), independent of all that has previously occurred. In other words, the probability that the N1 (t) process reaches n before the N2 (t) process reaches m is just the probability that n heads will appear before m tails if one flips a coin having probability p = 1 /(1 + 2 ) of a head appearing. But by noting that this event will occur if and only if the first n + m  1 tosses result in n or more heads, we see that our desired probability is given by
n+m1 1 2 P Sn < S m = k=n
n+m1 k
1 1 + 2
k
2 1 + 2
n+m1k
5.3.5. Conditional Distribution of the Arrival Times Suppose we are told that exactly one event of a Poisson process has taken place by time t, and we are asked to determine the distribution of the time at which the event occurred. Now, since a Poisson process possesses stationary and inde
5.3.
The Poisson Process
317
pendent increments it seems reasonable that each interval in [0, t] of equal length should have the same probability of containing the event. In other words, the time of the event should be uniformly distributed over [0, t]. This is easily checked since, for s t, P {T1 < s, N (t) = 1} P {T1 < sN(t) = 1} = P {N (t) = 1} = = = P {1 event in [0, s), 0 events in [s, t]} P {N (t) = 1} P {1 event in [0, s)}P {0 events in [s, t]} P {N (t) = 1}
ses e(ts) tet s = t This result may be generalized, but before doing so we need to introduce the concept of order statistics. Let Y1 , Y2 , . . . , Yn be n random variables. We say that Y(1) , Y(2) , . . . , Y(n) are the order statistics corresponding to Y1 , Y2 , . . . , Yn if Y(k) is the kth smallest value among Y1 , . . . , Yn , k = 1, 2, . . . , n. For instance if n = 3 and Y1 = 4, Y2 = 5, Y3 = 1 then Y(1) = 1, Y(2) = 4, Y(3) = 5. If the Yi , i = 1, . . . , n, are independent identically distributed continuous random variables with probability density f , then the joint density of the order statistics Y(1) , Y(2) , . . . , Y(n) is given by
n
f (y1 , y2 , . . . , yn ) = n!
i=1
f (yi ),
y1 < y2 < < yn
The preceding follows since (i) (Y(1) , Y(2) , . . . , Y(n) ) will equal (y1 , y2 , . . . , yn ) if (Y1 , Y2 , . . . , Yn ) is equal to any of the n! permutations of (y1 , y2 , . . . , yn ); and (ii) the probability density that (Y1 , Y2 , . . . , Yn ) is equal to yi1 , . . . , yin is n n j =1 f (yij ) = j =1 f (yj ) when i1 , . . . , in is a permutation of 1, 2, . . . , n. If the Yi , i = 1, . . . , n, are uniformly distributed over (0, t), then we obtain from the preceding that the joint density function of the order statistics Y(1) , Y(2) , . . . , Y(n) is n! 0 < y1 < y2 < < yn < t f (y1 , y2 , . . . , yn ) = n , t We are now ready for the following useful theorem.
318
5
The Exponential Distribution and the Poisson Process
Theorem 5.2 Given that N (t) = n, the n arrival times S1 , . . . , Sn have the
same distribution as the order statistics corresponding to n independent random variables uniformly distributed on the interval (0, t).
Proof To obtain the conditional density of S1 , . . . , Sn given that N (t) = n
note that for 0 < S1 < < Sn < t the event that S1 = s1 , S2 = s2 , . . . , Sn = sn , N(t) = n is equivalent to the event that the first n + 1 interarrival times satisfy T1 = s1 , T2 = s2  s1 , . . . , Tn = sn  sn1 , Tn+1 > t  sn . Hence, using Proposition 5.1, we have that the conditional joint density of S1 , . . . , Sn given that N(t) = n is as follows: f (s1 , . . . , sn  n) = = = which proves the result. f (s1 , . . . , sn , n) P {N (t) = n} es1 e(s2 s1 ) e(sn sn1 ) e(tsn ) et (t)n /n! n! , tn 0 < s1 < < sn < t
Remark The preceding result is usually paraphrased as stating that, under the
condition that n events have occurred in (0, t), the times S1 , . . . , Sn at which events occur, considered as unordered random variables, are distributed independently and uniformly in the interval (0, t). In Proposition 5.2 we showed that if each event of a Poisson process is independently classified as a type I event with probability p and as a type II event with probability 1  p then the counting processes of type I and type II events are independent Poisson processes with respective rates p and (1  p). Suppose now, however, that there are k possible types of events and that the probability that an event is classified as a type i event, i = 1, . . . , k, depends on the time the event occurs. Specifically, suppose that if an event occurs at time y then it will be classified as a type i event, independently of anything that has previously occurred, with probability Pi (y), i = 1, . . . , k where k Pi (y) = 1. Upon using i=1 Theorem 5.2 we can prove the following useful proposition.
Application of Theorem 5.2 (Sampling a Poisson Process)
Proposition 5.3 If Ni (t), i = 1, . . . , k, represents the number of type i events occurring by time t then Ni (t), i = 1, . . . , k, are independent Poisson random variables having means
E[Ni (t)] =
0 t
Pi (s) ds
Before proving this proposition, let us first illustrate its use.
5.3.
The Poisson Process
319
Example 5.18 (An Infinite Server Queue) Suppose that customers arrive at a
service station in accordance with a Poisson process with rate . Upon arrival the customer is immediately served by one of an infinite number of possible servers, and the service times are assumed to be independent with a common distribution G. What is the distribution of X(t), the number of customers that have completed service by time t? What is the distribution of Y (t), the number of customers that are being served at time t? To answer the preceding questions let us agree to call an entering customer a type I customer if he completes his service by time t and a type II customer if he does not complete his service by time t. Now, if the customer enters at time s, s t, then he will be a type I customer if his service time is less than t  s. Since the service time distribution is G, the probability of this will be G(t  s). Similarly, a customer entering at time s, s t, will be a type II customer with probability G(t  s) = 1  G(t  s). Hence, from Proposition 5.3 we obtain that the distribution of X(t), the number of customers that have completed service by time t, is Poisson distributed with mean E[X(t)] =
0 t
G(t  s) ds =
0
t
G(y) dy
(5.17)
Similarly, the distribution of Y (t), the number of customers being served at time t is Poisson with mean E[Y (t)] =
0 t
G(t  s) ds =
0
t
G(y) dy
(5.18)
Furthermore, X(t) and Y (t) are independent. Suppose now that we are interested in computing the joint distribution of Y (t) and Y (t + s)that is, the joint distribution of the number in the system at time t and at time t + s. To accomplish this, say that an arrival is type 1: type 2: type 3: type 4: if he arrives before time t and completes service between t and t + s, if he arrives before t and completes service after t + s, if he arrives between t and t + s and completes service after t + s, otherwise.
Hence an arrival at time y will be type i with probability Pi (y) given by P1 (y) = P2 (y) = G(t + s  y)  G(t  y), 0, G(t + s  y), 0, if y < t otherwise if y < t otherwise
320
5
The Exponential Distribution and the Poisson Process
P3 (y) =
G(t + s  y), 0,
if t < y < t + s otherwise
P4 (y) = 1  P1 (y)  P2 (y)  P3 (y) Hence, if Ni = Ni (s + t), i = 1, 2, 3, denotes the number of type i events that occur, then from Proposition 5.3, Ni , i = 1, 2, 3, are independent Poisson random variables with respective means E[Ni ] =
0 t+s
Pi (y) dy,
i = 1, 2, 3
Because Y (t) = N1 + N2 , Y (t + s) = N2 + N3 it is now an easy matter to compute the joint distribution of Y (t) and Y (t + s). For instance, Cov[Y (t), Y (t + s)] = Cov(N1 + N2 , N2 + N3 ) = Cov(N2 , N2 ) = Var(N2 ) =
0 t
by independence of N1 , N2 , N3
t 0
G(t + s  y) dy =
G(u + s) du
where the last equality follows since the variance of a Poisson random variable equals its mean, and from the substitution u = t  y. Also, the joint distribution of Y (t) and Y (t + s) is as follows: P {Y (t) = i, Y (t + s) = j } = P {N1 + N2 = i, N2 + N3 = j }
min(i,j )
=
l=0 min(i,j )
P {N2 = l, N1 = i  l, N3 = j  l}
=
l=0
P {N2 = l}P {N1 = i  l}P {N3 = j  l}
Example 5.19 (Minimizing the Number of Encounters) Suppose that cars enter a oneway highway in accordance with a Poisson process with rate . The cars enter at point a and depart at point b (see Figure 5.2). Each car travels at a
5.3.
The Poisson Process
321
Figure 5.2. Cars enter at point a and depart at b.
constant speed that is randomly determined, independently from car to car, from the distribution G. When a faster car encounters a slower one, it passes it with no time being lost. If your car enters the highway at time s and you are able to choose your speed, what speed minimizes the expected number of encounters you will have with other cars, where we say that an encounter occurs each time your car either passes or is passed by another car? Solution: We will show that for large s the speed that minimizes the expected number of encounters is the median of the speed distribution G. To see this, suppose that the speed x is chosen. Let d = b  a denote the length of the road. Upon choosing the speed x, it follows that your car will enter the road at time s and will depart at time s + t0 , where t0 = d/x is the travel time. Now, the other cars enter the road according to a Poisson process with rate . Each of them chooses a speed X according to the distribution G, and this results in a travel time T = d/X. Let F denote the distribution of travel time T . That is, F (t) = P {T t} = P {d/X t} = P {X d/t} = G(d/t)
Let us say that an event occurs at time t if a car enters the highway at time t. Also, say that the event is a type 1 event if it results in an encounter with your car. Now, your car will enter the road at time s and will exit at time s + t0 . Hence, a car will encounter your car if it enters before s and exits after s + t0 (in which case your car will pass it on the road) or if it enters after s but exits before s + t0 (in which case it will pass your car). As a result, a car that enters the road at time t will encounter your car if its travel time T is such that t + T > s + t0 , t + T < s + t0 , if t < s if s < t < s + t0
From the preceding, we see that an event at time t will, independently of other events, be a type 1 event with probability p(t) given by if t < s P {t + T > s + t0 } = F (s + t0  t), p(t) = P {t + T < s + t0 } = F (s + t0  t), if s < t < s + t0 0, if t > s + t0
322
5
The Exponential Distribution and the Poisson Process
Since events (that is, cars entering the road) are occurring according to a Poisson process it follows, upon applying Proposition 5.3, that the total number of type 1 events that ever occurs is Poisson with mean
0
p(t) dt =
0
s
F (s + t0  t) dt +
s
s+t0
F (s + t0  t) dt
=
s+t0 t0
F (y) dy +
0
t0
F (y) dy
To choose the value of t0 that minimizes the preceding quantity, we differentiate. This gives d dt0
0
p(t) dt = {F (s + t0 )  F (t0 ) + F (t0 )}
Setting this equal to 0, and using that F (s + t0 ) 0 when s is large, we see that the optimal travel time t0 is such that F (t0 )  F (t0 ) = 0 or F (t0 )  [1  F (t0 )] = 0 or F (t0 ) =
1 2
That is, the optimal travel time is the median of the travel time distribution. Since the speed X is equal to the distance d divided by the travel time T , it follows that the optimal speed x0 = d/t0 is such that F (d/x0 ) = Since F (d/x0 ) = G(x0 ) we see that G(x0 ) = 1 , and so the optimal speed is the median of the distribu2 tion of speeds. Summing up, we have shown that for any speed x the number of encounters with other cars will be a Poisson random variable, and the mean of this Poisson will be smallest when the speed x is taken to be the median of the distribution G.
1 2
Example 5.20 (Tracking the Number of HIV Infections) There is a relatively long incubation period from the time when an individual becomes infected with the HIV virus, which causes AIDS, until the symptoms of the disease appear.
5.3.
The Poisson Process
323
As a result, it is difficult for public health officials to be certain of the number of members of the population that are infected at any given time. We will now present a first approximation model for this phenomenon, which can be used to obtain a rough estimate of the number of infected individuals. Let us suppose that individuals contract the HIV virus in accordance with a Poisson process whose rate is unknown. Suppose that the time from when an individual becomes infected until symptoms of the disease appear is a random variable having a known distribution G. Suppose also that the incubation times of different infected individuals are independent. Let N1 (t) denote the number of individuals who have shown symptoms of the disease by time t. Also, let N2 (t) denote the number who are HIV positive but have not yet shown any symptoms by time t. Now, since an individual who contracts the virus at time s will have symptoms by time t with probability G(t  s) and will not with probability G(t  s), it follows from Proposition 5.3 that N1 (t) and N2 (t) are independent Poisson random variables with respective means E[N1 (t)] =
0 t
G(t  s) ds =
0
t
G(y) dy
and E[N2 (t)] =
0 t
G(t  s) ds =
0
t
G(y) dy
Now, if we knew , then we could use it to estimate N2 (t), the number of individuals infected but without any outward symptoms at time t, by its mean value E[N2 (t)]. However, since is unknown, we must first estimate it. Now, we will presumably know the value of N1 (t), and so we can use its known value as an estimate of its mean E[N1 (t)]. That is, if the number of individuals who have exhibited symptoms by time t is n1 , then we can estimate that n1 E[N1 (t)] =
0 t
G(y) dy
^ Therefore, we can estimate by the quantity given by ^ = n1
0 t
G(y) dy
Using this estimate of , we can estimate the number of infected but symptomless individuals at time t by ^ estimate of N2 (t) =
0 t
G(y) dy G(y) dy
=
n1
t 0
t 0
G(y) dy
324
5
The Exponential Distribution and the Poisson Process
For example, suppose that G is exponential with mean . Then G(y) = ey/ , and a simple integration gives that n1 (1  et/ ) t  (1  et/ )
estimate of N2 (t) =
If we suppose that t = 16 years, = 10 years, and n1 = 220 thousand, then the estimate of the number of infected but symptomless individuals at time 16 is 2,200(1  e1.6 ) = 218.96 16  10(1  e1.6 )
estimate =
That is, if we suppose that the foregoing model is approximately correct (and we should be aware that the assumption of a constant infection rate that is unchanging over time is almost certainly a weak point of the model), then if the incubation period is exponential with mean 10 years and if the total number of individuals who have exhibited AIDS symptoms during the first 16 years of the epidemic is 220 thousand, then we can expect that approximately 219 thousand individuals are HIV positive though symptomless at time 16.
Proof of Proposition 5.3 Let us compute the joint probability
P {Ni (t) = ni , i = 1, . . . , k}. To do so note first that in order for there to have been ni type i events for i = 1, . . . , k there must have been a total of k ni i=1 events. Hence, conditioning on N (t) yields P {N1 (t) = n1 , . . . , Nk (t) = nk }
k
= P N1 (t) = n1 , . . . , Nk (t) = nk N (t) =
i=1 k
ni
P N (t) =
i=1
ni
Now consider an arbitrary event that occurred in the interval [0, t]. If it had occurred at time s, then the probability that it would be a type i event would be Pi (s). Hence, since by Theorem 5.2 this event will have occurred at some time uniformly distributed on (0, t), it follows that the probability that this event will be a type i
5.3.
The Poisson Process
325
event is Pi = 1 t
t
Pi (s) ds
0
independently of the other events. Hence,
k
P Ni (t) = ni , i = 1, . . . , k N (t) =
i=1
ni
will just equal the multinomial probability of ni type i outcomes for i = 1, . . . , k when each of k ni independent trials results in outcome i with probability i=1 Pi , i = 1, . . . , k. That is,
k
P N1 (t) = n1 , . . . , Nk (t) = nk N (t) =
i=1
ni =
( k ni )! n1 n i=1 P Pk k n1 ! nk ! 1
Consequently, P {N1 (t) = n1 , . . . , Nk (t) = nk } = =
i=1
( i ni )! n1 (t) i ni n P1 Pk k et n1 ! nk ! ( i ni )!
k
etPi (tPi )ni /ni !
and the proof is complete We now present some additional examples of the usefulness of Theorem 5.2.
Example 5.21 Insurance claims are made at times distributed according to a
Poisson process with rate ; the successive claim amounts are independent random variables having distribution G with mean , and are independent of the claim arrival times. Let Si and Ci denote, respectively, the time and the amount of the ith claim. The total discounted cost of all claims made up to time t, call it D(t), is defined by
N (t)
D(t) =
i=1
eSi Ci
326
5
The Exponential Distribution and the Poisson Process
where is the discount rate and N (t) is the number of claims made by time t. To determine the expected value of D(t), we condition on N(t) to obtain
E[D(t)] =
n=0
E[D(t)N (t) = n]et
(t)n n!
Now, conditional on N(t) = n, the claim arrival times S1 , . . . , Sn are distributed as the ordered values U(1) , . . . , U(n) of n independent uniform (0, t) random variables U1 , . . . , Un . Therefore,
n
E[D(t)N (t) = n] = E
i=1 n
Ci eU(i)
=
i=1 n
E[Ci eU(i) ] E[Ci ]E[eU(i) ]
=
i=1
where the final equality used the independence of the claim amounts and their arrival times. Because E[Ci ] = , continuing the preceding gives
n
E[D(t)N (t) = n] =
i=1
E[eU(i) ]
n
= E
i=1 n
eU(i) eUi
= E
i=1
The last equality follows because U(1) , . . . , U(n) are the values U1 , . . . , Un in increasing order, and so n eU(i) = n eUi . Continuing the string of i=1 i=1 equalities yields E[D(t)N (t) = n] = nE[eU ] =n t x e dx t 0 = n (1  et ) t
5.3.
The Poisson Process
327
Therefore, E[D(t)N (t)] = N (t) Taking expectations yields the result E[D(t)] = (1  et ) (1  et ) t
Example 5.22 (An Optimization Example) Suppose that items arrive at a
processing plant in accordance with a Poisson process with rate . At a fixed time T , all items are dispatched from the system. The problem is to choose an intermediate time, t (0, T ), at which all items in the system are dispatched, so as to minimize the total expected wait of all items. If we dispatch at time t, 0 < t < T , then the expected total wait of all items will be t 2 (T  t)2 + 2 2 To see why this is true, we reason as follows: The expected number of arrivals in (0, t) is t, and each arrival is uniformly distributed on (0, t), and hence has expected wait t/2. Thus, the expected total wait of items arriving in (0, t) is t 2 /2. Similar reasoning holds for arrivals in (t, T ), and the preceding follows. To minimize this quantity, we differentiate with respect to t to obtain t2 d (T  t)2 + = t  (T  t) dt 2 2 and equating to 0 shows that the dispatch time that minimizes the expected total wait is t = T /2. We end this section with a result, quite similar in spirit to Theorem 5.2, which states that given Sn , the time of the nth event, then the first n  1 event times are distributed as the ordered values of a set of n  1 random variables uniformly distributed on (0, Sn ).
Proposition 5.4 Given that Sn = t, the set S1 , . . . , Sn1 has the distribution
of a set of n  1 independent uniform (0, t) random variables.
Proof We can prove the preceding in the same manner as we did Theorem 5.2,
or we can argue more loosely as follows: S1 , . . . , Sn1  Sn = t S1 , . . . , Sn1  Sn = t, N (t  ) = n  1 S1 , . . . , Sn1  N (t  ) = n  1 where means "has the same distribution as" and t  is infinitesimally smaller than t. The result now follows from Theorem 5.2.
328
5
The Exponential Distribution and the Poisson Process
5.3.6. Estimating Software Reliability When a new computer software package is developed, a testing procedure is often put into effect to eliminate the faults, or bugs, in the package. One common procedure is to try the package on a set of wellknown problems to see if any errors result. This goes on for some fixed time, with all resulting errors being noted. Then the testing stops and the package is carefully checked to determine the specific bugs that were responsible for the observed errors. The package is then altered to remove these bugs. Because we cannot be certain that all the bugs in the package have been eliminated, however, a problem of great importance is the estimation of the error rate of the revised software package. To model the preceding, let us suppose that initially the package contains an unknown number, m, of bugs, which we will refer to as bug 1, bug 2, . . . , bug m. Suppose also that bug i will cause errors to occur in accordance with a Poisson process having an unknown rate i , i = 1, . . . , m. Then, for instance, the number of errors due to bug i that occurs in any s units of operating time is Poisson distributed with mean i s. Also suppose that these Poisson processes caused by bugs i, i = 1, . . . , m are independent. In addition, suppose that the package is to be run for t time units with all resulting errors being noted. At the end of this time a careful check of the package is made to determine the specific bugs that caused the errors (that is, a debugging, takes place). These bugs are removed, and the problem is then to determine the error rate for the revised package. If we let i (t) = 1, 0, if bug i has not caused an error by t otherwise
then the quantity we wish to estimate is (t) =
i
i i (t)
the error rate of the final package. To start, note that E[ (t)] =
i
i E[i (t)] i ei t
i
=
(5.19)
Now each of the bugs that is discovered would have been responsible for a certain number of errors. Let us denote by Mj (t) the number of bugs that were responsible for j errors, j 1. That is, M1 (t) is the number of bugs that caused exactly
5.3.
The Poisson Process
329
one error, M2 (t) is the number that caused two errors, and so on, with j j Mj (t) equaling the total number of errors that resulted. To compute E[M1 (t)], let us define the indicator variables, Ii (t), i 1, by Ii (t) = Then, M1 (t) =
i
1, 0,
bug i causes exactly 1 error otherwise
Ii (t)
and so E[M1 (t)] =
i
E[Ii (t)] =
i
i tei t
(5.20)
Thus, from (5.19) and (5.20) we obtain the intriguing result that E (t)  M1 (t) =0 t (5.21)
Thus suggests the possible use of M1 (t)/t as an estimate of (t). To determine whether or not M1 (t)/t constitutes a "good" estimate of (t) we shall look at how far apart these two quantities tend to be. That is, we will compute E (t)  M1 (t) t
2
= Var
(t) 
M1 (t) t
from (5.21)
2 1 = Var( (t))  Cov( (t), M1 (t)) + 2 Var(M1 (t)) t t Now, Var( (t)) =
i
2 Var(i (t)) = i
i
2 ei t (1  ei t ), i i tei t (1  i tei t ),
Var(M1 (t)) =
i
Var(Ii (t)) =
i
Cov( (t), M1 (t)) = Cov
i
i i (t),
j
Ij (t)
=
i j
Cov(i i (t), Ij (t))
330
5
The Exponential Distribution and the Poisson Process
=
i
i Cov(i (t), Ii (t)) i ei t i tei t
i
=
where the last two equalities follow since i (t) and Ij (t) are independent when i = j because they refer to different Poisson processes and i (t)Ii (t) = 0. Hence we obtain that E (t)  M1 (t) t
2
=
i
2 ei t + i
1 t
i ei t
i
E[M1 (t) + 2M2 (t)] = t2 where the last equality follows from (5.20) and the identity (which we leave as an exercise) 1 (i t)2 ei t (5.22) E[M2 (t)] = 2
i
Thus, we can estimate the average square of the difference between M1 (t)/t by the observed value of M1 (t) + 2M2 (t) divided by t 2 .
(t) and
Example 5.23 Suppose that in 100 units of operating time 20 bugs are discovered of which two resulted in exactly one, and three resulted in exactly two, errors. Then we would estimate that (100) is something akin to the value of a random variable whose mean is equal to 1/50 and whose variance is equal to 8/10,000.
5.4.
Generalizations of the Poisson Process
5.4.1. Nonhomogeneous Poisson Process In this section we consider two generalizations of the Poisson process. The first of these is the nonhomogeneous, also called the nonstationary, Poisson process, which is obtained by allowing the arrival rate at time t to be a function of t.
Definition 5.4 The counting process {N (t), t
(i) (ii) (iii) (iv) N(0) = 0. {N(t), t 0} has independent increments. P {N(t + h)  N(t) 2} = o(h). P {N(t + h)  N(t) = 1} = (t)h + o(h).
0} is said to be a nonhomogeneous Poisson process with intensity function (t), t 0, if
5.4.
Generalizations of the Poisson Process
331
Time sampling an ordinary Poisson process generates a nonhomogeneous Poisson process. That is, let {N(t), t 0} be a Poisson process with rate , and suppose that an event occurring at time t is, independently of what has occurred prior to t, counted with probability p(t). With Nc (t) denoting the number of counted events by time t, the counting process {Nc (t), t 0} is a nonhomogeneous Poisson process with intensity function (t) = p(t). This is verified by noting that {Nc (t), t 0} satisfies the nonhomogeneous Poisson process axioms. 1. Nc (0) = 0. 2. The number of counted events in (s, s + t) depends solely on the number of events of the Poisson process in (s, s + t), which is independent of what has occurred prior to time s. Consequently, the number of counted events in (s, s + t) is independent of the process of counted events prior to s, thus establishing the independent increment property. 3. Let Nc (t, t + h) = Nc (t + h)  Nc (t), with a similar definition of N (t, t + h). P {Nc (t, t + h) 2} P {N (t, t + h) 2} = o(h)
4. To compute P {Nc (t, t + h) = 1}, condition on N (t, t + h). P {Nc (t, t + h) = 1} = P {Nc (t, t + h) = 1N (t, t + h) = 1}P {N (t, t + h) = 1} + P {Nc (t, t + h) = 1N (t, t + h) = p(t)h + o(h) Not only does time sampling a Poisson process result in a nonhomogeneous Poisson process, but it also works the other way: every nonhomogeneous Poisson process with a bounded intensity function can be thought of as being a time sampling of a Poisson process. To show this, we start by showing that the superposition of two independent nonhomogeneous Poisson processes remains a nonhomogeneous Poisson process. 2}P {N (t, t + h) 2} = P {Nc (t, t + h) = 1N (t, t + h) = 1}h + o(h)
Proposition 5.4 Let {N (t), t
0}, and {M(t), t 0}, be independent nonhomogeneous Poisson processes, with respective intensity functions (t) and (t), and let N (t) = N(t) + M(t). Then, the following are true. (a) {N (t), t 0} is a nonhomogeneous Poisson process with intensity function (t) + (t). (b) Given that an event of the {N (t)} process occurs at time t then, independent of what occurred prior to t, the event at t was from the {N (t)} process with (t) probability (t)+(t) .
332
5
The Exponential Distribution and the Poisson Process
Proof To verify that {N (t), t
0}, is a nonhomogeneous Poisson process with intensity function (t) + (t), we will argue that it satisfies the nonhomogeneous Poisson process axioms. 1. N (0) = N(0) + M(0) = 0. 2. To verify independent increments, let I1 , . . . , In be nonoverlapping intervals. Let N(I ) and M(I ) denote, respectively, the number of events from the {N(t)} process and from the {M(t)} process that are in the interval I . Because each counting process has independent increments, and the two processes are independent of each other, it follows that N(I1 ), . . . , N (In ), M(I1 ), . . . , M(In ) are all independent, and thus so are N(I1 ) + M(I1 ), . . . , N (In ) + M(In ), which shows that {N (t), t 0} also possesses independent increments. 3. In order for there to be exactly one event of the N process between t and t + h, either there must be one event of the N process and 0 events of the M process or the reverse. The first of these mutually exclusive possibilities occurs with probability P {N (t, t + h) = 1, M(t, t + h) = 0} = P {N (t, t + h) = 1} P {M(t, t + h) = 0} = ((t)h + o(h)) (1  (t)h + o(h)) = (t)h + o(h) Similarly, the second possibility occurs with probability P {N(t, t + h) = 0, M(t, t + h) = 1} = (t)h + o(h) yielding that P {N (t + h)  N (t) = 1} = ((t) + (t))h + o(h) 4. In order for there to be at least two events of the N process between t and t + h, one of the following three possibilities must occur: there is at least two events of the N process between t and t + h; there is at least two events of the M process between t and t + h; or both processes have exactly one event between t and t + h. Each of the first two of these possibilities occurs with probability o(h), while the third occurs with probability ((t)h + o(h))((t)h + o(h)) = o(h). Thus, P {N (t + h)  N (t) 2} o(h)
Thus, part (a) is proven. To prove (b), note first that it follows from independent increments that which process caused the event at time t is independent of what occurred prior to t. To
5.4.
Generalizations of the Poisson Process
333
find the conditional probability that the event at time t is from the N process, we use that P {N(t, t + h) = 1N (t, t + h) = 1} = = = P {N (t, t + h) = 1, M(t, t + h) = 0} P {N (t, t + h) = 1} (t)h + o(h) ((t) + (t))h + o(h) (t) +
o(h) h o(h) h
(t) + (t) +
Letting h 0 in the preceding proves (b). Now, suppose that {N(t), t 0} is a nonhomogeneous Poisson process with a bounded intensity function (t), and suppose that is such that (t) , for all t 0. Letting {M(t), t 0} be a nonhomogeneous Poisson process with intensity function (t) =  (t), t 0, that is independent of {N (t), t 0}, it follows from Proposition 5.4 that {N (t), t 0} can be regarded as being the process of time sampled events of the Poisson process {N (t) + M(t), t 0}, where an event of the Poisson process that occurs at time t is counted with probability p(t) = (t)/. With this interpretation of a nonhomogeneous Poisson process as being a timesampled Poisson process, the number of events of the nonhomogeneous Poisson process by time t, namely, N (t), is equal to the number of counted events of the Poisson process by time t. Consequently, from Proposition 5.3 it follows that N (t) is a Poisson random variable with mean E[N (t)] =
0 t
(y) dy =
t
(y) dy
0
Moreover, by regarding the nonhomogeneous Poisson process as starting at time s, the preceding yields that N (t + s)  N (t), the number of events in its first t t s+t time units, is a Poisson random variable with mean 0 (s + y) dy = s (y) dy. The function m(t) defined by m(t) =
0 t
(y) dy
is called the mean value function of the nonhomogeneous Poisson process.
Remark That N(s + t)  N (s) has a Poisson distribution with mean
s+t s
(y) dy is a consequence of the Poisson limit of the sum of independent
334
5
The Exponential Distribution and the Poisson Process
Bernoulli random variables (see Example 2.47). To see why, subdivide the int terval [s, s + t] into n subintervals of length n , where subinterval i goes from t t t t s + (i  1) n to s + i n , i = 1, . . . , n. Let Ni = N (s + i n )  N (s + (i  1) n ) be the number of events that occur in subinterval i, and note that
n
P { 2 events in some subinterval} = P
i=1 n
{Ni P {Ni
2}
2} by Axiom (iii)
i=1
= no(t/n) Because
n
lim no(t/n) = lim t
n
o(t/n) =0 t/n
it follows that, as n increases to , the probability of having two or more events in any of the n subintervals goes to 0. Consequently, with a probability going to 1, N(t) will equal the number of subintervals in which an event occurs. Because the t t t probability of an event in subinterval i is (s + i n ) n + o( n ), it follows, because the number of events in different subintervals are independent, that when n is large the number of subintervals that contain an event is approximately a Poisson random variable with mean
n
s+i
i=1
t n
t + no(t/n) n
But,
n n
lim
s +i
i=1
t n
t + no(t/n) = n
s+t
(y) dy
s
and the result follows. The importance of the nonhomogeneous Poisson process resides in the fact that we no longer require the condition of stationary increments. Thus we now allow for the possibility that events may be more likely to occur at certain times than during other times.
Example 5.24 Siegbert runs a hot dog stand that opens at 8 A . M . From 8
until 11 A . M . customers seem to arrive, on the average, at a steadily increasing rate that starts with an initial rate of 5 customers per hour at 8 A . M . and reaches a maximum of 20 customers per hour at 11 A . M . From 11 A . M . until 1 P. M . the
5.4.
Generalizations of the Poisson Process
335
(average) rate seems to remain constant at 20 customers per hour. However, the (average) arrival rate then drops steadily from 1 P. M . until closing time at 5 P. M . at which time it has the value of 12 customers per hour. If we assume that the numbers of customers arriving at Siegbert's stand during disjoint time periods are independent, then what is a good probability model for the preceding? What is the probability that no customers arrive between 8:30 A . M . and 9:30 A . M . on Monday morning? What is the expected number of arrivals in this period? Solution: A good model for the preceding would be to assume that arrivals constitute a nonhomogeneous Poisson process with intensity function (t) given by 0 t 3 5 + 5t, 3 t 5 (t) = 20, 20  2(t  5), 5 t 9 and (t) = (t  9) for t > 9
Note that N(t) represents the number of arrivals during the first t hours that the store is open. That is, we do not count the hours between 5 P. M . and 8 A . M . If for some reasons we wanted N (t) to represent the number of arrivals during the first t hours regardless of whether the store was open or not, then, assuming that the process begins at midnight we would let 0 t 8 0, 8 t 11 5 + 5(t  8), 11 t 13 (t) = 20, 20  2(t  13), 13 t 17 0, 17 < t 24 and (t) = (t  24) for t > 24
As the number of arrivals between 8:30 A . M . and 9:30 A . M . will be Poisson with mean m( 3 )  m( 1 ) in the first representation [and m( 19 )  m( 17 ) in the 2 2 2 2 second representation], we have that the probability that this number is zero is exp 
3/2 1/2
(5 + 5t) dt = e10
and the mean number of arrivals is
3/2 1/2
(5 + 5t) dt = 10
336
5
The Exponential Distribution and the Poisson Process
Suppose that events occur according to a Poisson process with rate , and suppose that, independent of what has previously occurred, an event at time s is a type 1 event with probability P1 (s) or a type 2 event with probability P2 (s) = 1  P1 (s). If Ni (t), t 0, denotes the number of type i events by time t, then it easily follows from Definition 5.4 that {N1 (t), t 0} and {N2 (t), t 0} are independent nonhomogeneous Poisson processes with respective intensity functions i (t) = Pi (t), i = 1, 2. (The proof mimics that of Proposition 5.2.) This result gives us another way of understanding (or of proving) the time sampling Poisson process result of Proposition 5.3 which states that N1 (t) and N2 (t) are indet pendent Poisson random variables with means E[Ni (t)] = 0 Pi (s) ds, i = 1, 2.
Example 5.25 (The Output Process of an Infinite Server Poisson Queue) It turns out that the output process of the M/G/ queuethat is, of the infinite server queue having Poisson arrivals and general service distribution Gis a nonhomogeneous Poisson process having intensity function (t) = G(t). To verify this claim, let us first argue that the departure process has independent increments. Towards this end, consider nonoverlapping intervals O1 , . . . , Ok ; now say that an arrival is type i, i = 1, . . . , k, if that arrival departs in the interval Oi . By Proposition 5.3, it follows that the numbers of departures in these intervals are independent, thus establishing independent increments. Now, suppose that an arrival is "counted" if that arrival departs between t and t + h. Because an arrival at time s, s < t + h, will be counted with probability G(t  s + h)  G(t  s), it follows from Proposition 5.3 that the number of departures in (t, t + h) is a Poisson random variable with mean
t+h
0
[G(t  s + h)  G(t  s)] ds =
0
t+h
[G (t  s + h)h + o(h)] ds G (y) dy + o(h)
= h
0
t+h
= G(t)h + o(h) Therefore, P {1 departure in (t, t + h)} = G(t)h eG(t)h + o(h) = G(t)h + o(h) and P { 2 departures in (t, t + h)} = o(h) which completes the verification.
5.4.
Generalizations of the Poisson Process
337
If we let Sn denote the time of the nth event of the nonhomogeneous Poisson process, then we can obtain its density as follows: P {t < Sn < t + h} = P {N (t) = n  1, one event in (t, t + h)} + o(h) = P {N (t) = n  1}P {one event in (t, t + h)} + o(h) = em(t) [m(t)]n1 [(t)h + o(h)] + o(h) (n  1)! [m(t)]n1 h + o(h) (n  1)!
= (t)em(t) which implies that
fSn (t) = (t)em(t) where m(t) =
0 t
[m(t)]n1 (n  1)!
(s) ds
5.4.2. Compound Poisson Process A stochastic process {X(t), t can be represented as 0} is said to be a compound Poisson process if it
N (t)
X(t) =
i=1
Yi ,
t
0
(5.23)
where {N(t), t 0} is a Poisson process, and {Yi , i 1} is a family of independent and identically distributed random variables that is also independent of {N(t), t 0}. As noted in Chapter 3, the random variable X(t) is said to be a compound Poisson random variable. Examples of Compound Poisson Processes (i) If Yi 1, then X(t) = N (t), and so we have the usual Poisson process. (ii) Suppose that buses arrive at a sporting event in accordance with a Poisson process, and suppose that the numbers of fans in each bus are assumed to be independent and identically distributed. Then {X(t), t 0} is a compound Poisson process where X(t) denotes the number of fans who have arrived by t. In Equation (5.23) Yi represents the number of fans in the ith bus.
338
5
The Exponential Distribution and the Poisson Process
(iii) Suppose customers leave a supermarket in accordance with a Poisson process. If Yi , the amount spent by the ith customer, i = 1, 2, . . . , are independent and identically distributed, then {X(t), t 0} is a compound Poisson process when X(t) denotes the total amount of money spent by time t. Because X(t) is a compound Poisson random variable with Poisson parameter t, we have from Examples 3.10 and 3.17 that E[X(t)] = tE[Y1 ] and
2 Var(X(t)) = tE Y1
(5.24)
(5.25)
Example 5.26 Suppose that families migrate to an area at a Poisson rate
= 2 per week. If the number of people in each family is independent and takes on the values 1, 2, 3, 4 with respective probabilities 1 , 1 , 1 , 1 , then what is the 6 3 3 6 expected value and variance of the number of individuals migrating to this area during a fixed fiveweek period? Solution: that Letting Yi denote the number of people in the ith family, we have E[Yi ] = 1
1 6
+2
1 6
1 3
+3
1 3
1 3
+4
1 3
1 6
= 5, 2
1 6
E Yi2 = 12
+ 22
+ 32
+ 42
=
43 6
Hence, letting X(5) denote the number of immigrants during a fiveweek period, we obtain from Equations (5.24) and (5.25) that E[X(5)] = 2 5 and Var[X(5)] = 2 5
43 6 5 2
= 25
=
215 3
Example 5.27 (Busy Periods in SingleServer Poisson Arrival Queues)
Consider a singleserver service station in which customers arrive according to a Poisson process having rate . An arriving customer is immediately served if the server is free; if not, the customer waits in line (that is, he or she joins the queue). The successive service times are independent with a common distribution. Such a system will alternate between idle periods when there are no customers in the system, so the server is idle, and busy periods when there are customers in the system, so the server is busy. A busy period will begin when an arrival finds the system empty, and because of the memoryless property of the Poisson arrivals
5.4.
Generalizations of the Poisson Process
339
it follows that the distribution of the length of a busy period will be the same for each such period. Let B denote the length of a busy period. We will compute its mean and variance. To begin, let S denote the service time of the first customer in the busy period and let N(S) denote the number of arrivals during that time. Now, if N (S) = 0 then the busy period will end when the initial customer completes his service, and so B will equal S in this case. Now, suppose that one customer arrives during the service time of the initial customer. Then, at time S there will be a single customer in the system who is just about to enter service. Because the arrival stream from time S on will still be a Poisson process with rate , it thus follows that the additional time from S until the system becomes empty will have the same distribution as a busy period. That is, if N (S) = 1 then B = S + B1 where B1 is independent of S and has the same distribution as B. Now, consider the general case where N (S) = n, so there will be n customers waiting when the server finishes his initial service. To determine the distribution of remaining time in the busy period note that the order in which customers are served will not affect the remaining time. Hence, let us suppose that the n arrivals, call them C1 , . . . , Cn , during the initial service period are served as follows. Customer C1 is served first, but C2 is not served until the only customers in the system are C2 , . . . , Cn . For instance, any customers arriving during C1 's service time will be served before C2 . Similarly, C3 is not served until the system is free of all customers but C3 , . . . , Cn , and so on. A little thought reveals that the times between the beginnings of service of customers Ci and Ci+1 , i = 1, . . . , n  1, and the time from the beginning of service of Cn until there are no customers in the system, are independent random variables, each distributed as a busy period. It follows from the preceding that if we let B1 ,B2 , . . . be a sequence of independent random variables, each distributed as a busy period, then we can express B as
N (S)
B =S+
i=1
Bi
Hence, E[BS] = S + E
N (S) i=1
Bi S
340 and
5
The Exponential Distribution and the Poisson Process
Var(BS) = Var
N (S)
N (S) i=1
Bi S
However, given S, i=1 Bi is a compound Poisson random variable, and thus from Equations (5.24) and (5.25) we obtain E[BS] = S + SE[B] = (1 + E[B])S Var(BS) = SE[B 2 ] Hence, E[B] = E[E[BS]] = (1 + E[B])E[S] implying, provided that E[S] < 1, that E[B] = E[S] 1  E[S]
Also, by the conditional variance formula Var(B) = Var(E[BS]) + E[Var(BS)] = (1 + E[B])2 Var(S) + E[S]E[B 2 ] = (1 + E[B])2 Var(S) + E[S](Var(B) + E 2 [B]) yielding Var(B) = Var(S)(1 + E[B])2 + E[S]E 2 [B] 1  E[S] Var(S) + E 3 [S] (1  E[S])3
Using E[B] = E[S]/(1  E[S]), we obtain Var(B) =
There is a very nice representation of the compound Poisson process when the set of possible values of the Yi is finite or countably infinite. So let us suppose that there are numbers j , j 1, such that P {Y1 = j } = pj ,
j
pj = 1
Now, a compound Poisson process arises when events occur according to a Poisson process and each event results in a random amount Y being added to
5.4.
Generalizations of the Poisson Process
341
the cumulative sum. Let us say that the event is a type j event whenever it results in adding the amount j , j 1. That is, the ith event of the Poisson process is a type j event if Yi = j . If we let Nj (t) denote the number of type j events by time t, then it follows from Proposition 5.2 that the random variables Nj (t), j 1, are independent Poisson random variables with respective means E[Nj (t)] = pj t Since, for each j , the amount j is added to the cumulative sum a total of Nj (t) times by time t, it follows that the cumulative sum at time t can be expressed as X(t) =
j
j Nj (t)
(5.26)
As a check of Equation (5.26), let us use it to compute the mean and variance of X(t). This yields E[X(t)] = E
j
j Nj (t) j E[Nj (t)]
=
j
=
j
j pj t
= t E[Y1 ] Also, Var[X(t)] = Var
j
j Nj (t)
2 j Var[Nj (t)]
=
j
by the independence of the Nj (t), j
1
=
j
2 j pj t
2 = tE[Y1 ]
where the next to last equality follows since the variance of the Poisson random variable Nj (t) is equal to its mean. Thus, we see that the representation (5.26) results in the same expressions for the mean and variance of X(t) as were previously derived.
342
5
The Exponential Distribution and the Poisson Process
One of the uses of the representation (5.26) is that it enables us to conclude that as t grows large, the distribution of X(t) converges to the normal distribution. To see why, note first that it follows by the central limit theorem that the distribution of a Poisson random variable converges to a normal distribution as its mean increases. (Why is this?) Therefore, each of the random variables Nj (t) converges to a normal random variable as t increases. Because they are independent, and because the sum of independent normal random variables is also normal, it follows that X(t) also approaches a normal distribution as t increases.
Example 5.28 In Example 5.24, find the approximate probability that at least
240 people migrate to the area within the next 50 weeks. Solution: Since = 2, E[Yi ] = 5/2, E[Yi2 ] = 43/6, we see that E[X(50)] = 250, Now, the desired probability is P {X(50) 240} = P {X(50) =P 239.5} 239.5  250 4300/6 Var[X(50)] = 4300/6
X(50)  250 4300/6
= 1  (0.3922) = (0.3922) = 0.6525 where Table 2.3 was used to determine (0.3922), the probability that a standard normal is less than 0.3922. Another useful result is that if {X(t), t 0} and {Y (t), t 0} are independent compound Poisson processes with respective Poisson parameters and distributions 1 , F1 and 2 , F2 , then {X(t) + Y (t), t 0} is also a compound Poisson process. This is true because in this combined process events will occur according to a Poisson process with rate 1 + 2 , and each event independently will be from the first compound Poisson process with probability 1 /(1 + 2 ). Consequently, the combined process will be a compound Poisson process with Poisson parameter 1 + 2 , and with distribution function F given by F (x) = 2 1 F1 (x) + F2 (x) 1 + 2 1 + 2
5.4.
Generalizations of the Poisson Process
343
5.4.3. Conditional or Mixed Poisson Processes Let {N(t), t 0} be a counting process whose probabilities are defined as follows. There is a positive random variable L such that, conditional on L = , the counting process is a Poisson process with rate . Such a counting process is called a conditional or a mixed Poisson process. Suppose that L is continuous with density function g. Because P {N(t + s)  N(s) = n} =
0
P {N (t + s)  N (s) = n  L = }g() d et (t)n g() d n! (5.27)
=
0
we see that a conditional Poisson process has stationary increments. However, because knowing how many events occur in an interval gives information about the possible value of L, which affects the distribution of the number of events in any other interval, it follows that a conditional Poisson process does not generally have independent increments. Consequently, a conditional Poisson process is not generally a Poisson process.
Example 5.29 If g is the gamma density with parameters m and ,
g() = e then P {N(t) = n} =
0
( )m1 , (m  1)!
>0
et
(t)n  ( )m1 e d n! (m  1)!
0
= Multiplying and dividing by P {N(t) = n} =
t n m n!(m  1)!
e(t+) n+m1 d
(n+m1)! (t+)n+m
gives
0
t n m (n + m  1)! n!(m  1)!(t + )n+m
(t + )e(t+)
((t + ))n+m1 d (n + m  1)!
Because (t + )e(t+) ((t + ))n+m1 /(n + m  1)! is the density function of a gamma (n + m, t + ) random variable, its integral is 1, giving the result P {N(t) = n} = n+m1 n t +
m
t t +
n
Therefore, the number of events in an interval of length t has the same distribution of the number of failures that occur before a total of m successes are amassed, when each trial is a success with probability t+ .
344
5
The Exponential Distribution and the Poisson Process
To compute the mean and variance of N (t), condition on L. Because, conditional on L, N(t) is Poisson with mean Lt, we obtain E[N (t)L] = Lt Var(N (t)L) = Lt where the final equality used that the variance of a Poisson random variable is equal to its mean. Consequently, the conditional variance formula yields Var(N (t)) = E[Lt] + Var(Lt) = tE[L] + t 2 Var(L) We can compute the conditional distribution function of L, given that N (t) = n, as follows. P {L xN(t) = n} = = = = P {L x, N(t) = n} P {N (t) = n}
0 P {L x 0
x, N(t) = nL = }g() d P {N (t) = n}
P {N (t) = nL = }g() d P {N (t) = n}
x t (t)n g() d 0 e t (t)n g() d 0 e
where the final equality used Equation (5.27). In other words, the conditional density function of L given that N (t) = n is fLN (t) (  n) = , t n g() d 0 e et n g() 0 (5.28)
Example 5.30 An insurance company feels that each of its policyholders has
a rating value and that a policyholder having rating value will make claims at times distributed according to a Poisson process with rate , when time is measured in years. The firm also believes that rating values vary from policyholder to policyholder, with the probability distribution of the value of a new policyholder being uniformly distributed over (0, 1). Given that a policyholder has made n claims in his or her first t years, what is the conditional distribution of the time until the policyholder's next claim?
5.4.
Generalizations of the Poisson Process
345
Solution: If T is the time until the next claim, then we want to compute P {T > x  N(t) = n}. Conditioning on the policyholder's rating value gives, upon using Equation (5.28), P {T > x  N(t) = n} =
0
P {T > x  L = , N (t) = n}fLN (t) (  n) d
=
1 x t n e d 0 e 1 t n d 0 e
There is a nice formula for the probability that more than n events occur in an interval of length t. In deriving it we will use the identity
j =n+1
et
(t)j = j!
t 0
ex
(x)n dx n!
(5.29)
which follows by noting that it equates the probability that the number of events by time t of a Poisson process with rate is greater than n with the probability that the time of the (n + 1)st event of this process (which has a gamma (n + 1, ) distribution) is less than t. Interchanging and t in Equation (5.29) yields the equivalent identity
j =n+1
et
(t)j = j!
0
tetx
(tx)n dx n!
(5.30)
Using Equation (5.27) we now have
P {N(t) > n} =
j =n+1 0 0
et
(t)j g() d j! (t)j g() d j! (by interchanging)
j =n+1
= =
0
et tetx
0 0 x 0
(tx)n dxg() d n! (tx)n dx n!
(using (5.30)) (by interchanging)
= =
g() dtetx
n
(tx) dx G(x)tetx n!
346
5
The Exponential Distribution and the Poisson Process
Exercises
1. The time T required to repair a machine is an exponentially distributed random variable with mean 1 (hours). 2 (a) What is the probability that a repair time exceeds 1 hour? 2 (b) What is the probability that a repair takes at least 12 1 hours given that its 2 duration exceeds 12 hours? 2. Suppose that you arrive at a singleteller bank to find five other customers in the bank, one being served and the other four waiting in line. You join the end of the line. If the service times are all exponential with rate , what is the expected amount of time you will spend in the bank? 3. Let X be an exponential random variable. Without any computations, tell which one of the following is correct. Explain your answer. (a) E[X 2 X > 1] = E[(X + 1)2 ]; (b) E[X 2 X > 1] = E[X 2 ] + 1; (c) E[X 2 X > 1] = (1 + E[X])2 . 4. Consider a post office with two clerks. Three people, A, B, and C, enter simultaneously. A and B go directly to the clerks, and C waits until either A or B leaves before he begins service. What is the probability that A is still in the post office after the other two have left when (a) the service time for each clerk is exactly (nonrandom) ten minutes? (b) the service times are i with probability 1 , i = 1, 2, 3? 3 (c) the service times are exponential with mean 1/? 5. The lifetime of a radio is exponentially distributed with a mean of ten years. If Jones buys a tenyearold radio, what is the probability that it will be working after an additional ten years? 6. In Example 5.3 if server i serves at an exponential rate i , i = 1, 2, show that P {Smith is not last} = 1 1 + 2
2
+
2 1 + 2
2
*7. If X1 and X2 are independent nonnegative continuous random variables, show that P {X1 < X2  min(X1 , X2 ) = t} = where ri (t) is the failure rate function of Xi . 8. Let Xi , i = 1, . . . , n be independent continuous random variables, with Xi having failure rate function ri (t). Let T be independent of this sequence, and r1 (t) r1 (t) + r2 (t)
Exercises
347
suppose that is given by
n i=1 P {T
= i} = 1. Show that the failure rate function r(t) of XT
n
r(t) =
i=1
ri (t)P {T = iX > t}
9. Machine 1 is currently working. Machine 2 will be put in use at a time t from now. If the lifetime of machine i is exponential with rate i , i = 1, 2, what is the probability that machine 1 is the first machine to fail? *10. Let X and Y be independent exponential random variables with respective rates and . Let M = min(X, Y ). Find (a) E[MXM = X], (b) E[MXM = Y ], (c) Cov(X, M). 11. Let X, Y1 , . . . , Yn be independent exponential random variables; X having rate , and Yi having rate . Let Aj be the event that the j th smallest of these n + 1 random variables is one of the Yi . Find p = P {X > maxi Yi }, by using the identity p = P (A1 An ) = P (A1 )P (A2 A1 ) P (An A1 An1 ) Verify your answer when n = 2 by conditioning on X to obtain p. 12. If Xi , i = 1, 2, 3, are independent exponential random variables with rates i , i = 1, 2, 3, find (a) P {X1 < X2 < X3 }, (b) P {X1 < X2  max(X1 , X2 , X3 ) = X3 }, (c) E[max Xi X1 < X2 < X3 ], (d) E[max Xi ]. 13. Find, in Example 5.8, the expected time until the nth person on line leaves the line (either by entering service or departing without service). 14. Let X be an exponential random variable with rate . (a) Use the definition of conditional expectation to determine E[XX < c]. (b) Now determine E[XX < c] by using the following identity: E[X] = E[XX < c]P {X < c} + E[XX > c]P {X > c} 15. One hundred items are simultaneously put on a life test. Suppose the lifetimes of the individual items are independent exponential random variables with mean 200 hours. The test will end when there have been a total of 5 failures. If T is the time at which the test ends, find E[T ] and Var(T ). 16. Suppose in Example 5.3 that the time it takes server i to serve customers is exponentially distributed with mean 1/i , i = 1, 2. What is the expected time until all three customers have left the post office?
348
5
The Exponential Distribution and the Poisson Process
17. A set of n cities is to be connected via communication links. The cost to construct a link between cities i and j is Cij , i = j . Enough links should be constructed so that for each pair of cities there is a path of links that connects them. As a result, only n  1 links need be constructed. A minimal cost algorithm for solving this problem (known as the minimal spanning tree problem) first constructs the cheapest of all the n links. Then, at each additional stage it chooses 2 the cheapest link that connects a city without any links to one with links. That is, if the first link is between cities 1 and 2, then the second link will either be between 1 and one of the links 3, . . . , n or between 2 and one of the links 3, . . . , n. Suppose that all of the n costs Cij are independent exponential random variables 2 with mean 1. Find the expected cost of the preceding algorithm if (a) n = 3, (b) n = 4. *18. Let X1 and X2 be independent exponential random variables, each having rate . Let X(1) = minimum(X1 , X2 ) and X(2) = maximum(X1 , X2 )
Find (a) E[X(1) ], (b) Var[X(1) ], (c) E[X(2) ], (d) Var[X(2) ]. 19. Repeat Exercise 18, but this time suppose that the Xi are independent exponentials with respective rates i , i = 1, 2. 20. Consider a twoserver system in which a customer is served first by server 1, then by server 2, and then departs. The service times at server i are exponential random variables with rates i , i = 1, 2. When you arrive, you find server 1 free and two customers at server 2customer A in service and customer B waiting in line. (a) Find PA , the probability that A is still in service when you move over to server 2. (b) Find PB , the probability that B is still in the system when you move over to server 2. (c) Find E[T ], where T is the time that you spend in the system. Hint: Write T = S1 + S2 + W A + W B where Si is your service time at server i, WA is the amount of time you wait in queue while A is being served, and WB is the amount of time you wait in queue while B is being served.
Exercises
349
21. In a certain system, a customer must first be served by server 1 and then by server 2. The service times at server i are exponential with rate i , i = 1, 2. An arrival finding server 1 busy waits in line for that server. Upon completion of service at server 1, a customer either enters service with server 2 if that server is free or else remains with server 1 (blocking any other customer from entering service) until server 2 is free. Customers depart the system after being served by server 2. Suppose that when you arrive there is one customer in the system and that customer is being served by server 1. What is the expected total time you spend in the system? 22. Suppose in Exercise 21 you arrive to find two others in the system, one being served by server 1 and one by server 2. What is the expected time you spend in the system? Recall that if server 1 finishes before server 2, then server 1's customer will remain with him (thus blocking your entrance) until server 2 becomes free. *23. A flashlight needs two batteries to be operational. Consider such a flashlight along with a set of n functional batteriesbattery 1, battery 2, . . . , battery n. Initially, battery 1 and 2 are installed. Whenever a battery fails, it is immediately replaced by the lowest numbered functional battery that has not yet been put in use. Suppose that the lifetimes of the different batteries are independent exponential random variables each having rate . At a random time, call it T , a battery will fail and our stockpile will be empty. At that moment exactly one of the batteries which we call battery Xwill not yet have failed. (a) (b) (c) (d) (e) What is P {X = n}? What is P {X = 1}? What is P {X = i}? Find E[T ]. What is the distribution of T ?
24. There are 2 servers available to process n jobs. Initially, each server begins work on a job. Whenever a server completes work on a job, that job leaves the system and the server begins processing a new job (provided there are still jobs waiting to be processed). Let T denote the time until all jobs have been processed. If the time that it takes server i to process a job is exponentially distributed with rate i , i = 1, 2, find E[T ] and Var(T ). 25. Customers can be served by any of three servers, where the service times of server i are exponentially distributed with rate i , i = 1, 2, 3. Whenever a server becomes free, the customer who has been waiting the longest begins service with that server. (a) If you arrive to find all three servers busy and no one waiting, find the expected time until you depart the system. (b) If you arrive to find all three servers busy and one person waiting, find the expected time until you depart the system.
350
5
The Exponential Distribution and the Poisson Process
26. Each entering customer must be served first by server 1, then by server 2, and finally by server 3. The amount of time it takes to be served by server i is an exponential random variable with rate i , i = 1, 2, 3. Suppose you enter the system when it contains a single customer who is being served by server 3. (a) Find the probability that server 3 will still be busy when you move over to server 2. (b) Find the probability that server 3 will still be busy when you move over to server 3. (c) Find the expected amount of time that you spend in the system. (Whenever you encounter a busy server, you must wait for the service in progress to end before you can enter service.) (d) Suppose that you enter the system when it contains a single customer who is being served by server 2. Find the expected amount of time that you spend in the system. 27. Show, in Example 5.7, that the distributions of the total cost are the same for the two algorithms. 28. Consider n components with independent lifetimes which are such that component i functions for an exponential time with rate i . Suppose that all components are initially in use and remain so until they fail. (a) Find the probability that component 1 is the second component to fail. (b) Find the expected time of the second failure. Hint: Do not make use of part (a). 29. Let X and Y be independent exponential random variables with respective rates and , where > . Let c > 0. (a) Show that the conditional density function of X, given that X + Y = c, is fXX+Y (xc) = (  )e()x , 1  e()c 0<x<c
(b) Use part (a) to find E[XX + Y = c]. (c) Find E[Y X + Y = c]. 30. The lifetimes of A's dog and cat are independent exponential random variables with respective rates d and c . One of them has just died. Find the expected additional lifetime of the other pet. 31. A doctor has scheduled two appointments, one at 1 P. M . and the other at 1:30 P. M . The amounts of time that appointments last are independent exponential random variables with mean 30 minutes. Assuming that both patients are on time, find the expected amount of time that the 1:30 appointment spends at the doctor's office.
Exercises
351
32. There are three jobs and a single worker who works first on job 1, then on job 2, and finally on job 3. The amounts of time that he spends on each job are independent exponential random variables with mean 1. Let Ci be the time at which job i is completed, i = 1, 2, 3, and let X = 3 Ci be the sum of these i=1 completion times. Find (a) E[X], (b) Var(X). 33. Let X and Y be independent exponential random variables with respective rates and . (a) Argue that, conditional on X > Y , the random variables min(X, Y ) and X  Y are independent. (b) Use part (a) to conclude that for any positive constant c E[min(X, Y )X > Y + c] = E[min(X, Y )X > Y ] = E[min(X, Y )] = 1 +
(c) Give a verbal explanation of why min(X, Y ) and X  Y are (unconditionally) independent. 34. Two individuals, A and B, both require kidney transplants. If she does not receive a new kidney, then A will die after an exponential time with rate A , and B after an exponential time with rate B . New kidneys arrive in accordance with a Poisson process having rate . It has been decided that the first kidney will go to A (or to B if B is alive and A is not at that time) and the next one to B (if still living). (a) What is the probability that A obtains a new kidney? (b) What is the probability that B obtains a new kidney? 35. Show that Definition 5.1 of a Poisson process implies Definition 5.3. 36. Let S(t) denote the price of a security at time t. A popular model for the process {S(t), t 0} supposes that the price remains unchanged until a "shock" occurs, at which time the price is multiplied by a random factor. If we let N (t) denote the number of shocks by time t, and let Xi denote the ith multiplicative factor, then this model supposes that
N (t)
S(t) = S(0)
i=1 N (t)
Xi
where i=1 Xi is equal to 1 when N (t) = 0. Suppose that the Xi are independent exponential random variables with rate ; that {N (t), t 0} is a Poisson process with rate ; that {N(t), t 0} is independent of the Xi ; and that S(0) = s. (a) Find E[S(t)]. (b) Find E[S 2 (t)].
352
5
The Exponential Distribution and the Poisson Process
37. Cars cross a certain point in the highway in accordance with a Poisson process with rate = 3 per minute. If Reb blindly runs across the highway, then what is the probability that she will be uninjured if the amount of time that it takes her to cross the road is s seconds? (Assume that if she is on the highway when a car passes by, then she will be injured.) Do it for s = 2, 5, 10, 20. 38. Let {Mi (t), t 0}, i = 1, 2 be independent Poisson processes with respective rates i , i = 1, 2, and set N1 (t) = M1 (t) + M2 (t), N2 (t) = M2 (t) + M3 (t) The stochastic process {(N1 (t), N2 (t)), t 0} is called a bivariate Poisson process. (a) Find P {N1 (t) = n, N2 (t) = m}. (b) Find Cov N1 (t), N2 (t) . 39. A certain scientific theory supposes that mistakes in cell division occur according to a Poisson process with rate 2.5 per year, and that an individual dies when 196 such mistakes have occurred. Assuming this theory, find (a) the mean lifetime of an individual, (b) the variance of the lifetime of an individual. Also approximate (c) the probability that an individual dies before age 67.2, (d) the probability that an individual reaches age 90, (e) the probability that an individual reaches age 100. *40. Show that if {Ni (t), t 0} are independent Poisson processes with rate i , i = 1, 2, then {N(t), t 0} is a Poisson process with rate 1 + 2 where N(t) = N1 (t) + N2 (t). 41. In Exercise 40 what is the probability that the first event of the combined process is from the N1 process? 42. Let {N(t), t 0} be a Poisson process with rate . Let Sn denote the time of the nth event. Find (a) E[S4 ], (b) E[S4 N(1) = 2], (c) E[N(4)  N(2)N (1) = 3]. 43. Customers arrive at a twoserver service station according to a Poisson process with rate . Whenever a new customer arrives, any customer that is in the system immediately departs. A new arrival enters service first with server 1 and then with server 2. If the service times at the servers are independent exponentials with respective rates 1 and 2 , what proportion of entering customers completes their service with server 2?
Exercises
353
44. Cars pass a certain street location according to a Poisson process with rate . A woman who wants to cross the street at that location waits until she can see that no cars will come by in the next T time units. (a) Find the probability that her waiting time is 0. (b) Find her expected waiting time. Hint: Condition on the time of the first car. 45. Let {N(t), t 0} be a Poisson process with rate , that is independent of the nonnegative random variable T with mean and variance 2 . Find (a) Cov(T , N (T )), (b) Var(N (T )). 46. Let {N(t), t 0} be a Poisson process with rate , that is independent of the sequence X1 , X2 , . . . of independent and identically distributed random variables with mean and variance 2 . Find Cov N (t),
N (t) i=1
Xi
47. Consider a twoserver parallel queuing system where customers arrive according to a Poisson process with rate , and where the service times are exponential with rate . Moreover, suppose that arrivals finding both servers busy immediately depart without receiving any service (such a customer is said to be lost), whereas those finding at least one free server immediately enter service and then depart when their service is completed. (a) If both servers are presently busy, find the expected time until the next customer enters the system. (b) Starting empty, find the expected time until both servers are busy. (c) Find the expected time between two successive lost customers. 48. Consider an nserver parallel queuing system where customers arrive according to a Poisson process with rate , where the service times are exponential random variables with rate , and where any arrival finding all servers busy immediately departs without receiving any service. If an arrival finds all servers busy, find (a) the expected number of busy servers found by the next arrival, (b) the probability that the next arrival finds all servers free, (c) the probability that the next arrival finds exactly i of the servers free.
354
5
The Exponential Distribution and the Poisson Process
49. Events occur according to a Poisson process with rate . Each time an event occurs, we must decide whether or not to stop, with our objective being to stop at the last event to occur prior to some specified time T , where T > 1/. That is, if an event occurs at time t, 0 t T , and we decide to stop, then we win if there are no additional events by time T , and we lose otherwise. If we do not stop when an event occurs and no additional events occur by time T , then we lose. Also, if no events occur by time T , then we lose. Consider the strategy that stops at the first event to occur after some fixed time s, 0 s T. (a) Using this strategy, what is the probability of winning? (b) What value of s maximizes the probability of winning? (c) Show that one's probability of winning when using the preceding strategy with the value of s specified in part (b) is 1/e. 50. The number of hours between successive train arrivals at the station is uniformly distributed on (0, 1). Passengers arrive according to a Poisson process with rate 7 per hour. Suppose a train has just left the station. Let X denote the number of people who get on the next train. Find (a) E[X], (b) Var(X). 51. If an individual has never had a previous automobile accident, then the probability he or she has an accident in the next h time units is h + o(h); on the other hand, if he or she has ever had a previous accident, then the probability is h + o(h). Find the expected number of accidents an individual has by time t. 52. Teams 1 and 2 are playing a match. The teams score points according to independent Poisson processes with respective rates 1 and 2 . If the match ends when one of the teams has scored k more points than the other, find the probability that team 1 wins. Hint: Relate this to the gambler's ruin problem. 53. The water level of a certain reservoir is depleted at a constant rate of 1000 units daily. The reservoir is refilled by randomly occurring rainfalls. Rainfalls occur according to a Poisson process with rate 0.2 per day. The amount of water added to the reservoir by a rainfall is 5000 units with probability 0.8 or 8000 units with probability 0.2. The present water level is just slightly below 5000 units. (a) What is the probability the reservoir will be empty after five days? (b) What is the probability the reservoir will be empty sometime within the next ten days?
Exercises
355
54. A viral linear DNA molecule of length, say, 1 is often known to contain a certain "marked position," with the exact location of this mark being unknown. One approach to locating the marked position is to cut the molecule by agents that break it at points chosen according to a Poisson process with rate . It is then possible to determine the fragment that contains the marked position. For instance, letting m denote the location on the line of the marked position, then if L1 denotes the last Poisson event time before m (or 0 if there are no Poisson events in [0, m]), and R1 denotes the first Poisson event time after m (or 1 if there are no Poisson events in [m, 1]), then it would be learned that the marked position lies between L1 and R1 . Find (a) (b) (c) (d) P {L1 = 0}, P {L1 < x}, 0 < x < m, P {R1 = 1}, P {R1 > x}, m < x < 1.
By repeating the preceding process on identical copies of the DNA molecule, we are able to zero in on the location of the marked position. If the cutting procedure is utilized on n identical copies of the molecule, yielding the data Li , Ri , i = 1, . . . , n, then it follows that the marked position lies between L and R, where L = max Li ,
i
R = min Ri
i 2 n .
(e) Find E[R  L], and in doing so, show that E[R  L]
55. Consider a single server queuing system where customers arrive according to a Poisson process with rate , service times are exponential with rate , and customers are served in the order of their arrival. Suppose that a customer arrives and finds n  1 others in the system. Let X denote the number in the system at the moment that customer departs. Find the probability mass function of X. Hint: Relate this to a negative binomial random variable. 56. An event independently occurs on each day with probability p. Let N (n) denote the total number of events that occur on the first n days, and let Tr denote the day on which the rth event occurs. (a) What is the distribution of N (n)? (b) What is the distribution of T1 ? (c) What is the distribution of Tr ? (d) Given that N(n) = r, show that the set of r days on which events occurred has the same distribution as a random selection (without replacement) of r of the values 1, 2, . . . , n.
356
5
The Exponential Distribution and the Poisson Process
*57. Events occur according to a Poisson process with rate = 2 per hour. (a) What is the probability that no event occurs between 8 P. M . and 9 P. M .? (b) Starting at noon, what is the expected time at which the fourth event occurs? (c) What is the probability that two or more events occur between 6 P. M . and 8 P. M .? 58. Consider the coupon collecting problem where there are m distinct types of coupons, and each new coupon collected is type j with probability pj , m j =1 pj = 1. Suppose you stop collecting when you have a complete set of at least one of each type. Show that P {i is the last type collected} = E
j =i
(1  U j /i )
where U is a uniform (0, 1) random variable. 59. There are two types of claims that are made to an insurance company. Let Ni (t) denote the number of type i claims made by time t, and suppose that {N1 (t), t 0} and {N2 (t), t 0} are independent Poisson processes with rates 1 = 10 and 2 = 1. The amounts of successive type 1 claims are independent exponential random variables with mean $1000 whereas the amounts from type 2 claims are independent exponential random variables with mean $5000. A claim for $4000 has just been received; what is the probability it is a type 1 claim? *60. Customers arrive at a bank at a Poisson rate . Suppose two customers arrived during the first hour. What is the probability that (a) both arrived during the first 20 minutes? (b) at least one arrived during the first 20 minutes? 61. A system has a random number of flaws that we will suppose is Poisson distributed with mean c. Each of these flaws will, independently, cause the system to fail at a random time having distribution G. When a system failure occurs, suppose that the flaw causing the failure is immediately located and fixed. (a) What is the distribution of the number of failures by time t? (b) What is the distribution of the number of flaws that remain in the system at time t? (c) Are the random variables in parts (a) and (b) dependent or independent? 62. Suppose that the number of typographical errors in a new text is Poisson distributed with mean . Two proofreaders independently read the text. Suppose that each error is independently found by proofreader i with probability pi , i = 1, 2.
Exercises
357
Let X1 denote the number of errors that are found by proofreader 1 but not by proofreader 2. Let X2 denote the number of errors that are found by proofreader 2 but not by proofreader 1. Let X3 denote the number of errors that are found by both proofreaders. Finally, let X4 denote the number of errors found by neither proofreader. (a) Describe the joint probability distribution of X1 , X2 , X3 , X4 . (b) Show that E[X1 ] 1  p2 = E[X3 ] p2 and E[X2 ] 1  p1 = E[X3 ] p1
Suppose now that , p1 , and p2 are all unknown. (c) By using Xi as an estimator of E[Xi ], i = 1, 2, 3, present estimators of p1 , p2 , and . (d) Give an estimator of X4 , the number of errors not found by either proofreader. 63. Consider an infinite server queuing system in which customers arrive in accordance with a Poisson process and where the service distribution is exponential with rate . Let X(t) denote the number of customers in the system at time t. Find (a) E[X(t + s)X(s) = n]; (b) Var[X(t + s)X(s) = n]; Hint: Divide the customers in the system at time t + s into two groups, one consisting of "old" customers and the other of "new" customers. (c) Consider an infinite server queuing system in which customers arrive according to a Poisson process with rate , and where the service times are all exponential random variables with rate . If there is currently a single customer in the system, find the probability that the system becomes empty when that customer departs. *64. Suppose that people arrive at a bus stop in accordance with a Poisson process with rate . The bus departs at time t. Let X denote the total amount of waiting time of all those who get on the bus at time t. We want to determine Var(X). Let N(t) denote the number of arrivals by time t. (a) What is E[XN(t)]? (b) Argue that Var[XN (t)] = N (t)t 2 /12. (c) What is Var(X)? 65. An average of 500 people pass the California bar exam each year. A California lawyer practices law, on average, for 30 years. Assuming these numbers remain steady, how many lawyers would you expect California to have in 2050?
358
5
The Exponential Distribution and the Poisson Process
66. Policyholders of a certain insurance company have accidents at times distributed according to a Poisson process with rate . The amount of time from when the accident occurs until a claim is made has distribution G. (a) Find the probability there are exactly n incurred but as yet unreported claims at time t. (b) Suppose that each claim amount has distribution F , and that the claim amount is independent of the time that it takes to report the claim. Find the expected value of the sum of all incurred but as yet unreported claims at time t. 67. Satellites are launched into space at times distributed according to a Poisson process with rate . Each satellite independently spends a random time (having distribution G) in space before falling to the ground. Find the probability that none of the satellites in the air at time t was launched before time s, where s < t. 68. Suppose that electrical shocks having random amplitudes occur at times distributed according to a Poisson process {N (t), t 0} with rate . Suppose that the amplitudes of the successive shocks are independent both of other amplitudes and of the arrival times of shocks, and also that the amplitudes have distribution F with mean . Suppose also that the amplitude of a shock decreases with time at an exponential rate , meaning that an initial amplitude A will have value Aex after an additional time x has elapsed. Let A(t) denote the sum of all amplitudes at time t. That is,
N (t)
A(t) =
i=1
Ai e(tSi )
where Ai and Si are the initial amplitude and the arrival time of shock i. (a) Find E[A(t)] by conditioning on N (t). (b) Without any computations, explain why A(t) has the same distribution as does D(t) of Example 5.21. 69. For Example 5.21, let M(t) = E[D(t)] (a) Argue that M(t + h) = M(t) + et M(h) (b) Argue that M(t + h) = M(h) + eh M(t) (c) Argue that M(h) = h + o(h) (d) Use parts (a) and (c) to derive and then solve a differential equation for M(t). (e) Use parts (b) and (c) to derive and then solve a differential equation for M(t).
Exercises
359
70. For the infinite server queue with Poisson arrivals and general service distribution G, find the probability that (a) the first customer to arrive is also the first to depart. Let S(t) equal the sum of the remaining service times of all customers in the system at time t. (b) Argue that S(t) is a compound Poisson random variable. (c) Find E[S(t)]. (d) Find Var(S(t)). 71. Let Sn denote the time of the nth event of the Poisson process {N (t), t 0} having rate . Show, for an arbitrary function g, that the random variable N (t) i=1 g(Si ) has the same distribution as the compound Poisson random variN (t) able i=1 g(Ui ), where U1 , U2 , . . . is a sequence of independent and identically distributed uniform (0, t) random variables that is independent of N , a Poisson random variable with mean t. Consequently, conclude that E
N (t) i=1
g(Si ) =
0
t
g(x) dx
Var
N (t) i=1
g(Si ) =
0
t
g 2 (x) dx
72. A cable car starts off with n riders. The times between successive stops of the car are independent exponential random variables with rate . At each stop one rider gets off. This takes no time, and no additional riders get on. After a rider gets off the car, he or she walks home. Independently of all else, the walk takes an exponential time with rate . (a) What is the distribution of the time at which the last rider departs the car? (b) Suppose the last rider departs the car at time t. What is the probability that all the other riders are home at that time? 73. Shocks occur according to a Poisson process with rate , and each shock independently causes a certain system to fail with probability p. Let T denote the time at which the system fails and let N denote the number of shocks that it takes. (a) Find the conditional distribution of T given that N = n. (b) Calculate the conditional distribution of N , given that T = t, and notice that it is distributed as 1 plus a Poisson random variable with mean (1  p)t. (c) Explain how the result in part (b) could have been obtained without any calculations. 74. The number of missing items in a certain location, call it X, is a Poisson random variable with mean . When searching the location, each item will independently be found after an exponentially distributed time with rate . A reward of R is received for each item found, and a searching cost of C per unit of search time is incurred. Suppose that you search for a fixed time t and then stop.
360
5
The Exponential Distribution and the Poisson Process
(a) Find your total expected return. (b) Find the value of t that maximizes the total expected return. (c) The policy of searching for a fixed time is a static policy. Would a dynamic policy, which allows the decision as to whether to stop at each time t, depend on the number already found by t be beneficial? Hint: How does the distribution of the number of items not yet found by time t depend on the number already found by that time? 75. Suppose that the times between successive arrivals of customers at a singleserver station are independent random variables having a common distribution F . Suppose that when a customer arrives, he or she either immediately enters service if the server is free or else joins the end of the waiting line if the server is busy with another customer. When the server completes work on a customer, that customer leaves the system and the next waiting customer, if there are any, enters service. Let Xn denote the number of customers in the system immediately before the nth arrival, and let Yn denote the number of customers that remain in the system when the nth customer departs. The successive service times of customers are independent random variables (which are also independent of the interarrival times) having a common distribution G. (a) If F is the exponential distribution with rate , which, if any, of the processes {Xn }, {Yn } is a Markov chain? (b) If G is the exponential distribution with rate , which, if any, of the processes {Xn }, {Yn } is a Markov chain? (c) Give the transition probabilities of any Markov chains in parts (a) and (b). 76. For the model of Example 5.27, find the mean and variance of the number of customers served in a busy period. 77. Events occur according to a nonhomogeneous Poisson process whose mean value function is given by m(t) = t 2 + 2t, t 0
What is the probability that n events occur between times t = 4 and t = 5? 78. A store opens at 8 A . M . From 8 until 10 customers arrive at a Poisson rate of four an hour. Between 10 and 12 they arrive at a Poisson rate of eight an hour. From 12 to 2 the arrival rate increases steadily from eight per hour at 12 to ten per hour at 2; and from 2 to 5 the arrival rate drops steadily from ten per hour at 2 to four per hour at 5. Determine the probability distribution of the number of customers that enter the store on a given day. *79. Consider a nonhomogeneous Poisson process whose intensity function (t) is bounded and continuous. Show that such a process is equivalent to a process of
Exercises
361
counted events from a (homogeneous) Poisson process having rate , where an event at time t is counted (independent of the past) with probability (t)/; and where is chosen so that (s) < for all s. 80. Let T1 , T2 , . . . denote the interarrival times of events of a nonhomogeneous Poisson process having intensity function (t). (a) Are the Ti independent? (b) Are the Ti identically distributed? (c) Find the distribution of T1 . 81. (a) Let {N(t), t 0} be a nonhomogeneous Poisson process with mean value function m(t). Given N (t) = n, show that the unordered set of arrival times has the same distribution as n independent and identically distributed random variables having distribution function m(x) , x t F (x) = m(t) 1, x t (b) Suppose that workmen incur accidents in accordance with a nonhomogeneous Poisson process with mean value function m(t). Suppose further that each injured man is out of work for a random amount of time having distribution F . Let X(t) be the number of workers who are out of work at time t. By using part (a), find E[X(t)]. 82. Let X1 , X2 , . . . be independent positive continuous random variables with a common density function f , and suppose this sequence is independent of N , a Poisson random variable with mean . Define N (t) = number of i N : Xi t
Show that {N(t), t 0} is a nonhomogeneous Poisson process with intensity function (t) = f (t). 83. Suppose that {N0 (t), t 0} is a Poisson process with rate = 1. Let (t) denote a nonnegative function of t, and let m(t) =
0 t
(s) ds
Define N(t) by N (t) = N0 (m(t)) Argue that {N(t), t function (t), t 0. 0} is a nonhomogeneous Poisson process with intensity
362
5
The Exponential Distribution and the Poisson Process
Hint: Make use of the identity m(t + h)  m(t) = m (t)h + o(h) *84. Let X1 , X2 , . . . be independent and identically distributed nonnegative continuous random variables having density function f (x). We say that a record occurs at time n if Xn is larger than each of the previous values X1 , . . . , Xn1 . (A record automatically occurs at time 1.) If a record occurs at time n, then Xn is called a record value. In other words, a record occurs whenever a new high is reached, and that new high is called the record value. Let N (t) denote the number of record values that are less than or equal to t. Characterize the process {N (t), t 0} when (a) f is an arbitrary continuous density function. (b) f (x) = ex . Hint: Finish the following sentence: There will be a record whose value is between t and t + dt if the first Xi that is greater than t lies between . . . 85. An insurance company pays out claims on its life insurance policies in accordance with a Poisson process having rate = 5 per week. If the amount of money paid on each policy is exponentially distributed with mean $2000, what is the mean and variance of the amount of money paid by the insurance company in a fourweek span? 86. In good years, storms occur according to a Poisson process with rate 3 per unit time, while in other years they occur according to a Poisson process with rate 5 per unit time. Suppose next year will be a good year with probability 0.3. Let N(t) denote the number of storms during the first t time units of next year. (a) Find P {N(t) = n}. (b) Is {N(t)} a Poisson process? (c) Does {N(t)} have stationary increments? Why or why not? (d) Does it have independent increments? Why or why not? (e) If next year starts off with three storms by time t = 1, what is the conditional probability it is a good year? 87. Determine Cov[X(t), X(t + s)] when {X(t), t 0} is a compound Poisson process. 88. Customers arrive at the automatic teller machine in accordance with a Poisson process with rate 12 per hour. The amount of money withdrawn on each transaction is a random variable with mean $30 and standard deviation $50. (A negative withdrawal means that money was deposited.) The machine is in use for 15 hours daily. Approximate the probability that the total daily withdrawal is less than $6000.
Exercises
363
89. Some components of a twocomponent system fail after receiving a shock. Shocks of three types arrive independently and in accordance with Poisson processes. Shocks of the first type arrive at a Poisson rate 1 and cause the first component to fail. Those of the second type arrive at a Poisson rate 2 and cause the second component to fail. The third type of shock arrives at a Poisson rate 3 and causes both components to fail. Let X1 and X2 denote the survival times for the two components. Show that the joint distribution of X1 and X2 is given by P {X1 > s, X1 > t} = exp{1 s  2 t  3 max(s, t)} This distribution is known as the bivariate exponential distribution. 90. In Exercise 89 show that X1 and X2 both have exponential distributions. *91. Let X1 , X2 , . . . , Xn be independent and identically distributed exponential random variables. Show that the probability that the largest of them is greater than the sum of the others is n/2n1 . That is, if M = max Xj
j
then show
n
P M>
i=1
Xi  M =
n 2n1
Hint: What is P {X1 >
n i=2 Xi }?
92. Prove Equation (5.22). 93. Prove that (a) max(X1 , X2 ) = X1 + X2  min(X1 , X2 ) and, in general,
n 1
(b) max(X1 , . . . , Xn ) = +
Xi 
i<j
min(Xi , Xj ) min(Xi , Xj , Xk ) +
i<j <k
+ (1)n1 min(Xi , Xj , . . . , Xn ) Show by defining appropriate random variables Xi , i = 1, . . . , n, and by taking expectations in part (b) how to obtain the wellknown formula
n
P
1
Ai =
i
P (Ai ) 
i<j
P (Ai Aj ) + + (1)n1 P (A1 An )
(c) Consider n independent Poisson processesthe ith having rate i . Derive an expression for the expected time until an event has occurred in all n processes.
364
5
The Exponential Distribution and the Poisson Process
94. A twodimensional Poisson process is a process of randomly occurring events in the plane such that (i) for any region of area A the number of events in that region has a Poisson distribution with mean A, and (ii) the number of events in nonoverlapping regions are independent. For such a process, consider an arbitrary point in the plane and let X denote its distance from its nearest event (where distance is measured in the usual Euclidean manner). Show that (a) P {X > t} = et , 1 (b) E[X] = .
2
2
95. Let {N(t), t
0} be a conditional Poisson process with a random rate L.
(a) Derive an expression for E[LN (t) = n]. (b) Find, for s > t, E[N (s)N (t) = n]. (c) Find, for s < t, E[N (s)N (t) = n]. 96. For the conditional Poisson process, let m1 = E[L], m2 = E[L2 ]. In terms of m1 and m2 , find Cov(N (s), N (t)) for s t.
References
1. H. Cramr and M. Leadbetter, "Stationary and Related Stochastic Processes," John Wiley, New York, 1966. 2. S. Ross, "Stochastic Processes," Second Edition, John Wiley, New York, 1996. 3. S. Ross, "Probability Models for Computer Science," Academic Press, 2002.
ContinuousTime Markov Chains
6
6.1. Introduction
In this chapter we consider a class of probability models that has a wide variety of applications in the real world. The members of this class are the continuoustime analogs of the Markov chains of Chapter 4 and as such are characterized by the Markovian property that, given the present state, the future is independent of the past. One example of a continuoustime Markov chain has already been met. This is the Poisson process of Chapter 5. For if we let the total number of arrivals by time t [that is, N(t)] be the state of the process at time t, then the Poisson process is a continuoustime Markov chain having states 0, 1, 2, . . . that always proceeds from state n to state n + 1, where n 0. Such a process is known as a pure birth process since when a transition occurs the state of the system is always increased by one. More generally, an exponential model which can go (in one transition) only from state n to either state n  1 or state n + 1 is called a birth and death model. For such a model, transitions from state n to state n + 1 are designated as births, and those from n to n  1 as deaths. Birth and death models have wide applicability in the study of biological systems and in the study of waiting line systems in which the state represents the number of customers in the system. These models will be studied extensively in this chapter. In Section 6.2 we define continuoustime Markov chains and then relate them to the discretetime Markov chains of Chapter 4. In Section 6.3 we consider birth and death processes and in Section 6.4 we derive two sets of differential equations the forward and backward equationsthat describe the probability laws for the system. The material in Section 6.5 is concerned with determining the limiting (or longrun) probabilities connected with a continuoustime Markov chain. In Section 6.6 we consider the topic of time reversibility. We show that all birth and death processes are time reversible, and then illustrate the importance of this ob
365
366
6
ContinuousTime Markov Chains
servation to queueing systems. In the final section we show how to "uniformize" Markov chains, a technique useful for numerical computations.
6.2.
ContinuousTime Markov Chains
Suppose we have a continuoustime stochastic process {X(t), t 0} taking on values in the set of nonnegative integers. In analogy with the definition of a discretetime Markov chain, given in Chapter 4, we say that the process {X(t), t 0} is a continuoustime Markov chain if for all s, t 0 and nonnegative integers i, j, x(u), 0 u < s P {X(t + s) = j X(s) = i, X(u) = x(u), 0 = P {X(t + s) = j X(s) = i} u < s}
In other words, a continuoustime Markov chain is a stochastic process having the Markovian property that the conditional distribution of the future X(t + s) given the present X(s) and the past X(u), 0 u < s, depends only on the present and is independent of the past. If, in addition, P {X(t + s) = j X(s) = i} is independent of s, then the continuoustime Markov chain is said to have stationary or homogeneous transition probabilities. All Markov chains considered in this text will be assumed to have stationary transition probabilities. Suppose that a continuoustime Markov chain enters state i at some time, say, time 0, and suppose that the process does not leave state i (that is, a transition does not occur) during the next ten minutes. What is the probability that the process will not leave state i during the following five minutes? Now since the process is in state i at time 10 it follows, by the Markovian property, that the probability that it remains in that state during the interval [10, 15] is just the (unconditional) probability that it stays in state i for at least five minutes. That is, if we let Ti denote the amount of time that the process stays in state i before making a transition into a different state, then P {Ti > 15Ti > 10} = P {Ti > 5} or, in general, by the same reasoning, P {Ti > s + tTi > s} = P {Ti > t} for all s, t 0. Hence, the random variable Ti is memoryless and must thus (see Section 5.2.2) be exponentially distributed.
6.2.
ContinuousTime Markov Chains
367
In fact, the preceding gives us another way of defining a continuoustime Markov chain. Namely, it is a stochastic process having the properties that each time it enters state i (i) the amount of time it spends in that state before making a transition into a different state is exponentially distributed with mean, say, 1/vi , and (ii) when the process leaves state i, it next enters state j with some probability, say, Pij . Of course, the Pij must satisfy Pii = 0, Pij = 1,
j
all i all i
In other words, a continuoustime Markov chain is a stochastic process that moves from state to state in accordance with a (discretetime) Markov chain, but is such that the amount of time it spends in each state, before proceeding to the next state, is exponentially distributed. In addition, the amount of time the process spends in state i, and the next state visited, must be independent random variables. For if the next state visited were dependent on Ti , then information as to how long the process has already been in state i would be relevant to the prediction of the next stateand this contradicts the Markovian assumption.
Example 6.1 (A Shoeshine Shop) Consider a shoeshine establishment consisting of two chairschair 1 and chair 2. A customer upon arrival goes initially to chair 1 where his shoes are cleaned and polish is applied. After this is done the customer moves on to chair 2 where the polish is buffed. The service times at the two chairs are assumed to be independent random variables that are exponentially distributed with respective rates 1 and 2 . Suppose that potential customers arrive in accordance with a Poisson process having rate , and that a potential customer will enter the system only if both chairs are empty. The preceding model can be analyzed as a continuoustime Markov chain, but first we must decide upon an appropriate state space. Since a potential customer will enter the system only if there are no other customers present, it follows that there will always either be 0 or 1 customers in the system. However, if there is 1 customer in the system, then we would also need to know which chair he was presently in. Hence, an appropriate state space might consist of the three states 0, 1, and 2 where the states have the following interpretation: State 0 1 2 Interpretation system is empty a customer is in chair 1 a customer is in chair 2
368
6
ContinuousTime Markov Chains
We leave it as an exercise for you to verify that v0 = , v 1 = 1 , v 2 = 2 , P01 = P12 = P20 = 1
6.3.
Birth and Death Processes
Consider a system whose state at any time is represented by the number of people in the system at that time. Suppose that whenever there are n people in the system, then (i) new arrivals enter the system at an exponential rate n , and (ii) people leave the system at an exponential rate n . That is, whenever there are n persons in the system, then the time until the next arrival is exponentially distributed with mean 1/n and is independent of the time until the next departure which is itself exponentially distributed with mean 1/n . Such a system is called a birth and death process. The parameters {n } and {n } are called, respectively, the n=0 n=1 arrival (or birth) and departure (or death) rates. Thus, a birth and death process is a continuoustime Markov chain with states {0, 1, . . .} for which transitions from state n may go only to either state n  1 or state n + 1. The relationships between the birth and death rates and the state transition rates and probabilities are v 0 = 0 , v i = i + i , P0 1 = 1, i , i + i i , Pi,i1 = i + i Pi,i+1 = i>0 i>0 i>0
The preceding follows, because if there are i in the system, then the next state will be i + 1 if a birth occurs before a death, and the probability that an exponential random variable with rate i will occur earlier than an (independent) exponential with rate i is i /(i + i ). Moreover, the time until either a birth or a death occurs is exponentially distributed with rate i + i (and so, vi = i + i ).
Example 6.2 (The Poisson Process) Consider a birth and death process for
which n = 0, n = , for all n for all n 0 0
This is a process in which departures never occur, and the time between successive arrivals is exponential with mean 1/. Hence, this is just the Poisson process.
6.3.
Birth and Death Processes
369
A birth and death process for which n = 0 for all n is called a pure birth process. Another pure birth process is given by the next example.
Example 6.3 (A Birth Process with Linear Birth Rate) Consider a population
whose members can give birth to new members but cannot die. If each member acts independently of the others and takes an exponentially distributed amount of time, with mean 1/, to give birth, then if X(t) is the population size at time t, then {X(t), t 0} is a pure birth process with n = n, n 0. This follows since if the population consists of n persons and each gives birth at an exponential rate , then the total rate at which births occur is n. This pure birth process is known as a Yule process after G. Yule, who used it in his mathematical theory of evolution.
Example 6.4 (A Linear Growth Model with Immigration) A model in which
n = n, n = n + , n n 1 0
is called a linear growth process with immigration. Such processes occur naturally in the study of biological reproduction and population growth. Each individual in the population is assumed to give birth at an exponential rate ; in addition, there is an exponential rate of increase of the population due to an external source such as immigration. Hence, the total birth rate where there are n persons in the system is n + . Deaths are assumed to occur at an exponential rate for each member of the population, so n = n. Let X(t) denote the population size at time t. Suppose that X(0) = i and let M(t) = E[X(t)] We will determine M(t) by deriving and then solving a differential equation that it satisfies. We start by deriving an equation for M(t + h) by conditioning on X(t). This yields M(t + h) = E[X(t + h)] = E[E[X(t + h)X(t)]] Now, given the size of the population at time t then, ignoring events whose probability is o(h), the population at time t + h will either increase in size by 1 if a birth or an immigration occurs in (t, t + h), or decrease by 1 if a death occurs in this interval, or remain the same if neither of these two possibilities occurs. That
370
6
ContinuousTime Markov Chains
is, given X(t), X(t) + 1, X(t + h) = X(t)  1, X(t), Therefore,
with probability [ + X(t)]h + o(h) with probability X(t)h + o(h) with probability 1  [ + X(t) + X(t)] h + o(h)
E[X(t + h)X(t)] = X(t) + [ + X(t)  X(t)]h + o(h) Taking expectations yields M(t + h) = M(t) + (  )M(t)h + h + o(h) or, equivalently, M(t + h)  M(t) o(h) = (  )M(t) + + h h Taking the limit as h 0 yields the differential equation M (t) = (  )M(t) + If we now define the function h(t) by h(t) = (  )M(t) + then h (t) = (  )M (t) Therefore, the differential equation (6.1) can be rewritten as h (t) = h(t)  or h (t) = h(t) Integration yields log[h(t)] = (  )t + c or (6.1)
6.3.
Birth and Death Processes
371
h(t) = Ke()t Putting this back in terms of M(t) gives + (  )M(t) = Ke()t To determine the value of the constant K, we use the fact that M(0) = i and evaluate the preceding at t = 0. This gives + (  )i = K Substituting this back in the preceding equation for M(t) yields the following solution for M(t): M(t) = [e()t  1] + ie()t 
Note that we have implicitly assumed that = . If = , then the differential equation (6.1) reduces to M (t) = Integrating (6.2) and using that M(0) = i gives the solution M(t) = t + i (6.2)
Example 6.5 (The Queueing System M/M/1) Suppose that customers arrive at a singleserver service station in accordance with a Poisson process having rate . That is, the times between successive arrivals are independent exponential random variables having mean 1/. Upon arrival, each customer goes directly into service if the server is free; if not, then the customer joins the queue (that is, he waits in line). When the server finishes serving a customer, the customer leaves the system and the next customer in line, if there are any waiting, enters the service. The successive service times are assumed to be independent exponential random variables having mean 1/. The preceding is known as the M/M/1 queueing system. The first M refers to the fact that the interarrival process is Markovian (since it is a Poisson process) and the second to the fact that the service distribution is exponential (and, hence, Markovian). The 1 refers to the fact that there is a single server. If we let X(t) denote the number in the system at time t then {X(t), t 0} is a birth and death process with
n = , n = , n n 1 0
372
6
ContinuousTime Markov Chains
Example 6.6 (A Multiserver Exponential Queueing System) Consider an exponential queueing system in which there are s servers available, each serving at rate . An entering customer first waits in line and then goes to the first free server. This is a birth and death process with parameters n = n, s, 1 n n>s n 0 s
n = ,
To see why this is true, reason as follows: If there are n customers in the system, where n s, then n servers will be busy. Since each of these servers works at rate , the total departure rate will be n. On the other hand, if there are n customers in the system, where n > s, then all s of the servers will be busy, and thus the total departure rate will be s. This is known as an M/M/s queueing model. Consider now a general birth and death process with birth rates {n } and death rates {n }, where 0 = 0, and let Ti denote the time, starting from state i, it takes for the process to enter state i + 1, i 0. We will recursively compute E[Ti ], i 0, by starting with i = 0. Since T0 is exponential with rate 0 , we have that E[T0 ] = 1 0
For i > 0, we condition whether the first transition takes the process into state i  1 or i + 1. That is, let Ii = and note that E[Ti Ii = 1] = 1 , i + i 1 E[Ti Ii = 0] = + E[Ti1 ] + E[Ti ] i + i 1, 0, if the first transition from i is to i + 1 if the first transition from i is to i  1
(6.3)
This follows since, independent of whether the first transition is from a birth or death, the time until it occurs is exponential with rate i + i ; now if this first transition is a birth, then the population size is at i + 1, so no additional time is needed; whereas if it is death, then the population size becomes i  1 and the additional time needed to reach i + 1 is equal to the time it takes to return to state i (and this has mean E[Ti1 ]) plus the additional time it then takes to reach i + 1
6.3.
Birth and Death Processes
373
(and this has mean E[Ti ]). Hence, since the probability that the first transition is a birth is i /(i + i ), we see that E[Ti ] = or, equivalently, E[Ti ] = 1 i + E[Ti1 ], i i i 1 1 i + (E[Ti1 ] + E[Ti ]) i + i i + i
Starting with E[T0 ] = 1/0 , the preceding yields an efficient method to successively compute E[T1 ], E[T2 ], and so on. Suppose now that we wanted to determine the expected time to go from state i to state j where i < j . This can be accomplished using the preceding by noting that this quantity will equal E[Ti ] + E[Ti+1 ] + + E[Tj 1 ].
Example 6.7 For the birth and death process having parameters i ,
i , 1 + E[Ti1 ] 1 = (1 + E[Ti1 ]) Starting with E[T0 ] = 1/, we see that E[Ti ] = E[T1 ] = E[T2 ] = and, in general, E[Ti ] = = 1 1+ + 1  (/)i+1 , 
j 1 2
1 1+ , 1 1+ +
2
+ + i 0
i
The expected time to reach state j , starting at state k, k < j , is E[time to go from k to j ] =
i=k
E[Ti ] (/)k+1 [1  (/)j k ] j k    1  /
=
374
6
ContinuousTime Markov Chains
The foregoing assumes that = . If = , then i +1 , j (j + 1)  k(k + 1) E[time to go from k to j ] = 2 E[Ti ] = We can also compute the variance of the time to go from 0 to i + 1 by utilizing the conditional variance formula. First note that Equation (6.3) can be written as E[Ti Ii ] = Thus Var(E[Ti Ii ]) = (E[Ti1 ] + E[Ti ])2 Var(Ii ) = (E[Ti1 ] + E[Ti ])2 i i (i + i )2 (6.4) 1 + (1  Ii )(E[Ti1 ] + E[Ti ]) i + i
where Var(Ii ) is as shown since Ii is a Bernoulli random variable with parameter p = i /(i + i ). Also, note that if we let Xi denote the time until the transition from i occurs, then Var(Ti Ii = 1) = Var(Xi Ii = 1) = Var(Xi ) = 1 (i + i )2 (6.5)
where the preceding uses the fact that the time until transition is independent of the next state visited. Also, Var(Ti Ii = 0) = Var(Xi + time to get back to i + time to then reach i + 1) = Var(Xi ) + Var(Ti1 ) + Var(Ti ) (6.6)
where the foregoing uses the fact that the three random variables are independent. We can rewrite Equations (6.5) and (6.6) as Var(Ti Ii ) = Var(Xi ) + (1  Ii )[Var(Ti1 ) + Var(Ti )] so E[Var(Ti Ii )] = 1 i + [Var(Ti1 ) + Var(Ti )] (i + i )2 i + i (6.7)
6.4.
The Transition Probability Function Pij (t)
375
Hence, using the conditional variance formula, which states that Var(Ti ) is the sum of Equations (6.7) and (6.4), we obtain Var(Ti ) = 1 i + [Var(Ti1 ) + Var(Ti )] 2 i + i (i + i ) + or, equivalently, Var(Ti ) = i 1 i + Var(Ti1 ) + (E[Ti1 ] + E[Ti ])2 i (i + i ) i i + i i i (E[Ti1 ] + E[Ti ])2 (i + i )2
Starting with Var(T0 ) = 1/2 and using the former recursion to obtain the expec0 tations, we can recursively compute Var(Ti ). In addition, if we want the variance of the time to reach state j , starting from state k, k < j , then this can be expressed as the time to go from k to k + 1 plus the additional time to go from k + 1 to k + 2, and so on. Since, by the Markovian property, these successive random variables are independent, it follows that
j 1
Var(time to go from k to j ) =
i=k
Var(Ti )
6.4.
Let
The Transition Probability Function Pij (t)
Pij (t) = P {X(t + s) = j X(s) = i} denote the probability that a process presently in state i will be in state j a time t later. These quantities are often called the transition probabilities of the continuoustime Markov chain. We can explicitly determine Pij (t) in the case of a pure birth process having distinct birth rates. For such a process, let Xk denote the time the process spends in state k before making a transition into state k + 1, k 1. Suppose that the process is presently in state i, and let j > i. Then, as Xi is the time it spends in state i before moving to state i + 1, and Xi+1 is the time it then spends in state j 1 i + 1 before moving to state i + 2, and so on, it follows that k=i Xk is the time
376
6
ContinuousTime Markov Chains
it takes until the process enters state j . Now, if the process has not yet entered state j by time t, then its state at time t is smaller than j , and vice versa. That is, X(t) < j Xi + + Xj 1 > t Therefore, for i < j , we have for a pure birth process that
j 1
P {X(t) < j X(0) = i} = P
k=i
Xk > t
However, since Xi , . . . , Xj 1 are independent exponential random variables with respective rates i , . . . , j 1 , we obtain from the preceding and Equation (5.9), j 1 which gives the tail distribution function of k=i Xk , that
j 1 k t j 1 r=k, r=i
P {X(t) < j X(0) = i} =
k=i
e
r r  k
Replacing j by j + 1 in the preceding gives that
j j
P {X(t) < j + 1X(0) = i} =
k=i
e
k t r=k, r=i
r r  k
Since P {X(t) = j X(0) = i} = P {X(t) < j + 1X(0) = i}  P {X(t) < j X(0) = i} and since Pii (t) = P {Xi > t} = ei t , we have shown the following.
Proposition 6.1 For a pure birth process having i = j when i = j
j j
Pij (t) =
k=i
ek t
r=k, r=i
r  r  k
j 1 k=i
ek t
j 1 r=k, r=i
r , r  k
i<j
Pii (t) = ei t
6.4.
The Transition Probability Function Pij (t)
377
Example 6.8 Consider the Yule process, which is a pure birth process in
which each individual in the population independently gives birth at rate , and so n = n, n 1. Letting i = 1, we obtain from Proposition 6.1
j j
P1j (t) =
k=1
ekt
r=k, r=1 j 1 r=1
r  r k
j 1 k=1
j 1 k=1
ekt
j
j 1 r=k, r=1
r r k
j 1 r=k, r=1
= ej t
r + r j
ekt
r=k, r=1
r  r k
j 1
r r k
= ej t (1)j 1 +
j 1 k=1
ekt
j 1 j k
r=k, r=1
r r k
Now, k j k
j 1 r=k, r=1
(j  1)! r = r k (1  k)(2  k) (k  1  k)(j  k)! = (1)k1 j 1 k1
so
j
P1j (t) =
k=1
j  1 kt e (1)k1 k1
j 1 i=0
= et =e
t
j  1 it e (1)i i
(1  et )j 1
Thus, starting with a single individual, the population size at time t has a geometric distribution with mean et . If the population starts with i individuals, then we can regard each of these individuals as starting her own independent Yule process, and so the population at time t will be the sum of i independent and identically distributed geometric random variables with parameter et . But this means that the conditional distribution of X(t), given that X(0) = i, is the same as the distribution of the number of times that a coin that lands heads on each flip with probability et must be flipped to amass a total of i heads. Hence, the
378
6
ContinuousTime Markov Chains
population size at time t has a negative binomial distribution with parameters i and et , so Pij (t) = j  1 it e (1  et )j i , i 1 j i 1
[We could, of course, have used Proposition 6.1 to immediately obtain an equation for Pij (t), rather than just using it for P1j (t), but the algebra that would have then been needed to show the equivalence of the resulting expression to the preceding result is somewhat involved.] We shall now derive a set of differential equations that the transition probabilities Pij (t) satisfy in a general continuoustime Markov chain. However, first we need a definition and a pair of lemmas. For any pair of states i and j , let qij = vi Pij Since vi is the rate at which the process makes a transition when in state i and Pij is the probability that this transition is into state j , it follows that qij is the rate, when in state i, at which the process makes a transition into state j . The quantities qij are called the instantaneous transition rates. Since vi =
j
vi Pij =
j
qij
and Pij = qij = vi qij j qij
it follows that specifying the instantaneous transition rates determines the parameters of the continuoustime Markov chain.
Lemma 6.2
(a) (b) limh0 1  Pii (h) = vi h Pij (h) limh0 = qij h
when i = j
Proof We first note that since the amount of time until a transition occurs is
exponentially distributed it follows that the probability of two or more transitions
6.4.
The Transition Probability Function Pij (t)
379
in a time h is o(h). Thus, 1  Pii (h), the probability that a process in state i at time 0 will not be in state i at time h, equals the probability that a transition occurs within time h plus something small compared to h. Therefore,  1 Pii (h) = vi h + o(h) and part (a) is proven. To prove part (b), we note that Pij (h), the probability that the process goes from state i to state j in a time h, equals the probability that a transition occurs in this time multiplied by the probability that the transition is into state j , plus something small compared to h. That is, Pij (h) = hvi Pij + o(h) and part (b) is proven.
Lemma 6.3 For all s
0, t
0,
Pij (t + s) =
k=0
Pik (t)Pkj (s)
(6.8)
Proof In order for the process to go from state i to state j in time t + s, it must
be somewhere at time t and thus Pij (t + s) = P {X(t + s) = j X(0) = i}
=
k=0
P {X(t + s) = j, X(t) = kX(0) = i}
=
k=0
P {X(t + s) = j X(t) = k, X(0) = i} P {X(t) = kX(0) = i}
=
k=0
P {X(t + s) = j X(t) = k} P {X(t) = kX(0) = i}
=
k=0
Pkj (s)Pik (t)
and the proof is completed.
380
6
ContinuousTime Markov Chains
The set of equations (6.8) is known as the ChapmanKolmogorov equations. From Lemma 6.3, we obtain
Pij (h + t)  Pij (t) =
k=0
Pik (h)Pkj (t)  Pij (t) Pik (h)Pkj (t)  [1  Pii (h)]Pij (t)
k=i
= and thus Pij (t + h)  Pij (t) = lim h0 h0 h lim
k=i
Pik (h) 1  Pii (h) Pkj (t)  Pij (t) h h
Now assuming that we can interchange the limit and the summation in the preceding and applying Lemma 6.2, we obtain Pij (t) =
k=i
qik Pkj (t)  vi Pij (t)
It turns out that this interchange can indeed be justified and, hence, we have the following theorem.
Theorem 6.1 (Kolmogorov's Backward Equations) For all states i, j , and
times t 0, Pij (t) =
k=i
qik Pkj (t)  vi Pij (t)
Example 6.9 The backward equations for the pure birth process become
Pij (t) = i Pi+1,j (t)  i Pij (t)
Example 6.10 The backward equations for the birth and death process become P0j (t) = 0 P1j (t)  0 P0j (t), Pij (t) = (i + i ) or equivalently P0j (t) = 0 [P1j (t)  P0j (t)], Pij (t) = i Pi+1,j (t) + i Pi1,j (t)  (i + i )Pij (t), i>0 (6.9) i i Pi+1,j (t) + Pi1,j (t)  (i + i )Pij (t) i + i i + i
6.4.
The Transition Probability Function Pij (t)
381
Example 6.11 (A ContinuousTime Markov Chain Consisting of Two States)
Consider a machine that works for an exponential amount of time having mean 1/ before breaking down; and suppose that it takes an exponential amount of time having mean 1/ to repair the machine. If the machine is in working condition at time 0, then what is the probability that it will be working at time t = 10? To answer this question, we note that the process is a birth and death process (with state 0 meaning that the machine is working and state 1 that it is being repaired) having parameters 0 = , i = 0, i = 0, 1 = , i = 0, i = 1
We shall derive the desired probability, namely, P00 (10) by solving the set of differential equations given in Example 6.10. From Equation (6.9), we obtain P00 (t) = [P10 (t)  P00 (t)], P10 (t) = P00 (t)  P10 (t) (6.10) (6.11)
Multiplying Equation (6.10) by and Equation (6.11) by and then adding the two equations yields P00 (t) + P10 (t) = 0 By integrating, we obtain P00 (t) + P10 (t) = c However, since P00 (0) = 1 and P10 (0) = 0, we obtain c = and hence P00 (t) + P10 (t) = or equivalently P10 (t) = [1  P00 (t)] By substituting this result in Equation (6.10), we obtain P00 (t) = [1  P00 (t)]  P00 (t) =  ( + )P00 (t) Letting h(t) = P00 (t)  + (6.12)
382
6
ContinuousTime Markov Chains
we have h (t) =  ( + ) h(t) + = ( + )h(t) or h (t) = ( + ) h(t) By integrating both sides, we obtain log h(t) = ( + )t + c or h(t) = Ke(+)t and thus P00 (t) = Ke(+)t + + +
which finally yields, by setting t = 0 and using the fact that P00 (0) = 1, P00 (t) = e(+)t + + +
From Equation (6.12), this also implies that P10 (t) = (+)t  e + +
Hence, our desired probability P00 (10) equals P00 (10) = e10(+) + + +
Another set of differential equations, different from the backward equations, may also be derived. This set of equations, known as Kolmogorov's forward
6.4.
The Transition Probability Function Pij (t)
383
equations is derived as follows. From the ChapmanKolmogorov equations (Lemma 6.3), we have
Pij (t + h)  Pij (t) =
k=0
Pik (t)Pkj (h)  Pij (t) Pik (t)Pkj (h)  [1  Pjj (h)]Pij (t)
k=j
=
and thus lim Pij (t + h)  Pij (t) = lim h0 h Pik (t)
k=j
h0
Pkj (h) 1  Pjj (h)  Pij (t) h h
and, assuming that we can interchange limit with summation, we obtain from Lemma 6.2 Pij (t) =
k=j
qkj Pik (t)  vj Pij (t)
Unfortunately, we cannot always justify the interchange of limit and summation and thus the preceding is not always valid. However, they do hold in most models, including all birth and death processes and all finite state models. We thus have the following.
Theorem 6.2 (Kolmogorov's Forward Equations) Under suitable regularity
conditions, Pij (t) =
k=j
qkj Pik (t)  vj Pij (t)
(6.13)
We shall now solve the forward equations for the pure birth process. For this process, Equation (6.13) reduces to Pij (t) = j 1 Pi,j 1 (t)  j Pij (t) However, by noting that Pij (t) = 0 whenever j < i (since no deaths can occur), we can rewrite the preceding equation to obtain Pii (t) = i Pii (t), Pij (t) = j 1 Pi,j 1 (t)  j Pij (t), j i +1 (6.14)
384
6
ContinuousTime Markov Chains
Proposition 6.4 For a pure birth process,
Pii (t) = ei t , Pij (t) = j 1 ej t
t 0
i ej s Pi,j 1 (s) ds, j
0 i +1
Proof The fact that Pii (t) = ei t follows from Equation (6.14) by integrating
and using the fact that Pii (0) = 1. To prove the corresponding result for Pij (t), we note by Equation (6.14) that ej t Pij (t) + j Pij (t) = ej t j 1 Pi,j 1 (t) or d j t e Pij (t) = j 1 ej t Pi,j 1 (t) dt Hence, since Pij (0) = 0, we obtain the desired results.
Example 6.12 (Forward Equations for Birth and Death Process) The forward
equations (Equation 6.13) for the general birth and death process become Pi0 (t) =
k=0
qk0 Pik (t)  0 Pi0 (t) (6.15)
= 1 Pi1 (t)  0 Pi0 (t) Pij (t) =
k=j
qkj Pik (t)  (j + j )Pij (t) (6.16)
= j 1 Pi,j 1 (t) + j +1 Pi,j +1 (t)  (j + j )Pij (t)
6.5.
Limiting Probabilities
In analogy with a basic result in discretetime Markov chains, the probability that a continuoustime Markov chain will be in state j at time t often converges to a limiting value which is independent of the initial state. That is, if we call this value Pj , then Pj lim Pij (t)
t
where we are assuming that the limit exists and is independent of the initial state i.
6.5.
Limiting Probabilities
385
To derive a set of equations for the Pj , consider first the set of forward equations Pij (t) =
k=j
qkj Pik (t)  vj Pij (t)
(6.17)
Now, if we let t approach , then assuming that we can interchange limit and summation, we obtain lim Pij (t) = lim =
k=j
t
t
qkj Pik (t)  vj Pij (t)
k=j
qkj Pk  vj Pj
However, as Pij (t) is a bounded function (being a probability it is always between 0 and 1), it follows that if Pij (t) converges, then it must converge to 0 (why is this?). Hence, we must have that 0=
k=j
qkj Pk  vj Pj
or vj Pj =
k=j
qkj Pk ,
all states j
(6.18)
The preceding set of equations, along with this equation Pj = 1
j
(6.19)
can be used to solve for the limiting probabilities.
Remarks (i) We have assumed that the limiting probabilities Pj exist. A sufficient condition for this is that (a) all states of the Markov chain communicate in the sense that starting in state i there is a positive probability of ever being in state j , for all i, j and (b) the Markov chain is positive recurrent in the sense that, starting in any state, the mean time to return to that state is finite If conditions (a) and (b) hold, then the limiting probabilities will exist and satisfy Equations (6.18) and (6.19). In addition, Pj also will have the interpretation of being the longrun proportion of time that the process is in state j . (ii) Equations (6.18) and (6.19) have a nice interpretation: In any interval (0, t) the number of transitions into state j must equal to within 1 the number of tran
386
6
ContinuousTime Markov Chains
sitions out of state j (why?). Hence, in the long run, the rate at which transitions into state j occur must equal the rate at which transitions out of state j occur. Now when the process is in state j , it leaves at rate vj , and, as Pj is the proportion of time it is in state j , it thus follows that vj Pj = rate at which the process leaves state j Similarly, when the process is in state k, it enters j at a rate qkj . Hence, as Pk is the proportion of time in state k, we see that the rate at which transitions from k to j occur is just qkj Pk ; thus qkj Pk = rate at which the process enters state j
k=j
So, Equation (6.18) is just a statement of the equality of the rates at which the process enters and leaves state j . Because it balances (that is, equates) these rates, the equations (6.18) are sometimes referred to as "balance equations." (iii) When the limiting probabilities Pj exist, we say that the chain is ergodic. The Pj are sometimes called stationary probabilities since it can be shown that (as in the discretetime case) if the initial state is chosen according to the distribution {Pj }, then the probability of being in state j at time t is Pj , for all t. Let us now determine the limiting probabilities for a birth and death process. From Equation (6.18) or equivalently, by equating the rate at which the process leaves a state with the rate at which it enters that state, we obtain State 0 1 2 n, n 1 Rate at which leave = rate at which enter 0 P0 = 1 P1 (1 + 1 )P1 = 2 P2 + 0 P0 (2 + 2 )P2 = 3 P3 + 1 P1 (n + n )Pn = n+1 Pn+1 + n1 Pn1
By adding to each equation the equation preceding it, we obtain 0 P0 = 1 P1 , 1 P1 = 2 P2 , 2 P2 = 3 P3 , . . . n Pn = n+1 Pn+1 , n 0
6.5.
Limiting Probabilities
387
Solving in terms of P0 yields P1 = P2 = P3 = . . . Pn = And by using the fact that n1 n1 n2 1 0 Pn1 = P0 n n n1 2 1
n=0 Pn
0 P0 , 1 1 1 0 P1 = P0 , 2 2 1 2 2 1 0 P2 = P0 , 3 3 2 1
= 1, we obtain
1 = P0 + P0
n=1
n1 1 0 n 2 1
or P0 = 1+
n=1
1
0 1 n1 1 2 n
and so Pn = 0 1 n1
1 2 n 1 +
n=1
0 1 n1 1 2 n
,
n
1
(6.20)
The foregoing equations also show us what condition is necessary for these limiting probabilities to exist. Namely, it is necessary that
n=1
0 1 n1 < 1 2 n
(6.21)
This condition also may be shown to be sufficient.
388
6
ContinuousTime Markov Chains
In the multiserver exponential queueing system (Example 6.6), Condition (6.21) reduces to
n=s+1
n < (s)n
which is equivalent to /s < 1. For the linear growth model with immigration (Example 6.4), Condition (6.21) reduces to
n=1
( + ) ( + (n  1)) < n!n
Using the ratio test, the preceding will converge when ( + ) ( + n) n!n + n = lim n ( + ) ( + (n  1)) n (n + 1) (n + 1)!n+1 lim = That is, the condition is satisfied when < . When Condition (6.21) is not satisfied. <1
it is easy to show that
Example 6.13 (A Machine Repair Model) Consider a job shop that consists
of M machines and one serviceman. Suppose that the amount of time each machine runs before breaking down is exponentially distributed with mean 1/, and suppose that the amount of time that it takes for the serviceman to fix a machine is exponentially distributed with mean 1/. We shall attempt to answer these questions: (a) What is the average number of machines not in use? (b) What proportion of time is each machine in use? Solution: If we say that the system is in state n whenever n machines are not in use, then the preceding is a birth and death process having parameters n = n = (M  n), 0, n 1
n M n>M
This is so in the sense that a failing machine is regarded as an arrival and a fixed machine as a departure. If any machines are broken down, then since the serviceman's rate is , n = . On the other hand, if n machines are not in use, then since the M  n machines in use each fail at a rate , it follows that
6.5.
Limiting Probabilities
389
n = (M  n). From Equation (6.20) we have that Pn , the probability that n machines will not be in use, is given by P0 = = Pn = 1 1+ 1+ 1+
M n=1 M n=1 M n=1
[M(M  1) (M  n + 1)/n ] 1 (/)n M!/(M  n)! (/)n M!/(M  n)! , , n = 0, 1, . . . , M
(/)n M!/(M  n)!
Hence, the average number of machines not in use is given by
M
nPn =
n=0
M n n=0 n(/) M!/(M  n)! 1 + M (/)n M!/(M  n)! n=1
(6.22)
To obtain the longrun proportion of time that a given machine is working we will compute the equivalent limiting probability of its working. To do so, we condition on the number of machines that are not working to obtain
M
P {machine is working} =
n=0 M
P {machine is workingn not working}Pn M n Pn M
M
=
n=0
(since if n are not working, then M  n are working!)
=1
0
nPn M
where
M 0
nPn is given by Equation (6.22).
Example 6.14 (The M/M/1 Queue) In the M/M/1 queue n = , n =
and thus, from Equation (6.20), Pn = (/)n 1 + (/)n n=1 n 0
= (/)n (1  /),
provided that / < 1. It is intuitive that must be less than for limiting probabilities to exist. Customers arrive at rate and are served at rate , and
390
6
ContinuousTime Markov Chains
thus if > , then they arrive at a faster rate than they can be served and the queue size will go to infinity. The case = behaves much like the symmetric random walk of Section 4.3, which is null recurrent and thus has no limiting probabilities.
Example 6.15 Let us reconsider the shoeshine shop of Example 6.1, and determine the proportion of time the process is in each of the states 0, 1, 2. Because this is not a birth and death process (since the process can go directly from state 2 to state 0), we start with the balance equations for the limiting probabilities.
State 0 1 2 Rate that the process leaves = rate that the process enters P0 = 2 P2 1 P1 = P0 2 P2 = 1 P1
Solving in terms of P0 yields P2 = P0 , 2 P1 = P0 1
which implies, since P0 + P1 + P2 = 1, that P0 1 + or P0 = and P1 = P2 = 2 , 1 2 + (1 + 2 ) 1 1 2 + (1 + 2 ) 1 2 1 2 + (1 + 2 ) =1 + 2 1
Example 6.16 Consider a set of n components along with a single repairman.
Suppose that component i functions for an exponentially distributed time with rate i and then fails. The time it then takes to repair component i is exponential with rate i , i = 1, . . . , n. Suppose that when there is more than one failed component the repairman always works on the most recent failure. For instance, if there are at
6.5.
Limiting Probabilities
391
present two failed componentssay, components 1 and 2 of which 1 has failed most recentlythen the repairman will be working on component 1. However, if component 3 should fail before 1's repair is completed, then the repairman would stop working on component 1 and switch to component 3 (that is, a newly failed component preempts service). To analyze the preceding as a continuoustime Markov chain, the state must represent the set of failed components in the order of failure. That is, the state will be i1 , i2 , . . . , ik if i1 , i2 , . . . , ik are the k failed components (all the other n  k being functional) with i1 having been the most recent failure (and is thus presently being repaired), i2 the second most recent, and so on. Because there are k! possible orderings for a fixed set of k failed components and n choices of that set, it k follows that there are
n k=0
n k! = k
n k=0
n! = n! (n  k)!
n i=0
1 i!
possible states. The balance equations for the limiting probabilities are as follows:
i 1 +
i=ij j =1,...,k
i P (i1 , . . . , ik ) =
i=ij j =1,...,k
P (i, i1 , . . . , ik )i +P (i2 , . . . , ik )i1 ,
n
n
i P () =
i=1 i=1
P (i)i
(6.23)
where is the state when all components are working. The preceding equations follow because state i1 , . . . , ik can be left either by a failure of any of the additional components or by a repair completion of component i1 . Also that state can be entered either by a repair completion of component i when the state is i, i1 , . . . , ik or by a failure of component i1 when the state is i2 , . . . , ik . However, if we take P (i1 , . . . , ik ) = i 1 i 2 i k P () i 1 i 2 i k
(6.24)
then it is easily seen that Equations (6.23) are satisfied. Hence, by uniqueness these must be the limiting probabilities with P () determined to make their sum
392
6
ContinuousTime Markov Chains
equal 1. That is, P () = 1 +
i1 ,...,ik
i 1 i k i 1 i k
1
As an illustration, suppose n = 2 and so there are five states , 1, 2, 12, 21. Then from the preceding we would have P () = 1 + P (1) = P (2) = 2 21 2 1 + + 1 2 1 2
1
,
1 P (), 1 2 P (), 2 1 2 P () 1 2
P (1, 2) = P (2, 1) =
It is interesting to note, using Equation (6.24), that given the set of failed components, each of the possible orderings of these components is equally likely.
6.6.
Time Reversibility
Consider a continuoustime Markov chain that is ergodic and let us consider the limiting probabilities Pi from a different point of view than previously. If we consider the sequence of states visited, ignoring the amount of time spent in each state during a visit, then this sequence constitutes a discretetime Markov chain with transition probabilities Pij . Let us assume that this discretetime Markov chain, called the embedded chain, is ergodic and denote by i its limiting probabilities. That is, the i are the unique solution of i =
j
j Pj i ,
all i
i = 1
i
Now since i represents the proportion of transitions that take the process into state i, and because 1/vi is the mean time spent in state i during a visit, it seems
6.6.
Time Reversibility
393
intuitive that Pi , the proportion of time in state i, should be a weighted average of the i where i is weighted proportionately to 1/vi . That is, it is intuitive that Pi = i /vi j j /vj (6.25)
To check the preceding, recall that the limiting probabilities Pi must satisfy vi Pi =
j =i
Pj qj i ,
all i
or equivalently, since Pii = 0 vi Pi =
j
Pj vj Pj i ,
all i
Hence, for the Pi s to be given by Equation (6.25), the following would be necessary: i =
j
j Pj i ,
all i
But this, of course, follows since it is in fact the defining equation for the i s. Suppose now that the continuoustime Markov chain has been in operation for a long time, and suppose that starting at some (large) time T we trace the process going backward in time. To determine the probability structure of this reversed process, we first note that given we are in state i at some timesay, tthe probability that we have been in this state for an amount of time greater than s is just evi s . This is so, since P {process is in state i throughout [t  s, t]X(t) = i} P {process is in state i throughout [t  s, t]} = P {X(t) = i} P {X(t  s) = i}evi s = P {X(t) = i} = evi s since for t large P {X(t  s) = i} = P {X(t) = i} = Pi . In other words, going backward in time, the amount of time the process spends in state i is also exponentially distributed with rate vi . In addition, as was shown
394
6
ContinuousTime Markov Chains
in Section 4.8, the sequence of states visited by the reversed process constitutes a discretetime Markov chain with transition probabilities Qij given by Qij = j Pj i i
Hence, we see from the preceding that the reversed process is a continuoustime Markov chain with the same transition rates as the forwardtime process and with onestage transition probabilities Qij . Therefore, the continuoustime Markov chain will be time reversible, in the sense that the process reversed in time has the same probabilistic structure as the original process, if the embedded chain is time reversible. That is, if i Pij = j Pj i , Now using the fact that Pi = (i /vi )/( dition is equivalent to Pi qij = Pj qj i ,
j
for all i, j j /vj ), we see that the preceding con
for all i, j
(6.26)
Since Pi is the proportion of time in state i and qij is the rate when in state i that the process goes to j , the condition of time reversibility is that the rate at which the process goes directly from state i to state j is equal to the rate at which it goes directly from j to i. It should be noted that this is exactly the same condition needed for an ergodic discretetime Markov chain to be time reversible (see Section 4.8). An application of the preceding condition for time reversibility yields the following proposition concerning birth and death processes.
Proposition 6.5 An ergodic birth and death process is time reversible. Proof We must show that the rate at which a birth and death process goes from
state i to state i + 1 is equal to the rate at which it goes from i + 1 to i. Now in any length of time t the number of transitions from i to i + 1 must equal to within 1 the number from i + 1 to i (since between each transition from i to i + 1 the process must return to i, and this can only occur through i + 1, and vice versa). Hence, as the number of such transitions goes to infinity as t , it follows that the rate of transitions from i to i + 1 equals the rate from i + 1 to i. Proposition 6.5 can be used to prove the important result that the output process of an M/M/s queue is a Poisson process. We state this as a corollary.
Corollary 6.6 Consider an M/M/s queue in which customers arrive in accordance with a Poisson process having rate and are served by any one of s serverseach having an exponentially distributed service time with rate .
6.6.
Time Reversibility
395
Figure 6.1. The number in the system.
If < s, then the output process of customers departing is, after the process has been in operation for a long time, a Poisson process with rate .
Proof Let X(t) denote the number of customers in the system at time t. Since
the M/M/s process is a birth and death process, it follows from Proposition 6.5 that {X(t), t 0} is time reversible. Now going forward in time, the time points at which X(t) increases by 1 constitute a Poisson process since these are just the arrival times of customers. Hence, by time reversibility the time points at which X(t) increases by 1 when we go backward in time also constitute a Poisson process. But these latter points are exactly the points of time when customers depart. (See Figure 6.1.) Hence, the departure times constitute a Poisson process with rate .
Example 6.17 Consider a first come first serve M/M/1 queue, with arrival
rate and service rate , where < , that is in steady state. Given that customer C spends a total of t time units in the system, what is the conditional distribution of the number of others that were present when C arrived? Solution: Suppose that C arrived at time s and departed at time s + t. Because the system is first come first served, the number that were in the system when C arrived is equal to the number of departures of other customers that occur after time s and before time s + t, which is equal to the number of arrivals in the reversed process in that interval of time. Now, in the reversed process C would have arrived at time s + t and departed at time s. Because the reversed process is also an M/M/1 queueing system, the number of arrivals during that interval of length t is Poisson distributed with mean t. (For a more direct argument for this result, see Section 8.3.1.) We have shown that a process is time reversible if and only if Pi qij = Pj qj i for all i = j
396
6
ContinuousTime Markov Chains
Analogous to the result for discretetime Markov chains, if we can find a probability vector P that satisfies the preceding then the Markov chain is time reversible and the Pi s are the longrun probabilities. That is, we have the following proposition.
Proposition 6.7 If for some set {Pi }
Pi = 1,
i
Pi
0
and Pi qij = Pj qj i for all i = j (6.27)
then the continuoustime Markov chain is time reversible and Pi represents the limiting probability of being in state i.
Proof For fixed i we obtain upon summing Equation (6.27) over all j : j = i
Pi qij =
j =i j =i
Pj qj i
or, since
j =i qij
= vi , vi Pi =
j =i
Pj qj i
Hence, the Pi s satisfy the balance equations and thus represent the limiting probabilities. Because Equation (6.27) holds, the chain is time reversible.
Example 6.18 Consider a set of n machines and a single repair facility to
service them. Suppose that when machine i, i = 1, . . . , n, goes down it requires an exponentially distributed amount of work with rate i to get it back up. The repair facility divides its efforts equally among all down components in the sense that whenever there are k down machines 1 k n each receives work at a rate of 1/k per unit time. Finally, suppose that each time machine i goes back up it remains up for an exponentially distributed time with rate i . The preceding can be analyzed as a continuoustime Markov chain having 2n states where the state at any time corresponds to the set of machines that are down at that time. Thus, for instance, the state will be (i1 , i2 , . . . , ik ) when machines i1 , . . . , ik are down and all the others are up. The instantaneous transition rates are
6.6.
Time Reversibility
397
as follows: q(i1 ,...,ik1 ),(i1 ,...,ik ) = ik , q(i1 ,...,ik ),(i1 ,...,ik1 ) = ik /k where i1 , . . . , ik are all distinct. This follows since the failure rate of machine ik is always ik and the repair rate of machine ik when there are k failed machines is ik /k. Hence the time reversible equations (6.27) are P (i1 , . . . , ik )ik /k = P (i1 , . . . , ik1 )ik or P (i1 , . . . , ik ) = = = . . .
k
kik P (i1 , . . . , ik1 ) i k kik (k  1)ik1 P (i1 , . . . , ik2 ) i k ik1 upon iterating
= k!
j =1
(ij /ij )P ()
where is the state in which all components are working. Because P () + we see that
k
P (i1 , . . . , ik ) = 1
P () = 1 +
i1 ,...,ik
1
k!
j =1
(ij /ij )
(6.28)
where the preceding sum is over all the 2n  1 nonempty subsets {i1 , . . . , ik } of {1, 2, . . . , n}. Hence as the time reversible equations are satisfied for this choice of probability vector it follows from Proposition 6.7 that the chain is time reversible and
k
P (i1 , . . . , ik ) = k! with P () being given by (6.28).
(ij /ij )P ()
j =1
398
6
ContinuousTime Markov Chains
For instance, suppose there are two machines. Then, from the preceding we would have P () = P (1) = P (2) = P (1, 2) = 1 , 1 + 1 /1 + 2 /2 + 21 2 /1 2 1 /1 , 1 + 1 /1 + 2 /2 + 21 2 /1 2 2 /2 , 1 + 1 /1 + 2 /2 + 21 2 /1 2 21 2 1 2 [1 + 1 /1 + 2 /2 + 21 2 /1 2 ]
Consider a continuoustime Markov chain whose state space is S. We say that the Markov chain is truncated to the set A S if qij is changed to 0 for all i A, j A. That is, transitions out of the class A are no longer allowed, whereas ones / in A continue at the same rates as before. A useful result is that if the chain is time reversible, then so is the truncated one. j S, that is truncated to the set A S and remains irreducible is also time reversible and has limiting probabilities PjA given by PjA = Pj
iA Pi
Proposition 6.8 A time reversible chain with limiting probabilities Pj ,
,
j A
Proof By Proposition 6.7 we need to show that, with PjA as given,
PiA qij = PjA qj i or, equivalently, Pi qij = Pj qj i for i A, j A for i A, j A
But this follows since the original chain is, by assumption, time reversible.
Example 6.19 Consider an M/M/1 queue in which arrivals finding N in the
system do not enter. This finite capacity system can be regarded as a truncation of the M/M/1 queue to the set of states A = {0, 1, . . . , N}. Since the number in the system in the M/M/1 queue is time reversible and has limiting probabilities Pj = (/)j (1  /) it follows from Proposition 6.6 that the finite capacity model is also time reversible and has limiting probabilities given by Pj = (/)j
N i i=0 (/)
,
j = 0, 1, . . . , N
6.6.
Time Reversibility
399
Another useful result is given by the following proposition, whose proof is left as an exercise.
Proposition 6.9 If {Xi (t), t
0} are, for i = 1, . . . , n, independent time reversible continuoustime Markov chains, then the vector process {(Xi (t), . . . , Xn (t)), t 0} is also a time reversible continuoustime Markov chain.
Example 6.20 Consider an ncomponent system where component i, i =
1, . . . , n, functions for an exponential time with rate i and then fails; upon failure, repair begins on component i, with the repair taking an exponentially distributed time with rate i . Once repaired, a component is as good as new. The components act independently except that when there is only one working component the system is temporarily shut down until a repair has been completed; it then starts up again with two working components. (a) What proportion of time is the system shut down? (b) What is the (limiting) averaging number of components that are being repaired? Solution: Consider first the system without the restriction that it is shut down when a single component is working. Letting Xi (t), i = 1, . . . , n, equal 1 if component i is working at time t and 0 if it is failed, then {Xi (t), t 0}, i = 1, . . . , n, are independent birth and death processes. Because a birth and death process is time reversible, it follows from Proposition 6.9 that the process {(X1 (t), . . . , Xn (t)), t 0} is also time reversible. Now, with Pi (j ) = lim P {Xi (t) = j },
t
j = 0, 1
we have Pi (1) = Also, with P (j1 , . . . , jn ) = lim P {Xi (t) = ji , i = 1, . . . , n}
t
i , i + i
Pi (0) =
i i + i
it follows, by independence, that
n
P (j1 , . . . , jn ) =
i=1
Pi (ji ),
ji = 0, 1, i = 1, . . . , n
Now, note that shutting down the system when only one component is working is equivalent to truncating the preceding unconstrained system to the set
400
6
ContinuousTime Markov Chains
consisting of all states except the one having all components down. Therefore, with PT denoting a probability for the truncated system, we have from Proposition 6.8 that PT (j1 , . . . , jn ) = where
n
P (j1 , . . . , jn ) , 1C
n
ji > 0
i=1
C = P (0, . . . , 0) =
j =1
j /(j + j )
Hence, letting (0, 1i ) = (0, . . . , 0, 1, 0, . . . , 0) be the n vector of zeroes and ones whose single 1 is in the ith place, we have
n
PT (system is shut down) =
i=1
PT (0, 1i ) 1 1C C
n i=1
= =
i i + i
j =i
j j + j
n i=1 i /i
1C
Let R denote the number of components being repaired. Then with Ii equal to 1 if component i is being repaired and 0 otherwise, we have for the unconstrained (nontruncated) system that
n n n
E[R] = E
i=1
Ii =
i=1
Pi (0) =
i=1
i /(i + i )
But, in addition, E[R] = E[Rall components are in repair]C + E[Rnot all components are in repair](1  C) = nC + ET [R](1  C) implying that ET [R] =
n i=1 i /(i
+ i )  nC 1C
6.7.
Uniformization
401
6.7.
Uniformization
Consider a continuoustime Markov chain in which the mean time spent in a state is the same for all states. That is, suppose that vi = v, for all states i. In this case since the amount of time spent in each state during a visit is exponentially distributed with rate v, it follows that if we let N (t) denote the number of state transitions by time t, then {N (t), t 0} will be a Poisson process with rate v. To compute the transition probabilities Pij (t), we can condition on N (t): Pij (t) = P {X(t) = j X(0) = i}
=
n=0
P {X(t) = j X(0) = i, N (t) = n}P {N (t) = nX(0) = i} P {X(t) = j X(0) = i, N (t) = n}evt (vt)n n!
=
n=0
Now the fact that there have been n transitions by time t tells us something about the amount of time spent in each of the first n states visited, but since the distribution of time spent in each state is the same for all states, it follows that knowing that N(t) = n gives us no information about which states were visited. Hence,
n P {X(t) = j X(0) = i, N (t) = n} = Pij n where Pij is just the nstage transition probability associated with the discretetime Markov chain with transition probabilities Pij ; and so when vi v
Pij (t) =
n=0
n Pij evt
(vt)n n!
(6.29)
Equation (6.29) is often useful from a computational point of view since it enables us to approximate Pij (t) by taking a partial sum and then computing (by matrix multiplication of the transition probability matrix) the relevant n stage probabilin ties Pij . Whereas the applicability of Equation (6.29) would appear to be quite limited since it supposes that vi v, it turns out that most Markov chains can be put in that form by the trick of allowing fictitious transitions from a state to itself. To see how this works, consider any Markov chain for which the vi are bounded, and let v be any number such that vi v, for all i (6.30)
Now when in state i, the process actually leaves at rate vi ; but this is equivalent to supposing that transitions occur at rate v, but only the fraction vi/v of transitions
402
6
ContinuousTime Markov Chains
are real ones (and thus real transitions occur at rate vi ) and the remaining fraction 1  vi /v are fictitious transitions which leave the process in state i. In other words, any Markov chain satisfying condition (6.30) can be thought of as being a process that spends an exponential amount of time with rate v in state i and then makes a transition to j with probability Pij , where 1  vi , Pij = v v iP , ij v j =i j =i (6.31)
Hence, from Equation (6.29) we have that the transition probabilities can be computed by
Pij (t) =
n=0
n Pij evt
(vt)n n!
where Pij are the nstage transition probabilities corresponding to Equation (6.31). This technique of uniformizing the rate in which a transition occurs from each state by introducing transitions from a state to itself is known as uniformization.
Example 6.21 Let us reconsider Example 6.11, which models the workings
of a machineeither on or offas a twostate continuoustime Markov chain with P01 = P10 = 1, v0 = , v1 = Letting v = + , the uniformized version of the preceding is to consider it a continuoustime Markov chain with P00 = = 1  P01 , + = 1  P11 , P10 = + vi = + , i = 1, 2
As P00 = P10 , it follows that the probability of a transition into state 0 is equal to /( + ) no matter what the present state. Because a similar result is true for
6.7.
Uniformization
403
state 1, it follows that the nstage transition probabilities are given by
n Pi0 = n Pi1 =
, + , +
n n
1, i = 0, 1 1, i = 0, 1
Hence,
P00 (t) =
n=0
n P00 e(+)t
[( + )t]n n! [( + )t]n e(+)t + n! +
=e
(+)t
+
n=1
= e(+)t + [1  e(+)t ] = Similarly,
+ e(+)t + +
P11 (t) =
n=0
n P11 e(+)t
[( + )t]n n! +
= e(+)t + [1  e(+)t ] = + e(+)t + +
The remaining probabilities are P01 (t) = 1  P00 (t) = [1  e(+)t ], + P10 (t) = 1  P11 (t) = [1  e(+)t ] +
Example 6.22 Consider the twostate chain of Example 6.20 and suppose
that the initial state is state 0. Let O(t) denote the total amount of time that the process is in state 0 during the interval (0, t). The random variable O(t) is often called the occupation time. We will now compute its mean.
404
6
ContinuousTime Markov Chains
If we let I (s) = 1, 0, if X(s) = 0 if X(s) = 1
then we can represent the occupation time by O(t) =
0 t
I (s) ds
Taking expectations and using the fact that we can take the expectation inside the integral sign (since an integral is basically a sum), we obtain E[O(t)] =
0 t
E[I (s)] ds
t 0
= =
0
P {X(s) = 0} ds P00 (s) ds
t
=
t+ {1  e(+)t } + ( + )2
where the final equality follows by integrating P00 (s) = + e(+)s + +
(For another derivation of E[O(t)], see Exercise 38.)
6.8.
Computing the Transition Probabilities
For any pair of states i and j , let rij = qij , vi , if i = j if i = j
Using this notation, we can rewrite the Kolmogorov backward equations Pij (t) =
k=i
qik Pkj (t)  vi Pij (t)
6.8.
Computing the Transition Probabilities
405
and the forward equations Pij (t) =
k=j
qkj Pik (t)  vj Pij (t)
as follows: Pij (t) =
k
rik Pkj (t) rkj Pik (t)
k
(backward) (forward)
Pij (t) =
This representation is especially revealing when we introduce matrix notation. Define the matrices R, and P(t), P (t) by letting the element in row i, column j of these matrices be, respectively, rij , Pij (t), and Pij (t). Since the backward equations say that the element in row i, column j of the matrix P (t) can be obtained by multiplying the ith row of the matrix R by the j th column of the matrix P(t), it is equivalent to the matrix equation P (t) = RP(t) Similarly, the forward equations can be written as P (t) = P(t)R Now, just as the solution of the scalar differential equation f (t) = cf (t) [or, equivalent, f (t) = f (t)c] is f (t) = f (0)ect it can be shown that the solution of the matrix differential Equations (6.32) and (6.33) is given by P(t) = P(0)eRt Since P(0) = I (the identity matrix), this yields that P(t) = eRt where the matrix eRt is defined by
(6.32)
(6.33)
(6.34)
eRt =
n=0
Rn
tn n!
(6.35)
with Rn being the (matrix) multiplication of R by itself n times.
406
6
ContinuousTime Markov Chains
The direct use of Equation (6.35) to compute P(t) turns out to be very inefficient for two reasons. First, since the matrix R contains both positive and negative elements (remember the offdiagonal elements are the qij while the ith diagonal element is vi ), there is the problem of computer roundoff error when we compute the powers of R. Second, we often have to compute many of the terms in the infinite sum (6.35) to arrive at a good approximation. However, there are certain indirect ways that we can utilize the relation (6.34) to efficiently approximate the matrix P(t). We now present two of these methods.
Approximation Method 1 Rather than using (6.35) to compute eRt , we
can use the matrix equivalent of the identity ex = lim which states that eRt = lim
n n
1+
x n t n
n
n
I+R
Thus, if we let n be a power of 2, say, n = 2k , then we can approximate P(t) by raising the matrix M = I + Rt/n to the nth power, which can be accomplished by k matrix multiplications (by first multiplying M by itself to obtain M2 and then multiplying that by itself to obtain M4 and so on). In addition, since only the diagonal elements of R are negative (and the diagonal elements of the identity matrix I are equal to 1) by choosing n large enough, we can guarantee that the matrix I + Rt/n has all nonnegative elements.
Approximation Method 2 A second approach to approximating eRt uses
the identity eRt = lim
n
IR t n
n
t n
n
IR and thus
for n large
P(t) = eRt I  R =
t n
n
t IR n
1 n
Hence, if we again choose n to be a large power of 2, say, n = 2k , we can approximate P(t) by first computing the inverse of the matrix I  Rt/n and then
Exercises
407
raising that matrix to the nth power (by utilizing k matrix multiplications). It can be shown that the matrix (I  Rt/n)1 will have only nonnegative elements.
Remark Both of the preceding computational approaches for approximating
P(t) have probabilistic interpretations (see Exercises 41 and 42).
Exercises
1. A population of organisms consists of both male and female members. In a small colony any particular male is likely to mate with any particular female in any time interval of length h, with probability h + o(h). Each mating immediately produces one offspring, equally likely to be male or female. Let N1 (t) and N2 (t) denote the number of males and females in the population at t. Derive the parameters of the continuoustime Markov chain {N1 (t), N2 (t)}, i.e., the vi , Pij of Section 6.2. *2. Suppose that a onecelled organism can be in one of two stateseither A or B. An individual in state A will change to state B at an exponential rate ; an individual in state B divides into two new individuals of type A at an exponential rate . Define an appropriate continuoustime Markov chain for a population of such organisms and determine the appropriate parameters for this model. 3. Consider two machines that are maintained by a single repairman. Machine i functions for an exponential time with rate i before breaking down, i = 1, 2. The repair times (for either machine) are exponential with rate . Can we analyze this as a birth and death process? If so, what are the parameters? If not, how can we analyze it? *4. Potential customers arrive at a singleserver station in accordance with a Poisson process with rate . However, if the arrival finds n customers already in the station, then he will enter the system with probability n . Assuming an exponential service rate , set this up as a birth and death process and determine the birth and death rates. 5. There are N individuals in a population, some of whom have a certain infection that spreads as follows. Contacts between two members of this population occur in accordance with a Poisson process having rate . When a contact occurs, it is equally likely to involve any of the N pairs of individuals in the population. 2 If a contact involves an infected and a noninfected individual, then with probability p the noninfected individual becomes infected. Once infected, an individual remains infected throughout. Let X(t) denote the number of infected members of the population at time t.
408
6
ContinuousTime Markov Chains
(a) Is {X(t), t 0} a continuoustime Markov chain? (b) Specify its type. (c) Starting with a single infected individual, what is the expected time until all members are infected? 6. Consider a birth and death process with birth rates i = (i + 1), i death rates i = i, i 0. (a) Determine the expected time to go from state 0 to state 4. (b) Determine the expected time to go from state 2 to state 5. (c) Determine the variances in parts (a) and (b). *7. Individuals join a club in accordance with a Poisson process with rate . Each new member must pass through k consecutive stages to become a full member of the club. The time it takes to pass through each stage is exponentially distributed with rate . Let Ni (t) denote the number of club members at time t who have passed through exactly i stages, i = 1, . . . , k  1. Also, let N(t) = (N1 (t), N2 (t), . . . , Nk1 (t)). (a) Is {N(t), t 0} a continuoustime Markov chain? (b) If so, give the infinitesimal transition rates. That is, for any state n = (n1 , . . . , nk1 ) give the possible next states along with their infinitesimal rates. 8. Consider two machines, both of which have an exponential lifetime with mean 1/. There is a single repairman that can service machines at an exponential rate . Set up the Kolmogorov backward equations; you need not solve them. 9. The birth and death process with parameters n = 0 and n = , n > 0 is called a pure death process. Find Pij (t). 10. Consider two machines. Machine i operates for an exponential time with rate i and then fails; its repair time is exponential with rate i , i = 1, 2. The machines act independently of each other. Define a fourstate continuoustime Markov chain which jointly describes the condition of the two machines. Use the assumed independence to compute the transition probabilities for this chain and then verify that these transition probabilities satisfy the forward and backward equations. *11. Consider a Yule process starting with a single individualthat is, suppose X(0) = 1. Let Ti denote the time it takes the process to go from a population of size i to one of size i + 1. (a) Argue that Ti , i = 1, . . . , j , are independent exponentials with respective rates i. (b) Let X1 , . . . , Xj denote independent exponential random variables each having rate , and interpret Xi as the lifetime of component i. Argue that 0, and
Exercises
409
max(X1 , . . . , Xj ) can be expressed as max(X1 , . . . , Xj ) = 1 + 2 + + j where 1 , 2 , . . . , j are independent exponentials with respective rates j , (j  1), . . . , . Hint: Interpret i as the time between the i  1 and the ith failure. (c) Using (a) and (b) argue that P {T1 + + Tj (d) Use (c) to obtain that P1j (t) = (1  et )j 1  (1  et )j = et (1  et )j 1 and hence, given X(0) = 1, X(t) has a geometric distribution with parameter p = et . (e) Now conclude that Pij (t) = j  1 ti e (1  et )j i i 1 t} = (1  et )j
12. Each individual in a biological population is assumed to give birth at an exponential rate , and to die at an exponential rate . In addition, there is an exponential rate of increase due to immigration. However, immigration is not allowed when the population size is N or larger. (a) Set this up as a birth and death model. (b) If N = 3, 1 = = , = 2, determine the proportion of time that immigration is restricted. 13. A small barbershop, operated by a single barber, has room for at most two customers. Potential customers arrive at a Poisson rate of three per hour, and the successive service times are independent exponential random variables with mean 1 4 hour. What is (a) the average number of customers in the shop? (b) the proportion of potential customers that enter the shop? (c) If the barber could work twice as fast, how much more business would he do? 14. Potential customers arrive at a fullservice, onepump gas station at a Poisson rate of 20 cars per hour. However, customers will only enter the station for gas if there are no more than two cars (including the one currently being attended to) at the pump. Suppose the amount of time required to service a car is exponentially distributed with a mean of five minutes.
410
6
ContinuousTime Markov Chains
(a) What fraction of the attendant's time will be spent servicing cars? (b) What fraction of potential customers are lost? 15. A service center consists of two servers, each working at an exponential rate of two services per hour. If customers arrive at a Poisson rate of three per hour, then, assuming a system capacity of at most three customers, (a) what fraction of potential customers enter the system? (b) what would the value of part (a) be if there was only a single server, and his rate was twice as fast (that is, = 4)? *16. The following problem arises in molecular biology. The surface of a bacterium consists of several sites at which foreign moleculessome acceptable and some notbecome attached. We consider a particular site and assume that molecules arrive at the site according to a Poisson process with parameter . Among these molecules a proportion is acceptable. Unacceptable molecules stay at the site for a length of time which is exponentially distributed with parameter 1 , whereas an acceptable molecule remains at the site for an exponential time with rate 2 . An arriving molecule will become attached only if the site is free of other molecules. What percentage of time is the site occupied with an acceptable (unacceptable) molecule? 17. Each time a machine is repaired it remains up for an exponentially distributed time with rate . It then fails, and its failure is either of two types. If it is a type 1 failure, then the time to repair the machine is exponential with rate 1 ; if it is a type 2 failure, then the repair time is exponential with rate 2 . Each failure is, independently of the time it took the machine to fail, a type 1 failure with probability p and a type 2 failure with probability 1  p. What proportion of time is the machine down due to a type 1 failure? What proportion of time is it down due to a type 2 failure? What proportion of time is it up? 18. After being repaired, a machine functions for an exponential time with rate and then fails. Upon failure, a repair process begins. The repair process proceeds sequentially through k distinct phases. First a phase 1 repair must be performed, then a phase 2, and so on. The times to complete these phases are independent, with phase i taking an exponential time with rate i , i = 1, . . . , k. (a) What proportion of time is the machine undergoing a phase i repair? (b) What proportion of time is the machine working? *19. A single repairperson looks after both machines 1 and 2. Each time it is repaired, machine i stays up for an exponential time with rate i , i = 1, 2. When machine i fails, it requires an exponentially distributed amount of work with rate i to complete its repair. The repairperson will always service machine 1 when it is down. For instance, if machine 1 fails while 2 is being repaired, then the repairperson will immediately stop work on machine 2 and start on 1. What proportion of time is machine 2 down?
Exercises
411
20. There are two machines, one of which is used as a spare. A working machine will function for an exponential time with rate and will then fail. Upon failure, it is immediately replaced by the other machine if that one is in working order, and it goes to the repair facility. The repair facility consists of a single person who takes an exponential time with rate to repair a failed machine. At the repair facility, the newly failed machine enters service if the repairperson is free. If the repairperson is busy, it waits until the other machine is fixed; at that time, the newly repaired machine is put in service and repair begins on the other one. Starting with both machines in working condition, find (a) the expected value and (b) the variance of the time until both are in the repair facility. (c) In the long run, what proportion of time is there a working machine? 21. Suppose that when both machines are down in Exercise 20 a second repairperson is called in to work on the newly failed one. Suppose all repair times remain exponential with rate . Now find the proportion of time at least one machine is working, and compare your answer with the one obtained in Exercise 20. 22. Customers arrive at a singleserver queue in accordance with a Poisson process having rate . However, an arrival that finds n customers already in the system will only join the system with probability 1/(n + 1). That is, with probability n/(n + 1) such an arrival will not join the system. Show that the limiting distribution of the number of customers in the system is Poisson with mean /. 23. A job shop consists of three machines and two repairmen. The amount of time a machine works before breaking down is exponentially distributed with mean 10. If the amount of time it takes a single repairman to fix a machine is exponentially distributed with mean 8, then (a) what is the average number of machines not in use? (b) what proportion of time are both repairmen busy? *24. Consider a taxi station where taxis and customers arrive in accordance with Poisson processes with respective rates of one and two per minute. A taxi will wait no matter how many other taxis are present. However, an arriving customer that does not find a taxi waiting leaves. Find (a) the average number of taxis waiting, and (b) the proportion of arriving customers that get taxis. 25. Customers arrive at a service station, manned by a single server who serves at an exponential rate 1 , at a Poisson rate . After completion of service the customer then joins a second system where the server serves at an exponential
412
6
ContinuousTime Markov Chains
rate 2 . Such a system is called a tandem or sequential queueing system. Assuming that < i , i = 1, 2, determine the limiting probabilities. Hint: Try a solution of the form Pn,m = C n m , and determine C, , . 26. Consider an ergodic M/M/s queue in steady state (that is, after a long time) and argue that the number presently in the system is independent of the sequence of past departure times. That is, for instance, knowing that there have been departures 2, 3, 5, and 10 time units ago does not affect the distribution of the number presently in the system. 27. In the M/M/s queue if you allow the service rate to depend on the number in the system (but in such a way so that it is ergodic), what can you say about the output process? What can you say when the service rate remains unchanged but > s? *28. If {X(t)} and {Y (t)} are independent continuoustime Markov chains, both of which are time reversible, show that the process {X(t), Y (t)} is also a time reversible Markov chain. 29. Consider a set of n machines and a single repair facility to service these machines. Suppose that when machine i, i = 1, . . . , n, fails it requires an exponentially distributed amount of work with rate i to repair it. The repair facility divides its efforts equally among all failed machines in the sense that whenever there are k failed machines each one receives work at a rate of 1/k per unit time. If there are a total of r working machines, including machine i, then i fails at an instantaneous rate i /r. (a) Define an appropriate state space so as to be able to analyze the preceding system as a continuoustime Markov chain. (b) Give the instantaneous transition rates (that is, give the qij ). (c) Write the time reversibility equations. (d) Find the limiting probabilities and show that the process is time reversible. 30. Consider a graph with nodes 1, 2, . . . , n and the n arcs (i, j ), i = j , 2 i, j, = 1, . . . , n. (See Section 3.6.2 for appropriate definitions.) Suppose that a particle moves along this graph as follows: Events occur along the arcs (i, j ) according to independent Poisson processes with rates ij . An event along arc (i, j ) causes that arc to become excited. If the particle is at node i at the moment that (i, j ) becomes excited, it instantaneously moves to node j , i, j = 1, . . . , n. Let Pj denote the proportion of time that the particle is at node j . Show that Pj = Hint: Use time reversibility. 1 n
Exercises
413
31. A total of N customers move about among r servers in the following manner. When a customer is served by server i, he then goes over to server j , j = i, with probability 1/(r  1). If the server he goes to is free, then the customer enters service; otherwise he joins the queue. The service times are all independent, with the service times at server i being exponential with rate , i = 1, . . . , r. Let the state at any time be the vector (n1 , . . . , nr ), where ni is the number of customers presently at server i, i = 1, . . . , r, i ni = N . (a) Argue that if X(t) is the state at time t, then {X(t), t 0}, is a continuoustime Markov chain. (b) Give the infinitesimal rates of this chain. (c) Show that this chain is time reversible, and find the limiting probabilities. 32. Customers arrive at a twoserver station in accordance with a Poisson process having rate . Upon arriving, they join a single queue. Whenever a server completes a service, the person first in line enters service. The service times of server i are exponential with rate i , i = 1, 2, where 1 + 2 > . An arrival finding both servers free is equally likely to go to either one. Define an appropriate continuoustime Markov chain for this model, show it is time reversible, and find the limiting probabilities. *33. Consider two M/M/1 queues with respective parameters i , i , i = 1, 2. Suppose they share a common waiting room that can hold at most three customers. That is, whenever an arrival finds her server busy and three customers in the waiting room, she goes away. Find the limiting probability that there will be n queue 1 customers and m queue 2 customers in the system. Hint: Use the results of Exercise 28 together with the concept of truncation. 34. Four workers share an office that contains four telephones. At any time, each worker is either "working" or "on the phone." Each "working" period of worker i lasts for an exponentially distributed time with rate i , and each "on the phone" period lasts for an exponentially distributed time with rate i , i = 1, 2, 3, 4. (a) What proportion of time are all workers "working"? Let Xi (t) equal 1 if worker i is working at time t, and let it be 0 otherwise. Let X(t) = (X1 (t), X2 (t), X3 (t), X4 (t)). (b) Argue that {X(t), t 0} is a continuoustime Markov chain and give its infinitesimal rates. (c) Is {X(t)} time reversible? Why or why not? Suppose now that one of the phones has broken down. Suppose that a worker who is about to use a phone but finds them all being used begins a new "working" period. (d) What proportion of time are all workers "working"?
414
6
ContinuousTime Markov Chains
35. Consider a time reversible continuoustime Markov chain having infinitesimal transition rates qij and limiting probabilities {Pi }. Let A denote a set of states for this chain, and consider a new continuoustime Markov chain with transition rates qij given by
qij =
cqij , qij ,
if i A, j A / otherwise
where c is an arbitrary positive number. Show that this chain remains time reversible, and find its limiting probabilities. 36. Consider a system of n components such that the working times of component i, i = 1, . . . , n, are exponentially distributed with rate i . When failed, however, the repair rate of component i depends on how many other components are down. Specifically, suppose that the instantaneous repair rate of component i, i = 1, . . . , n, when there are a total of k failed components, is k i . (a) Explain how we can analyze the preceding as a continuoustime Markov chain. Define the states and give the parameters of the chain. (b) Show that, in steady state, the chain is time reversible and compute the limiting probabilities. 37. For the continuoustime Markov chain of Exercise 3 present a uniformized version. 38. In Example 6.20, we computed m(t) = E[O(t)], the expected occupation time in state 0 by time t for the twostate continuoustime Markov chain starting in state 0. Another way of obtaining this quantity is by deriving a differential equation for it. (a) Show that m(t + h) = m(t) + P00 (t)h + o(h) (b) Show that m (t) = (c) Solve for m(t). 39. Let O(t) be the occupation time for state 0 in the twostate continuoustime Markov chain. Find E[O(t)X(0) = 1]. 40. Consider the twostate continuoustime Markov chain. Starting in state 0, find Cov[X(s), X(t)]. + e(+)t + +
References
415
41. Let Y denote an exponential random variable with rate that is independent of the continuoustime Markov chain {X(t)} and let Pij = P {X(Y ) = j X(0) = i} (a) Show that Pij = 1 vi + qik Pkj +
k
ij vi +
where ij is 1 when i = j and 0 when i = j . (b) Show that the solution of the preceding set of equations is given by P = (I  R/)1 where P is the matrix of elements Pij , I is the identity matrix, and R the matrix specified in Section 6.8. (c) Suppose now that Y1 , . . . , Yn are independent exponentials with rate that are independent of {X(t)}. Show that P {X(Y1 + + Yn ) = j X(0) = i} is equal to the element in row i, column j of the matrix Pn . (d) Explain the relationship of the preceding to Approximation 2 of Section 6.8. *42. (a) Show that Approximation 1 of Section 6.8 is equivalent to uniformizing the continuoustime Markov chain with a value v such that vt = n and then n approximating Pij (t) by Pij . (b) Explain why the preceding should make a good approximation. Hint: What is the standard deviation of a Poisson random variable with mean n?
References
1. D. R. Cox and H. D. Miller, "The Theory of Stochastic Processes," Methuen, London, 1965. 2. A. W. Drake, "Fundamentals of Applied Probability Theory," McGrawHill, New York, 1967. 3. S. Karlin and H. Taylor, "A First Course in Stochastic Processes," Second Edition, Academic Press, New York, 1975. 4. E. Parzen, "Stochastic Processes," HoldenDay, San Francisco, California, 1962. 5. S. Ross, "Stochastic Processes," Second Edition, John Wiley, New York, 1996.
This page intentionally left blank
Renewal Theory and Its Applications
7
7.1. Introduction
We have seen that a Poisson process is a counting process for which the times between successive events are independent and identically distributed exponential random variables. One possible generalization is to consider a counting process for which the times between successive events are independent and identically distributed with an arbitrary distribution. Such a counting process is called a renewal process. Let {N(t), t 0} be a counting process and let Xn denote the time between the (n  1)st and the nth event of this process, n 1.
Definition 7.1 If the sequence of nonnegative random variables {X1 X2 , . . .}
is independent and identically distributed, then the counting process {N (t), t is said to be a renewal process. 0}
Thus, a renewal process is a counting process such that the time until the first event occurs has some distribution F , the time between the first and second event has, independently of the time of the first event, the same distribution F , and so on. When an event occurs, we say that a renewal has taken place. For an example of a renewal process, suppose that we have an infinite supply of lightbulbs whose lifetimes are independent and identically distributed. Suppose also that we use a single lightbulb at a time, and when it fails we immediately replace it with a new one. Under these conditions, {N (t), t 0} is a renewal process when N(t) represents the number of lightbulbs that have failed by time t. For a renewal process having interarrival times X1 , X2 , . . . , let
n
S0 = 0,
Sn =
i=1
Xi ,
n
1
417
418
7
Renewal Theory and Its Applications
Figure 7.1. Renewal and interarrival times.
That is, S1 = X1 is the time of the first renewal; S2 = X1 + X2 is the time until the first renewal plus the time between the first and second renewal, that is, S2 is the time of the second renewal. In general, Sn denotes the time of the nth renewal (see Figure 7.1). We shall let F denote the interarrival distribution and to avoid trivialities, we assume that F (0) = P {Xn = 0} < 1. Furthermore, we let = E[Xn ], n 1
be the mean time between successive renewals. It follows from the nonnegativity of Xn and the fact that Xn is not identically 0 that > 0. The first question we shall attempt to answer is whether an infinite number of renewals can occur in a finite amount of time. That is, can N (t) be infinite for some (finite) value of t? To show that this cannot occur, we first note that, as Sn is the time of the nth renewal, N (t) may be written as N (t) = max{n : Sn t} (7.1)
To understand why Equation (7.1) is valid, suppose, for instance, that S4 t but S5 > t. Hence, the fourth renewal had occurred by time t but the fifth renewal occurred after time t; or in other words, N (t), the number of renewals that occurred by time t, must equal 4. Now by the strong law of large numbers it follows that, with probability 1, Sn n as n
But since > 0 this means that Sn must be going to infinity as n goes to infinity. Thus, Sn can be less than or equal to t for at most a finite number of values of n, and hence by Equation (7.1), N (t) must be finite. However, though N(t) < for each t, it is true that, with probability 1, N () lim N (t) =
t
This follows since the only way in which N (), the total number of renewals that occur, can be finite is for one of the interarrival times to be infinite.
7.2.
Distribution of N(t)
419
Therefore, P {N() < } = P {Xn = for some n}
=P
n=1 n=1
{Xn = } P {Xn = }
=0
7.2.
Distribution of N(t)
The distribution of N(t) can be obtained, at least in theory, by first noting the important relationship that the number of renewals by time t is greater than or equal to n if and only if the nth renewal occurs before or at time t. That is, N (t) From Equation (7.2) we obtain P {N(t) = n} = P {N (t) = P {Sn n}  P {N (t) t}  P {Sn+1 t} n + 1} (7.3) n Sn t (7.2)
Now since the random variables Xi , i 1, are independent and have a common distribution F , it follows that Sn = n Xi is distributed as Fn , the nfold coni=1 volution of F with itself (Section 2.5). Therefore, from Equation (7.3) we obtain P {N (t) = n} = Fn (t)  Fn+1 (t)
Example 7.1 Suppose that P {Xn = i} = p(1  p)i1 , i
1. That is, suppose that the interarrival distribution is geometric. Now S1 = X1 may be interpreted as the number of trials necessary to get a single success when each trial is independent and has a probability p of being a success. Similarly, Sn may be interpreted as the number of trials necessary to attain n successes, and hence has the negative binomial distribution k  1 p n (1  p)kn , k n P {Sn = k} = n1 0, k<n
420
7
Renewal Theory and Its Applications
Thus, from Equation (7.3) we have that
[t]
P {N(t) = n} =
k=n
k1 n p (1  p)kn n1
[t]

k=n+1
k  1 n+1 p (1  p)kn1 n
Equivalently, since an event independently occurs with probability p at each of the times 1, 2, . . . P {N(t) = n} = [t] n p (1  p)[t]n n
By using Equation (7.2) we can calculate m(t), the mean value of N (t), as m(t) = E[N (t)]
=
n=1
P {N (t) P {Sn
n=1
n}
= =
n=1
t}
Fn (t)
where we have used the fact that if X is nonnegative and integer valued, then
k
E[X] =
k=1
kP {X = k} =
k=1 n=1
P {X = k} P {X
n=1
=
n=1 k=n
P {X = k} =
n}
The function m(t) is known as the meanvalue or the renewal function. It can be shown that the meanvalue function m(t) uniquely determines the renewal process. Specifically, there is a onetoone correspondence between the interarrival distributions F and the meanvalue functions m(t).
7.2.
Distribution of N(t)
421
Example 7.2 Suppose we have a renewal process whose meanvalue function
is given by m(t) = 2t, t 0
What is the distribution of the number of renewals occurring by time 10? Solution: Since m(t) = 2t is the meanvalue function of a Poisson process with rate 2, it follows, by the onetoone correspondence of interarrival distributions F and meanvalue functions m(t), that F must be exponential with mean 1 . Thus, the renewal process is a Poisson process with rate 2 and hence 2 P {N(10) = n} = e20 (20)n , n! n 0
Another interesting result that we state without proof is that m(t) < for all t <
Remarks (i) Since m(t) uniquely determines the interarrival distribution, it follows that the Poisson process is the only renewal process having a linear meanvalue function. (ii) Some readers might think that the finiteness of m(t) should follow directly from the fact that, with probability 1, N (t) is finite. However, such reasoning is not valid; consider the following: Let Y be a random variable having the following probability distribution
Y = 2n with probability Now,
1 n 2 ,
n
1
P {Y < } =
n=1
P {Y = 2 } =
n n=1
1 n 2
=1
But
E[Y ] =
n=1
2n P {Y = 2n } =
n=1
2n
1 n 2
=
Hence, even when Y is finite, it can still be true that E[Y ] = .
422
7
Renewal Theory and Its Applications
An integral equation satisfied by the renewal function can be obtained by conditioning on the time of the first renewal. Assuming that the interarrival distribution F is continuous with density function f this yields m(t) = E[N (t)] =
0
E[N (t)X1 = x]f (x) dx
(7.4)
Now suppose that the first renewal occurs at a time x that is less than t. Then, using the fact that a renewal process probabilistically starts over when a renewal occurs, it follows that the number of renewals by time t would have the same distribution as 1 plus the number of renewals in the first t  x time units. Therefore, E[N(t)X1 = x] = 1 + E[N (t  x)] Since, clearly E[N (t)X1 = x] = 0 we obtain from Equation (7.4) that m(t) =
0 t
if x < t
when x > t
[1 + m(t  x)]f (x) dx
t 0
= F (t) +
m(t  x)f (x) dx
(7.5)
Equation (7.5) is called the renewal equation and can sometimes be solved to obtain the renewal function.
Example 7.3 One instance in which the renewal equation can be solved is when the interarrival distribution is uniformsay, uniform on (0, 1). We will now present a solution in this case when t 1. For such values of t, the renewal function becomes
m(t) = t +
0 t
m(t  x) dx m(y) dy by the substitution y = t  x
=t+
0
t
Differentiating the preceding equation yields m (t) = 1 + m(t) Letting h(t) = 1 + m(t), we obtain h (t) = h(t)
7.3.
Limit Theorems and Their Applications
423
or log h(t) = t + C or h(t) = Ket or m(t) = Ket  1 Since m(0) = 0, we see that K = 1, and so we obtain m(t) = et  1, 0 t 1
7.3.
Limit Theorems and Their Applications
We have shown previously that, with probability 1, N (t) goes to infinity as t goes to infinity. However, it would be nice to know the rate at which N (t) goes to infinity. That is, we would like to be able to say something about limt N (t)/t. As a prelude to determining the rate at which N (t) grows, let us first consider the random variable SN (t) . In words, just what does this random variable represent? Proceeding inductively suppose, for instance, that N (t)= 3. Then SN (t) = S3 represents the time of the third event. Since there are only three events that have occurred by time t, S3 also represents the time of the last event prior to (or at) time t. This is, in fact, what SN (t) representsnamely, the time of the last renewal prior to or at time t. Similar reasoning leads to the conclusion that SN (t)+1 represents the time of the first renewal after time t (see Figure 7.2). We now are ready to prove the following.
Proposition 7.1 With probability 1,
1 N (t) t as t
Figure 7.2.
424
7
Renewal Theory and Its Applications
Proof Since SN (t) is the time of the last renewal prior to or at time t, and SN (t)+1 is the time of the first renewal after time t, we have
SN (t) or SN (t) N (t) t SN (t)+1 < N (t) N (t) (7.6) t < SN (t)+1
However, since SN (t) /N(t) = N (t) Xi /N(t) is the average of N (t) independent i=1 and identically distributed random variables, it follows by the strong law of large numbers that SN (t) /N(t) as N (t) . But since N (t) when t , we obtain SN (t) N (t) Furthermore, writing SN (t)+1 = N (t) SN (t)+1 N (t) + 1 N (t) + 1 N (t) as t
we have that SN (t)+1 /(N(t) + 1) by the same reasoning as before and N (t) + 1 1 N (t) Hence, SN (t)+1 N (t) as t as t
The result now follows by Equation (7.6) since t/N(t) is between two random variables, each of which converges to as t .
Remarks (i) The preceding propositions are true even when , the mean time
between renewals, is infinite. In this case, we interpret 1/ to be 0. (ii) The number 1/ is called the rate of the renewal process. (iii) Because the average time between renewals is , it is quite intuitive that the average rate at which renewals occur is 1 per every time units. Proposition 7.1 says that the average renewal rate up to time t will, with probability 1, converge to 1/ as t . What about the expected average renewal rate? Is it true that m(t)/t also converges to 1/? This result, known as the elementary renewal theorem, will be stated without proof.
7.3.
Limit Theorems and Their Applications
425
Elementary Renewal Theorem m(t) 1 t as t
As before, 1/ is interpreted as 0 when = .
Remark At first glance it might seem that the elementary renewal theorem
should be a simple consequence of Proposition 7.1. That is, since the average renewal rate will, with probability 1, converge to 1/, should this not imply that the expected average renewal rate also converges to 1/? We must, however, be careful; consider the next example.
Example 7.4 Let U be a random variable which is uniformly distributed on
(0, 1); and define the random variables Yn , n Yn = 0, n, 1, by if U > 1/n if U 1/n
Now, since, with probability 1, U will be greater than 0, it follows that Yn will equal 0 for all sufficiently large n. That is, Yn will equal 0 for all n large enough so that 1/n < U . Hence, with probability 1, Yn 0 However, E[Yn ] = nP U 1 1 =n =1 n n as n
Therefore, even though the sequence of random variables Yn converges to 0, the expected values of the Yn are all identically 1.
Example 7.5 Beverly has a radio that works on a single battery. As soon as
the battery in use fails, Beverly immediately replaces it with a new battery. If the lifetime of a battery (in hours) is distributed uniformly over the interval (30, 60), then at what rate does Beverly have to change batteries? Solution: If we let N (t) denote the number of batteries that have failed by time t, we have by Proposition 7.1 that the rate at which Beverly replaces batteries is given by
t
lim
1 1 N (t) = = t 45
That is, in the long run, Beverly will have to replace one battery every 45 hours.
426
7
Renewal Theory and Its Applications
Example 7.6 Suppose in Example 7.5 that Beverly does not keep any surplus
batteries on hand, and so each time a failure occurs she must go and buy a new battery. If the amount of time it takes for her to get a new battery is uniformly distributed over (0,1), then what is the average rate that Beverly changes batteries? Solution: In this case the mean time between renewals is given by = EU1 + EU2 where U1 is uniform over (30, 60) and U2 is uniform over (0, 1). Hence, = 45 +
1 2
= 45 1 2
2 91 .
and so in the long run, Beverly will be putting in a new battery at the rate of That is, she will put in two new batteries every 91 hours.
Example 7.7 Suppose that potential customers arrive at a singleserver bank
in accordance with a Poisson process having rate . However, suppose that the potential customer will enter the bank only if the server is free when he arrives. That is, if there is already a customer in the bank, then our arriver, rather than entering the bank, will go home. If we assume that the amount of time spent in the bank by an entering customer is a random variable having distribution G, then (a) what is the rate at which customers enter the bank? (b) what proportion of potential customers actually enter the bank? Solution: In answering these questions, let us suppose that at time 0 a customer has just entered the bank. (That is, we define the process to start when the first customer enters the bank.) If we let G denote the mean service time, then, by the memoryless property of the Poisson process, it follows that the mean time between entering customers is = G + 1
Hence, the rate at which customers enter the bank will be given by 1 = 1 + G On the other hand, since potential customers will be arriving at a rate , it follows that the proportion of them entering the bank will be given by /(1 + G ) 1 = 1 + G In particular if = 2 (in hours) and G = 2, then only one customer out of five will actually enter the system.
7.3.
Limit Theorems and Their Applications
427
A somewhat unusual application of Proposition 7.1 is provided by our next example.
Example 7.8 A sequence of independent trials, each of which results in out
come number i with probability Pi , i = 1, . . . , n, n Pi = 1, is observed until i the same outcome occurs k times in a row; this outcome then is declared to be the winner of the game. For instance, if k = 2 and the sequence of outcomes is 1, 2, 4, 3, 5, 2, 1, 3, 3, then we stop after nine trials and declare outcome number 3 the winner. What is the probability that i wins, i = 1, . . . , n, and what is the expected number of trials? Solution: We begin by computing the expected number of coin tosses, call it E[T ], until a run of k successive heads occurs when the tosses are independent and each lands on heads with probability p. By conditioning on the time of the first nonhead, we obtain
k
E[T ] =
j =1
(1  p)p j 1 (j + E[T ]) + kp k
Solving this for E[T ] yields (1  p) E[T ] = k + pk Upon simplifying, we obtain E[T ] = = 1 + p + + p k1 pk 1  pk p k (1  p) (7.7)
k j =1
jp j 1
Now, let us return to our example, and let us suppose that as soon as the winner of a game has been determined we immediately begin playing another game. For each i let us determine the rate at which outcome i wins. Now, every time i wins, everything starts over again and thus wins by i constitute renewals. Hence, from Proposition 7.1, the rate at which i wins = 1 E[Ni ]
428
7
Renewal Theory and Its Applications
where Ni denotes the number of trials played between successive wins of outcome i. Hence, from Equation (7.7) we see that rate at which i wins = Pik (1  Pi ) 1  Pik (7.8)
Hence, the longrun proportion of games that are won by number i is given by proportion of games i wins = =
n j =1 rate
rate at which i wins at which j wins Pik (1  Pi )/(1  Pik )
n k k j =1 (Pj (1  Pj )/(1  Pj ))
However, it follows from the strong law of large numbers that the longrun proportion of games that i wins will, with probability 1, be equal to the probability that i wins any given game. Hence, P {i wins} = Pik (1  Pi )/(1  Pik ) n k k j =1 (Pj (1  Pj )/(1  Pj ))
To compute the expected time of a game, we first note that the
n
rate at which games end =
i=1 n
rate at which i wins Pik (1  Pi ) 1  Pik
=
i=1
[from Equation (7.8)]
Now, as everything starts over when a game ends, it follows by Proposition 7.1 that the rate at which games end is equal to the reciprocal of the mean time of a game. Hence, E[time of a game} = = 1 rate at which games end 1
n k k i=1 (Pi (1  Pi )/(1  Pi ))
A key element in the proof of the elementary renewal theorem, which is also of independent interest, is the establishment of a relationship between m(t), the mean number of renewals by time t, and E[SN (t)+1 ], the expected time of
7.3.
Limit Theorems and Their Applications
429
the first renewal after t. Letting g(t) = E[SN (t)+1 ] we will derive an integral equation, similar to the renewal equation, for g(t) by conditioning on the time of the first renewal. This yields g(t) =
0
E[SN (t)+1 X1 = x]f (x) dx
where we have supposed that the interarrival times are continuous with density f . Now if the first renewal occurs at time x and x > t, then clearly the time of the first renewal after t is x. On the other hand, if the first renewal occurs at a time x < t, then by regarding x as the new origin, it follows that the expected time, from this origin, of the first renewal occurring after a time t  x from this origin is g(t  x). That is, we see that E[SN (t)+1 X1 = x] = g(t  x) + x, x, if x < t if x > t
Substituting this into the preceding equation gives g(t) =
0 t
(g(t  x) + x) f (x) dx +
t
xf (x) dx
=
0
t
g(t  x) f (x) dx +
0
xf (x) dx
or g(t) = +
0 t
g(t  x) f (x) dx
which is quite similar to the renewal equation m(t) = F (t) +
0 t
m(t  x)f (x) ds
Indeed, if we let g1 (t) = we see that g1 (t) + 1 = 1 +
0 t
g(t) 1
[g1 (t  x) + 1]f (x) dx
430 or
7
Renewal Theory and Its Applications
g1 (t) = F (t) +
0
t
g1 (t  x)f (x) dx
That is, g1 (t) = E[SN (t)+1 ]/  1 satisfies the renewal equation and thus, by uniqueness, must be equal to m(t). We have thus proven the following.
Proposition 7.2
E[SN (t)+1 ] = [m(t) + 1] A second derivation of Proposition 7.2 is given in Exercises 13 and 14. To see how Proposition 7.2 can be used to establish the elementary renewal theorem, let Y (t) denote the time from t until the next renewal. Y (t) is called the excess, or residual life, at t. As the first renewal after t will occur at time t + Y (t), we see that SN (t)+1 = t + Y (t) Taking expectations and utilizing Proposition 7.2 yields [m(t) + 1] = t + E[Y (t)] which implies that m(t) 1 1 E[Y (t)] =  + t t t The elementary renewal theorem can now be proven by showing that lim E[Y (t)] =0 t (7.9)
t
(see Exercise 14). The relation (7.9) shows that if we can determine E[Y (t)], the mean excess at t, then we can compute m(t) and vice versa.
Example 7.9 Consider the renewal process whose interarrival distribution is
the convolution of two exponentials; that is, F = F1 F2 , where Fi (t) = 1  ei t , i = 1, 2
We will determine the renewal function by first determining E[Y (t)]. To obtain the mean excess at t, imagine that each renewal corresponds to a new machine being put in use, and suppose that each machine has two componentsinitially component 1 is employed and this lasts an exponential time with rate 1 , and then
7.3.
Limit Theorems and Their Applications
431
component 2, which functions for an exponential time with rate 2 , is employed. When component 2 fails, a new machine is put in use (that is, a renewal occurs). Now consider the process {X(t), t 0} where X(t) is i if a type i component is in use at time t. It is easy to see that {X(t), t 0} is a twostate continuoustime Markov chain, and so, using the results of Example 6.11, its transition probabilities are 1 2 e(1 +2 )t + P11 (t) = 1 + 2 1 + 2 To compute the expected remaining life of the machine in use at time t, we condition on whether it is using its first or second component: for if it is still using its first component, then its remaining life is 1/1 + 1/2 , whereas if it is already using its second component, then its remaining life is 1/2 . Hence, letting p(t) denote the probability that the machine in use at time t is using its first component, we have that E[Y (t)] = = 1  p(t) 1 1 p(t) + + 1 2 2 1 p(t) + 2 1
But, since at time 0 the first machine is utilizing its first component, it follows that p(t) = P11 (t), and so, upon using the preceding expression of P11 (t), we obtain E[Y (t)] = 1 1 2 + e(1 +2 )t + 2 1 + 2 1 (1 + 2 ) (7.10)
Now it follows from Equation (7.9) that m(t) + 1 = t E[Y (t)] + u (7.11)
where , the mean interarrival time, is given in this case by = 1 1 1 + 2 + = 1 2 1 2
Substituting Equation (7.10) and the preceding equation into (7.11) yields, after simplifying, m(t) = 1 2 1 2 t [1  e(1 +2 )t ] 1 + 2 (1 + 2 )2
432
7
Renewal Theory and Its Applications
Remark Using the relationship of Equation (7.11) and results from the twostate continuoustime Markov chain, the renewal function can also be obtained in the same manner as in Example 7.9 for the interarrival distributions F (t) = pF1 (t) + (1  p)F2 (t) and F (t) = pF1 (t) + (1  p)(F1 F2 )(t) when Fi (t) = 1  ei t , t > 0, i = 1, 2. An important limit theorem is the central limit theorem for renewal processes. This states that, for large t, N (t) is approximately normally distributed with mean t/ and variance t 2 /3 , where and 2 are, respectively, the mean and variance of the interarrival distribution. That is, we have the following theorem which we state without proof. Central Limit Theorem for Renewal Processes N (t)  t/ t 2 /3 1 <x = 2
x 
t
lim P
ex
2 /2
dx
In addition, as might be expected from the central limit theorem for renewal processes, it can be shown that Var(N (t))/t converges to 2 /3 . That is, it can be shown that
t
lim
Var(N (t)) = 2 /3 t
(7.12)
Example 7.10 Two machines continually process an unending number of jobs. The time that it takes to process a job on machine 1 is a gamma random variable with parameters n = 4, = 2, whereas the time that it takes to process a job on machine 2 is uniformly distributed between 0 and 4. Approximate the probability that together the two machines can process at least 90 jobs by time t = 100.
Solution: If we let Ni (t) denote the number of jobs that machine i can process by time t, then {N1 (t), t 0} and {N2 (t), t 0} are independent renewal processes. The interarrival distribution of the first renewal process is gamma with parameters n = 4, = 2, and thus has mean 2 and variance 1. Correspondingly, the interarrival distribution of the second renewal process is uniform between 0 and 4, and thus has mean 2 and variance 16/12.
7.4.
Renewal Reward Processes
433
Therefore, N1 (100) is approximately normal with mean 50 and variance 100/8; and N2 (100) is approximately normal with mean 50 and variance 100/6. Hence, N1 (100) + N2 (100) is approximately normal with mean 100 and variance 175/6. Thus, with denoting the standard normal distribution function, we have P {N1 (100) + N2 (100) > 89.5} = P N1 (100) + N2 (100)  100 89.5  100 > 175/6 175/6 10.5 175/6 10.5 175/6 (1.944)
1
0.9741
7.4.
Renewal Reward Processes
A large number of probability models are special cases of the following model. Consider a renewal process {N (t), t 0} having interarrival times Xn , n 1, and suppose that each time a renewal occurs we receive a reward. We denote by Rn , the reward earned at the time of the nth renewal. We shall assume that the Rn , n 1, are independent and identically distributed. However, we do allow for the possibility that Rn may (and usually will) depend on Xn , the length of the nth renewal interval. If we let
N (t)
R(t) =
n=1
Rn
then R(t) represents the total reward earned by time t. Let E[R] = E[Rn ], E[X] = E[Xn ]
Proposition 7.3 If E[R] < and E[X] < , then
(a) with probability 1, (b) R(t) E[R] = t E[X] E[R(t)] E[R] = lim t t E[X]
t
lim
434
7
Renewal Theory and Its Applications
Proof We give the proof for (a) only. To prove this, write
R(t) = t
N (t) n=1 Rn
t
=
N (t) n=1 Rn
N (t)
N(t) t
By the strong law of large numbers we obtain
N (t) n=1 Rn
N (t) and by Proposition 7.1
E[R]
as t
N (t) 1 t E[X] The result thus follows.
as t
Remark (i) If we say that a cycle is completed every time a renewal occurs,
then Proposition 7.3 states that the longrun average reward per unit time is equal to the expected reward earned during a cycle divided by the expected length of a cycle. (ii) Although we have supposed that the reward is earned at the time of a renewal, the result remains valid when the reward is earned gradually throughout the renewal cycle.
Example 7.11 In Example 7.7 if we suppose that the amounts that the successive customers deposit in the bank are independent random variables having a common distribution H , then the rate at which deposits accumulatethat is, limt (total deposits by the time t)/tis given by H E[deposits during a cycle] = E[time of cycle] G + 1/ where G + 1/ is the mean time of a cycle, and H is the mean of the distribution H .
Example 7.12 (A Car Buying Model) The lifetime of a car is a continuous
random variable having a distribution H and probability density h. Mr. Brown has a policy that he buys a new car as soon as his old one either breaks down or reaches the age of T years. Suppose that a new car costs C1 dollars and also that an additional cost of C2 dollars is incurred whenever Mr. Brown's car breaks down. Under the assumption that a used car has no resale value, what is Mr. Brown's longrun average cost?
7.4.
Renewal Reward Processes
435
If we say that a cycle is complete every time Mr. Brown gets a new car, then it follows from Proposition 7.3 (with costs replacing rewards) that his longrun average cost equals E[cost incurred during a cycle] E[length of a cycle] Now letting X be the lifetime of Mr. Brown's car during an arbitrary cycle, then the cost incurred during that cycle will be given by C1 , C 1 + C2 , if X > T if X T
so the expected cost incurred over a cycle is C1 P {X > T } + (C1 + C2 )P {X Also, the length of the cycle is X, T, and so the expected length of a cycle is
T 0 T T 0
T } = C1 + C2 H (T )
if X T if X > T
xh(x) dx +
T h(x) dx =
xh(x) dx + T [1  H (T )]
Therefore, Mr. Brown's longrun average cost will be C1 + C2 H (T )
T 0
xh(x) dx + T [1  H (T )]
(7.13)
Now, suppose that the lifetime of a car (in years) is uniformly distributed over (0, 10), and suppose that C1 is 3 (thousand) dollars and C2 is 1 (thousand) 2 dollars. What value of T minimizes Mr. Brown's longrun average cost?
436
7
Renewal Theory and Its Applications
If Mr. Brown uses the value T , T average cost equals 3 + 1 (T /10) 2
T 0 (x/10) dx
10, then from Equation (7.13) his longrun
+ T (1  T /10)
= =
T 2 /20 + (10T 60 + T 20T  T 2
3 + T /20  T 2 )/10
We can now minimize this by using the calculus. Toward this end, let g(T ) = then g (T ) = Equating to 0 yields 20T  T 2 = (60 + T )(20  2T ) or, equivalently, T 2 + 120 T  1200 = 0 which yields the solutions T 9.25and T 129.25 Since T 10, it follows that the optimal policy for Mr. Brown would be to purchase a new car whenever his old car reaches the age of 9.25 years. (20T  T 2 )  (60 + T )(20  2T ) (20T  T 2 )2 60 + T 20T  T 2
Example 7.13 (Dispatching a Train) Suppose that customers arrive at a train depot in accordance with a renewal process having a mean interarrival time . Whenever there are N customers waiting in the depot, a train leaves. If the depot incurs a cost at the rate of nc dollars per unit time whenever there are n customers waiting, what is the average cost incurred by the depot? If we say that a cycle is completed whenever a train leaves, then the preceding is a renewal reward process. The expected length of a cycle is the expected time
7.4.
Renewal Reward Processes
437
required for N customers to arrive and, since the mean interarrival time is , this equals E[length of cycle] = N If we let Tn denote the time between the nth and (n + 1)st arrival in a cycle, then the expected cost of a cycle may be expressed as E[cost of a cycle] = E[c T1 + 2c T2 + + (N  1) c TN 1 ] which, since E[Tn ] = , equals c N (N  1) 2
Hence, the average cost incurred by the depot is c N (N  1) c(N  1) = 2N 2 Suppose now that each time a train leaves, the depot incurs a cost of six units. What value of N minimizes the depot's longrun average cost when c = 2, = 1? In this case, we have that the average cost per unit time when the depot uses N is 6 6 + c N (N  1)/2 =N 1+ N N By treating this as a continuous function of N and using the calculus, we obtain that the minimal value of N is N = 6 2.45 Hence, the optimal integral value of N is either 2 which yields a value 4, or 3 which also yields the value 4. Hence, either N = 2 or N = 3 minimizes the depot's average cost.
Example 7.14 Suppose that customers arrive at a singleserver system in
accordance with a Poisson process with rate . Upon arriving a customer must pass through a door that leads to the server. However, each time someone passes through, the door becomes locked for the next t units of time. An arrival finding a locked door is lost, and a cost c is incurred by the system. An arrival finding the door unlocked passes through to the server. If the server is free, the customer enters service; if the server is busy, the customer departs without service and a cost K is incurred. If the service time of a customer is exponential with rate , find the average cost per unit time incurred by the system.
438
7
Renewal Theory and Its Applications
Solution: The preceding can be considered to be a renewal reward process, with a new cycle beginning each time a customer arrives to find the door unlocked. This is so because whether or not the arrival finds the server free, the door will become locked for the next t time units and the server will be busy for a time X that is exponentially distributed with rate . (If the server is free, X is the service time of the entering customer; if the server is busy, X is the remaining service time of the customer in service.) Since the next cycle will begin at the first arrival epoch after a time t has passed, it follows that E[time of a cycle] = t + 1/ Let C1 denote the cost incurred during a cycle due to arrivals finding the door locked. Then, since each arrival in the first t time units of a cycle will result in a cost c, we have E[C1 ] = tc Also, let C2 denote the cost incurred during a cycle due to an arrival finding the door unlocked but the server busy. Then because a cost K is incurred if the server is still busy a time t after the cycle began and, in addition, the next arrival after that time occurs before the service completion, we see that E[C2 ] = Ket Consequently, average cost per unit time = tc + Ket /( + ) t + 1/ +
Example 7.15 Consider a manufacturing process that sequentially produces
items, each of which is either defective or acceptable. The following type of sampling scheme is often employed in an attempt to detect and eliminate most of the defective items. Initially, each item is inspected and this continues until there are k consecutive items that are acceptable. At this point 100% inspection ends and each successive item is independently inspected with probability . This partial inspection continues until a defective item is encountered, at which time 100% inspection is reinstituted, and the process begins anew. If each item is, independently, defective with probability q, (a) what proportion of items are inspected? (b) if defective items are removed when detected, what proportion of the remaining items are defective?
7.4.
Renewal Reward Processes
439
Remark Before starting our analysis, note that the preceding inspection
scheme was devised for situations in which the probability of producing a defective item changed over time. It was hoped that 100% inspection would correlate with times at which the defect probability was large and partial inspection when it was small. However, it is still important to see how such a scheme would work in the extreme case where the defect probability remains constant throughout. Solution: We begin our analysis by noting that we can treat the preceding as a renewal reward process with a new cycle starting each time 100% inspection is instituted. We then have proportion of items inspected = E[number inspected in a cycle] E[number produced in a cycle]
Let Nk denote the number of items inspected until there are k consecutive acceptable items. Once partial inspection beginsthat is, after Nk items have been producedsince each inspected item will be defective with probability q, it follows that the expected number that will have to be inspected to find a defective item is 1/q. Hence, E[number inspected in a cycle] = E[Nk ] + 1 q
In addition, since at partial inspection each item produced will, independently, be inspected and found to be defective with probability q, it follows that the number of items produced until one is inspected and found to be defective is 1/q, and so E[number produced in a cycle] = E[Nk ] + 1 q
Also, as E[Nk ] is the expected number of trials needed to obtain k acceptable items in a row when each item is acceptable with probability p = 1  q, it follows from Example 3.14 that E[Nk ] = Hence we obtain PI proportion of items that are inspected = (1/p)k (1/p)k  1 + 1/ 1 1 1 (1/p)k  1 + 2 + + k = p p p q
To answer (b), note first that since each item produced is defective with probability q it follows that the proportion of items that are both inspected and found to be defective is qPI . Hence, for N large, out of the first N items produced there will be (approximately) N qPI that are discovered to be defective and
440
7
Renewal Theory and Its Applications
thus removed. As the first N items will contain (approximately) N q defective items, it follows that there will be N q  N qPI defective items not discovered. Hence, proportion of the nonremoved items that are defective As the approximation becomes exact as N , we see that proportion of the nonremoved items that are defective = q(1  PI ) (1  qPI ) N q(1  PI ) N (1  qPI )
Example 7.16 (The Average Age of a Renewal Process) Consider a renewal process having interarrival distribution F and define A(t) to be the time at t since the last renewal. If renewals represent old items failing and being replaced by new ones, then A(t) represents the age of the item in use at time t. Since SN (t) represents the time of the last event prior to or at time t, we have that A(t) = t  SN (t) We are interested in the average value of the agethat is, in lim
s 0
s
A(t) dt s
To determine this quantity, we use renewal reward theory in the following way: Let us assume that at any time we are being paid money at a rate equal to the age of the renewal process at that time. That is, at time t, we are being paid at s rate A(t), and so 0 A(t) dt represents our total earnings by time s. As everything starts over again when a renewal occurs, it follows that
s 0
A(t) dt E[reward during a renewal cycle] s E[time of a renewal cycle]
Now since the age of the renewal process a time t into a renewal cycle is just t, we have reward during a renewal cycle =
0 X
t dt X2 2
=
7.4.
Renewal Reward Processes
441
where X is the time of the renewal cycle. Hence, we have that average value of age lim =
s 0
s
A(t) dt s (7.14)
E[X 2 ] 2E[X]
where X is an interarrival time having distribution function F .
Example 7.17 (The Average Excess of a Renewal Process) Another quantity
associated with a renewal process is Y (t), the excess or residual time at time t. Y (t) is defined to equal the time from t until the next renewal and, as such, represents the remaining (or residual) life of the item in use at time t. The average value of the excess, namely, lim
s 0
s
Y (t) dt s
also can be easily obtained by renewal reward theory. To do so, suppose that we are paid at time t at a rate equal to Y (t). Then our average reward per unit time will, by renewal reward theory, be given by average value of excess lim Y (t) dt s s E[reward during a cycle] = E[length of a cycle]
s 0
Now, letting X denote the length of a renewal cycle, we have that reward during a cycle =
0 X
(X  t) dt
= and thus the average value of the excess is
X2 2
average value of excess =
E[X 2 ] 2E[X]
which was the same result obtained for the average value of the age of renewal process.
442
7
Renewal Theory and Its Applications
7.5.
Regenerative Processes
Consider a stochastic process {X(t), t 0} with state space 0, 1, 2, . . . , having the property that there exist time points at which the process (probabilistically) restarts itself. That is, suppose that with probability one, there exists a time T1 , such that the continuation of the process beyond T1 is a probabilistic replica of the whole process starting at 0. Note that this property implies the existence of further times T2 , T3 , . . . , having the same property as T1 . Such a stochastic process is known as a regenerative process. From the preceding, it follows that T1 , T2 , . . . , constitute the arrival times of a renewal process, and we shall say that a cycle is completed every time a renewal occurs.
Examples (1) A renewal process is regenerative, and T1 represents the time
of the first renewal. (2) A recurrent Markov chain is regenerative, and T1 represents the time of the first transition into the initial state. We are interested in determining the longrun proportion of time that a regenerative process spends in state j . To obtain this quantity, let us imagine that we earn a reward at a rate 1 per unit time when the process is in state j and at rate 0 otherwise. That is, if I (s) represents the rate at which we earn at time s, then I (s) = and total reward earned by t =
0 t
1, 0,
if X(s) = j if X(s) = j
I (s) ds
As the preceding is clearly a renewal reward process that starts over again at the cycle time T1 , we see from Proposition 7.3 that average reward per unit time = E[reward by time T1 ] E[T1 ]
However, the average reward per unit is just equal to the proportion of time that the process is in state j . That is, we have the following.
Proposition 7.4 For a regenerative process, the longrun
proportion of time in state j = E[amount of time in j during a cycle] E[time of a cycle]
7.5.
Regenerative Processes
443
Remark If the cycle time T1 is a continuous random variable, then it can be
shown by using an advanced theorem called the "key renewal theorem" that the preceding is equal also to the limiting probability that the system is in state j at time t. That is, if T1 is continuous, then
t
lim P {X(t) = j } =
E[amount of time in j during a cycle] E[time of a cycle]
Example 7.18 Consider a positive recurrent continuous time Markov chain that is initially in state i. By the Markovian property, each time the process reenters state i it starts over again. Thus returns to state i are renewals and constitute the beginnings of new cycles. By Proposition 7.4, it follows that the longrun
proportion of time in state j = E[amount of time in j during an i i cycle] ii
where ii represents the mean time to return to state i. If we take j to equal i, then we obtain proportion of time in state i = 1/vi ii
Example 7.19 (A Queueing System with Renewal Arrivals) Consider a waiting time system in which customers arrive in accordance with an arbitrary renewal process and are served one at time by a single server having an arbitrary service distribution. If we suppose that at time 0 the initial customer has just arrived, then {X(t), t 0} is a regenerative process, where X(t) denotes the number of customers in the system at time t. The process regenerates each time a customer arrives and finds the server free.
Example 7.20 Although a system needs only a single machine to function, it maintains an additional machine as a backup. A machine in use functions for a random time with density function f and then fails. If a machine fails while the other one is in working condition, then the latter is put in use and, simultaneously, repair begins on the one that just failed. If a machine fails while the other machine is in repair, then the newly failed machine waits until the repair is completed; at that time the repaired machine is put in use and, simultaneously, repair begins on the recently failed one. All repair times have density function g. Find P0 , P1 , P2 , where Pi is the longrun proportion of time that exactly i of the machines are in working condition.
Solution: Let us say that the system is in state i whenever i machines are in working condition i = 0, 1, 2. It is then easy to see that every time the system enters state 1 it probabilistically starts over. That is, the system restarts every
444
7
Renewal Theory and Its Applications
time that a machine is put in use while, simultaneously, repair begins on the other one. Say that a cycle begins each time the system enters state 1. If we let X denote the working time of the machine put in use at the beginning of a cycle, and let R be the repair time of the other machine, then the length of the cycle, call it Tc , can be expressed as Tc = max(X, R) The preceding follows when X R, because, in this case, the machine in use fails before the other one has been repaired, and so a new cycle begins when that repair is completed. Similarly, it follows when R < X, because then the repair occurs first, and so a new cycle begins when the machine in use fails. Also, let Ti , i = 0, 1, 2, be the amount of time that the system is in state i during a cycle. Then, because the amount of time during a cycle that neither machine is working is R  X provided that this quantity is positive or 0 otherwise, we have T0 = (R  X)+ Similarly, because the amount of time during the cycle that a single machine is working is min(X, R), we have T1 = min(X, R) Finally, because the amount of time during the cycle that both machines are working is X  R if this quantity is positive or 0 otherwise, we have T2 = (X  R)+ Hence, we obtain that P0 = P1 = P2 = E[(R  X)+ ] E[max(X, R)] E[min(X, R)] E[max(X, R)] E[(X  R)+ ] E[max(X, R)]
That P0 + P1 + P2 = 1 follows from the easily checked identity max(x, r) = min(x, r) + (x  r)+ + (r  x)+
7.5.
Regenerative Processes
445
The preceding expectations can be computed as follows:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 r r r
E[max(X, R)] = = E[(R  X)+ ] = = E[min(X, R)] = = E[(X  R)+ ] =
max(x, r)f (x) g(r) dx dr rf (x) g(r) dx dr +
0 r
xf (x) g(r) dx dr
(r  x)+ f (x) g(r) dx dr
(r  x)f (x) g(r) dx dr min(x, r) f (x) g(r) dx dr xf (x) g(r) dx dr +
0 r
rf (x) g(r) dx dr
(x  r) f (x) g(r) dr dx
7.5.1. Alternating Renewal Processes Another example of a regenerative process is provided by what is known as an alternating renewal process, which considers a system that can be in one of two states: on or off. Initially it is on, and it remains on for a time Z1 ; it then goes off and remains off for a time Y1 . It then goes on for a time Z2 ; then off for a time Y2 ; then on, and so on. We suppose that the random vectors (Zn , Yn ), n 1 are independent and identically distributed. That is, both the sequence of random variables {Zn } and the sequence {Yn } are independent and identically distributed; but we allow Zn and Yn to be dependent. In other words, each time the process goes on, everything starts over again, but when it then goes off, we allow the length of the off time to depend on the previous on time. Let E[Z] = E[Zn ] and E[Y ] = E[Yn ] denote, respectively, the mean lengths of an on and off period. We are concerned with Pon , the longrun proportion of time that the system is on. If we let Xn = Yn + Zn , n 1
446
7
Renewal Theory and Its Applications
then at time X1 the process starts over again. That is, the process starts over again after a complete cycle consisting of an on and an off interval. In other words, a renewal occurs whenever a cycle is completed. Therefore, we obtain from Proposition 7.4 that Pon = = E[Z] E[Y ] + E[Z] E[on] E[on] + E[off] (7.15)
Also, if we let Poff denote the longrun proportion of time that the system is off, then Poff = 1  Pon = E[off] E[on] + E[off] (7.16)
Example 7.21 (A Production Process) One example of an alternating renewal
process is a production process (or a machine) which works for a time Z1 , then breaks down and has to be repaired (which takes a time Y1 ), then works for a time Z2 , then is down for a time Y2 , and so on. If we suppose that the process is as good as new after each repair, then this constitutes an alternating renewal process. It is worthwhile to note that in this example it makes sense to suppose that the repair time will depend on the amount of time the process had been working before breaking down.
Example 7.22 The rate a certain insurance company charges its policyholders alternates between r1 and r0 . A new policyholder is initially charged at a rate of r1 per unit time. When a policyholder paying at rate r1 has made no claims for the most recent s time units, then the rate charged becomes r0 per unit time. The rate charged remains at r0 until a claim is made, at which time it reverts to r1 . Suppose that a given policyholder lives forever and makes claims at times chosen according to a Poisson process with rate , and find (a) Pi , the proportion of time that the policyholder pays at rate ri , i = 0, 1; (b) the longrun average amount paid per unit time. Solution: If we say that the system is "on" when the policyholder pays at rate r1 and "off" when she pays at rate r0 , then this onoff system is an alternating renewal process with a new cycle starting each time a claim is made. If X is the time between successive claims, then the on time in the cycle is the
7.5.
Regenerative Processes
447
smaller of s and X. (Note that if X < s, then the off time in the cycle is 0.) Since X is exponential with rate , the preceding yields that E[on time in cycle] = E[min(X, s)] =
0 s
xex dx + ses
= Since E[X] = 1/, we see that P1 = and
1 (1  es )
E[on time in cycle] = 1  es E[X] P0 = 1  P1 = es
The longrun average amount paid per unit time is r0 P0 + r1 P1 = r1  (r1  r0 )es
Example 7.23 (The Age of a Renewal Process) Suppose we are interested in
determining the proportion of time that the age of a renewal process is less than some constant c. To do so, let a cycle correspond to a renewal, and say that the system is "on" at time t if the age at t is less than or equal to c, and say it is "off" if the age at t is greater than c. In other words, the system is "on" the first c time units of a renewal interval, and "off" the remaining time. Hence, letting X denote a renewal interval, we have, from Equation (7.15), proportion of time age is less than c = = = = E[min(X, c)] E[X]
0 P {min(X, c 0 P {X
c) > x} dx E[X]
> x} dx E[X] E[X] (7.17)
c 0 (1  F (x)) dx
where F is the distribution function of X and where we have used the identity that for a nonnegative random variable Y E[Y ] =
0
P {Y > x} dx
448
7
Renewal Theory and Its Applications
Example 7.24 (The Excess of a Renewal Process) Let us now consider the longrun proportion of time that the excess of a renewal process is less than c. To determine this quantity, let a cycle correspond to a renewal interval and say that the system is on whenever the excess of the renewal process is greater than or equal to c and that it is off otherwise. In other words, whenever a renewal occurs the process goes on and stays on until the last c time units of the renewal interval when it goes off. Clearly this is an alternating renewal process, and so we obtain from Equation (7.16) that
longrun proportion of time the excess is less than c = E[off time in cycle] E[cycle time]
If X is the length of a renewal interval, then since the system is off the last c time units of this interval, it follows that the off time in the cycle will equal min(X, c). Thus, longrun proportion of time the excess is less than c = = E[min(X, c)] E[X]
c 0 (1  F (x)) dx
E[X]
where the final equality follows from Equation (7.17). Thus, we see from the result of Example 7.23 that the longrun proportion of time that the excess is less than c and the longrun proportion of time that the age is less than c are equal. One way to understand this equivalence is to consider a renewal process that has been in operation for a long time and then observe it going backwards in time. In doing so, we observe a counting process where the times between successive events are independent random variables having distribution F . That is, when we observe a renewal process going backwards in time we again observe a renewal process having the same probability structure as the original. Since the excess (age) at any time for the backwards process corresponds to the age (excess) at that time for the original renewal process (see Figure 7.3), it follows that all longrun properties of the age and the excess must be equal.
Figure 7.3. Arrowheads indicate direction of time.
7.5.
Regenerative Processes
449
Example 7.25 (The Busy Period of the M/G/ Queue) The infinite server
queueing system in which customers arrive according to a Poisson process with rate , and have a general service distribution G, was analyzed in Section 5.3, where it was shown that the number of customers in the system at time t is Poisson t distributed with mean 0 G(t)dt. If we say that the system is busy when there is at least one customer in the system and is idle when the system is empty, find E[B], the expected length of a busy period. Solution: If we say that the system is on when there is at least one customer in the system, and off when the system is empty, then we have an alternating renewal process. Because 0 G(t)dt = E[S], where E[S] is the mean of the service distribution G, it follows from the result of Section 5.3 that
t
lim P {system off at t} = eE[S]
Consequently, from alternating renewal process theory we obtain eE[S] = E[off time in cycle] E[cycle time]
But when the system goes off, it remains off only up to the time of the next arrival, giving that E[off time in cycle] = 1/ Because E[on time in cycle] = E[B] we obtain that eE[S] = or 1 E[B] = (eE[S]  1) If is the mean interarrival time, then the distribution function Fe , defined by Fe (x) =
0 x
1/ 1/ + E[B]
1  F (y) dy
is called the equilibrium distribution of F . From the preceding, it follows that Fe (x) represents the longrun proportion of time that the age, and the excess, of the renewal process is less than or equal to x.
450
7
Renewal Theory and Its Applications
Example 7.26 (An Inventory Example) Suppose that customers arrive at a
specified store in accordance with a renewal process having interarrival distribution F. Suppose that the store stocks a single type of item and that each arriving customer desires a random amount of this commodity, with the amounts desired by the different customers being independent random variables having the common distribution G. The store uses the following (s, S) ordering policy: If its inventory level falls below s then it orders enough to bring its inventory up to S. That is, if the inventory after serving a customer is x, then the amount ordered is S  x, 0, if x < s if x s
The order is assumed to be instantaneously filled. For a fixed value y, s y S, suppose that we are interested in determining the longrun proportion of time that the inventory on hand is at least as large as y. To determine this quantity, let us say that the system is "on" whenever the inventory level is at least y and is "off" otherwise. With these definitions, the system will go on each time that a customer's demand causes the store to place an order that results in its inventory level returning to S. Since whenever this occurs a customer must have just arrived it follows that the times until succeeding customers arrive will constitute a renewal process with interarrival distribution F ; that is, the process will start over each time the system goes back on. Thus, the on and off periods so defined constitute an alternating renewal process, and from Equation (7.15) we have that longrun proportion of time inventory y= E[on time in a cycle] E[cycle time] (7.18)
Now, if we let D1 , D2 , . . . denote the successive customer demands, and let Nx = min(n : D1 + + Dn > S  x) (7.19)
then it is the Ny customer in the cycle that causes the inventory level to fall below y, and it is the Ns customer that ends the cycle. As a result, if we let Xi , i 1, denote the interarrival times of customers, then
Ny
on time in a cycle =
i=1 Ns
Xi
(7.20)
cycle time =
i=1
Xi
(7.21)
7.5.
Regenerative Processes
451
Assuming that the interarrival times are independent of the successive demands, we have that
Ny Ny
E
i=1
Xi = E E
i=1
Xi Ny
= E[Ny E[X]] = E[X]E[Ny ] Similarly,
Ns
E
i=1
Xi = E[X]E[Ns ]
Therefore, from Equations (7.18), (7.20), and (7.21) we see that longrun proportion of time inventory y= E[Ny ] E[Ns ] (7.22)
However, as the Di , i 1, are independent and identically distributed nonnegative random variables with distribution G, it follows from Equation (7.19) that Nx has the same distribution as the index of the first event to occur after time S  x of a renewal process having interarrival distribution G. That is, Nx  1 would be the number of renewals by time S  x of this process. Hence, we see that E[Ny ] = m(S  y) + 1, E[Ns ] = m(S  s) + 1 where
m(t) =
n=1
Gn (t)
From Equation (7.22), we arrive at longrun proportion of time inventory y= m(S  y) + 1 , m(S  s) + 1 s y S
For instance, if the customer demands are exponentially distributed with mean 1/, then longrun proportion of time inventory y= (S  y) + 1 , (S  s) + 1 s y S
452
7
Renewal Theory and Its Applications
7.6.
SemiMarkov Processes
Consider a process that can be in state 1 or state 2 or state 3. It is initially in state 1 where it remains for a random amount of time having mean 1 , then it goes to state 2 where it remains for a random amount of time having mean 2 , then it goes to state 3 where it remains for a mean time 3 , then back to state 1, and so on. What proportion of time is the process in state i, i = 1, 2, 3? If we say that a cycle is completed each time the process returns to state 1, and if we let the reward be the amount of time we spend in state i during that cycle, then the preceding is a renewal reward process. Hence, from Proposition 7.3 we obtain that Pi , the proportion of time that the process is in state i, is given by Pi = i , 1 + 2 + 3 i = 1, 2, 3
Similarly, if we had a process which could be in any of N states 1, 2, . . . , N and which moved from state 1 2 3 N  1 N 1, then the longrun proportion of time that the process spends in state i is Pi = i , 1 + 2 + + N i = 1, 2, . . . , N
where i is the expected amount of time the process spends in state i during each visit. Let us now generalize the preceding to the following situation. Suppose that a process can be in any one of N states 1, 2, . . . , N , and that each time it enters state i it remains there for a random amount of time having mean i and then makes a transition into state j with probability Pij . Such a process is called a semiMarkov process. Note that if the amount of time that the process spends in each state before making a transition is identically 1, then the semiMarkov process is just a Markov chain. Let us calculate Pi for a semiMarkov process. To do so, we first consider i the proportion of transitions that take the process into state i. Now if we let Xn denote the state of the process after the nth transition, then {Xn , n 0} is a Markov chain with transition probabilities Pij , i, j = 1, 2, . . . , N . Hence, i will just be the limiting (or stationary) probabilities for this Markov chain (Section 4.4). That is, i will be the unique nonnegative solution of
We shall assume that there exists a solution of Equation (7.23). That is, we assume that all of the
states in the Markov chain communicate.
7.6.
N
SemiMarkov Processes
453
i = 1,
i=1 N
i =
j =1
j Pj i ,
i = 1, 2, . . . , N
(7.23)
Now since the process spends an expected time i in state i whenever it visits that state, it seems intuitive that Pi should be a weighted average of the i where i is weighted proportionately to i . That is, Pi = i i N j =1 j j , i = 1, 2, . . . , N (7.24)
where the i are given as the solution to Equation (7.23).
Example 7.27 Consider a machine that can be in one of three states: good
condition, fair condition, or broken down. Suppose that a machine in good condition will remain this way for a mean time 1 and then will go to either the fair condition or the broken condition with respective probabilities 3 and 1 . A ma4 4 chine in fair condition will remain that way for a mean time 2 and then will break down. A broken machine will be repaired, which takes a mean time 3 , and when repaired will be in good condition with probability 2 and fair condition with 3 probability 1 . What proportion of time is the machine in each state? 3 Solution: i satisfy Letting the states be 1, 2, 3, we have by Equation (7.23) that the
1 + 2 + 3 = 1, 1 = 2 3 , 3 2 = 3 1 + 1 3 , 4 3 3 = 1 1 + 2 4 The solution is 1 =
4 15 ,
2 = 1 , 3
3 =
2 5
454
7
Renewal Theory and Its Applications
Hence, from Equation (7.24) we obtain that Pi , the proportion of time the machine is in state i, is given by P1 = P2 = P3 = 41 , 41 + 52 + 63 52 , 41 + 52 + 63 63 41 + 52 + 63
For instance, if 1 = 5, 2 = 2, 3 = 1, then the machine will be in good 5 condition 5 of the time, in fair condition 18 of the time, in broken condition 1 9 6 of the time.
Remark When the distributions of the amount of time spent in each state dur
ing a visit are continuous, then Pi also represents the limiting (as t ) probability that the process will be in state i at time t. tion is discrete and is such that P {X = i} = pi , i 1
Example 7.28 Consider a renewal process in which the interarrival distribu
where X represents an interarrival random variable. Let L(t) denote the length of the renewal interval that contains the point t [that is, if N (t) is the number of renewals by time t and Xn the nth interarrival time, then L(t) = XN (t)+1 ]. If we think of each renewal as corresponding to the failure of a lightbulb (which is then replaced at the beginning of the next period by a new bulb), then L(t) will equal i if the bulb in use at time t dies in its ith period of use. It is easy to see that L(t) is a semiMarkov process. To determine the proportion of time that L(t) = j , note that each time a transition occursthat is, each time a renewal occursthe next state will be j with probability pj . That is, the transition probabilities of the embedded Markov chain are Pij = pj . Hence, the limiting probabilities of this embedded chain are given by j = pj and, since the mean time the semiMarkov process spends in state j before a transition occurs is j , it follows that the longrun proportion of time the state is j is Pj = jpj i ipi
7.7.
The Inspection Paradox
455
7.7.
The Inspection Paradox
Suppose that a piece of equipment, say, a battery, is installed and serves until it breaks down. Upon failure it is instantly replaced by a like battery, and this process continues without interruption. Letting N (t) denote the number of batteries that have failed by time t, we have that {N (t), t 0} is a renewal process. Suppose further that the distribution F of the lifetime of a battery is not known and is to be estimated by the following sampling inspection scheme. We fix some time t and observe the total lifetime of the battery that is in use at time t. Since F is the distribution of the lifetime for all batteries, it seems reasonable that it should be the distribution for this battery. However, this is the inspection paradox for it turns out that the battery in use at time t tends to have a larger lifetime than an ordinary battery. To understand the preceding socalled paradox, we reason as follows. In renewal theoretic terms what we are interested in is the length of the renewal interval containing the point t. That is, we are interested in XN (t)+1 = SN (t)+1  SN (t) (see Figure 7.2). To calculate the distribution of XN (t)+1 we condition on the time of the last renewal prior to (or at) time t. That is, P {XN (t)+1 > x} = E[P {XN (t)+1 > xSN (t) = t  s}] where we recall (Figure 7.2) that SN (t) is the time of the last renewal prior to (or at) t. Since there are no renewals between t  s and t, it follows that XN (t)+1 must be larger than x if s > x. That is, P {XN (t)+1 > xSN (t) = t  s} = 1 if s > x (7.25)
On the other hand, suppose that s x. As before, we know that a renewal occurred at time t  s and no additional renewals occurred between t  s and t, and we ask for the probability that no renewals occur for an additional time x  s. That is, we are asking for the probability that an interarrival time will be greater than x given that it is greater than s. Therefore, for s x, P {XN (t)+1 > xSN (t) = t  s} = P {interarrival time > xinterarrival time > s} = P {interarrival time > x}/P {interarrival time > s} 1  F (x) = 1  F (s) 1  F (x)
(7.26)
456
7
Renewal Theory and Its Applications
Figure 7.4.
Hence, from Equations (7.25) and (7.26) we see that, for all s, P {XN (t)+1 > xSN (t) = t  s} Taking expectations on both sides yields that P {XN (t)+1 > x} 1  F (x) (7.27) 1  F (x)
However, 1  F (x) is the probability that an ordinary renewal interval is larger than x, that is, 1  F (x) = P {Xn > x}, and thus Equation (7.27) is a statement of the inspection paradox that the length of the renewal interval containing the point t tends to be larger than an ordinary renewal interval.
Remark To obtain an intuitive feel for the socalled inspection paradox, reason
as follows. We think of the whole line being covered by renewal intervals, one of which covers the point t. Is it not more likely that a larger interval, as opposed to a shorter interval, covers the point t? We can explicitly calculate the distribution of XN (t)+1 when the renewal process is a Poisson process. [Note that, in the general case, we did not need to calculate explicitly P {XN (t)+1 > x} to show that it was at least as large as 1  F (x).] To do so we write XN (t)+1 = A(t) + Y (t) where A(t) denotes the time from t since the last renewal, and Y (t) denotes the time from t until the next renewal (see Figure 7.4). A(t) is the age of the process at time t (in our example it would be the age at time t of the battery in use at time t), and Y (t) is the excess life of the process at time t (it is the additional time from t until the battery fails). Of course, it is true that A(t) = t  SN (t) , and Y (t) = SN (t)+1  t. To calculate the distribution of XN (t)+1 we first note the important fact that, for a Poisson process, A(t) and Y (t) are independent. This follows since by the memoryless property of the Poisson process, the time from t until the next renewal will be exponentially distributed and will be independent of all that has previously occurred [including, in particular, A(t)]. In fact, this shows that if {N (t), t 0}
7.7.
The Inspection Paradox
457
is a Poisson process with rate , then P {Y (t) x} = 1  ex (7.28)
The distribution of A(t) may be obtained as follows P {0 renewals in [t  x, t]}, 0, ex , 0, if x t if x > t if x t
P {A(t) > x} = =
if x > t
or, equivalently, P {A(t) x} = 1  ex , 1, x t x>t
(7.29)
Hence, by the independence of Y (t) and A(t) the distribution of XN (t)+1 is just the convolution of the exponential distribution equation (7.28) and the distribution of equation (7.29). It is interesting to note that for t large, A(t) approximately has an exponential distribution. Thus, for t large, XN (t)+1 has the distribution of the convolution of two identically distributed exponential random variables, which by Section 5.2.3, is the gamma distribution with parameters (2, ). In particular, for t large, the expected length of the renewal interval containing the point t is approximately twice the expected length of an ordinary renewal interval. Using the results obtained in Examples 7.16 and 7.17 concerning the average values of the age and of the excess, it follows from the identity XN (t)+1 = A(t) + Y (t) that the average length of the renewal interval containing a specified point is
s 0
s
lim
XN (t)+1 dt E[X 2 ] = s E[X]
where X has the interarrival distribution. Because, except for when X is a constant, E[X 2 ] > (E[X])2 , this average value is, as expected from the inspection paradox, greater than the expected value of an ordinary renewal interval.
458
7
Renewal Theory and Its Applications
We can use an alternating renewal process argument to determine the longrun proportion of time that XN (t)+1 is greater than c. To do so, let a cycle correspond to a renewal interval, and say that the system is on at time t if the renewal interval containing t is of length greater than c (that is, if XN (t)+1 > c), and say that the system is off at time t otherwise. In other words, the system is always on during a cycle if the cycle time exceeds c or is always off during the cycle if the cycle time is less than c. Thus, if X is the cycle time, we have on time in cycle = X, 0, if X > c if X c
Therefore, we obtain from alternating renewal process theory that longrun proportion of timeXN (t)+1 > c = = where f is the density function of an interarrival. E[on time in cycle] E[cycle time]
c xf (x) dx
7.8.
Computing the Renewal Function
The difficulty with attempting to use the identity
m(t) =
n=1
Fn (t)
to compute the renewal function is that the determination of Fn (t) = P {X1 + + Xn t} requires the computation of an ndimensional integral. Following, we present an effective algorithm which requires as inputs only onedimensional integrals. Let Y be an exponential random variable having rate , and suppose that Y is independent of the renewal process {N (t), t 0}. We start by determining E[N(Y )], the expected number of renewals by the random time Y . To do so, we first condition on X1 , the time of the first renewal. This yields E[N(Y )] =
0
E[N (Y )X1 = x]f (x) dx
(7.30)
where f is the interarrival density. To determine E[N (Y )X1 = x], we now condition on whether or not Y exceeds x. Now, if Y < x, then as the first renewal occurs at time x, it follows that the number of renewals by time Y is equal to 0.
7.8.
Computing the Renewal Function
459
On the other hand, if we are given that x < Y , then the number of renewals by time Y will equal 1 (the one at x) plus the number of additional renewals between x and Y . But by the memoryless property of exponential random variables, it follows that, given that Y > x, the amount by which it exceeds x is also exponential with rate , and so given that Y > x the number of renewals between x and Y will have the same distribution as N (Y ). Hence, E[N(Y )X1 = x, Y < x] = 0, E[N(Y )X1 = x, Y > x] = 1 + E[N (Y )] and so, E[N(Y )X1 = x] = E[N (Y )X1 = x, Y < x]P {Y < xX1 = x} + E[N (Y )X1 = x, Y > x]P {Y > xX1 = x} = E[N (Y )X1 = x, Y > x]P {Y > x} since Y and X1 are independent = (1 + E[N (Y )])ex Substituting this into Equation (7.30) gives E[N(Y )] = (1 + E[N (Y )])
0
exf (x) dx
or E[N (Y )] = E[eX ] 1  E[eX ] (7.31)
where X has the renewal interarrival distribution. If we let = 1/t, then Equation (7.31) presents an expression for the expected number of renewals (not by time t, but) by a random exponentially distributed time with mean t. However, as such a random variable need not be close to its mean (its variance is t 2 ), Equation (7.31) need not be particularly close to m(t). To obtain an accurate approximation suppose that Y1 , Y2 , . . . , Yn are independent exponentials with rate and suppose they are also independent of the renewal process. Let, for r = 1, . . . , n, mr = E[N (Y1 + + Yr )] To compute an expression for mr , we again start by conditioning on X1 , the time of the first renewal. mr =
0
E[N (Y1 + + Yr )X1 = x] f (x) dx
(7.32)
460
7
Renewal Theory and Its Applications
To determine the foregoing conditional expectation, we now condition on the j number of partial sums i=1 Yi , j = 1, . . . , r, that are less than x. Now, if all r partial sums are less than xthat is, if r Yi < xthen clearly the numi=1 ber of renewals by time r Yi is 0. On the other hand, given that k, k < r, of i=1 these partial sums are less than x, it follows from the lack of memory property of the exponential that the number of renewals by time r Yi will have the same i=1 distribution as 1 plus N(Yk+1 + + Yr ). Hence,
j
E N(Y1 + + Yr ) X1 = x, k of the sums
i=1
Yi are less than x
=
0, 1 + mrk ,
if k = r if k < r
(7.33)
To determine the distribution of the number of the partial sums that are less than j x, note that the successive values of these partial sums i=1 Yi , j = 1, . . . , r, have the same distribution as the first r event times of a Poisson process with rate (since each successive partial sum is the previous sum plus an independent exponential with rate ). Hence, it follows that, for k < r,
j
P k of the partial sums
i=1
Yi are less than x X1 = x
=
ex (x)k k!
(7.34)
Upon substitution of Equations (7.33) and (7.34) into Equation (7.32), we obtain mr =
0 r1 k=0
(1 + mrk )
ex (x)k f (x) dx k!
or, equivalently, mr =
r1 k X ](k /k!) + E[eX ] k=1 (1 + mrk )E[X e 1  E[eX ]
(7.35)
If we set = n/t, then starting with m1 given by Equation (7.31), we can use Equation (7.35) to recursively compute m2 , . . . , mn . The approximation of m(t) = E[N(t)] is given by mn = E[N (Y1 + + Yn )]. Since Y1 + + Yn is the sum of n independent exponential random variables each with mean t/n, it follows that it is (gamma) distributed with mean t and variance nt 2 /n2 = t 2 /n. Hence, by
7.9.
Applications to Patterns
461
Table 7.1 Fi i 1 1 1 1 2 2 2 2 2 2 3 3 3 3 t 1 2 5 10 0.1 0.3 0.5 1 3 10 0.1 0.3 1 3
Approximating m(t)
Exact m(t) 0.2838 0.7546 2.250 4.75 0.1733 0.5111 0.8404 1.6400 4.7389 15.5089 0.2819 0.7638 2.0890 5.4444 n=1 0.3333 0.8000 2.273 4.762 0.1681 0.4964 0.8182 1.6087 4.7143 15.5000 0.2692 0.7105 2.0000 5.4000 n=3 0.3040 0.7697 2.253 4.751 0.1687 0.4997 0.8245 1.6205 4.7294 15.5081 0.2772 0.7421 2.0556 5.4375 Approximation n = 10 0.2903 0.7586 2.250 4.750 0.1689 0.5010 0.8273 1.6261 4.7350 15.5089 0.2804 0.7567 2.0789 5.4437 n = 25 0.2865 0.7561 2.250 4.750 0.1690 0.5014 0.8281 1.6277 4.7363 15.5089 0.2813 0.7609 2.0850 5.4442 n = 50 0.2852 0.7553 2.250 4.750   0.8283 1.6283 4.7367 15.5089   2.0870 5.4443
choosing n large, n Yi will be a random variable having most of its probability i=1 concentrated about t, and so E[N ( n Yi )] should be quite close to E[N (t)]. i=1 [Indeed, if m(t) is continuous at t, it can be shown that these approximations converge to m(t) as n goes to infinity.]
Example 7.29 Table 7.1 compares the approximation with the exact value for the distributions Fi with densities fi , i = 1, 2, 3, which are given by
f1 (x) = xex , 1  F2 (x) = 0.3ex + 0.7e2x , 1  F3 (x) = 0.5ex + 0.5e5x
7.9.
Applications to Patterns
A counting process with independent interarrival times X1 , X2 , . . . is said to be a delayed or general renewal process if X1 has a different distribution from the identically distributed random variables X2 , X3 , . . . . That is, a delayed renewal process is a renewal process in which the first interarrival time has a different distribution than the others. Delayed renewal processes often arise in
462
7
Renewal Theory and Its Applications
practice and it is important to note that all of the limiting theorems about N(t), the number of events by time t, remain valid. For instance, it remains true that E[N(t)] 1 t and Var(N(t)) 2 /3 t as t
where and 2 are the expected value and variance of the interarrivals Xi , i > 1. 7.9.1. Patterns of Discrete Random Variables Let X1 , X2 , . . . be independent with P {Xi = j } = p(j ), j 0, and let T denote the first time the pattern x1 , . . . , xr occurs. If we say that a renewal occurs at time n, n r, if (Xnr+1 , . . . , Xn ) = (x1 , . . . , xr ), then N (n), n 1, is a delayed renewal process, where N (n) denotes the number of renewals by time n. It follows that 1 E[N (n)] n 2 Var(N(n)) 3 n as n as n (7.36) (7.37)
where and are, respectively, the mean and standard deviation of the time between successive renewals. Whereas, in Section 3.6.4, we showed how to compute the expected value of T , we will now show how to use renewal theory results to compute both its mean and its variance. To begin, let I (i) equal 1 if there is a renewal at time i and let it be 0 otherwise, i r. Also, let p = r p(xi ). Since, i=1 P {I (i) = 1} = P {Xir+1 = i1 , . . . , Xi = ir } = p it follows that I (i), i r, are Bernoulli random variables with parameter p. Now,
n
N (n) =
i=r
I (i)
so
n
E[N (n)] =
i=r
E[I (i)] = (n  r + 1)p
Dividing by n and then letting n give, from Equation (7.36), = 1/p (7.38)
7.9.
Applications to Patterns
463
That is, the mean time between successive occurrences of the pattern is equal to 1/p. Also, Var(N(n)) 1 = n n =
n
Var(I (i)) +
i=r
2 n
n1
Cov(I (i), I (j ))
i=r n j >i n1
nr +1 2 p(1  p) + n n
Cov(I (i), I (j ))
i=r i<j min(i+r1, n)
where the final equality used the fact that I (i) and I (j ) are independent, and thus have zero covariance, when i  j  r. Letting n , and using the fact that Cov(I (i), I (j )) depends on i and j only through j  i, gives Var(N(n)) p(1  p) + 2 n
r1
Cov(I (r), I (r + j ))
j =1
Therefore, using Equations (7.37) and (7.38), we see that
r1
2 = p 2 (1  p) + 2p 3
Cov(I (r), I (r + j ))
j =1
(7.39)
Let us now consider the amount of "overlap" in the pattern. The overlap, equal to the number of values at the end of one pattern that can be used as the beginning part of the next pattern, is said to be of size k, k > 0, if k = max{j < r : (irj +1 , . . . , ir ) = (i1 , . . . , ij )} and is of size 0 if for all k = 1, . . . , r  1, (irk+1 , . . . , ir ) = (i1 , . . . , ik ). Thus, for instance, the pattern 0, 0, 1, 1 has overlap 0, whereas 0, 0, 1, 0, 0 has overlap 2. We consider two cases. Case 1: The Pattern Has Overlap 0 In this case, N(n), n 1, is an ordinary renewal process and T is distributed as an interarrival time with mean and variance 2 . Hence, we have the following
464
7
Renewal Theory and Its Applications
from Equation (7.38): E[T ] = = 1 p (7.40)
Also, since two patterns cannot occur within a distance less than r of each other, it follows that I (r)I (r + j ) = 0 when 1 j r  1. Hence, Cov(I (r), I (r + j )) = E[I (r)]E[I (r + j )] = p 2 , Hence, from Equation (7.39), we obtain Var(T ) = 2 = p 2 (1  p)  2p 3 (r  1)p 2 = p 2  (2r  1)p 1 (7.41) if 1 j r 1
Remark In cases of "rare" patterns, if the pattern hasn't yet occurred by some
time n, then it would seem that we would have no reason to believe that the remaining time would be much less than if we were just beginning from scratch. That is, it would seem that the distribution is approximately memoryless and would thus be approximately exponentially distributed. Thus, since the variance of an exponential is equal to its mean squared, we would expect when is large that Var(T ) E 2 [T ], and this is borne out by the preceding, which states that Var(T ) = E 2 [T ]  (2r  1)E[T ].
Example 7.30 Suppose we are interested in the number of times that a fair
coin needs to be flipped before the pattern h, h, t, h, t occurs. For this pattern, 1 r = 5, p = 32 , and the overlap is 0. Hence, from Equations (7.40) and (7.41) E[T ] = 32, and Var(T )/E 2 [T ] = 0.71875 On the other hand, if p(i) = i/10, i = 1, 2, 3, 4 and the pattern is 1, 2, 1, 4, 1, 3, 2 then r = 7, p = 3/625,000, and the overlap is 0. Thus, again from Equations (7.40) and (7.41), we see that in this case E[T ] = 208,333.33, Var(T ) = 4.34 1010 , Var(T )/E 2 [T ] = 0.99994 Var(T ) = 322  9 32 = 736,
7.9.
Applications to Patterns
465
Case 2: The Overlap Is of Size k In this case, T = Ti1 ,...,ik + T where Ti1 ,...,ik is the time until the pattern i1 , . . . , ik appears and T , distributed as an interarrival time of the renewal process, is the additional time that it takes, starting with i1 , . . . , ik , to obtain the pattern i1 , . . . , ir . Because these random variables are independent, we have E[T ] = E[Ti1 ,...,ik ] + E[T ] Var(T ) = Var(Ti1 ,...,ik ) + Var(T ) Now, from Equation (7.38) E[T ] = = p 1 (7.44)
(7.42) (7.43)
Also, since no two renewals can occur within a distance r  k  1 of each other, it follows that I (r)I (r + j ) = 0 if 1 j r  k  1. Therefore, from Equation (7.39), we see that Var(T ) = 2 = p 2 (1  p) + 2p 3
r1
E[I (r)I (r + j )]  (r  1)p 2
j =rk r1
= p 2  (2r  1)p 1 + 2p 3
E[I (r)I (r + j )]
j =rk
(7.45)
The quantities E[I (r)I (r + j )] in Equation (7.45) can be calculated by considering the particular pattern. To complete the calculation of the first two moments of T , we then compute the mean and variance of Ti1 ,...,ik by repeating the same method.
Example 7.31 Suppose that we want to determine the number of flips of a
fair coin until the pattern h, h, t, h, h occurs. For this pattern, r = 5, p = the overlap parameter is k = 2. Because E[I (5)I (8)] = P {h, h, t, h, h, t, h, h} =
1 256 1 512 1 32 ,
and
E[I (5)I (9)] = P {h, h, t, h, h, h, t, h, h} = we see from Equations (7.44) and (7.45) that E[T ] = 32 Var(T ) = (32)2  9(32) + 2(32)3
1 256
+
1 512
= 1120
466
7
Renewal Theory and Its Applications
Hence, from Equations (7.42) and (7.43) we obtain E[T ] = E[Th,h ] + 32, Var(T ) = Var(Th,h ) + 1120
Now, consider the pattern h, h. It has r = 2, p = 1 , and overlap parameter 1. 4 Since, for this pattern, E[I (2)I (3)] = 1 , we obtain, as in the preceding, that 8 E[Th,h ] = E[Th ] + 4, Var(Th,h ) = Var(Th ) + 16  3(4) + 2 64 = Var(Th ) + 20 8 Finally, for the pattern h, which has r = 1, p = 1 , we see from Equations (7.40) 2 and (7.41) that E[Th ] = 2, Putting it all together gives E[T ] = 38, Var(T ) = 1142, Var(T )/E 2 [T ] = 0.79086 Var(Th ) = 2
Example 7.32 Suppose that P {Xn = i} = pi , and consider the pattern
3 3 0, 1, 2, 0, 1, 3, 0, 1. Then p = p0 p1 p2 p3 , r = 8, and the overlap parameter is k = 2. Since 5 5 2 2 E[I (8)I (14)] = p0 p1 p2 p3
E[I (8)I (15)] = 0 we see from Equations (7.42) and (7.44) that E[T ] = E[T0,1 ] + p 1 and from Equations (7.43) and (7.45) that Var(T ) = Var(T0,1 ) + p 2  15p 1 + 2p 1 (p0 p1 )1 Now, the r and p values of the pattern 0, 1 are r(0, 1) = 2, p(0, 1) = p0 p1 , and this pattern has overlap 0. Hence, from Equations (7.40) and (7.41), E[T0,1 ] = (p0 p1 )1 , Var(T0,1 ) = (p0 p1 )2  3(p0 p1 )1
For instance, if pi = 0.2, i = 0, 1, 2, 3 then E[T ] = 25 + 58 = 390,650 Var(T ) = 625  75 + 516 + 35 58 = 1.526 1011 Var(T )/E 2 [T ] = 0.99996
7.9.
Applications to Patterns
467
Remark It can be shown that T is a type of discrete random variable called
new better than used (NBU), which loosely means that if the pattern has not yet occurred by some time n then the additional time until it occurs tends to be less than the time it would take the pattern to occur if one started all over at that point. Such a random variable is known to satisfy (see Proposition 9.6.1 of Ref. [4]) Var(T ) E 2 [T ]  E[T ] E 2 [T ]
Now, suppose that there are s patterns, A(1), . . . , A(s) and that we are interested in the mean time until one of these patterns occurs, as well as the probability mass function of the one that occurs first. Let us assume, without any loss of generality, that none of the patterns is contained in any of the others. [That is, we rule out such trivial cases as A(1) = h, h and A(2) = h, h, t.] To determine the quantities of interest, let T (i) denote the time until pattern A(i) occurs, i = 1, . . . , s, and let T (i, j ) denote the additional time, starting with the occurrence of pattern A(i), until pattern A(j ) occurs, i = j . Start by computing the expected values of these random variables. We have already shown how to compute E[T (i)], i = 1, . . . , s. To compute E[T (i, j )], use the same approach, taking into account any "overlap" between the latter part of A(i) and the beginning part of A(j ). For instance, suppose A(1) = 0, 0, 1, 2, 0, 3, and A(2) = 2, 0, 3, 2, 0. Then T (2) = T2,0,3 + T (1, 2) where T2,0,3 is the time to obtain the pattern 2, 0, 3. Hence, E[T (1, 2)] = E[T (2)]  E[T2,0,3 ]
2 2 = p2 p0 p3 1
+ (p0 p2 )1  (p2 p0 p3 )1
So, suppose now that all of the quantities E[T (i)] and E[T (i, j )] have been computed. Let M = min T (i)
i
and let P (i) = P {M = T (i)}, i = 1, . . . , s
That is, P (i) is the probability that pattern A(i) is the first pattern to occur. Now, for each j we will derive an equation that E[T (j )] satisfies as follows: E[T (j )] = E[M] + E[T (j )  M] = E[M] +
i:i=j
E[T (i, j )]P (i),
j = 1, . . . , s
(7.46)
468
7
Renewal Theory and Its Applications
where the final equality is obtained by conditioning on which pattern occurs first. But the Equations (7.46) along with the equation
s
P (i) = 1
i=1
constitute a set of s + 1 equations in the s + 1 unknowns E[M], P (i), i = 1, . . . , s. Solving them yields the desired quantities.
Example 7.33 Suppose that we continually flip a fair coin. With A(1) =
h, t, t, h, h and A(2) = h, h, t, h, t, we have E[T (1)] = 32 + E[Th ] = 34 E[T (2)] = 32 E[T (1, 2)] = E[T (2)]  E[Th,h ] = 32  (4 + E[Th ]) = 26 E[T (2, 1)] = E[T (1)]  E[Th,t ] = 34  4 = 30 Hence, we need solve the equations 34 = E[M] + 30P (2) 32 = E[M] + 26P (1) 1 = P (1) + P (2) These equations are easily solved, and yield the values P (1) = P (2) = 1 , 2 E[M] = 19
Note that although the mean time for pattern A(2) is less than that for A(1), each has the same chance of occurring first. Equations (7.46) are easy to solve when there are no overlaps in any of the patterns. In this case, for all i = j E[T (i, j )] = E[T (j )] so Equations (7.46) reduce to E[T (j )] = E[M] + (1  P (j ))E[T (j )] or P (j ) = E[M]/E[T (j )]
7.9.
Applications to Patterns
469
Summing the preceding over all j yields E[M] = P (j ) = 1
s j =1 1/E[T (j )]
(7.47) (7.48)
1/E[T (j )]
s j =1 1/E[T (j )]
In our next example we use the preceding to reanalyze the model of Example 7.8.
Example 7.34 Suppose that each play of a game is, independently of the
outcomes of previous plays, won by player i with probability pi , i = 1, . . . , s. Suppose further that there are specified numbers n(1), . . . , n(s) such that the first player i to win n(i) consecutive plays is declared the winner of the match. Find the expected number of plays until there is a winner, and also the probability that the winner is i, i = 1, . . . , s. Solution: Letting A(i), for i = 1, . . . , s, denote the pattern of ni consecutive values of i, this problem asks for P (i), the probability that pattern A(i) occurs first, and for E[M]. Because E[T (i)] = (1/pi )n(i) + (1/pi )n(i)1 + + 1/pi = we obtain, from Equations (7.47) and (7.48), that E[M] = 1
s j =1 n(j ) pj (1  pj )/ n(i) 1  pi
pi
n(i)
(1  pi )
1  pj
n(j )
P (i) =
n(i) n(i) pi (1  pi )/ 1  pi s j =1
pj
n(j )
(1  pj )/ 1  pj
n(j )
7.9.2. The Expected Time to a Maximal Run of Distinct Values Let Xi , i 1, be independent and identically distributed random variables that are equally likely to take on any of the values 1, 2, . . . , m. Suppose that these random variables are observed sequentially, and let T denote the first time that a run of m consecutive values includes all the values 1, . . . , m. That is, T = min{n : Xnm+1 , . . . , Xn are all distinct}
470
7
Renewal Theory and Its Applications
To compute E[T ], define a renewal process by letting the first renewal occur at time T . At this point start over and, without using any of the data values up to T , let the next renewal occur the next time a run of m consecutive values are all distinct, and so on. For instance, if m = 3 and the data are 1, 3, 3, 2, 1, 2, 3, 2, 1, 3, . . . , (7.49)
then there are two renewals by time 10, with the renewals occurring at times 5 and 9. We call the sequence of m distinct values that constitutes a renewal a renewal run. Let us now transform the renewal process into a delayed renewal reward process by supposing that a reward of 1 is earned at time n, n m, if the values Xnm+1 , . . . , Xn are all distinct. That is, a reward is earned each time the previous m data values are all distinct. For instance, if m = 3 and the data values are as in (7.49) then unit rewards are earned at times 5, 7, 9, and 10. If we let Ri denote the reward earned at time i, then by Proposition 7.3, lim
n
E
n i=1 Ri
n
=
E[R] E[T ]
(7.50)
where R is the reward earned between renewal epochs. Now, with Ai equal to the set of the first i data values of a renewal run, and Bi to the set of the first i values following this renewal run, we have the following:
m1
E[R] = 1 +
i=1 m1
E[reward earned a time i after a renewal]
=1+
i=1 m1
P {Ai = Bi } i! mi (7.51)
=1+
i=1 m1
=
i=0
i! mi
Hence, since for i
m m! mm
E[Ri ] = P {Xim+1 , . . . , Xi are all distinct} =
7.9.
Applications to Patterns
471
it follows from Equation (7.50) that E[R] m! = mm E[T ] Thus from Equation (7.51) we obtain E[T ] = mm m!
m1
i!/mi
i=0
The preceding delayed renewal reward process approach also gives us another way of computing the expected time until a specified pattern appears. We illustrate by the following example.
Example 7.35 Compute E[T ], the expected time until the pattern h, h, h, t, h, h, h appears, when a coin that comes up heads with probability p and tails with probability q = 1  p is continually flipped.
Solution: Define a renewal process by letting the first renewal occur when the pattern first appears, and then start over. Also, say that a reward of 1 is earned whenever the pattern appears. If R is the reward earned between renewal epochs, we have
6
E[R] = 1 +
i=1
E[reward earned i units after a renewal]
= 1 + 0 + 0 + 0 + p 3 q + p 3 qp + p 3 qp 2 Hence, since the expected reward earned at time i is E[Ri ] = p 6 q, we obtain the following from the renewal reward theorem: 1 + qp 3 + qp 4 + qp 5 = qp 6 E[T ] or E[T ] = q 1 p 6 + p 3 + p 2 + p 1 7.9.3. Increasing Runs of Continuous Random Variables Let X1 , X2 , . . . be a sequence of independent and identically distributed continuous random variables, and let T denote the first time that there is a string of r
472
7
Renewal Theory and Its Applications
consecutive increasing values. That is, T = min{n r : Xnr+1 < Xnr+2 < < Xn }
To compute E[T ], define a renewal process as follows. Let the first renewal occur at T . Then, using only the data values after T , say that the next renewal occurs when there is again a string of r consecutive increasing values, and continue in this fashion. For instance, if r = 3 and the first 15 data values are 12, 20, 22, 28, 43, 18, 24, 33, 60, 4, 16, 8, 12, 15, 18 then 3 renewals would have occurred by time 15, namely, at times 3, 8, and 14. If we let N(n) denote the number of renewals by time n, then by the elementary renewal theorem E[N (n)] 1 n E[T ] To compute E[N(n)], define a stochastic process whose state at time k, call it Sk , is equal to the number of consecutive increasing values at time k. That is, for 1 j k Sk = j if Xkj > Xkj +1 < < Xk1 < Xk
where X0 = . Note that a renewal will occur at time k if and only if Sk = ir for some i 1. For instance, if r = 3 and X5 > X6 < X7 < X8 < X9 < X10 < X11 then S6 = 1, S7 = 2, S8 = 3, S9 = 4, S10 = 5, S11 = 6
and renewals occur at times 8 and 11. Now, for k > j P {Sk = j } = P {Xkj > Xkj +1 < < Xk1 < Xk } = P {Xkj +1 < < Xk1 < Xk }  P {Xkj < Xkj +1 < < Xk1 < Xk } = = 1 1  j ! (j + 1)! j (j + 1)!
where the next to last equality follows since all possible orderings of the random variables are equally likely.
7.10.
The Insurance Ruin Problem
473
From the preceding, we see that
k
lim P {a renewal occurs at time k}= lim
k
P {Sk = ir} =
i=1 i=1
ir (ir + 1)!
However,
n
E[N(n)] =
k=1
P {a renewal occurs at time k} 1, for which limk ak exists
Because we can show that for any numbers ak , k lim
n k=1 ak
n
n
= lim ak
k
we obtain from the preceding, upon using the elementary renewal theorem, E[T ] = 1
i=1 ir/(ir
+ 1)!
7.10.
The Insurance Ruin Problem
Suppose that claims are made to an insurance firm according to a Poisson process with rate , and that the successive claim amounts Y1 , Y2 , . . . are independent random variables having a common distribution function F with density f (x). Suppose also that the claim amounts are independent of the claim arrival times. M(t) Thus, if we let M(t) be the number of claims made by time t, then i=1 Yi is the total amount paid out in claims by time t. Supposing that the firm starts with an initial capital x and receives income at a constant rate c per unit time, we are interested in the probability that the firm's net capital ever becomes negative; that is, we are interested in
M(t)
R(x) = P
i=1
Yi > x + ct for some t
0
If the firm's capital ever becomes negative, we say that the firm is ruined; thus R(x) is the probability of ruin given that the firm begins with an initial capital x. Let = E[Yi ] be the mean claim amount, and let = /c. Because claims occur at rate , the long run rate at which money is paid out is . (A formal argument uses renewal reward processes. A new cycle begins when a claim occurs; the cost for the cycle is the claim amount, and so the long run average cost
474
7
Renewal Theory and Its Applications
is , the expected cost incurred in a cycle, divided by 1/, the mean cycle time.) Because the rate at which money is received is c, it is clear that R(x) = 1 when > 1. As R(x) can be shown to also equal 1 when = 1 (think of the recurrence of the symmetric random walk), we will suppose that < 1. To determine R(x), we start by deriving a differential equation. To begin, consider what can happen in the first h time units, where h is small. With probability 1  h + o(h) there will be no claims and the firm's capital at time h will be x + ch; with probability h + o(h) there will be exactly one claim and the firm's capital at time h will be x + ch  Y1 ; with probability o(h) there will be two or more claims. Therefore, conditioning on what happens during the first h time units yields that R(x) = (1  h)R(x + ch) + h E[R(x + ch  Y1 )] + o(h) Equivalently, R(x + ch)  R(x) = h R(x + ch)  h E[R(x + ch  Y1 )] + o(h) Dividing through by ch gives R(x + ch)  R(x) 1 o(h) = R(x + ch)  E[R(x + ch  Y1 )] + ch c c c h Letting h go to 0 yields the differential equation R (x) = R(x)  E[R(x  Y1 )] c c
x 0
Because R(u) = 1 when u < 0, the preceding can be written as R (x) = R(x)  c c or, equivalently, R (x) = R(x)  c c
x 0
R(x  y)f (y) dy 
c
f (y) dy
x
R(x  y)f (y) dy 
F (x) c
(7.52)
where F (x) = 1  F (x). We will now use the preceding equation to show that R(x) also satisfies the equation R(x) = R(0) + c
x 0
R(x  y)F (y) dy  c
x 0
F (y) dy,
x
0
(7.53)
To verify Equation (7.53), we will show that differentiating both sides of it results in Equation (7.52). [It can be shown that both (7.52) and (7.53) have unique solutions.] To do so, we will need the following lemma, whose proof is given at the end of this section.
7.10.
The Insurance Ruin Problem
475
Lemma 7.5 For a function k, and a differentiable function t
d dx
x 0
t (x  y)k(y) dy = t (0)k(x) +
0
x
t (x  y)k(y) dy
Differentiating both sides of Equation (7.53) gives, upon using the preceding lemma, R (x) = R(0)F (x) + c
x 0
R (x  y)F (y) dy  F (x)
(7.54)
Differentiation by parts [u = F (y), dv = R (x  y) dy] shows that
x 0
R (x  y)F (y) dy = F (y)R(x  y)x  0 = F (x)R(0) + R(x) 
x 0
R(x  y)f (y) dy
x
R(x  y)f (y) dy
0
Substituting this result back in Equation (7.54) gives Equation (7.52). Thus, we have established Equation (7.53). To obtain a more usable expression for R(x), consider a renewal process whose interarrival times X1 , X2 , . . . are distributed according to the equilibrium distribution of F . That is, the density function of the Xi is fe (x) = Fe (x) = F (x)
Let N(t) denote the number of renewals by time t, and let us derive an expression for q(x) = E N (x)+1 Conditioning on X1 gives that q(x) =
0
E N (x)+1 X1 = y
F (y) dy
Because, given that X1 = y, the number of renewals by time x is distributed as 1 + N(x  y) when y x, or is identically 0 when y > x, we see that E[ N (x)+1 X1 = y] = E N (xy)+1 , , if y x if y > x
476
7
Renewal Theory and Its Applications
Therefore, q(x) satisfies q(x) =
0 x
q(x  y)
x 0 x 0
F (y) dy +
x
F (y) dy
= c = c
q(x  y) F (y) dy + c
F (y) dy 
0 x 0
x
F (y) dy
0
q(x  y) F (y) dy +  c
F (y) dy
Because q(0) = , this is exactly the same equation that is satisfied by R(x), namely Equation (7.53). Therefore, because the solution to (7.53) is unique, we obtain the following.
Proposition 7.6
R(x) = q(x) = E N (x)+1
Example 7.36 Suppose that the firm does not start with any initial cap
ital. Then, because N(0) = 0, we see that the firm's probability of ruin is R(0) = . so is Fe . Hence, N(x) is Poisson with mean x/, giving the result
Example 7.37 If the claim distribution F is exponential with mean , then
R(x) = E N (x)+1 =
n=0
n+1 ex/ (x/)n /n!
x/
=e = e
( x/)n /n!
n=0
x(1)/
To obtain some intuition about the ruin probability, let T be independent of the interarrival times Xi of the renewal process having interarrival distribution Fe , and let T have probability mass function P {T = n} = n (1  ), n = 0, 1, . . .
Now consider P { T Xi > x}, the probability that the sum of the first T of the i=1 Xi exceeds x. Because N (x) + 1 is the first renewal that occurs after time x, we
7.10.
The Insurance Ruin Problem
477
have
n
N(x) + 1 = min n :
i=1
Xi > x
Therefore, conditioning on the number of renewals by time x gives that
T T
P
i=1
Xi > x =
j =0
P
i=1
Xi > x N (x) = j P {N (x) = j }
=
j =0
P {T
j + 1N (x) = j }P {N (x) = j }
=
j =0
P {T
j + 1}P {N (x) = j }
=
j =0
j +1 P {N (x) = j }
= E N (x)+1 Consequently, P { T Xi > x} is equal to the ruin probability. Now, as noted in i=1 Example 7.36, the ruin probability of a firm starting with 0 initial capital is . Suppose that the firm starts with an initial capital x, and suppose for the moment that it is allowed to remain in business even if its capital becomes negative. Because the probability that the firm's capital ever falls below its initial starting amount x is the same as the probability that its capital ever becomes negative when it starts with 0, this probability is also . Thus if we say that a low occurs whenever the firm's capital becomes lower than it has ever previously been, then the probability that a low ever occurs is . Now, if a low does occur, then the probability that there will be another low is the probability that the firm's capital will ever fall below its previous low, and clearly this is also . Therefore, each new low is the final one with probability 1  . Consequently, the total number of lows that ever occur has the same distribution as T . In addition, if we let Wi be the amount by which the ith low is less than the low preceding it, it is easy to see that W1 , W2 , . . . are independent and identically distributed, and are also independent of the number of lows. Because the minimal value over all time of the firm's capital (when it is allowed to remain in business even when its capital becomes negative) is x  T Wi , it follows that the ruin probability of a firm i=1
478
7
Renewal Theory and Its Applications
that starts with an initial capital x is
T
R(x) = P
i=1
Wi > x
Because
T
R(x) = E N (x)+1 = P
i=1
Xi > x
we can identify Wi with Xi . That is, we can conclude that each new low is lower than its predecessor by a random amount whose distribution is the equilibrium distribution of a claim amount. Let us now give the proof of Lemma 7.5.
Proof of Lemma 7.5
Let G(x) =
x 0
t (x  y)k(y) dy. Then
x 0
G(x + h)  G(x) = G(x + h)  +
0 x
t (x + h  y)k(y) dy
t (x + h  y)k(y) dy  G(x) t (x + h  y)k(y) dy [t (x + h  y)  t (x  y)]k(y) dy
=
x
x+h
+
0
x
Dividing through by h gives G(x + h)  G(x) 1 = h h +
0 x+h x x
t (x + h  y)k(y) dy
t (x + h  y)  t (x  y) k(y) dy h
Letting h 0 gives the result: G (x) = t (0) k(x) +
0 x
t (x  y) k(y) dy
Exercises
479
Exercises
1. Is it true that (a) N(t) < n if and only if Sn > t? (b) N(t) n if and only if Sn t? (c) N(t) > n if and only if Sn < t? 2. Suppose that the interarrival distribution for a renewal process is Poisson distributed with mean . That is, suppose P {Xn = k} = e k , k! k = 0, 1, . . .
(a) Find the distribution of Sn . (b) Calculate P {N(t) = n}. *3. If the meanvalue function of the renewal process {N (t), t m(t) = t/2, t 0, what is P {N (5) = 0}? 4. Let {N1 (t), t 0} and {N2 (t), t N(t) = N1 (t) + N2 (t). 0} is given by
0} be independent renewal processes. Let 0} independent?
(a) Are the interarrival times of {N (t), t (b) Are they identically distributed? (c) Is {N(t), t 0} a renewal process?
5. Let U1 , U2 , . . . be independent uniform (0, 1) random variables, and define N by N = min{n : U1 + U2 + + Un > 1} What is E[N]? *6. Consider a renewal process {N (t), t 0} having a gamma (r, ) interarrival distribution. That is, the interarrival density is f (x) = ex (x)r1 , (r  1)! x>0
(a) Show that
P {N (t)
n} =
i=nr
et (t)i i!
480
7
Renewal Theory and Its Applications
(b) Show that
m(t) =
i=r
i et (t)i r i!
where [i/r] is the largest integer less than or equal to i/r. Hint: Use the relationship between the gamma (r, ) distribution and the sum of r independent exponentials with rate , to define N (t) in terms of a Poisson process with rate . 7. Mr. Smith works on a temporary basis. The mean length of each job he gets is three months. If the amount of time he spends between jobs is exponentially distributed with mean 2, then at what rate does Mr. Smith get new jobs? *8. A machine in use is replaced by a new machine either when it fails or when it reaches the age of T years. If the lifetimes of successive machines are independent with a common distribution F having density f , show that (a) the longrun rate at which machines are replaced equals
T 0
xf (x) dx + T (1  F (T ))
1
(b) the longrun rate at which machines in use fail equals F (T )
T 0
xf (x) dx + T [1  F (T )]
9. A worker sequentially works on jobs. Each time a job is completed, a new one is begun. Each job, independently, takes a random amount of time having distribution F to complete. However, independently of this, shocks occur according to a Poisson process with rate . Whenever a shock occurs, the worker discontinues working on the present job and starts a new one. In the long run, at what rate are jobs completed? 10. Consider a renewal process with mean interarrival time . Suppose that each event of this process is independently "counted" with probability p. Let NC (t) denote the number of counted events by time t, t > 0. (a) Is NC (t), t 0 a renewal process? (b) What is limt NC (t)/t?
Exercises
481
11. A renewal process for which the time until the initial renewal has a different distribution than the remaining interarrival times is called a delayed (or a general) renewal process. Prove that Proposition 7.1 remains valid for a delayed renewal process. (In general, it can be shown that all of the limit theorems for a renewal process remain valid for a delayed renewal process provided that the time until the first renewal has a finite mean.) 12. Events occur according to a Poisson process with rate . Any event that occurs within a time d of the event that immediately preceded it is called a devent. For instance, if d = 1 and events occur at times 2, 2.8, 4, 6, 6.6, . . . , then the events at times 2.8 and 6.6 would be devents. (a) At what rate do devents occur? (b) What proportion of all events are devents? 13. Let X1 , X2 , . . . be a sequence of independent random variables. The nonnegative integer valued random variable N is said to be a stopping time for the sequence if the event {N = n} is independent of Xn+1 , Xn+2 , . . . . The idea being that the Xi are observed one at a timefirst X1 , then X2 , and so onand N represents the number observed when we stop. Hence, the event {N = n} corresponds to stopping after having observed X1 , . . . , Xn and thus must be independent of the values of random variables yet to come, namely, Xn+1 , Xn+2 , . . . . (a) Let X1 , X2 , . . . be independent with P {Xi = 1} = p = 1  P {Xi = 0}, Define N1 = min{n : X1 + + Xn = 5} N2 = N3 = 3, 5, 3, 2, if X1 = 0 if X1 = 1 if X4 = 0 if X4 = 1 i 1
Which of the Ni are stopping times for the sequence X1 , . . .? An important result, known as Wald's equation states that if X1 , X2 , . . . are independent and identically distributed and have a finite mean E(X), and if N is a stopping time for this sequence having a finite mean, then
N
E
i=1
Xi = E[N ]E[X] 1 by
To prove Wald's equation, let us define the indicator variables Ii , i Ii = 1, 0, if i N if i > N
482
7
Renewal Theory and Its Applications
(b) Show that
N
Xi =
i=1 i=1
Xi Ii
From part (b) we see that
N
E
i=1
Xi
=E
i=1
Xi Ii
=
i=1
E[Xi Ii ]
where the last equality assumes that the expectation can be brought inside the summation (as indeed can be rigorously proven in this case). (c) Argue that Xi and Ii are independent. Hint: Ii equals 0 or 1 depending on whether or not we have yet stopped after observing which random variables? (d) From part (c) we have
N
E
i=1
Xi =
i=1
E[X]E[Ii ]
Complete the proof of Wald's equation. (e) What does Wald's equation tell us about the stopping times in part (a)? 14. Wald's equation can be used as the basis of a proof of the elementary renewal theorem. Let X1 , X2 , . . . denote the interarrival times of a renewal process and let N(t) be the number of renewals by time t. (a) Show that whereas N (t) is not a stopping time, N (t) + 1 is. Hint: Note that N(t) = n X1 + + Xn (b) Argue that
N (t)+1
t
and X1 + + Xn+1 > t
E
i=1
Xi = [m(t) + 1]
Exercises
483
(c) Suppose that the Xi are bounded random variables. That is, suppose there is a constant M such that P {Xi < M} = 1. Argue that
N (t)+1
t<
i=1
Xi < t + M
(d) Use the previous parts to prove the elementary renewal theorem when the interarrival times are bounded. 15. Consider a miner trapped in a room that contains three doors. Door 1 leads him to freedom after two days of travel; door 2 returns him to his room after a fourday journey; and door 3 returns him to his room after a sixday journey. Suppose at all times he is equally likely to choose any of the three doors, and let T denote the time it takes the miner to become free. (a) Define a sequence of independent and identically distributed random variables X1 , X2 . . . and a stopping time N such that
N
T=
i=1
Xi
Note: You may have to imagine that the miner continues to randomly choose doors even after he reaches safety. (b) Use Wald's equation to find E[T ]. (c) Compute E[ N Xi N = n] and note that it is not equal to E[ i=1 (d) Use part (c) for a second derivation of E[T ].
n i=1 Xi ].
16. A deck of 52 playing cards is shuffled and the cards are then turned face up one at a time. Let Xi equal 1 if the ith card turned over is an ace, and let it be 0 otherwise, i = 1, . . . , 52. Also, let N denote the number of cards that need be turned over until all four aces appear. That is, the final ace appears on the N th card to be turned over. Is the equation
N
E
i=1
Xi = E[N ]E[Xi ]
valid? If not, why is Wald's equation not applicable? 17. In Example 7.7, suppose that potential customers arrive in accordance with a renewal process having interarrival distribution F . Would the number of events by time t constitute a (possibly delayed) renewal process if an event corresponds to a customer
484
7
Renewal Theory and Its Applications
(a) entering the bank? (b) leaving the bank? What if F were exponential? *18. Compute the renewal function when the interarrival distribution F is such that 1  F (t) = pe1 t + (1  p)e2 t 19. For the renewal process whose interarrival times are uniformly distributed over (0, 1), determine the expected time from t = 1 until the next renewal. 20. For a renewal reward process consider Wn = R1 + R2 + + Rn X1 + X2 + + Xn
where Wn represents the average reward earned during the first n cycles. Show that Wn E[R]/E[X] as n . 21. Consider a singleserver bank for which customers arrive in accordance with a Poisson process with rate . If a customer will enter the bank only if the server is free when he arrives, and if the service time of a customer has the distribution G, then what proportion of time is the server busy? *22. The lifetime of a car has a distribution H and probability density h. Ms. Jones buys a new car as soon as her old car either breaks down or reaches the age of T years. A new car costs C1 dollars and an additional cost of C2 dollars is incurred whenever a car breaks down. Assuming that a T yearold car in working order has an expected resale value R(T ), what is Ms. Jones' longrun average cost? 23. If H is the uniform distribution over (2, 8) and if C1 = 4, C2 = 1, and R(T ) = 4  (T /2), then what value of T minimizes Ms. Jones' longrun average cost in Exercise 22? 24. Wald's equation can also be proved by using renewal reward processes. Let N be a stopping time for the sequence of independent and identically distributed random variables Xi , i 1. (a) Let N1 = N . Argue that the sequence of random variables XN1 +1 , XN1 +2 , . . . is independent of X1 , . . . , XN and has the same distribution as the original sequence Xi , i 1. Now treat XN1 +1 , XN1 +2 , . . . as a new sequence, and define a stopping time N2 for this sequence that is defined exactly as is N1 is on the original sequence. (For instance, if N1 = min{n: Xn > 0}, then N2 = min{n: XN1 +n > 0}.) Similarly, define a stopping time N3 on the sequence XN1 +N2 +1 , XN1 +N2 +2 , . . . that is identically defined on this sequence as is N1 on the original sequence, and so on.
Exercises
485
(b) Is the reward process in which Xi is the reward earned during period i a renewal reward process? If so, what is the length of the successive cycles? (c) Derive an expression for the average reward per unit time. (d) Use the strong law of large numbers to derive a second expression for the average reward per unit time. (e) Conclude Wald's equation. 25. Suppose in Example 7.13 that the arrival process is a Poisson process and suppose that the policy employed is to dispatch the train every t time units. (a) Determine the average cost per unit time. (b) Show that the minimal average cost per unit time for such a policy is approximately c/2 plus the average cost per unit time for the best policy of the type considered in that example. 26. Consider a train station to which customers arrive in accordance with a Poisson process having rate . A train is summoned whenever there are N customers waiting in the station, but it takes K units of time for the train to arrive at the station. When it arrives, it picks up all waiting customers. Assuming that the train station incurs a cost at a rate of nc per unit time whenever there are n customers present, find the longrun average cost. 27. A machine consists of two independent components, the ith of which functions for an exponential time with rate i . The machine functions as long as at least one of these components function. (That is, it fails when both components have failed.) When a machine fails, a new machine having both its components working is put into use. A cost K is incurred whenever a machine failure occurs; operating costs at rate ci per unit time are incurred whenever the machine in use has i working components, i = 1, 2. Find the long run average cost per unit time. 28. In Example 7.15, what proportion of the defective items produced is discovered? 29. Consider a singleserver queueing system in which customers arrive in accordance with a renewal process. Each customer brings in a random amount of work, chosen independently according to the distribution G. The server serves one customer at a time. However, the server processes work at rate i per unit time whenever there are i customers in the system. For instance, if a customer with workload 8 enters service when there are three other customers waiting in line, then if no one else arrives that customer will spend 2 units of time in service. If another customer arrives after 1 unit of time, then our customer will spend a total of 1.8 units of time in service provided no one else arrives. Let Wi denote the amount of time customer i spends in the system. Also, define E[W ] by E[W ] = lim (W1 + + Wn )/n
n
and so E[W ] is the average amount of time a customer spends in the system.
486
7
Renewal Theory and Its Applications
Let N denote the number of customers that arrive in a busy period. (a) Argue that E[W ] = E[W1 + + WN ]/E[N] Let Li denote the amount of work customer i brings into the system; and so the Li , i 1, are independent random variables having distribution G. (b) Argue that at any time t, the sum of the times spent in the system by all arrivals prior to t is equal to the total amount of work processed by time t. Hint: Consider the rate at which the server processes work. (c) Argue that
N N
Wi =
i=1 i=1
Li
(d) Use Wald's equation (see Exercise 13) to conclude that E[W ] = where is the mean of the distribution G. That is, the average time that customers spend in the system is equal to the average work they bring to the system. *30. For a renewal process, let A(t) be the age at time t. Prove that if < , then with probability 1 A(t) 0 t as t
31. If A(t) and Y (t) are, respectively, the age and the excess at time t of a renewal process having an interarrival distribution F , calculate P {Y (t) > xA(t) = s} 32. Determine the longrun proportion of time that XN (t)+1 < c. 33. In Example 7.14, find the long run proportion of time that the server is busy. 34. An M/G/ queueing system is cleaned at the fixed times T , 2T , 3T , . . . . All customers in service when a cleaning begins are forced to leave early and a cost C1 is incurred for each customer. Suppose that a cleaning takes time T /4, and that all customers who arrive while the system is being cleaned are lost, and a cost C2 is incurred for each one.
Exercises
487
(a) Find the long run average cost per unit time. (b) Find the long run proportion of time the system is being cleaned. *35. Satellites are launched according to a Poisson process with rate . Each satellite will, independently, orbit the earth for a random time having distribution F . Let X(t) denote the number of satellites orbiting at time t. (a) Determine P {X(t) = k}. Hint: Relate this to the M/G/ queue. (b) If at least one satellite is orbiting, then messages can be transmitted and we say that the system is functional. If the first satellite is orbited at time t = 0, determine the expected time that the system remains functional. Hint: Make use of part (a) when k = 0. 36. Each of n skiers continually, and independently, climbs up and then skis down a particular slope. The time it takes skier i to climb up has distribution Fi , and it is independent of her time to ski down, which has distribution Hi , i = 1, . . . , n. Let N(t) denote the total number of times members of this group have skied down the slope by time t. Also, let U (t) denote the number of skiers climbing up the hill at time t. (a) What is limt N (t)/t? (b) Find limt E[U (t)]. (c) If all Fi are exponential with rate and all Gi are exponential with rate , what is P {U (t) = k}? 37. There are three machines, all of which are needed for a system to work. Machine i functions for an exponential time with rate i before it fails, i = 1, 2, 3. When a machine fails, the system is shut down and repair begins on the failed machine. The time to fix machine 1 is exponential with rate 5; the time to fix machine 2 is uniform on (0, 4); and the time to fix machine 3 is a gamma random variable with parameters n = 3 and = 2. Once a failed machine is repaired, it is as good as new and all machines are restarted. (a) What proportion of time is the system working? (b) What proportion of time is machine 1 being repaired? (c) What proportion of time is machine 2 in a state of suspended animation (that is, neither working nor being repaired)? 38. A truck driver regularly drives round trips from A to B and then back to A. Each time he drives from A to B, he drives at a fixed speed that (in miles per hour) is uniformly distributed between 40 and 60; each time he drives from B to A, he drives at a fixed speed that is equally likely to be either 40 or 60.
488
7
Renewal Theory and Its Applications
(a) In the long run, what proportion of his driving time is spent going to B? (b) In the long run, for what proportion of his driving time is he driving at a speed of 40 miles per hour? 39. A system consists of two independent machines that each functions for an exponential time with rate . There is a single repairperson. If the repairperson is idle when a machine fails, then repair immediately begins on that machine; if the repairperson is busy when a machine fails, then that machine must wait until the other machine has been repaired. All repair times are independent with distribution function G and, once repaired, a machine is as good as new. What proportion of time is the repairperson idle? 40. Three marksmen take turns shooting at a target. Marksman 1 shoots until he misses, then marksman 2 begins shooting until he misses, then marksman 3 until he misses, and then back to marksman 1, and so on. Each time marksman i fires he hits the target, independently of the past, with probability Pi , i = 1, 2, 3. Determine the proportion of time, in the long run, that each marksman shoots. 41. Each time a certain machine breaks down it is replaced by a new one of the same type. In the long run, what percentage of time is the machine in use less than one year old if the life distribution of a machine is (a) uniformly distributed over (0, 2)? (b) exponentially distributed with mean 1? *42. For an interarrival distribution F having mean , we defined the equilibrium distribution of F , denoted Fe , by Fe (x) = 1
x 0
[1  F (y)] dy
(a) Show that if F is an exponential distribution, then F = Fe . (b) If for some constant c, F (x) = 0, 1, x<c x c
show that Fe is the uniform distribution on (0, c). That is, if interarrival times are identically equal to c, then the equilibrium distribution is the uniform distribution on the interval (0, c). (c) The city of Berkeley, California, allows for two hours parking at all nonmetered locations within one mile of the University of California. Parking officials regularly tour around, passing the same point every two hours. When an official encounters a car he or she marks it with chalk. If the same car is there on the official's return two hours later, then a parking ticket is written. If you
Exercises
489
park your car in Berkeley and return after three hours, what is the probability you will have received a ticket? 43. Consider a renewal process having interarrival distribution F such that F (x) = 1 ex + 1 ex/2 , 2 2 x>0
That is, interarrivals are equally likely to be exponential with mean 1 or exponential with mean 2. (a) Without any calculations, guess the equilibrium distribution Fe . (b) Verify your guess in part (a). 44. An airport shuttle bus picks up all passengers waiting at a bus stop and drops them off at the airport terminal; it then returns to the stop and repeats the process. The times between returns to the stop are independent random variables with distribution F , mean , and variance 2 . Passengers arrive at the bus stop in accordance with a Poisson process with rate . Suppose the bus has just left the stop, and let X denote the number of passengers it picks up when it returns. (a) Find E[X]. (b) Find Var(X). (c) At what rate does the shuttle bus arrive at the terminal without any passengers? Suppose that each passenger that has to wait at the bus stop more than c time units writes an angry letter to the shuttle bus manager. (d) What proportion of passengers write angry letters? (e) How does your answer in part (d) relate to Fe (x)? 45. Consider a system that can be in either state 1 or 2 or 3. Each time the system enters state i it remains there for a random amount of time having mean i and then makes a transition into state j with probability Pij . Suppose P12 = 1, P21 = P23 = 1 , 2 P31 = 1
(a) What proportion of transitions takes the system into state 1? (b) If 1 = 1, 2 = 2, 3 = 3, then what proportion of time does the system spend in each state? 46. Consider a semiMarkov process in which the amount of time that the process spends in each state before making a transition into a different state is exponentially distributed. What kind of process is this? 47. In a semiMarkov process, let tij denote the conditional expected time that the process spends in state i given that the next state is j .
490
7
Renewal Theory and Its Applications
(a) Present an equation relating i to the tij . (b) Show that the proportion of time the process is in i and will next enter j is equal to Pi Pij tij /i . Hint: Say that a cycle begins each time state i is entered. Imagine that you receive a reward at a rate of 1 per unit time whenever the process is in i and heading for j . What is the average reward per unit time? 48. A taxi alternates between three different locations. Whenever it reaches location i, it stops and spends a random time having mean ti before obtaining another passenger, i = 1, 2, 3. A passenger entering the cab at location i will want to go to location j with probability Pij . The time to travel from i to j is a random variable with mean mij . Suppose that t1 = 1, t2 = 2, t3 = 4, P12 = 1, P23 = 1, P31 = 2 = 1  P32 , m12 = 10, m23 = 20, m31 = 15, m32 = 25. Define an appro3 priate semiMarkov process and determine (a) the proportion of time the taxi is waiting at location i, and (b) the proportion of time the taxi is on the road from i to j , i, j = 1, 2, 3. *49. Consider a renewal process having the gamma (n, ) interarrival distribution, and let Y (t) denote the time from t until the next renewal. Use the theory of semiMarkov processes to show that lim P {Y (t) < x} = 1 n
n
t
Gi, (x)
i=1
where Gi, (x) is the gamma (i, ) distribution function. 50. To prove Equation (7.24), define the following notation: Xi time spent in state i on the j th visit to this state; Ni (m) number of visits to state i in the first m transitions In terms of this notation, write expressions for (a) the amount of time during the first m transitions that the process is in state i; (b) the proportion of time during the first m transitions that the process is in state i. Argue that, with probability 1,
Ni (m) j
(c)
j =1
Xi i Ni (m)
j
as m
(d) Ni (m)/m i as m . (e) Combine parts (a), (b), (c), and (d) to prove Equation (7.24).
Exercises
491
51. In 1984 the country of Morocco in an attempt to determine the average amount of time that tourists spend in that country on a visit tried two different sampling procedures. In one, they questioned randomly chosen tourists as they were leaving the country; in the other, they questioned randomly chosen guests at hotels. (Each tourist stayed at a hotel.) The average visiting time of the 3000 tourists chosen from hotels was 17.8, whereas the average visiting time of the 12,321 tourists questioned at departure was 9.0. Can you explain this discrepancy? Does it necessarily imply a mistake? 52. Let Xi , i = 1, 2, . . . , be the interarrival times of the renewal process {N (t)}, and let Y , independent of the Xi , be exponential with rate . (a) Use the lack of memory property of the exponential to argue that P {X1 + + Xn < Y } = (P {X < Y })n (b) Use part (a) to show that E[N (Y )] = E[eX ] 1  E[eX ]
where X has the interarrival distribution. 53. Write a program to approximate m(t) for the interarrival distribution F G, where F is exponential with mean 1 and G is exponential with mean 3. 54. Let Xi , i 1, be independent random variables with pj = P {X = j }, j 1. If pj = j/10, j = 1, 2, 3, 4, find the expected time and the variance of the number of variables that need be observed until the pattern 1, 2, 3, 1, 2 occurs. 55. A coin that comes up heads with probability 0.6 is continually flipped. Find the expected number of flips until either the sequence thht or the sequence ttt occurs, and find the probability that ttt occurs first. 56. Random digits, each of which is equally likely to be any of the digits 0 through 9, are observed in sequence. (a) Find the expected time until a run of 10 distinct values occurs. (b) Find the expected time until a run of 5 distinct values occurs. 57. Let h(x) = P { T Xi > x} where X1 , X2 , . . . are independent random i=1 variables having distribution function Fe and T is independent of the Xi and has probability mass function P {T = n} = n (1  ), n 0. Show that h(x) satisfies Equation (7.53). Hint: Start by conditioning on whether T = 0 or T > 0.
492
7
Renewal Theory and Its Applications
References
The results in Section 7.9.1 concerning the computation of the variance of the time until a specified pattern appears are new, as are the results of Section 7.9.2. The results of Section 7.9.3 are from Ref. [3].
1. D. R. Cox, "Renewal Theory," Methuen, London, 1962. 2. W. Feller, "An Introduction to Probability Theory and Its Applications," Vol. II, John Wiley, New York, 1966. 3. F. Hwang and D. Trietsch, "A Simple Relation Between the Pattern Probability and the Rate of False Signals in Control Charts," Probability in the Engineering and Informational Sciences, 10, 315323, 1996. 4. S. Ross, "Stochastic Processes," Second Edition, John Wiley, New York, 1996. 5. H. C. Tijms, "Stochastic Models, An Algorithmic Approach," John Wiley, New York, 1994.
Queueing Theory
8
8.1. Introduction
In this chapter we will study a class of models in which customers arrive in some random manner at a service facility. Upon arrival they are made to wait in queue until it is their turn to be served. Once served they are generally assumed to leave the system. For such models we will be interested in determining, among other things, such quantities as the average number of customers in the system (or in the queue) and the average time a customer spends in the system (or spends waiting in the queue). In Section 8.2 we derive a series of basic queueing identities which are of great use in analyzing queueing models. We also introduce three different sets of limiting probabilities which correspond to what an arrival sees, what a departure sees, and what an outside observer would see. In Section 8.3 we deal with queueing systems in which all of the defining probability distributions are assumed to be exponential. For instance, the simplest such model is to assume that customers arrive in accordance with a Poisson process (and thus the interarrival times are exponentially distributed) and are served one at a time by a single server who takes an exponentially distributed length of time for each service. These exponential queueing models are special examples of continuoustime Markov chains and so can be analyzed as in Chapter 6. However, at the cost of a (very) slight amount of repetition we shall not assume that you are familiar with the material of Chapter 6, but rather we shall redevelop any needed material. Specifically we shall derive anew (by a heuristic argument) the formula for the limiting probabilities. In Section 8.4 we consider models in which customers move randomly among a network of servers. The model of Section 8.4.1 is an open system in which customers are allowed to enter and depart the system, whereas the one studied
493
494
8
Queueing Theory
in Section 8.4.2 is closed in the sense that the set of customers in the system is constant over time. In Section 8.5 we study the model M/G/1, which while assuming Poisson arrivals, allows the service distribution to be arbitrary. To analyze this model we first introduce in Section 8.5.1 the concept of work, and then use this concept in Section 8.5.2 to help analyze this system. In Section 8.5.3 we derive the average amount of time that a server remains busy between idle periods. In Section 8.6 we consider some variations of the model M/G/1. In particular in Section 8.6.1 we suppose that bus loads of customers arrive according to a Poisson process and that each bus contains a random number of customers. In Section 8.6.2 we suppose that there are two different classes of customerswith type 1 customers receiving service priority over type 2. In Section 8.6.3 we present an M/G/1 optimization example. We suppose that the server goes on break whenever she becomes idle, and then determine, under certain cost assumptions, the optimal time for her to return to service. In Section 8.7 we consider a model with exponential service times but where the interarrival times between customers is allowed to have an arbitrary distribution. We analyze this model by use of an appropriately defined Markov chain. We also derive the mean length of a busy period and of an idle period for this model. In Section 8.8 we consider a single server system whose arrival process results from return visits of a finite number of possible sources. Assuming a general service distribution, we show how a Markov chain can be used to analyze this system. In the final section of the chapter we talk about multiserver systems. We start with loss systems, in which arrivals finding all servers busy, are assumed to depart and as such are lost to the system. This leads to the famous result known as Erlang's loss formula, which presents a simple formula for the number of busy servers in such a model when the arrival process in Poisson and the service distribution is general. We then discuss multiserver systems in which queues are allowed. However, except in the case where exponential service times are assumed, there are very few explicit formulas for these models. We end by presenting an approximation for the average time a customer waits in queue in a kserver model which assumes Poisson arrivals but allows for a general service distribution.
8.2.
Preliminaries
In this section we will derive certain identities which are valid in the great majority of queueing models.
8.2.
Preliminaries
495
8.2.1. Cost Equations Some fundamental quantities of interest for queueing models are L, LQ , W, WQ , the average number of customers in the system; the average number of customers waiting in queue; the average amount of time a customer spends in the system; the average amount of time a customer spends waiting in queue.
A large number of interesting and useful relationships between the preceding and other quantities of interest can be obtained by making use of the following idea: Imagine that entering customers are forced to pay money (according to some rule) to the system. We would then have the following basic cost identity: average rate at which the system earns = a average amount an entering customer pays (8.1)
where a is defined to be average arrival rate of entering customers. That is, if N (t) denotes the number of customer arrivals by time t, then a = lim N (t) t
t
We now present a heuristic proof of Equation (8.1).
Heuristic Proof of Equation (8.1) Let T be a fixed large number. In two
different ways, we will compute the average amount of money the system has earned by time T . On one hand, this quantity approximately can be obtained by multiplying the average rate at which the system earns by the length of time T . On the other hand, we can approximately compute it by multiplying the average amount paid by an entering customer by the average number of customers entering by time T (and this latter factor is approximately a T ). Hence, both sides of Equation (8.1) when multiplied by T are approximately equal to the average amount earned by T . The result then follows by letting T . By choosing appropriate cost rules, many useful formulas can be obtained as special cases of Equation (8.1). For instance, by supposing that each customer pays $1 per unit time while in the system, Equation (8.1) yields the socalled
This can be made into a rigorous proof provided we assume that the queueing process is regenerative in the sense of Section 7.5. Most models, including all the ones in this chapter, satisfy this condition.
496
8
Queueing Theory
Little's formula, L = a W (8.2)
This follows since, under this cost rule, the rate at which the system earns is just the number in the system, and the amount a customer pays is just equal to its time in the system. Similarly if we suppose that each customer pays $1 per unit time while in queue, then Equation (8.1) yields LQ = a W Q (8.3)
By supposing the cost rule that each customer pays $1 per unit time while in service we obtain from Equation (8.1) that the average number of customers in service = a E[S] (8.4)
where E[S] is defined as the average amount of time a customer spends in service. It should be emphasized that Equations (8.1) through (8.4) are valid for almost all queueing models regardless of the arrival process, the number of servers, or queue discipline. 8.2.2. SteadyState Probabilities Let X(t) denote the number of customers in the system at time t and define Pn , n 0, by Pn = lim P {X(t) = n}
t
where we assume the preceding limit exists. In other words, Pn is the limiting or longrun probability that there will be exactly n customers in the system. It is sometimes referred to as the steadystate probability of exactly n customers in the system. It also usually turns out that Pn equals the (longrun) proportion of time that the system contains exactly n customers. For example, if P0 = 0.3, then in the long run, the system will be empty of customers for 30 percent of the time. Similarly, P1 = 0.2 would imply that for 20 percent of the time the system would contain exactly one customer.
A sufficient condition for the validity of the dual interpretation of P is that the queueing process n
be regenerative.
8.2.
Preliminaries
497
Two other sets of limiting probabilities are {an , n
0} and {dn , n
0}, where
an = proportion of customers that find n in the system when they arrive, and dn = proportion of customers leaving behind n in the system when they depart That is, Pn is the proportion of time during which there are n in the system; an is the proportion of arrivals that find n; and dn is the proportion of departures that leave behind n. That these quantities need not always be equal is illustrated by the following example.
Example 8.1 Consider a queueing model in which all customers have service
times equal to 1, and where the times between successive customers are always greater than 1 [for instance, the interarrival times could be uniformly distributed over (1, 2)]. Hence, as every arrival finds the system empty and every departure leaves it empty, we have a0 = d0 = 1 However, P0 = 1 as the system is not always empty of customers. It was, however, no accident that an equaled dn in the previous example. That arrivals and departures always see the same number of customers is always true as is shown in the next proposition.
Proposition 8.1 In any system in which customers arrive and depart one at
a time the rate at which arrivals find n = the rate at which departures leave n and an = dn goes from n to n + 1; similarly, a departure will leave behind n whenever the number in the system goes from n + 1 to n. Now in any interval of time T the number of transitions from n to n + 1 must equal to within 1 the number from n + 1 to n. [Between any two transitions from n to n + 1, there must be one from n + 1 to n, and conversely.] Hence, the rate of transitions from n to n + 1 equals the rate from n + 1 to n; or, equivalently, the rate at which arrivals find n equals the rate at which departures leave n. Now an , the proportion of arrivals finding n,
Proof An arrival will see n in the system whenever the number in the system
498
8
Queueing Theory
can be expressed as an = Similarly, dn = the rate at which departures leave n overall departure rate the rate at which arrivals find n overall arrival rate
Thus, if the overall arrival rate is equal to the overall departure rate, then the preceding shows that an = dn . On the other hand, if the overall arrival rate exceeds the overall departure rate, then the queue size will go to infinity, implying that an = dn = 0. Hence, on the average, arrivals and departures always see the same number of customers. However, as Example 8.1 illustrates, they do not, in general, see the time averages. One important exception where they do is in the case of Poisson arrivals.
Proposition 8.2 Poisson arrivals always see time averages. In particular, for
Poisson arrivals, Pn = an To understand why Poisson arrivals always see time averages, consider an arbitrary Poisson arrival. If we knew that it arrived at time t, then the conditional distribution of what it sees upon arrival is the same as the unconditional distribution of the system state at time t. For knowing that an arrival occurs at time t gives us no information about what occurred prior to t. (Since the Poisson process has independent increments, knowing that an event occurred at time t does not affect the distribution of what occurred prior to t.) Hence, an arrival would just see the system according to the limiting probabilities. Contrast the foregoing with the situation of Example 8.1 where knowing that an arrival occurred at time t tells us a great deal about the past; in particular it tells us that there have been no arrivals in (t  1, t). Thus, in this case, we cannot conclude that the distribution of what an arrival at time t observes is the same as the distribution of the system state at time t. For a second argument as to why Poisson arrivals see time averages, note that the total time the system is in state n by time T is (roughly) Pn T . Hence, as Poisson arrivals always arrive at rate no matter what the system state, it follows that the number of arrivals in [0, T ] that find the system in state n is (roughly) Pn T . In the long run, therefore, the rate at which arrivals find the system in state n is Pn and, as is the overall arrival rate, it follows that Pn / = Pn is the proportion of arrivals that find the system in state n. The result that Poisson arrivals see time averages is called the PASTA principle.
8.3.
Exponential Models
499
8.3.
Exponential Models
8.3.1. A SingleServer Exponential Queueing System Suppose that customers arrive at a singleserver service station in accordance with a Poisson process having rate . That is, the time between successive arrivals are independent exponential random variables having mean 1/. Each customer, upon arrival, goes directly into service if the server is free and, if not, the customer joins the queue. When the server finishes serving a customer, the customer leaves the system, and the next customer in line, if there is any, enters service. The successive service times are assumed to be independent exponential random variables having mean 1/. The preceding is called the M/M/1 queue. The two Ms refer to the fact that both the interarrival and the service distributions are exponential (and thus memoryless, or Markovian), and the 1 to the fact that there is a single server. To analyze it, we shall begin by determining the limiting probabilities Pn , for n = 0, 1, . . . . To do so, think along the following lines. Suppose that we have an infinite number of rooms numbered 0, 1, 2, . . . , and suppose that we instruct an individual to enter room n whenever there are n customers in the system. That is, he would be in room 2 whenever there are two customers in the system; and if another were to arrive, then he would leave room 2 and enter room 3. Similarly, if a service would take place he would leave room 2 and enter room 1 (as there would now be only one customer in the system). Now suppose that in the long run our individual is seen to have entered room 1 at the rate of ten times an hour. Then at what rate must he have left room 1? Clearly, at this same rate of ten times an hour. For the total number of times that he enters room 1 must be equal to (or one greater than) the total number of times he leaves room 1. This sort of argument thus yields the general principle which will enable us to determine the state probabilities. Namely, for each n 0, the rate at which the process enters state n equals the rate at which it leaves state n. Let us now determine these rates. Consider first state 0. When in state 0 the process can leave only by an arrival as clearly there cannot be a departure when the system is empty. Since the arrival rate is and the proportion of time that the process is in state 0 is P0 , it follows that the rate at which the process leaves state 0 is P0 . On the other hand, state 0 can only be reached from state 1 via a departure. That is, if there is a single customer in the system and he completes service, then the system becomes empty. Since the service rate is and the proportion of time that the system has exactly one customer is P1 , it follows that the rate at which the process enters state 0 is P1 . Hence, from our rateequality principle we get our first equation, P0 = P1
500
8
Queueing Theory
Now consider state 1. The process can leave this state either by an arrival (which occurs at rate ) or a departure (which occurs at rate ). Hence, when in state 1, the process will leave this state at a rate of + . Since the proportion of time the process is in state 1 is P1 , the rate at which the process leaves state 1 is ( + )P1 . On the other hand, state 1 can be entered either from state 0 via an arrival or from state 2 via a departure. Hence, the rate at which the process enters state 1 is P0 + P2 . Because the reasoning for other states is similar, we obtain the following set of equations: State 0 n, n 1 Rate at which the process leaves = rate at which it enters P0 = P1 ( + )Pn = Pn1 + Pn+1 (8.5)
The set of Equations (8.5) which balances the rate at which the process enters each state with the rate at which it leaves that state is known as balance equations. In order to solve Equations (8.5), we rewrite them to obtain P1 = Pn+1 = P0 , Pn + Pn  Pn1 , n 1
Solving in terms of P0 yields P0 = P0 , P1 = P2 = P3 = P4 = Pn+1 = P0 , P1 + P1  P0 = P1 = P2 + P2  P1 = P2 = P3 + P3  P2 = P3 =
2
P0 ,
3
P0 ,
4
P0 ,
n+1
Pn + Pn  Pn1 = Pn =
P0
If one event occurs at a rate and another occurs at rate , then the total rate at which either event occurs is + . Suppose one man earns $2 per hour and another earns $3 per hour; then together they clearly earn $5 per hour.
8.3.
Exponential Models
501
To determine P0 we use the fact that the Pn must sum to 1, and thus
1=
n=0
Pn =
n=0
n
P0 =
P0 1  /
or P0 = 1  Pn = ,
n
1
,
n
1
(8.6)
Notice that for the preceding equations to make sense, it is necessary for / to be less than 1. For otherwise (/)n would be infinite and all the Pn would n=0 be 0. Hence, we shall assume that / < 1. Note that it is quite intuitive that there would be no limiting probabilities if > . For suppose that > . Since customers arrive at a Poisson rate , it follows that the expected total number of arrivals by time t is t. On the other hand, what is the expected number of customers served by time t? If there were always customers present, then the number of customers served would be a Poisson process having rate since the time between successive services would be independent exponentials having mean 1/. Hence, the expected number of customers served by time t is no greater than t; and, therefore, the expected number in the system at time t is at least t  t = (  )t Now if > , then the preceding number goes to infinity as t becomes large. That is, / > 1, the queue size increases without limit and there will be no limiting probabilities. Note also that the condition / < 1 is equivalent to the condition that the mean service time be less than the mean time between successive arrivals. This is the general condition that must be satisfied for limited probabilities to exist in most singleserver queueing systems.
Remarks (i) In solving the balance equations for the M/M/1 queue, we obtained as an intermediate step the set of equations
Pn = Pn+1 , n 0
These equations could have been directly argued from the general queueing result (shown in Proposition 8.1) that the rate at which arrivals find n in the system namely Pn is equal to the rate at which departures leave behind nnamely, Pn+1 .
502
8
Queueing Theory
(ii) We can also prove that Pn = (/)n (1  /) by using a queueing cost identity. Suppose that, for a fixed n > 0, whenever there are at least n customers in the system the nth oldest customer (with age measured from when the customer arrived) pays 1 per unit time. Letting X be the steady state number of customers in the system, because the system earns 1 per unit time whenever X is at least n, it follows that average rate at which the system earns = P {X n} Also, because a customer who finds fewer than n  1 in the system when it arrives will pay 0, while an arrival who finds at least n  1 in the system will pay 1 per unit time for an exponentially distributed time with rate average amount a customer pays = Therefore, the queueing cost identity yields that P {X Iterating this gives P {X n} = (/)P {X = (/)2 P {X = = (/)n P {X = (/) Therefore, P {X = n} = P {X n}  P {X n + 1} = (/)n (1  /)
n
1 P {X
n  1}
n} = (/)P {X
n  1}, n  1}
n>0
n  2}
0}
Now let us attempt to express the quantities L, LQ , W , and WQ in terms of the limiting probabilities Pn . Since Pn is the longrun probability that the system contains exactly n customers, the average number of customers in the system clearly is given by
L=
n=0
nPn
n
=
n=0
n 
1
(8.7)
=
8.3.
Exponential Models
503
where the last equation followed upon application of the algebraic identity
nx n =
n=0
x (1  x)2
The quantities W, WQ , and LQ now can be obtained with the help of Equations (8.2) and (8.3). That is, since a = , we have from Equation (8.7) that W= = L 1 ,  1
WQ = W  E[S] =W  =
, (  ) 2 (  )
LQ = WQ = (8.8)
Example 8.2 Suppose that customers arrive at a Poisson rate of one per every
12 minutes, and that the service time is exponential at a rate of one service per 8 minutes. What are L and W ? Solution: Since =
1 12 ,
= 1 , we have 8 L = 2, W = 24
Hence, the average number of customers in the system is two, and the average time a customer spends in the system is 24 minutes. 1 Now suppose that the arrival rate increases 20 percent to = 10 . What is the corresponding change in L and W ? Again using Equations (8.7), we get L = 4, W = 40
Hence, an increase of 20 percent in the arrival rate doubled the average number of customers in the system.
504
8
Queueing Theory
To understand this better, write Equations (8.7) as L= W= / , 1  / 1/ 1  /
From these equations we can see that when / is near 1, a slight increase in / will lead to a large increase in L and W .
A Technical Remark We have used the fact that if one event occurs at an
exponential rate , and another independent event at an exponential rate , then together they occur at an exponential rate + . To check this formally, let T1 be the time at which the first event occurs, and T2 the time at which the second event occurs. Then P {T1 P {T2 t} = 1  et , t} = 1  et
Now if we are interested in the time until either T1 or T2 occurs, then we are interested in T = min(T1 , T2 ). Now P {T t} = 1  P {T > t} = 1  P {min(T1 , T2 ) > t} However, min(T1 , T2 ) > t if and only if both T1 and T2 are greater than t; hence, P {T t} = 1  P {T1 > t, T2 > t} = 1  P {T1 > t}P {T2 > t} = 1  et et = 1  e(+)t Thus, T has an exponential distribution with rate + , and we are justified in adding the rates. Given that an M/M/1 steadystate customerthat is, a customer who arrives after the system has been in operation a long timespends a total of t time units in the system, let us determine the conditional distribution of N , the number of others that were present when that customer arrived. That is, letting W be the
8.3.
Exponential Models
505
amount of time a customer spends in the system, we will find P {N = nW = t}. Now, P {N = nW = t} = = fN,W (n, t) fW (t) P {N = n}fW N (tn) fW (t)
where fW N (tn) is the conditional density of W given that N = n, and fW (t) is the unconditional density of W . Now, given that N = n, the time that the customer spends in the system is distributed as the sum of n + 1 independent exponential random variables with a common rate , implying that the conditional distribution of W given that N = n is the gamma distribution with parameters n + 1 and . Therefore, with C = 1/fW (t) P {N = nW = t} = CP {N = n}et (t)n n! (t)n n! (by PASTA)
= C(/)n (1  /)et =K (t)n n!
where K = C(1  /)et does not depend on n. Summing over n yields
1=
n=0
P {N = nT = t} = K
n=0
(t)n = Ket n!
Thus, K = et , showing that P {N = nW = t} = et (t)n n!
Therefore, the conditional distribution of the number seen by an arrival who spends a total of t time units in the system is the Poisson distribution with mean t. In addition, as a byproduct of our analysis, we have that fW (t) = 1/C = 1 (1  /)et K
= (  )e()t
506
8
Queueing Theory
In other words, W , the amount of time a customer spends in the system, is an exponential random variable with rate  . (As a check, we note that E[W ] = 1/(  ) which checks with Equation (8.8) since W = E[W ].)
Remark Another argument as to why W is exponential with rate  is as
follows. If we let N denote the number of customers in the system as seen by an arrival, then this arrival will spend N + 1 service times in the system before departing. Now, P {N + 1 = j } = P {N = j  1} = (/)j 1 (1  /),
j
1
In words, the number of services that have to be completed before the arrival departs is a geometric random variable with parameter 1  /. Therefore, after each service completion our customer will be the one departing with probability 1  /. Thus, no matter how long the customer has already spent in the system, the probability he will depart in the next h time units is h + o(h), the probability that a service ends in that time, multiplied by 1  /. That is, the customer will depart in the next h time units with probability (  )h + o(h), which says that the hazard rate function of W is the constant  . But only the exponential has a constant hazard rate, and so we can conclude that W is exponential with rate  . Our next example illustrates the inspection paradox.
Example 8.3 For an M/M/1 queue in steady state, what is the probability
that the next arrival finds n in the system? Solution: Although it might initially seem, by the PASTA principle, that this probability should just be (/)n (1  /), we must be careful. Because if t is the current time, then the time from t until the next arrival is exponentially distributed with rate , and is independent of the time from t since the last arrival, which (in the limit, as t goes to infinity) is also exponential with rate . Thus, although the times between successive arrivals of a Poisson process are exponential with rate , the time between the previous arrival before t and the first arrival after t is distributed as the sum of two independent exponentials. (This is an illustration of the inspection paradox, which results because the length of an interarrival interval that contains a specified time tends to be longer than an ordinary interarrival intervalsee Section 7.7.) Let Na denote the number found by the next arrival, and let X be the number currently in the system. Conditioning on X yields
8.3.
Exponential Models
507
P {Na = n} =
k=0
P {Na = nX = k}P {X = k} P {Na = nX = k}(/)k (1  /)
k=0
= =
k=n
P {Na = nX = k}(/)k (1  /)
=
i=0
P {Na = nX = n + i}(/)n+i (1  /)
Now, for n > 0, given there are currently n + i in the system, the next arrival will find n if we have i services before an arrival and then an arrival before the next service completion. By the lack of memory property of exponential interarrival random variables, this gives
P {Na = nX = n + i} =
+
i
, +
n>0
Consequently, for n > 0,
P {Na = n} =
i=0
+
i
+ +
n+i
(1  /)
i=0
= (/)n (1  /)
+
i
= (/)n+1 (1  /)
On the other hand, the probability that the next arrival will find the system empty, when there are currently i in the system, is the probability that there are i services before the next arrival. Therefore, P {Na = 0X = i} = ( + )i , giving that
508
8
Queueing Theory
P {Na = 0} =
i=0
+
i
i
(1  /)
i
= (1  /)
i=0
+
= (1 + /)(1  /) As a check, note that
P {Na = n} = (1  /) 1 + / +
n=0 n=1
(/)n+1
= (1  /)
i=0
(/)i
=1 Note that P {Na = 0} is larger than P0 = 1  /, showing that the next arrival is more likely to find an empty system than is an average arrival, and thus illustrating the inspection paradox that when the next customer arrives the elapsed time since the previous arrival is distributed as the sum of two independent exponentials with rate . Also, we might expect because of the inspection paradox that E[Na ] is less than L, the average number of customers seen by an arrival. That this is indeed the case is seen from
E[Na ] =
n=1
n(/)n+1 (1  /) =
L<L
8.3.2. A SingleServer Exponential Queueing System Having Finite Capacity In the previous model, we assumed that there was no limit on the number of customers that could be in the system at the same time. However, in reality there is always a finite system capacity N , in the sense that there can be no more than N customers in the system at any time. By this, we mean that if an arriving customer finds that there are already N customers present, then he does not enter the system. As before, we let Pn , 0 n N , denote the limiting probability that there are n customers in the system. The rateequality principle yields the following set of
8.3.
Exponential Models
509
balance equations: State 0 1 n N N 1 Rate at which the process leaves = rate at which it enters P0 = P1 ( + )Pn = Pn1 + Pn+1 PN = PN 1
The argument for state 0 is exactly as before. Namely, when in state 0, the process will leave only via an arrival (which occurs at rate ) and hence the rate at which the process leaves state 0 is P0 . On the other hand, the process can enter state 0 only from state 1 via a departure; hence, the rate at which the process enters state 0 is P1 . The equation for states n, where 1 n < N , is the same as before. The equation for state N is different because now state N can only be left via a departure since an arriving customer will not enter the system when it is in state N ; also, state N can now only be entered from state N  1 (as there is no longer a state N + 1) via an arrival. We could now either solve the balance equations exactly as we did for the infinite capacity model, or we could save a few lines by directly using the result that the rate at which departures leave behind n  1 is equal to the rate at which arrivals find n  1. Invoking this result yields that Pn = Pn1 , giving that Pn = Pn1 =
2
n = 1, . . . , N
(8.9)
Pn2 = =
N n=0 Pn
n
P0 ,
n = 1, . . . , N
(8.10)
By using the fact that
= 1 we obtain
N
1 = P0
n=0
n
= P0 or P0 =
1  (/)N +1 1  /
(1  /) 1  (/)N +1
510
8
Queueing Theory
and hence from Equation (8.10) we obtain Pn = (/)n (1  /) , 1  (/)N +1 n = 0, 1, . . . , N (8.11)
Note that in this case, there is no need to impose the condition that / < 1. The queue size is, by definition, bounded so there is no possibility of its increasing indefinitely. As before, L may be expressed in terms of Pn to yield
N
L=
n=0
nPn (1  /) 1  (/)N +1
N
=
n
n=0
n
which after some algebra yields L= [1 + N (/)N +1  (N + 1)(/)N ] (  )(1  (/)N +1 ) (8.12)
In deriving W , the expected amount of time a customer spends in the system, we must be a little careful about what we mean by a customer. Specifically, are we including those "customers" who arrive to find the system full and thus do not spend any time in the system? Or, do we just want the expected time spent in the system by a customer who actually entered the system? The two questions lead, of course, to different answers. In the first case, we have a = ; whereas in the second case, since the fraction of arrivals that actually enter the system is 1  PN , it follows that a = (1  PN ). Once it is clear what we mean by a customer, W can be obtained from W= L a
Example 8.4 Suppose that it costs c dollars per hour to provide service at
a rate . Suppose also that we incur a gross profit of A dollars for each customer served. If the system has a capacity N , what service rate maximizes our total profit? Solution: To solve this, suppose that we use rate . Let us determine the amount of money coming in per hour and subtract from this the amount going out each hour. This will give us our profit per hour, and we can choose so as to maximize this.
8.3.
Exponential Models
511
Now, potential customers arrive at a rate . However, a certain proportion of them do not join the systemnamely, those who arrive when there are N customers already in the system. Hence, since PN is the proportion of time that the system is full, it follows that entering customers arrive at a rate of (1  PN ). Since each customer pays $A, it follows that money comes in at an hourly rate of (1  PN )A and since it goes out at an hourly rate of c, it follows that our total profit per hour is given by profit per hour = (1  PN )A  c = A 1  = (/)N (1  /)  c 1  (/)N +1
A[1  (/)N ]  c 1  (/)N +1
For instance if N = 2, = 1, A = 10, c = 1, then profit per hour = = 10[1  (1/)2 ]  1  (1/)3 10(3  )  3  1
in order to maximize profit we differentiate to obtain d (23  32 + 1) 1 [profit per hour] = 10 d (3  1)2 The value of that maximizes our profit now can be obtained by equating to zero and solving numerically. In the previous two models, it has been quite easy to define the state of the system. Namely, it was defined as the number of people in the system. Now we shall consider some examples where a more detailed state space is necessary. 8.3.3. A Shoeshine Shop Consider a shoeshine shop consisting of two chairs. Suppose that an entering customer first will go to chair 1. When his work is completed in chair 1, he will go either to chair 2 if that chair is empty or else wait in chair 1 until chair 2 becomes empty. Suppose that a potential customer will enter this shop as long as chair 1
512
8
Queueing Theory
is empty. (Thus, for instance, a potential customer might enter even if there is a customer in chair 2.) If we suppose that potential customers arrive in accordance with a Poisson process at rate , and that the service times for the two chairs are independent and have respective exponential rates of 1 and 2 , then (a) what proportion of potential customers enters the system? (b) what is the mean number of customers in the system? (c) what is the average amount of time that an entering customer spends in the system? To begin we must first decide upon an appropriate state space. It is clear that the state of the system must include more information than merely the number of customers in the system. For instance, it would not be enough to specify that there is one customer in the system as we would also have to know which chair he was in. Further, if we only know that there are two customers in the system, then we would not know if the man in chair 1 is still being served or if he is just waiting for the person in chair 2 to finish. To account for these points, the following state space, consisting of the five states, (0, 0), (1, 0), (0, 1), (1, 1), and (b, 1), will be used. The states have the following interpretation: State (0, 0) (1, 0) (0, 1) (1, 1) (b, 1) Interpretation There are no customers in the system. There is one customer in the system, and he is in chair 1. There is one customer in the system, and he is in chair 2. There are two customers in the system, and both are presently being served. There are two customers in the system, but the customer in the first chair has completed his work in that chair and is waiting for the second chair to become free.
It should be noted that when the system is in state (b, 1), the person in chair 1, though not being served, is nevertheless "blocking" potential arrivals from entering the system. As a prelude to writing down the balance equations, it is usually worthwhile to make a transition diagram. This is done by first drawing a circle for each state and then drawing an arrow labeled by the rate at which the process goes from one state to another. The transition diagram for this model is shown in Figure 8.1. The explanation for the diagram is as follows: The arrow from state (0, 0) to state (1, 0) which is labeled means that when the process is in state (0, 0), that is, when the system is empty, then it goes to state (1, 0) at a rate , that is via an arrival. The arrow from (0, 1) to (1, 1) is similarly explained.
8.3.
Exponential Models
513
Figure 8.1. A transition diagram.
When the process is in state (1, 0), it will go to state (0, 1) when the customer in chair 1 is finished and this occurs at a rate 1 ; hence the arrow from (1, 0) to (0, 1) labeled 1 . The arrow from (1, 1) to (b, 1) is similarly explained. When in state (b, 1) the process will go to state (0, 1) when the customer in chair 2 completes his service (which occurs at rate 2 ); hence the arrow from (b, 1) to (0, 1) labeled 2 . Also when in state (1, 1) the process will go to state (1, 0) when the man in chair 2 finishes and hence the arrow from (1, 1) to (1, 0) labeled 2 . Finally, if the process is in state (0, 1), then it will go to state (0, 0) when the man in chair 2 completes his service, hence the arrow from (0, 1) to (0, 0) labeled 2 . Because there are no other possible transitions, this completes the transition diagram. To write the balance equations we equate the sum of the arrows (multiplied by the probability of the states where they originate) coming into a state with the sum of the arrows (multiplied by the probability of the state) going out of that state. This gives State (0, 0) (1, 0) (0, 1) (1, 1) (b, 1) Rate that the process leaves = rate that it enters P00 = 2 P01 1 P10 = P00 + 2 P11 ( + 2 )P01 = 1 P10 + 2 Pb1 (1 + 2 )P11 = P01 2 Pb1 = 1 P11 P00 + P10 + P01 + P11 + Pb1 = 1 may be solved to determine the limiting probabilities. Though it is easy to solve the preceding equations, the resulting solutions are quite involved and hence will
These along with the equation
514
8
Queueing Theory
not be explicitly presented. However, it is easy to answer our questions in terms of these limiting probabilities. First, since a potential customer will enter the system when the state is either (0, 0) or (0, 1), it follows that the proportion of customers entering the system is P00 + P01 . Secondly, since there is one customer in the system whenever the state is (0 1) or (1, 0) and two customers in the system whenever the state is (1, 1) or (b, 1), it follows that L, the average number in the system, is given by L = P01 + P10 + 2(P11 + Pb1 ) To derive the average amount of time that an entering customer spends in the system, we use the relationship W = L/a . Since a potential customer will enter the system when in state (0, 0) or (0, 1), it follows that a = (P00 + P01 ) and hence W= P01 + P10 + 2(P11 + Pb1 ) ( P00 + P01 )
Example 8.5 (a) If = 1, 1 = 1, 2 = 2, then calculate the preceding
quantities of interest. (b) If = 1, 1 = 2, 2 = 1, then calculate the preceding. Solution: (a) Solving the balance equations yields P00 = Hence, L=
28 37 , 12 37 ,
P10 =
16 37 ,
P11 =
2 37 ,
P01 =
6 37 ,
Pb1 =
1 37
W=
28 18
(b) Solving the balance equations yields P00 = Hence, L = 1, W=
11 6 3 11 ,
P10 =
2 11 ,
P11 =
1 11 ,
Pb1 =
2 11 ,
P01 =
3 11
8.3.4. A Queueing System with Bulk Service In this model, we consider a singleserver exponential queueing system in which the server is able to serve two customers at the same time. Whenever the server completes a service, she then serves the next two customers at the same time. However, if there is only one customer in line, then she serves that customer by herself. We shall assume that her service time is exponential at rate whether
8.3.
Exponential Models
515
she is serving one or two customers. As usual, we suppose that customers arrive at an exponential rate . One example of such a system might be an elevator or a cable car which can take at most two passengers at any time. It would seem that the state of the system would have to tell us not only how many customers there are in the system, but also whether one or two are presently being served. However, it turns out that we can more easily solve the problem not by concentrating on the number of customers in the system, but rather on the number in queue. So let us define the state as the number of customers waiting in queue, with two states when there is no one in queue. That is, let us have as a state space 0 , 0, 1, 2, . . . , with the interpretation State 0 0 n, n > 0 Interpretation No one in service Server busy; no one waiting n customers waiting
The transition diagram is shown in Figure 8.2 and the balance equations are State 0 0 n, n 1 Rate at which the process leaves = rate at which it enters P0 = P0 ( + )P0 = P0 + P1 + P2 ( + )Pn = Pn1 + Pn+2
Now the set of equations ( + )Pn = Pn1 + Pn+2 , has a solution of the form Pn = n P0 To see this, substitute the preceding in Equation (8.13) to obtain ( + ) n P0 = n1 P0 + n+2 P0 or ( + ) = + 3 n = 1, 2, . . . (8.13)
Figure 8.2.
516
8
Queueing Theory
Solving this for yields the three roots: 1 + 1 + 4/ 1  1 + 4/ , and = = 1, = 2 2 As the first two are clearly not possible, it follows that 1 + 4/  1 = 2 Hence, Pn = n P0 , P0 where the bottom equation follows from the first balance equation. (We can ignore the second balance equation as one of these equations is always redundant.) To obtain P0 , we use P0 =
P0 + P0 +
n=1
Pn = 1
or P0 1 + or P0 or P0 = and thus Pn = P0 = where = n (1  ) , + (1  ) (1  ) + (1  ) 1 + 4/  1 2 n 0 (8.14) (1  ) + (1  ) 1 + =1 1 +
n = 1
n=1
8.4.
Network of Queues
517
Note that for the preceding to be valid we need < 1, or equivalently / < 2, which is intuitive since the maximum service rate is 2, which must be larger than the arrival rate to avoid overloading the system. All the relevant quantities of interest now can be determined. For instance, to determine the proportion of customers that are served alone, we first note that the rate at which customers are served alone is P0 + P1 , since when the system is empty a customer will be served alone upon the next arrival and when there is one customer in queue he will be served alone upon a departure. As the rate at which customers are served is , it follows that proportion of customers that are served alone = P0 + P1 = P0 + P1
Also,
LQ =
n=1
nPn (1  ) + (1  )
= = and
n n
n=1
from Equation (8.14)
(1  )[ + (1  )]
by algebraic identity
1
n n =
(1  )2
WQ =
LQ , 1 ,
W = WQ + L = W
8.4.
Network of Queues
8.4.1. Open Systems Consider a twoserver system in which customers arrive at a Poisson rate at server 1. After being served by server 1 they then join the queue in front of server 2. We suppose there is infinite waiting space at both servers. Each server
518
8
Queueing Theory
Figure 8.3. A tandem queue.
serves one customer at a time with server i taking an exponential time with rate i for a service, i = 1, 2. Such a system is called a tandem or sequential system (see Figure 8.3). To analyze this system we need to keep track of the number of customers at server 1 and the number at server 2. So let us define the state by the pair (n, m) meaning that there are n customers at server 1 and m at server 2. The balance equations are State 0, 0 n, 0; n > 0 0, m; m > 0 n, m; nm > 0 Rate that the process leaves = rate that it enters P0,0 = 2 P0,1 ( + 1 )Pn,0 = 2 Pn,1 + Pn1,0 ( + 2 )P0,m = 2 P0,m+1 + 1 P1,m1 ( + 1 + 2 )Pn,m = 2 Pn,m+1 + 1 Pn+1,m1 + Pn1,m (8.15)
Rather than directly attempting to solve these (along with the equation n,m Pn,m = 1) we shall guess at a solution and then verify that it indeed satisfies the preceding. We first note that the situation at server 1 is just as in an M/M/1 model. Similarly, as it was shown in Section 6.6 that the departure process of an M/M/1 queue is a Poisson process with rate , it follows that what server 2 faces is also an M/M/1 queue. Hence, the probability that there are n customers at server 1 is P {n at server 1} = and, similarly, P {m at server 2} = 2
m
1
n
1
1
1
2
Now if the numbers of customers at servers 1 and 2 were independent random variables, then it would follow that Pn,m = 1
n
1
1
2
m
1
2
(8.16)
8.4.
Network of Queues
519
To verify that Pn,m is indeed equal to the preceding (and thus that the number of customers at server 1 is independent of the number at server 2), all we need do is verify that the preceding satisfies the set of Equations (8.15)this suffices since we know that the Pn,m are the unique solution of Equations (8.15). Now, for instance, if we consider the first equation of (8.15), we need to show that 1 1 1 2 = 2 1  1 2 1 2
which is easily verified. We leave it as an exercise to show that the Pn,m , as given by Equation (8.16), satisfy all of the Equations (8.15), and are thus the limiting probabilities. From the preceding we see that L, the average number of customers in the system, is given by L=
n,m
(n + m)Pn,m 1
n
=
n
n
1
1
+
m
m
2
m
1
2
+ = 1  2  and from this we see that the average time a customer spends in the system is W= 1 1 L = + 1  2 
Remarks (i) The result (Equations (8.15)) could have been obtained as a direct
consequence of the time reversibility of an M/M/1 (see Section 6.6). For not only does time reversibility imply that the output from server 1 is a Poisson process, but it also implies (Exercise 26 of Chapter 6) that the number of customers at server 1 is independent of the past departure times from server 1. As these past departure times constitute the arrival process to server 2, the independence of the numbers of customers in the two systems follows. (ii) Since a Poisson arrival sees time averages, it follows that in a tandem queue the numbers of customers an arrival (to server 1) sees at the two servers are independent random variables. However, it should be noted that this does not imply that the waiting times of a given customer at the two servers are independent. For a counter example suppose that is very small with respect to 1 = 2 ; and thus almost all customers have zero wait in queue at both servers. However, given that the wait in queue of a customer at server 1 is positive, his wait in queue at server 2 also will be positive with probability at least as large as 1 (why?). Hence, the wait2
520
8
Queueing Theory
ing times in queue are not independent. Remarkably enough, however, it turns out that the total times (that is, service time plus wait in queue) that an arrival spends at the two servers are indeed independent random variables. The preceding result can be substantially generalized. To do so, consider a system of k servers. Customers arrive from outside the system to server i, i = 1, . . . , k, in accordance with independent Poisson processes at rate ri ; they then join the queue at i until their turn at service comes. Once a customer is served by server i, he then joins the queue in front of server j , j = 1, . . . , k, with probability Pij . Hence, k =1 Pij 1, and 1  k =1 Pij represents the probability that j j a customer departs the system after being served by server i. If we let j denote the total arrival rate of customers to server j , then the j can be obtained as the solution of
k
j = rj +
i=1
i Pij ,
i = 1, . . . , k
(8.17)
Equation (8.17) follows since rj is the arrival rate of customers to j coming from outside the system and, as i is the rate at which customers depart server i (rate in must equal rate out), i Pij is the arrival rate to j of those coming from server i. It turns out that the number of customers at each of the servers is independent and of the form P {n customers at server j } = j j
n
1
j , j
n
1
where j is the exponential service rate at server j and the j are the solution to Equation (8.17). Of course, it is necessary that j /j < 1 for all j . To prove this, we first note that it is equivalent to asserting that the limiting probabilities P (n1 , n2 , . . . , nk ) = P {nj at server j , j = 1, . . . , k} are given by
k
P (n1 , n2 , . . . , nk ) =
j =1
j j
nj
1
j j
(8.18)
which can be verified by showing that it satisfies the balance equations for this model. The average number of customers in the system is
k
L=
j =1 k
average number at server j j j  j
=
j =1
8.4.
Network of Queues
521
The average time a customer spends in the system can be obtained from L = W with = k =1 rj . (Why not = k =1 j ?) This yields j j W=
k j =1 j /(j  j ) k j =1 rj
Remark The result embodied in Equation (8.18) is rather remarkable in that it
says that the distribution of the number of customers at server i is the same as in an M/M/1 system with rates i and i . What is remarkable is that in the network model the arrival process at node i need not be a Poisson process. For if there is a possibility that a customer may visit a server more than once (a situation called feedback), then the arrival process will not be Poisson. An easy example illustrating this is to suppose that there is a single server whose service rate is very large with respect to the arrival rate from outside. Suppose also that with probability p = 0.9 a customer upon completion of service is fed back into the system. Hence, at an arrival time epoch there is a large probability of another arrival in a short time (namely, the feedback arrival); whereas at an arbitrary time point there will be only a very slight chance of an arrival occurring shortly (since is so very small). Hence, the arrival process does not possess independent increments and so cannot be Poisson. Thus, we see that when feedback is allowed the steadystate probabilities of the number of customers at any given station have the same distribution as in an M/M/1 model even though the model is not M/M/1. (Presumably such quantities as the joint distribution of the number at the station at two different time points will not be the same as for an M/M/1.)
Example 8.6 Consider a system of two servers where customers from outside
the system arrive at server 1 at a Poisson rate 4 and at server 2 at a Poisson rate 5. The service rates of 1 and 2 are respectively 8 and 10. A customer upon completion of service at server 1 is equally likely to go to server 2 or to leave the system (i.e., P11 = 0, P12 = 1 ); whereas a departure from server 2 will go 25 percent of 2 the time to server 1 and will depart the system otherwise (i.e., P21 = 1 , P22 = 0). 4 Determine the limiting probabilities, L, and W . Solution: The total arrival rates to servers 1 and 2call them 1 and 2  can be obtained from Equation (8.17). That is, we have 1 = 4 + 1 2 , 4 2 = 5 + 1 1 2 implying that 1 = 6, 2 = 8
522
8
Queueing Theory
Hence, P {n at server 1, m at server 2} = = and L= W= 8.4.2. Closed Systems The queueing systems described in Section 8.4.1 are called open systems since customers are able to enter and depart the system. A system in which new customers never enter and existing ones never depart is called a closed system. Let us suppose that we have m customers moving among a system of k servers, where the service times at server i are exponential with rate i , i = 1, . . . , k. When a customer completes service at server i, she then joins the queue in front of server j, j = 1, . . . , k, with probability Pij , where we now suppose that k j =1 Pij = 1 for all i = 1, . . . , k. That is, P = [Pij ] is a Markov transition probability matrix, which we shall assume is irreducible. Let = (1 , . . . , k ) denote the stationary probabilities for this Markov chain; that is, is the unique positive solution of
k 3 4 1 20 n 1 4 n 4 5 4 5 m 1 5
3 4
m
8 6 + = 7, 8  6 10  8 L 7 = 9 9
j =
i=1 k
i Pij ,
j = 1
j =1
(8.19)
If we denote the average arrival rate (or equivalently the average service completion rate) at server j by m (j ), j = 1, . . . , k then, analogous to Equation (8.17), the m (j ) satisfy
k
m (j ) =
i=1
m (i)Pij
8.4.
Network of Queues
523
Hence, from (8.19) we can conclude that m (j ) = m j , where
k
j = 1, 2, . . . , k
(8.20)
m =
j =1
m (j )
(8.21)
From Equation (8.21), we see that m is the average service completion rate of the entire system, that is, it is the system throughput rate.* If we let Pm (n1 , n2 , . . . , nk ) denote the limiting probabilities Pm (n1 , n2 , . . . , nk ) = P {nj customers at server j, j = 1, . . . , k} then, by verifying that they satisfy the balance equation, it can be shown that Pm (n1 , n2 , . . . , nk ) = Km 0,
k nj j =1 (m (j )/j ) ,
if k =1 nj = m j otherwise
But from Equation (8.20) we thus obtain that Pm (n1 , n2 , . . . , nk ) = where Cm =
k
n1 ,...,nk : nj =m
Cm 0,
k nj j =1 (j /j ) ,
if k =1 nj = m j otherwise 1
(8.22)
j =1
(j /j )nj
(8.23)
Equation (8.22) is not as useful as we might suppose, for in order to utilize it we must determine the normalizing constant Cm given by Equation (8.23) which requires summing the products k =1 (j /j )nj over all the feasible vecj tors (n1 , . . . , nk ): k =1 nj = m. Hence, since there are m+k1 vectors this is j m only computationally feasible for relatively small values of m and k. We will now present an approach that will enable us to determine recursively many of the quantities of interest in this model without first computing the normalizing constants. To begin, consider a customer who has just left server i and is headed to server j , and let us determine the probability of the system as seen
* We are just using the notation (j ) and to indicate the dependence on the number of customers m m
in the closed system. This will be used in recursive relations we will develop.
524
8
Queueing Theory
by this customer. In particular, let us determine the probability that this customer observes, at that moment, nl customers at server l, l = 1, . . . , k, k nl = m  1. l=1 This is done as follows: P {customer observes nl at server l, l = 1, . . . , k  customer goes from i to j } = = = P {state is (n1 , . . . , ni + 1, . . . , nj , . . . , nk ), customer goes from i toj } P {customer goes from i toj } Pm (n1 , . . . , ni + 1, . . . , nj , . . . , nk )i Pij n: nj =m1 Pm (n1 , . . . , ni + 1, . . . , nk )i Pij (i /i )
k k nj j =1 (j /j )
K (j /j )nj
j =1
from (8.22)
=C
where C does not depend on n1 , . . . , nk . But because the preceding is a probability density on the set of vectors (n1 , . . . , nk ), k =1 nj = m1, it follows from (8.22) j that it must equal Pm1 (n1 , . . . , nk ). Hence, P {customer observes nl at server l, l = 1, . . . , k  customer goes from i to j }
k
= Pm1 (n1 , . . . , nk ),
i=1
ni = m  1
(8.24)
As (8.24) is true for all i, we thus have proven the following proposition, known as the arrival theorem.
Proposition 8.3 (The Arrival Theorem) In the closed network system with
m customers, the system as seen by arrivals to server j is distributed as the stationary distribution in the same network system when there are only m  1 customers. Denote by Lm (j ) and Wm (j ) the average number of customers and the average time a customer spends at server j when there are m customers in the network. Upon conditioning on the number of customers found at server j by an arrival to that server, it follows that Wm (j ) = = 1 + Em [number at server j as seen by an arrival] j 1 + Lm1 (j ) j (8.25)
8.4.
Network of Queues
525
where the last equality follows from the arrival theorem. Now when there are m  1 customers in the system, then, from Equation (8.20), m1 (j ), the average arrival rate to server j , satisfies m1 (j ) = m1 j Now, applying the basic cost identity Equation (8.1) with the cost rule being that each customer in the network system of m  1 customers pays one per unit time while at server j , we obtain Lm1 (j ) = m1 j Wm1 (j ) Using Equation (8.25), this yields Wm (j ) = Also using the fact that tion (8.26): 1 + m1 j Wm1 (j ) j (8.27) (8.26)
k j =1 Lm1 (j )
= m  1 (why?) we obtain, from Equak
m  1 = m1
j =1
j Wm1 (j )
or m1 = m1
k i=1 i Wm1 (i)
(8.28)
Hence, from Equation (8.27), we obtain the recursion Wm (j ) = (m  1)j Wm1 (j ) 1 + j j k i Wm1 (i) i=1 (8.29)
Starting with the stationary probabilities j , j = 1, . . . , k, and W1 (j ) = 1/j we can now use Equation (8.29) to determine recursively W2 (j ), W3 (j ), . . . , Wm (j ). We can then determine the throughput rate m by using Equation (8.28), and this will determine Lm (j ) by Equation (8.26). This recursive approach is called mean value analysis.
Example 8.7 Consider a kserver network in which the customers move in a cyclic permutation. That is,
Pi,i+1 = 1, i = 1, 2 . . . , k  1, Pk,1 = 1
Let us determine the average number of customers at server j when there are two customers in the system. Now, for this network i = 1/k, i = 1, . . . , k
526 and as
8
Queueing Theory
W1 (j ) = we obtain from Equation (8.29) that W2 (j ) = = Hence, from Equation (8.28), 2 = 2
k l=1
1 j
(1/k)(1/j ) 1 + j j k (1/k)(1/i ) i=1 1 + j 2 j 1
k i=1 1/i
=
2k
k l=1
1 W2 (l) k
1 + l 2 l
1
k i=1 1/i
and finally, using Equation (8.26), 2 1 L2 (j ) = 2 W2 (j ) = k
k l=1
1 + j 2 j 1 + l 2 l
1
k i=1 1/i
1
k i=1 1/i
Another approach to learning about the stationary probabilities specified by Equation (8.22), which finesses the computational difficulties of computing the constant Cm , is to use the Gibbs sampler of Section 4.9 to generate a Markov chain having these stationary probabilities. To begin, note that since there are always a total of m customers in the system, Equation (8.22) may equivalently be written as a joint mass function of the numbers of customers at each of the servers 1, . . . , k  1, as follows:
k1
Pm (n1 , . . . , nk1 ) = Cm (k /k )m
k1
nj j =1 k1
(j /j )nj
=K
j =1
(aj )nj ,
j =1
nj
m
8.4.
Network of Queues
527
where aj = (j k )/(k j ), j = 1, . . . , k  1. Now, if N = (N1 , . . . , Nk1 ) has the preceding joint mass function then, P {Ni = nN1 = n1 , . . . , Ni1 = ni1 , Ni+1 = ni+1 , . . . , Nk1 = nk1 } = Pm (n1 , . . . , ni1 , n, ni+1 , . . . , nk1 ) r Pm (n1 , . . . , ni1 , r, ni+1 , . . . , nk1 ) n m
j =i
= Cain ,
nj
It follows from the preceding that we may use the Gibbs sampler to generate the values of a Markov chain whose limiting probability mass function is Pm (n1 , . . . , nk1 ) as follows: 1. Let (n1 , . . . , nk1 ) be arbitrary nonnegative integers satisfying k1 nj j =1 m. 2. Generate a random variable I that is equally likely to be any of 1, . . . , k  1. 3. If I = i, set s = m  j =i nj , and generate the value of a random variable X having probability mass function P {X = n} = Cain , 4. Let nI = X and go to step 2. The successive values of the state vector (n1 , . . . , nk1 , m  k1 nj ) constitute j =1 the sequence of states of a Markov chain with the limiting distribution Pm . All quantities of interest can be estimated from this sequence. For instance, the average of the values of the j th coordinate of these vectors will converge to the mean number of individuals at station j , the proportion of vectors whose j th coordinate is less than r will converge to the limiting probability that the number of individuals at station j is less than r, and so on. Other quantities of interest can also be obtained from the simulation. For instance, suppose we want to estimate Wj , the average amount of time a customer spends at server j on each visit. Then, as noted in the preceding, Lj , the average number of customers at server j , can be estimated. To estimate Wj , we use the identity Lj = j W j where j is the rate at which customers arrive at server j . Setting j equal to the service completion rate at server j shows that j = P {j is busy}j Using the Gibbs sampler simulation to estimate P {j is busy} then leads to an estimator of Wj . n = 0, . . . , s
528
8
Queueing Theory
8.5.
The System M/G/1
8.5.1. Preliminaries: Work and Another Cost Identity For an arbitrary queueing system, let us define the work in the system at any time t to be the sum of the remaining service times of all customers in the system at time t. For instance, suppose there are three customers in the systemthe one in service having been there for three of his required five units of service time, and both people in queue having service times of six units. Then the work at that time is 2 + 6 + 6 = 14. Let V denote the (time) average work in the system. Now recall the fundamental cost equation (8.1), which states that the average rate at which the system earns = a average amount a customer pays and consider the following cost rule: Each customer pays at a rate of y/unit time when his remaining service time is y, whether he is in queue or in service. Thus, the rate at which the system earns is just the work in the system; so the basic identity yields that V = a E[amount paid by a customer]
Now, let S and WQ denote respectively the service time and the time a given customer spends waiting in queue. Then, since the customer pays at a constant rate of S per unit time while he waits in queue and at a rate of S  x after spending an amount of time x in service, we have E[amount paid by a customer] = E SWQ + S 0
(S  x) dx
and thus
V = a E[SWQ ] +
a E[S 2 ] 2
(8.30)
It should be noted that the preceding is a basic queueing identity [like Equations (8.2)(8.4)] and as such is valid in almost all models. In addition, if a customer's service time is independent of his wait in queue (as is usually, but not always the case),* then we have from Equation (8.30) that V = a E[S]WQ +
* For an example where it is not true, see Section 8.6.2.
a E[S 2 ] 2
(8.31)
8.5.
The System M/G/1
529
8.5.2. Application of Work to M/G/1 The M/G/1 model assumes (i) Poisson arrivals at rate ; (ii) a general service distribution; and (iii) a single server. In addition, we will suppose that customers are served in the order of their arrival. Now, for an arbitrary customer in an M/G/1 system. Customer's wait in queue = work in the system when he arrives (8.32)
this follows since there is only a single server (think about it!). Taking expectations of both sides of Equation (8.32) yields WQ = average work as seen by an arrival But, due to Poisson arrivals, the average work as seen by an arrival will equal V , the time average work in the system. Hence, for the model M/G/1, WQ = V The preceding in conjunction with the identity E[S 2 ] 2 yields the socalled PollaczekKhintchine formula, V = E[S]WQ + WQ = E[S 2 ] 2(1  E[S]) (8.33)
where E[S] and E[S 2 ] are the first two moments of the service distribution. The quantities L, LQ , and W can be obtained from Equation (8.33) as LQ = WQ = 2 E[S 2 ] , 2(1  E[S]) E[S 2 ] + E[S], 2(1  E[S]) (8.34)
W = WQ + E[S] = L = W =
2 E[S 2 ] + E[S] 2(1  E[S])
Remarks (i) For the preceding quantities to be finite, we need E[S] < 1. This condition is intuitive since we know from renewal theory that if the server was always busy, then the departure rate would be 1/E[S] (see Section 7.3), which must be larger than the arrival rate to keep things finite. (ii) Since E[S 2 ] = Var(S) + (E[S])2 , we see from Equations (8.33) and (8.34) that, for fixed mean service time, L, LQ , W , and WQ all increase as the variance of the service distribution increases. (iii) Another approach to obtain WQ is presented in Exercise 38.
530
8
Queueing Theory
8.5.3. Busy Periods The system alternates between idle periods (when there are no customers in the system, and so the server is idle) and busy periods (when there is at least one customer in the system, and so the server is busy). Let us denote by In and Bn , respectively, the lengths of the nth idle and the nth busy period, n 1. Hence, in the first n=1 (Ij + Bj ) time units the server j will be idle for a time n=1 Ij , and so the proportion of time that the server will j be idle, which of course is just P0 , can be expressed as P0 = proportion of idle time = lim I1 + + In n I1 + + In + B1 + + Bn
Now it is easy to see that the I1 , I2 , . . . are independent and identically distributed as are the B1 , B2 , . . . . Hence, by dividing the numerator and the denominator of the right side of the preceding by n, and then applying the strong law of large numbers, we obtain P0 = lim = (I1 + + In )/n (I1 + + In )/n + (B1 + + Bn )/n (8.35)
n
E[I ] E[I ] + E[B]
where I and B represent idle and busy time random variables. Now I represents the time from when a customer departs and leaves the system empty until the next arrival. Hence, from Poisson arrivals, it follows that I is exponential with rate , and so E[I ] = 1 (8.36)
To compute P0 , we note from Equation (8.4) (obtained from the fundamental cost equation by supposing that a customer pays at a rate of one per unit time while in service) that average number of busy servers = E[S]
8.6.
Variations on the M/G/1
531
However, as the lefthand side of the preceding equals 1  P0 (why?), we have P0 = 1  E[S] and, from Equations (8.35)(8.37), 1  E[S] = or E[B] = E[S] 1  E[S] 1/ 1/ + E[B] (8.37)
Another quantity of interest is C, the number of customers served in a busy period. The mean of C can be computed by noting that, on the average, for every E[C] arrivals exactly one will find the system empty (namely, the first customer in the busy period). Hence, a0 = 1 E[C]
and, as a0 = P0 = 1  E[S] because of Poisson arrivals, we see that E[C] = 1 1  E[S]
8.6.
Variations on the M/G/1
8.6.1. The M/G/1 with RandomSized Batch Arrivals Suppose that, as in the M/G/1, arrivals occur in accordance with a Poisson process having rate . But now suppose that each arrival consists not of a single customer but of a random number of customers. As before there is a single server whose service times have distribution G. Let us denote by j , j 1, the probability that an arbitrary batch consists of j customers; and let N denote a random variable representing the size of a batch and so P {N = j } = j . Since a = E(N), the basic formula for work [Equation (8.31)] becomes V = E[N ] E(S)WQ + E(S 2 ) 2 (8.38)
To obtain a second equation relating V to WQ , consider an average customer. We have that
532
8
Queueing Theory
his wait in queue = work in system when he arrives + his waiting time due to those in his batch Taking expectations and using the fact that Poisson arrivals see time averages yields WQ = V + E[waiting time due to those in his batch] = V + E[WB ] (8.39)
Now, E(WB ) can be computed by conditioning on the number in the batch, but we must be careful because the probability that our average customer comes from a batch of size j is not j . For j is the proportion of batches that are of size j , and if we pick a customer at random, it is more likely that he comes from a larger rather than a smaller batch. (For instance, suppose 1 = 100 = 1 , then half the 2 batches are of size 1 but 100/101 of the customers will come from a batch of size 100!) To determine the probability that our average customer came from a batch of size j we reason as follows: Let M be a large number. Then of the first M batches approximately Mj will be of size j , j 1, and thus there would have been approximately j Mj customers that arrived in a batch of size j . Hence, the proportion of arrivals in the first M batches that were from batches of size j is approximately j Mj / j j Mj . This proportion becomes exact as M , and so we see that j j proportion of customers from batches of size j = j j j = j j E[N ]
We are now ready to compute E(WB ), the expected wait in queue due to others in the batch: j j (8.40) E[WB  batch of size j ] E[WB ] = E[N ]
j
Now if there are j customers in his batch, then our customer would have to wait for i  1 of them to be served if he was ith in line among his batch members. As he is equally likely to be either 1st, 2nd, . . . , or j th in line we see that
j
E[WB  batch is of size j ] =
i=1
(i  1)E(S) j 1 E[S] 2
1 j
=
8.6.
Variations on the M/G/1
533
Substituting this in Equation (8.40) yields E[WB ] = = E[S] 2E[N ] (j  1)j j
j
E[S](E[N 2 ]  E[N ]) 2E[N ]
and from Equations (8.38) and (8.39) we obtain WQ = E[S](E[N 2 ]  E[N ])/2E[N ] + E[N ]E[S 2 ]/2 1  E[N ]E[S]
Remarks (i) Note that the condition for WQ to be finite is that
E(N) < 1 E[S]
which again says that the arrival rate must be less than the service rate (when the server is busy). (ii) For fixed value of E[N ], WQ is increasing in Var[N ], again indicating that "singleserver queues do not like variation." (iii) The other quantities L, LQ , and W can be obtained by using W = WQ + E[S], L = a W = E[N ]W, LQ = E[N ]WQ 8.6.2. Priority Queues Priority queueing systems are ones in which customers are classified into types and then given service priority according to their type. Consider the situation where there are two types of customers, which arrive according to independent Poisson processes with respective rates 1 and 2 , and have service distributions G1 and G2 . We suppose that type 1 customers are given service priority, in that service will never begin on a type 2 customer if a type 1 is waiting. However, if a type 2 is being served and a type 1 arrives, we assume that the service of the type 2 is continued until completion. That is, there is no preemption once service has begun. i Let WQ denote the average wait in queue of a type i customer, i = 1, 2. Our i objective is to compute the WQ . First, note that the total work in the system at any time would be exactly the same no matter what priority rule was employed (as long as the server is always
534
8
Queueing Theory
busy whenever there are customers in the system). This is so since the work will always decrease at a rate of one per unit time when the server is busy (no matter who is in service) and will always jump by the service time of an arrival. Hence, the work in the system is exactly as it would be if there was no priority rule but rather a firstcome, firstserved (called FIFO) ordering. However, under FIFO the preceding model is just M/G/1 with = 1 + 2 , G(x) = 2 1 G1 (x) + G2 (x) (8.41)
which follows since the combination of two independent Poisson processes is itself a Poisson process whose rate is the sum of the rates of the component processes. The service distribution G can be obtained by conditioning on which priority class the arrival is fromas is done in Equation (8.41). Hence, from the results of Section 8.5, it follows that V , the average work in the priority queueing system, is given by V= = = E[S 2 ] 2(1  E[S])
2 2 ((1 /)E[S1 ] + (2 /)E[S2 ]) 2[1  ((1 /)E[S1 ] + (2 /)E[S2 ])] 2 2 1 E[S1 ] + 2 E[S2 ] 2(1  1 E[S1 ]  2 E[S2 ])
(8.42)
where Si has distribution Gi , i = 1, 2. i Continuing in our quest for WQ let us note that S and WQ , the service and wait in queue of an arbitrary customer, are not independent in the priority model since knowledge about S gives us information as to the type of customer which in turn gives us information about WQ . To get around this we will compute separately the average amount of type 1 and type 2 work in the system. Denoting V i as the average amount of type i work we have, exactly as in Section 8.5.1,
i V i = i E[Si ]WQ +
i E[Si2 ] , 2
i = 1, 2
(8.43)
If we define
i i VQ i E[Si ]WQ , i VS
i E[Si2 ] 2
8.6.
Variations on the M/G/1
535
i then we may interpret VQ as the average amount of type i work in queue, and i as the average amount of type i work in service (why?). VS 1 Now we are ready to compute WQ . To do so, consider an arbitrary type 1 arrival. Then
his delay = amount of type 1 work in the system when he arrives + amounts of type 2 work in service when he arrives Taking expectations and using the fact that Poisson arrivals see time average yields
1 2 WQ = V 1 + VS 1 = 1 E[S1 ]WQ + 2 2 1 E[S1 ] 2 E[S2 ] + 2 2
(8.44)
or
1 WQ = 2 2 1 E[S1 ] + 2 E[S2 ] 2(1  1 E[S1 ])
(8.45)
2 To obtain WQ we first note that since V = V 1 + V 2 , we have from Equations (8.42) and (8.43) that 2 2 1 E[S1 ] + 2 E[S2 ] 1 2 = 1 E[S1 ]WQ + 2 E[S2 ]WQ 2(1  1 E[S1 ]  2 E[S2 ])
+
2 2 1 E[S1 ] 2 E[S2 ] + 2 2
1 2 = WQ + 2 E[S2 ]WQ
[from Equation (8.44)]
Now, using Equation (8.45), we obtain
2 2 E[S2 ]WQ = 2 2 1 E[S1 ] + 2 E[S2 ] 1 1  2 1  1 E[S1 ]  2 E[S2 ] 1  1 E[S1 ]
or
2 WQ = 2 2 1 E[S1 ] + 2 E[S2 ] 2(1  1 E[S1 ]  2 E[S2 ])(1  1 E[S1 ])
(8.46)
nite is that 1 E[S1 ] < 1, which is independent of the type 2 parameters. (Is this 2 intuitive?) For WQ to be finite, we need, from Equation (8.46), that 1 E[S1 ] + 2 E[S2 ] < 1
1 Remarks (i) Note that from Equation (8.45), the condition for WQ to be fi
536
8
Queueing Theory
Since the arrival rate of all customers is = 1 + 2 , and the average service time of a customer is (1 /)E[S1 ] + (2 /)E[S2 ], the preceding condition is just that the average arrival rate be less than the average service rate. (ii) If there are n types of customers, we can solve for V j , j = 1, . . . , n, in a similar fashion. First, note that the total amount of work in the system of customers of types 1, . . . , j is independent of the internal priority rule concerning types 1, . . . , j and only depends on the fact that each of them is given priority over any customers of types j + 1, . . . , n. (Why is this? Reason it out!) Hence, V 1 + + V j is the same as it would be if types 1, . . . , j were considered as a single type I priority class and types j + 1, . . . , n as a single type II priority class. Now, from Equations (8.43) and (8.45), VI = where I = 1 + + j , II = j +1 + + n ,
j 2 I E[SI2 ] + I II E[SI ]E[SII ] 2(1  I E[SI ])
E[SI ] =
i=1 j
i E[Si ], I i E[Si2 ], I i E[Si2 ] II
E[SI2 ] =
i=1 n 2 E[SII ] =
i=j +1
Hence, as V I = V 1 + + V j , we have an expression for V 1 + + V j , for each j = 1, . . . , n, which then can be solved for the individual V 1 , V 2 , . . . , V n . i We now can obtain WQ from Equation (8.43). The result of all this (which we leave for an exercise) is that
i WQ = 2 2 1 E[S1 ] + + n E[Sn ] i j =i1 (1  1 E[S1 ]   j E[Sj ])
2
,
i = 1, . . . , n
(8.47)
8.6.3. An M/G/1 Optimization Example Consider a singleserver system where customers arrive according to a Poisson process with rate , and where the service times are independent and have distribution function G. Let = E[S], where S represents a service time random
8.6.
Variations on the M/G/1
537
variable, and suppose that < 1. Suppose that the server departs whenever a busy period ends and does not return until there are n customers waiting. At that time the server returns and continues serving until the system is once again empty. If the system facility incurs costs at a rate of c per unit time per customer in the system, as well as a cost K each time the server returns, what value of n, n 1, minimizes the longrun average cost per unit time incurred by the facility, and what is this minimal cost? To answer the preceding, let us first determine A(n), the average cost per unit time for the policy that returns the server whenever there are n customers waiting. To do so, say that a new cycle begins each time the server returns. As it is easy to see that everything probabilistically starts over when a cycle begins, it follows from the theory of renewal reward processes that if C(n) is the cost incurred in a cycle and T (n) is the time of a cycle, then A(n) = E[C(n)] E[T (n)]
To determine E[C(n)] and E[T (n)], consider the time interval of length, say, Ti , starting from the first time during a cycle that there are a total of i customers in the system until the first time afterward that there are only i  1. Therefore, n Ti i=1 is the amount of time that the server is busy during a cycle. Adding the additional mean idle time until n customers are in the system gives that
n
E[T (n)] =
i=1
E[Ti ] + n/
Now, consider the system at the moment when a service is about to begin and there are i  1 customers waiting in queue. Since service times do not depend on the order in which customers are served, suppose that the order of service is last come first served, implying that service does not begin on the i  1 presently in queue until these i  1 are the only ones in the system. Thus, we see that the time that it takes to go from i customers in the system to i  1 has the same distribution as the time it takes the M/G/1 system to go from a single customer (just beginning service) to empty; that is, its distribution is that of B, the length of an M/G/1 busy period. (Essentially the same argument was made in Example 5.25.) Hence, E[Ti ] = E[B] = implying that E[T (n)] = nE[S] n n + = 1  E[S] (1  ) (8.48) E[S] 1
To determine E[C(n)], let Ci denote the cost incurred during the interval of length Ti that starts with i  1 in queue and a service just beginning and ends
538
8
Queueing Theory
when the i  1 in queue are the only customers in the system. Thus, K + n Ci i=1 represents the total cost incurred during the busy part of the cycle. In addition, during the idle part of the cycle there will be i customers in the system for an exponential time with rate , i = 1, . . . , n  1, resulting in an expected cost of c(1 + + n  1)/. Consequently,
n
E[C(n)] = K +
i=1
E[Ci ] +
n(n  1)c 2
(8.49)
To find E[Ci ], consider the moment when the interval of length Ti begins, and let Wi be the sum of the initial service time plus the sum of the times spent in the system by all the customers that arrive (and are served) until the moment when the interval ends and there are only i  1 customers in the system. Then, Ci = (i  1)cTi + cWi where the first term refers to the cost incurred due to the i  1 customers in queue during the interval of length Ti . As it is easy to see that Wi has the same distribution as Wb , the sum of the times spent in the system by all arrivals in an M/G/1 busy period, we obtain that E[Ci ] = (i  1)c Using Equation (8.49), this yields E[C(n)] = K + n(n  1)cE[S] n(n  1)c + ncE[Wb ] + 2(1  ) 2 n(n  1)c 2 n(n  1)c 2(1  ) +1 1 E[S] + cE[Wb ] 1 (8.50)
= K + ncE[Wb ] + = K + ncE[Wb ] +
Utilizing the preceding in conjunction with Equation (8.48) shows that A(n) = K(1  ) c(n  1) + c(1  )E[Wb ] + n 2 (8.51)
To determine E[Wb ], we use the result that the average amount of time spent in the system by a customer in the M/G/1 system is W = WQ + E[S] = E[S 2 ] + E[S] 2(1  )
However, if we imagine that on day j, j 1, we earn an amount equal to the total time spent in the system by the j th arrival at the M/G/1 system, then it follows
8.6.
Variations on the M/G/1
539
from renewal reward processes (since everything probabilistically restarts at the end of a busy period) that W= E[Wb ] E[N ]
where N is the number of customers served in an M/G/1 busy period. Since E[N] = 1/(1  ) we see that (1  )E[Wb ] = W = E[S 2 ] + E[S] 2(1  )
Therefore, using Equation (8.51), we obtain A(n) = c(n  1) K(1  ) c2 E[S 2 ] + + c + n 2(1  ) 2
To determine the optimal value of n, treat n as a continuous variable and differentiate the preceding to obtain A (n) = K(1  ) c + 2 n2
Setting this equal to 0 and solving yields that the optimal value of n is n = 2K(1  ) c c c2 E[S 2 ] + c  2(1  ) 2
and the minimal average cost per unit time is A(n ) = 2K(1  )c +
It is interesting to see how close we can come to the minimal average cost when we use a simpler policy of the following form: Whenever the server finds the system empty of customers she departs and then returns after a fixed time t has elapsed. Let us say that a new cycle begins each time the server departs. Both the expected costs incurred during the idle and the busy parts of a cycle are obtained by conditioning on N(t), the number of arrivals in the time t that the server is gone. With C(t) being the cost incurred during a cycle, we obtain E[C(t)  N(t)] = K + =K +
N (t)
E[Ci ] + cN (t)
i=1
t 2
N (t)(N (t)  1)cE[S] t + N (t)cE[Wb ] + cN (t) 2(1  ) 2
540
8
Queueing Theory
The final term of the first equality is the conditional expected cost during the idle time in the cycle and is obtained by using that, given the number of arrivals in the time t, the arrival times are independent and uniformly distributed on (0, t); the second equality used Equation (8.50). Since N (t) is Poisson with mean t, it follows that E[N (t)(N (t)  1)] = E[N 2 (t)]  E[N (t)] = 2 t 2 . Thus, taking the expected value of the preceding gives E[C(t)] = K + =K + ct 2 2 t 2 cE[S] + tcE[Wb ] + 2(1  ) 2 ct 2 + tcE[Wb ] 2(1  )
Similarly, if T (t) is the time of a cycle, then E[T (t)] = E[E[T (t)N (t)]] = E[t + N (t)E[B]] =t + = t 1
t 1
Hence, the average cost per unit time, call it A(t), is E[C(t)] A(t) = E[T (t)] = K(1  ) ct + + c(1  )E[Wb ] t 2
Thus, from Equation (8.51), we see that A(n/)  A(n) = c/2 which shows that allowing the return decision to depend on the number presently in the system can reduce the average cost only by the amount c/2. 8.6.4. The M/G/1 Queue with Server Breakdown Consider a single server queue in which customers arrive according to a Poisson process with rate , and where the amount of service time required by each cus
8.6.
Variations on the M/G/1
541
tomer has distribution G. Suppose, however, that when working the server breaks down at an exponential rate . That is, the probability a working server will be able to work for an additional time t without breaking down is et . When the server breaks down, it immediately goes to the repair facility. The repair time is a random variable with distribution H . Suppose that the customer in service when a breakdown occurs has its service continue, when the sever returns, from the point it was at when the breakdown occurred. (Therefore, the total amount of time a customer is actually receiving service from a working server has distribution G.) By letting a customer's "service time" include the time that the customer is waiting for the server to come back from being repaired, the preceding is an M/G/1 queue. If we let T denote the amount of time from when a customer first enters service until it departs the system, then T is a service time random variable of this M/G/1 queue. The average amount of time a customer spends waiting in queue before its service first commences is, thus, WQ = E[T 2 ] 2(1  E[T ])
To compute E[T ] and E[T 2 ], let S, having distribution G, be the service requirement of the customer; let N denote the number of times that the server breaks down while the customer is in service; let R1 , R2 , . . . be the amounts of time the server spends in the repair facility on its successive visits. Then,
N
T=
i=1
Ri + S
Conditioning on S yields
N
E[T S = s] = E
i=1
Ri S = s + s,
N
Var(T S = s) = Var
i=1
Ri S = s
Now, a working server always breaks down at an exponential rate . Therefore, given that a customer requires s units of service time, it follows that the number of server breakdowns while that customer is being served is a Poisson random variable with mean s. Consequently, conditional on S = s, the random variable
542
8
Queueing Theory
is a compound Poisson random variable with Poisson mean s. Using the results from Examples 3.10 and 3.17, we thus obtain
N N
N i=1 Ri
E
i=1
Ri S = s = sE[R],
Var
i=1
Ri S = s = sE[R 2 ]
where R has the repair distribution H . Therefore, E[T S] = SE[R] + S = S(1 + E[R]), Var(T S) = SE[R 2 ] Thus, E[T ] = E[E[T S]] = E[S](1 + E[R]) and, by the conditional variance formula, Var(T ) = E[Var(T S)] + Var(E[T S]) = E[S]E[R 2 ] + (1 + E[R])2 Var(S) Therefore, E[T 2 ] = Var(T ) + (E[T ])2 = E[S]E[R 2 ] + (1 + E[R])2 E[S 2 ] Consequently, assuming that E[T ] = E[S](1 + E[R]) < 1, we obtain WQ = E[S]E[R 2 ] + (1 + E[R])2 E[S 2 ] 2(1  E[S](1 + E[R])) LQ = WQ , W = WQ + E[T ], L = W Some other quantities we might be interested in are (i) Pw , the proportion of time the server is working; (ii) Pr , the proportion of time the server is being repaired; (iii) PI , the proportion of time the server is idle.
From the preceding, we can now obtain
8.7.
The Model G/M/1
543
These quantities can all be obtained by using the queueing cost identity. For instance, if we suppose that customers pay 1 per unit time while actually being served, than average rate at which system earns = Pw , average amount a customer pays = E[S] Therefore, the identity yields that Pw = E[S] To determine Pr , suppose a customer whose service is interrupted pays 1 per unit time while the server is being repaired. Then, average rate at which system earns = Pr ,
N
average amount a customer pays = E
i=1
Ri = E[S]E[R]
yielding that Pr = E[S]E[R] Of course, PI can be obtained from PI = 1  Pw  Pr ing that 1  P0 = E[T ] is the proportion of time the server is either working or in repair. Thus, Pw = E[T ] Pr = E[T ] E[S] = E[S], E[T ] E[T ]  E[S] = E[S]E[R] E[T ]
Remark The quantities Pw and Pr could also have been obtained by first not
8.7.
The Model G/M/1
The model G/M/1 assumes that the times between successive arrivals have an arbitrary distribution G. The service times are exponentially distributed with rate and there is a single server. The immediate difficulty in analyzing this model stems from the fact that the number of customers in the system is not informative enough to serve as a
544
8
Queueing Theory
state space. For in summarizing what has occurred up to the present we would need to know not only the number in the system, but also the amount of time that has elapsed since the last arrival (since G is not memoryless). (Why need we not be concerned with the amount of time the person being served has already spent in service?) To get around this problem we shall only look at the system when a customer arrives; and so let us define Xn , n 1, by Xn the number in the system as seen by the nth arrival It is easy to see that the process {Xn , n 1} is a Markov chain. To compute the transition probabilities Pij for this Markov chain let us first note that, as long as there are customers to be served, the number of services in any length of time t is a Poisson random variable with mean t. This is true since the time between successive services is exponential and, as we know, this implies that the number of services thus constitutes a Poisson process. Hence, Pi,i+1j =
0
et
(t)j dG(t), j!
j = 0, 1, . . . , i
which follows since if an arrival finds i in the system, then the next arrival will find i + 1 minus the number served, and the probability that j will be served is easily seen to equal the right side of the preceding (by conditioning on the time between the successive arrivals). The formula for Pi0 is a little different (it is the probability that at least i + 1 Poisson events occur in a random length of time having distribution G) and can be obtained from
i
Pi0 = 1 
j =0
Pi,i+1j
The limiting probabilities k , k = 0, 1, . . . , can be obtained as the unique solution of k =
i
i Pik ,
k
0,
k = 1
i
which, in this case, reduce to
k =
i=k1
i
0
et
(t)i+1k dG(t), (i + 1  k)!
k
1, (8.52)
k = 1
0
8.7.
The Model G/M/1
545
(We have not included the equation 0 = i Pi0 since one of the equations is always redundant.) To solve the preceding, let us try a solution of the form k = c k . Substitution into Equation (8.52) leads to
c k = c
i=k1 0
i
0
et
(t)i+1k dG(t) (i + 1  k)! (t)i+1k dG(t) (i + 1  k)! (8.53)
=c However,
et k1
i=k1
i=k1
(t)i+1k = (i + 1  k)!
j =0
(t)j j!
= et and thus Equation (8.53) reduces to k = k1
0
et (1) dG(t)
or =
0
et (1) dG(t)
k k
(8.54)
The constant c can be obtained from c
0
= 1, which implies that
k = 1
or c=1 As (k ) is the unique solution to Equation (8.52), and k = (1  ) k satisfies, it follows that k = (1  ) k , k = 0, 1, . . .
where is the solution of Equation (8.54). [It can be shown that if the mean of G is greater than the mean service time 1/, then there is a unique value of
546
8
Queueing Theory
satisfying Equation (8.54) which is between 0 and 1.] The exact value of usually can only be obtained by numerical methods. As k is the limiting probability that an arrival sees k customers, it is just the ak as defined in Section 8.2. Hence, k = (1  ) k , k 0 (8.55)
We can obtain W by conditioning on the number in the system when a customer arrives. This yields W=
k
E[time in system  arrival sees k](1  ) k k+1 (1  ) k (Since if an arrival sees k then he spends k + 1 service periods in the system)
=
k
= and
1 (1  )
by using
0
kx k =
x (1  x)2
WQ = W 
1 = , (1  ) , (1  ) (1  ) (8.56)
L = W =
LQ = WQ =
where is the reciprocal of the mean interarrival time. That is, 1 =
x dG(x)
0
In fact, in exactly the same manner as shown for the M/M/1 in Section 8.3.1 and Exercise 4 we can show that W is exponential with rate (1  ),
WQ =
0 exponential with rate (1  )
with probability 1  with probability
where W and WQ are the amounts of time that a customer spends in system and queue, respectively (their means are W and WQ ). Whereas ak = (1  ) k is the probability that an arrival sees k in the system, it is not equal to the proportion of time during which there are k in the system (since the arrival process is not Poisson). To obtain the Pk we first note that the
8.7.
The Model G/M/1
547
rate at which the number in the system changes from k  1 to k must equal the rate at which it changes from k to k  1 (why?). Now the rate at which it changes from k  1 to k is equal to the arrival rate multiplied by the proportion of arrivals finding k  1 in the system. That is, rate number in system goes from k  1 to k = ak1 Similarly, the rate at which the number in the system changes from k to k  1 is equal to the proportion of time during which there are k in the system multiplied by the (constant) service rate. That is, rate number in system goes from k to k  1 = Pk Equating these rates yields Pk = and so, from Equation (8.55), Pk = and, as P0 = 1 
k=1 Pk ,
ak1 ,
k
1
(1  ) k1 ,
k
1
we obtain P0 = 1 
Remarks In the foregoing analysis we guessed at a solution of the stationary
probabilities of the Markov chain of the form k = c k , then verified such a solution by substituting in the stationary Equation (8.52). However, it could have been argued directly that the stationary probabilities of the Markov chain are of this form. To do so, define i to be the expected number of times that state i + 1 is visited in the Markov chain between two successive visits to state i, i 0. Now it is not difficult to see (and we will let you argue it out for yourself) that 0 = 1 = 2 = = Now it can be shown by using renewal reward processes that i+1 = = E[number of visits to state i + 1 in an ii cycle] E[number of transitions in an ii cycle] i 1/i
548 and so,
8
Queueing Theory
i+1 = i i = i , implying, since
0 i
i
0
= 1, that i = i (1  ), i 0
8.7.1. The G/M/1 Busy and Idle Periods Suppose that an arrival has just found the system emptyand so initiates a busy periodand let N denote the number of customers served in that busy period. Since the N th arrival (after the initiator of the busy period) will also find the system empty, it follows that N is the number of transitions for the Markov chain (of Section 8.7) to go from state 0 to state 0. Hence, 1/E[N ] is the proportion of transitions that take the Markov chain into state 0; or equivalently, it is the proportion of arrivals that find the system empty. Therefore, E[N ] = 1 1 = a0 1 
Also, as the next busy period begins after the N th interarrival, it follows that the cycle time (that is, the sum of a busy and idle period) is equal to the time until the N th interarrival. In other words, the sum of a busy and idle period can be expressed as the sum of N interarrival times. Thus, if Ti is the ith interarrival time after the busy period begins, then
N
E[Busy] + E[Idle] = E
i=1
Ti (by Wald's equation) (8.57)
= E[N ]E[T ] = 1 (1  )
For a second relation between E[Busy] and E[Idle], we can use the same argument as in Section 8.5.3 to conclude that E[Busy] 1  P0 = E[Idle] + E[Busy] and since P0 = 1  /, we obtain, upon combining this with (8.57), that E[Busy] = E[Idle] = 1 , (1  )  (1  )
8.8.
A Finite Source Model
549
8.8.
A Finite Source Model
Consider a system of m machines, whose working times are independent exponential random variables with rate . Upon failure, a machine instantly goes to a repair facility that consists of a single repairperson. If the repairperson is free, repair begins on the machine; otherwise, the machine joins the queue of failed machines. When a machine is repaired it becomes a working machine, and repair begins on a new machine from the queue of failed machines (provided the queue is nonempty). The successive repair times are independent random variables having density function g, with mean R =
0
xg(x) dx
To analyze this system, so as to determine such quantities as the average number of machines that are down and the average time that a machine is down, we will exploit the exponentially distributed working times to obtain a Markov chain. Specifically, let Xn denote the number of failed machines immediately after the nth repair occurs, n 1. Now, if Xn = i > 0, then the situation when the nth repair has just occurred is that repair is about to begin on a machine, there are i  1 other machines waiting for repair, and there are m  i working machines, each of which will (independently) continue to work for an exponential time with rate . Similarly, if Xn = 0, then all m machines are working and will (independently) continue to do so for exponentially distributed times with rate . Consequently, any information about earlier states of the system will not affect the probability distribution of the number of down machines at the moment of the next repair completion; hence, {Xn , n 1} is a Markov chain. To determine its transition probabilities Pi,j , suppose first that i > 0. Conditioning on R, the length of the next repair time, and making use of the independence of the m  i remaining working times, yields that for j m  i Pi,i1+j = P {j failures during R} =
0
P {j failures during R  R = r}g(r) dr mi (1  er )j (er )mij g(r) dr j
=
0
If i = 0, then, because the next repair will not begin until one of the machines fails, P0,j = P1,j , j m1
550
8
Queueing Theory
Let j , j = 0, . . . , m  1, denote the stationary probabilities of this Markov chain. That is, they are the unique solution of j =
i m1
i Pi,j ,
j = 1
j =0
Therefore, after explicitly determining the transition probabilities and solving the preceding equations, we would know the value of 0 , the proportion of repair completions that leaves all machines working. Let us say that the system is "on" when all machines are working and "off" otherwise. (Thus, the system is on when the repairperson is idle and off when he is busy.) As all machines are working when the system goes back on, it follows from the lack of memory property of the exponential that the system probabilistically starts over when it goes on. Hence, this onoff system is an alternating renewal process. Suppose that the system has just become on, thus starting a new cycle, and let Ri , i 1, be the time of the ith repair from that moment. Also, let N denote the number of repairs in the off (busy) time of the cycle. Then, it follows that B, the length of the off period, can be expressed as
N
B=
i=1
Ri
Although N is not independent of the sequence R1 , R2 , . . . , it is easy to check that it is a stopping time for this sequence, and thus by Wald's equation (see Exercise 13 of Chapter 7) we have that E[B] = E[N]E[R] = E[N]R Also, since an on time will last until one of the machines fails, and since the minimum of independent exponential random variables is exponential with a rate equal to the sum of their rates, it follows that E[I ], the mean on (idle) time in a cycle, is given by E[I ] = 1/(m) Hence, PB , the proportion of time that the repairperson is busy, satisfies PB = E[N]R E[N ]R + 1/(m)
8.8.
A Finite Source Model
551
However, since, on average, one out of every E[N ] repair completions will leave all machines working, it follows that 0 = Consequently, PB = R R + 0 /(m) (8.58) 1 E[N ]
Now focus attention on one of the machines, call it machine number 1, and let P1,R denote the proportion of time that machine 1 is being repaired. Since the proportion of time that the repairperson is busy is PB , and since all machines fail at the same rate and have the same repair distribution, it follows that P1,R = R PB = m mR + 0 / (8.59)
However, machine 1 alternates between time periods when it is working, when it is waiting in queue, and when it is in repair. Let Wi , Qi , Si denote, respectively, the ith working time, the ith queueing time, and the ith repair time of machine 1, i 1. Then, the proportion of time that machine 1 is being repaired during its first n workingqueuerepair cycles is: proportion of time in the first n cycles that machine 1 is being repaired = =
n i=1 Si + n Qi + n Si i=1 i=1 n i=1 Si /n n Wi /n + n Qi /n + n Si /n i=1 i=1 i=1 n i=1 Wi
Letting n and using the strong law of large numbers to conclude that the averages of the Wi and of the Si converge, respectively, to 1/ and R , yields that R P1,R = 1/ + Q + R where Q is the average amount of time that machine 1 spends in queue when it fails. Using Equation (8.59), the preceding gives that R R = mR + 0 / 1/ + Q + R or, equivalently, that Q = (m  1)R  (1  0 )/ Moreover, since all machines are probabilistically equivalent it follows that Q is equal to WQ , the average amount of time that a failed machine spends in queue.
552
8
Queueing Theory
To determine the average number of machines in queue, we will make use of the basic queueing identity LQ = a W Q = a Q where a is the average rate at which machines fail. To determine a , again focus attention on machine 1 and suppose that we earn one per unit time whenever machine 1 is being repaired. It then follows from the basic cost identity of Equation (8.1) that P1,R = r1 R where r1 is the average rate at which machine 1 fails. Thus, from Equation (8.59), we obtain that 1 r1 = mR + 0 / Because all m machines fail at the same rate, the preceding implies that m a = mr1 = mR + 0 / which gives that the average number of machines in queue is LQ = m(m  1)R  m(1  0 )/ mR + 0 /
Since the average number of machines being repaired is PB , the preceding, along with Equation (8.58), shows that the average number of down machines is L = LQ + PB = m2 R  m(1  0 )/ mR + 0 /
8.9.
Multiserver Queues
By and large, systems that have more than one server are much more difficult to analyze than those with a single server. In Section 8.9.1 we start first with a Poisson arrival system in which no queue is allowed, and then consider in Section 8.9.2 the infinite capacity M/M/k system. For both of these models we are able to present the limiting probabilities. In Section 8.9.3 we consider the model G/M/k. The analysis here is similar to that of the G/M/1 (Section 8.7) except that in place of a single quantity given as the solution of an integral equation, we have k such quantities. We end in Section 8.9.4 with the model M/G/k for which unfortunately our previous technique (used in M/G/1) no longer enables us to derive WQ , and we content ourselves with an approximation.
8.9.
Multiserver Queues
553
8.9.1. Erlang's Loss System A loss system is a queueing system in which arrivals that find all servers busy do not enter but rather are lost to the system. The simplest such system is the M/M/k loss system in which customers arrive according to a Poisson process having rate , enter the system if at least one of the k servers is free, and then spend an exponential amount of time with rate being served. The balance equations for this system are State 0 1 2 i, 0 < i < k k Rewriting gives P0 = P1 , P1 = 2P2 , P2 = 3P3 , . . . Pk1 = kPk or P1 = P2 = P3 = . . . Pk = and using
k 0 Pi
Rate leave = rate enter P0 = P1 ( + )P1 = 2P2 + P0 ( + 2)P2 = 3P3 + P1 ( + i)Pi = (i + 1)Pi+1 + Pi1 kPk = Pk1
P0 , (/)2 P1 = P0 , 2 2 (/)3 P2 = P0 , 3 3! (/)k Pk1 = P0 k k!
= 1, we obtain Pi = (/)i /i!
k j j =0 (/) /j !
,
i = 0, 1, . . . , k
554
8
Queueing Theory
Since E[S] = 1/, where E[S] is the mean service time, the preceding can be written as Pi = (E[S])i /i!
k j j =0 (E[S]) /j !
,
i = 0, 1, . . . , k
(8.60)
Consider now the same system except that the service distribution is general that is, consider the M/G/k with no queue allowed. This model is sometimes called the Erlang loss system. It can be shown (though the proof is advanced) that Equation (8.60) (which is called Erlang's loss formula) remains valid for this more general system. 8.9.2. The M/M/k Queue The M/M/k infinite capacity queue can be analyzed by the balance equation technique. We leave it for you to verify that (/)i i! , i k k1 (/)i (/)k k + Pi = k! k  i=0 i! (/k)i k k P0 , i>k k! We see from the preceding that we need to impose the condition < k. 8.9.3. The G/M/k Queue In this model we again suppose that there are k servers, each of whom serves at an exponential rate . However, we now allow the time between successive arrivals to have an arbitrary distribution G. To ensure that a steadystate (or limiting) distribution exists, we assume the condition 1/G < k where G is the mean of G.* The analysis for this model is similar to that presented in Section 8.7 for the case k = 1. Namely, to avoid having to keep track of the time since the last arrival, we look at the system only at arrival epochs. Once again, if we define Xn as the number in the system at the moment of the nth arrival, then {Xn , n 0} is a Markov chain.
* It follows from the renewal theory (Proposition 7.1) that customers arrive at rate 1/ , and as G the maximum service rate is k, we clearly need that 1/G < k for limiting probabilities to exist.
8.9.
Multiserver Queues
555
To derive the transition probabilities of the Markov chain, it helps to first note the relationship Xn+1 = Xn + 1  Yn , n 0
where Yn denotes the number of departures during the interarrival time between the nth and (n + 1)st arrival. The transition probabilities Pij can now be calculated as follows:
Case 1: j > i + 1. Case 2: j
In this case it easily follows that Pij = 0.
i + 1 k. In this case if an arrival finds i in the system, then as i < k the new arrival will also immediately enter service. Hence, the next arrival will find j if of the i + 1 services exactly i + 1  j are completed during the interarrival time. Conditioning on the length of this interarrival time yields Pij = P {i + 1  j of i + 1 services are completed in an interarrival time} =
0
P {i + 1  j of i + 1 are completedinterarrival time is t} dG(t) i +1 (i  et )i+1j (et )j dG(t) j
=
0
where the last equality follows since the number of service completions in a time t will have a binomial distribution.
Case 3: i + 1
j k. To evaluate Pij in this case we first note that when all servers are busy, the departure process is a Poisson process with rate k (why?). Hence, again conditioning on the interarrival time we have Pij = P {i + 1  j departures} =
0
P {i + 1  j departures in time t} dG(t) ekt (kt)i+1j dG(t) (i + 1  j )!
=
0
Case 4: i + 1
k > j. In this case since when all servers are busy the departure process is a Poisson process, it follows that the length of time until there will only be k in the system will have a gamma distribution with parameters i + 1  k, k (the time until
556
8
Queueing Theory
i + 1  k events of a Poisson process with rate k occur is gamma distributed with parameters i + 1  k, k). Conditioning first on the interarrival time and then on the time until there are only k in the system (call this latter random variable Tk ) yields Pij =
0
P {i + 1  j departures in time t} dG(t)
t 0
=
0
P {i + 1  j departures in t  Tk = s}keks k j 1  e(ts)
kj
(ks)ik ds dG(t) (i  k)!
=
0
0
t
e(ts) keks
j
(ks)ik ds dG(t) (i  k)!
where the last equality follows since of the k people in service at time s the number whose service will end by time t is binomial with parameters k and 1  e(ts) . We now can verify either by a direct substitution into the equations j = i i Pij , or by the same argument as presented in the remark at the end of Section 8.7, that the limiting probabilities of this Markov chain are of the form k1+j = c j , Substitution into any of the equations j = given as the solution of =
0
j = 0, 1, . . . .
i
i Pij when j > k yields that is
ekt (1) dG(t)
The values 0 , 1 , . . . , k2 , can be obtained by recursively solving the first k  1 of the steadystate equations, and c can then be computed by using i = 1. 0 If we let WQ denote the amount of time that a customer spends in queue, then in exactly the same manner as in G/M/1 we can show that c 0, with probability k1 i = 1  1 0 WQ = c Exp(k(1  )), with probability i = 1 k where Exp(k(1  )) is an exponential random variable with rate k(1  ). 8.9.4. The M/G/k Queue In this section we consider the M/G/k system in which customers arrive at a Poisson rate and are served by any of k servers, each of whom has the service
8.9.
Multiserver Queues
557
distribution G. If we attempt to mimic the analysis presented in Section 8.5 for the M/G/1 system, then we would start with the basic identity V = E[S]WQ + E[S 2 ]/2 (8.61)
and then attempt to derive a second equation relating V and WQ . Now if we consider an arbitrary arrival, then we have the following identity: work in system when customer arrives = k time customer spends in queue + R (8.62)
where R is the sum of the remaining service times of all other customers in service at the moment when our arrival enters service. The foregoing follows because while the arrival is waiting in queue, work is being processed at a rate k per unit time (since all servers are busy). Thus, an amount of work k time in queue is processed while he waits in queue. Now, all of this work was present when he arrived and in addition the remaining work on those still being served when he enters service was also present when he arrived so we obtain Equation (8.62). For an illustration, suppose that there are three servers all of whom are busy when the customer arrives. Suppose, in addition, that there are no other customers in the system and also that the remaining service times of the three people in service are 3, 6, and 7. Hence, the work seen by the arrival is 3 + 6 + 7 = 16. Now the arrival will spend 3 time units in queue, and at the moment he enters service, the remaining times of the other two customers are 6  3 = 3 and 7  3 = 4. Hence, R = 3 + 4 = 7 and as a check of Equation (8.62) we see that 16 = 3 3 + 7. Taking expectations of Equation (8.62) and using the fact that Poisson arrivals see time averages, we obtain V = kWQ + E[R] which, along with Equation (8.61), would enable us to solve for WQ if we could compute E[R]. However there is no known method for computing E[R] and in fact, there is no known exact formula for WQ . The following approximation for WQ was obtained in Reference 6 by using the foregoing approach and then approximating E[R]: WQ k E[S 2 ](E[S])k1
k1
2(k  1)!(k  E[S])2
n=0
(E[S])k (E[S])n + n! (k  1)!(k  E[S]) (8.63)
The preceding approximation has been shown to be quite close to the WQ when the service distribution is gamma. It is also exact when G is exponential.
558
8
Queueing Theory
Exercises
1. For the M/M/1 queue, compute (a) the expected number of arrivals during a service period and (b) the probability that no customers arrive during a service period. Hint: "Condition." *2. Machines in a factory break down at an exponential rate of six per hour. There is a single repairman who fixes machines at an exponential rate of eight per hour. The cost incurred in lost production when machines are out of service is $10 per hour per machine. What is the average cost rate incurred due to failed machines? 3. The manager of a market can hire either Mary or Alice. Mary, who gives service at an exponential rate of 20 customers per hour, can be hired at a rate of $3 per hour. Alice, who gives service at an exponential rate of 30 customers per hour, can be hired at a rate of $C per hour. The manager estimates that, on the average, each customer's time is worth $1 per hour and should be accounted for in the model. If customers arrive at a Poisson rate of 10 per hour, then (a) what is the average cost per hour if Mary is hired? if Alice is hired? (b) find C if the average cost per hour is the same for Mary and Alice. 4. Suppose that a customer of the M/M/1 system spends the amount of time x > 0 waiting in queue before entering service. (a) Show that, conditional on the preceding, the number of other customers that were in the system when the customer arrived is distributed as 1 + P , where P is a Poisson random variable with mean . (b) Let WQ denote the amount of time that an M/M/1 customer spends in queue. As a byproduct of your analysis in part (a), show that
P {WQ
x} =
1 1
if x = 0 +
()x ) (1  e
if x > 0
5. It follows from Exercise 4 that if, in the M/M/1 model, WQ is the amount of time that a customer spends waiting in queue, then WQ =
0, Exp(  ),
with probability 1  / with probability /
where Exp(  ) is an exponential random variable with rate  . Using this, find Var(WQ ).
Exercises
559
6. Two customers move about among three servers. Upon completion of service at server i, the customer leaves that server and enters service at whichever of the other two servers is free. (Therefore, there are always two busy servers.) If the service times at server i are exponential with rate i , i = 1, 2, 3, what proportion of time is server i idle? *7. Show that W is smaller in an M/M/1 model having arrivals at rate and service at rate 2 than it is in a twoserver M/M/2 model with arrivals at rate and with each server at rate . Can you give an intuitive explanation for this result? Would it also be true for WQ ? 8. A group of n customers moves around among two servers. Upon completion of service, the served customer then joins the queue (or enters service if the server is free) at the other server. All service times are exponential with rate . Find the proportion of time that there are j customers at server 1, j = 0, . . . , n. 9. A facility produces items according to a Poisson process with rate . However, it has shelf space for only k items and so it shuts down production whenever k items are present. Customers arrive at the facility according to a Poisson process with rate . Each customer wants one item and will immediately depart either with the item or empty handed if there is no item available. (a) Find the proportion of customers that go away empty handed. (b) Find the average time that an item is on the shelf. (c) Find the average number of items on the shelf. Suppose now that when a customer does not find any available items it joins the "customers' queue" as long as there are no more than n  1 other customers waiting at that time. If there are n waiting customers then the new arrival departs without an item. (d) Set up the balance equations. (e) In terms of the solution of the balance equations, what is the average number of customers in the system? 10. A group of m customers frequents a singleserver station in the following manner. When a customer arrives, he or she either enters service if the server is free or joins the queue otherwise. Upon completing service the customer departs the system, but then returns after an exponential time with rate . All service times are exponentially distributed with rate . (a) Define states and set up the balance equations. In terms of the solution of the balance equations, find (b) the average rate at which customers enter the station. (c) the average time that a customer spends in the station per visit.
560
8
Queueing Theory
11. Consider a singleserver queue with Poisson arrivals and exponential service times having the following variation: Whenever a service is completed a departure occurs only with probability . With probability 1  the customer, instead of leaving, joins the end of the queue. Note that a customer may be serviced more than once. (a) Set up the balance equations and solve for the steadystate probabilities, stating conditions for it to exist. (b) Find the expected waiting time of a customer from the time he arrives until he enters service for the first time. (c) What is the probability that a customer enters service exactly n times, n = 1, 2, . . .? (d) What is the expected amount of time that a customer spends in service (which does not include the time he spends waiting in line)? Hint: Use part (c). (e) What is the distribution of the total length of time a customer spends being served? Hint: Is it memoryless? 12. Exponential queueing systems in which the state is the number of customers in the system are known as birth and death queueing systems. For such a system, let n denote the rate at which a new customer joins the system when it is in state n, and let n denote the rate at which there is a departure from the system when in state n. (a) Give the quantities n and n for the M/M/1 queue with finite capacity N . (b) Write down the balance equations. (c) Show how the balance equations can be reduced to the set of equations n Pn = n+1 Pn+1 , n 0
(d) Give a direct argument for the preceding equations. (e) Solve the preceding equations, and in doing so, give the condition that is needed for there to be a solution. (f) What is the average arrival rate a ? (g) What is the average amount of time that a customer spends in the system? *13. A supermarket has two exponential checkout counters, each operating at rate . Arrivals are Poisson at rate . The counters operate in the following way: (i) One queue feeds both counters.
Exercises
561
(ii) One counter is operated by a permanent checker and the other by a stock clerk who instantaneously begins checking whenever there are two or more customers in the system. The clerk returns to stocking whenever he completes a service, and there are fewer than two customers in the system. (a) Let Pn = proportion of time there are n in the system. Set up equations for Pn and solve. (b) At what rate does the number in the system go from 0 to 1? from 2 to 1? (c) What proportion of time is the stock clerk checking? Hint: Be a little careful when there is one in the system. 14. Customers arrive at a singleservice facility at a Poisson rate of 40 per hour. When two or fewer customers are present, a single attendant operates the facility, and the service time for each customer is exponentially distributed with a mean value of two minutes. However, when there are three or more customers at the facility, the attendant is joined by an assistant and, working together, they reduce the mean service time to one minute. Assuming a system capacity of four customers, (a) what proportion of time are both servers free? (b) each man is to receive a salary proportional to the amount of time he is actually at work servicing customers, the rate being the same for both. If together they earn $100 per day, how should this money be split? 15. Consider a sequentialservice system consisting of two servers, A and B. Arriving customers will enter this system only if server A is free. If a customer does enter, then he is immediately served by server A. When his service by A is completed, he then goes to B if B is free, or if B is busy, he leaves the system. Upon completion of service at server B, the customer departs. Assuming that the (Poisson) arrival rate is two customers an hour, and that A and B serve at respective (exponential) rates of four and two customers an hour, (a) what proportion of customers enter the system? (b) what proportion of entering customers receive service from B? (c) what is the average number of customers in the system? (d) what is the average amount of time that an entering customer spends in the system? 16. Customers arrive at a twoserver system according to a Poisson process having rate = 5. An arrival finding server 1 free will begin service with that server. An arrival finding server 1 busy and server 2 free will enter service with server 2. An arrival finding both servers busy goes away. Once a customer is served by ei
562
8
Queueing Theory
ther server, he departs the system. The service times at server i are exponential with rates i , where 1 = 4, 2 = 2. (a) What is the average time an entering customer spends in the system? (b) What proportion of time is server 2 busy? 17. Customers arrive at a twoserver station in accordance with a Poisson process with a rate of two per hour. Arrivals finding server 1 free begin service with that server. Arrivals finding server 1 busy and server 2 free begin service with server 2. Arrivals finding both servers busy are lost. When a customer is served by server 1, she then either enters service with server 2 if 2 is free or departs the system if 2 is busy. A customer completing service at server 2 departs the system. The service times at server 1 and server 2 are exponential random variables with respective rates of four and six per hour. (a) What fraction of customers do not enter the system? (b) What is the average amount of time that an entering customer spends in the system? (c) What fraction of entering customers receives service from server 1? 18. Customers arrive at a twoserver system at a Poisson rate . An arrival finding the system empty is equally likely to enter service with either server. An arrival finding one customer in the system will enter service with the idle server. An arrival finding two others in the system will wait in line for the first free server. An arrival finding three in the system will not enter. All service times are exponential with rate , and once a customer is served (by either server), he departs the system. (a) Define the states. (b) Find the longrun probabilities. (c) Suppose a customer arrives and finds two others in the system. What is the expected times he spends in the system? (d) What proportion of customers enter the system? (e) What is the average time an entering customer spends in the system? 19. The economy alternates between good and bad periods. During good times customers arrive at a certain singleserver queueing system in accordance with a Poisson process with rate 1 , and during bad times they arrive in accordance with a Poisson process with rate 2 . A good time period lasts for an exponentially distributed time with rate 1 , and a bad time period lasts for an exponential time with rate 2 . An arriving customer will only enter the queueing system if the server is free; an arrival finding the server busy goes away. All service times are exponential with rate . (a) Define states so as to be able to analyze this system. (b) Give a set of linear equations whose solution will yield the long run proportion of time the system is in each state.
Exercises
563
In terms of the solutions of the equations in part (b), (c) what proportion of time is the system empty? (d) what is the average rate at which customers enter the system? 20. There are two types of customers. Type 1 and 2 customers arrive in accordance with independent Poisson processes with respective rate 1 and 2 . There are two servers. A type 1 arrival will enter service with server 1 if that server is free; if server 1 is busy and server 2 is free, then the type 1 arrival will enter service with server 2. If both servers are busy, then the type 1 arrival will go away. A type 2 customer can only be served by server 2; if server 2 is free when a type 2 customer arrives, then the customer enters service with that server. If server 2 is busy when a type 2 arrives, then that customer goes away. Once a customer is served by either server, he departs the system. Service times at server i are exponential with rate i , i = 1, 2. Suppose we want to find the average number of customers in the system. (a) Define states. (b) Give the balance equations. Do not attempt to solve them. In terms of the longrun probabilities, what is (c) the average number of customers in the system? (d) the average time a customer spends in the system? *21. Suppose in Exercise 20 we want to find out the proportion of time there is a type 1 customer with server 2. In terms of the longrun probabilities given in Exercise 20, what is (a) (b) (c) (d) the rate at which a type 1 customer enters service with server 2? the rate at which a type 2 customer enters service with server 2? the fraction of server 2's customers that are type 1? the proportion of time that a type 1 customer is with server 2?
22. Customers arrive at a singleserver station in accordance with a Poisson process with rate . All arrivals that find the server free immediately enter service. All service times are exponentially distributed with rate . An arrival that finds the server busy will leave the system and roam around "in orbit" for an exponential time with rate at which time it will then return. If the server is busy when an orbiting customer returns, then that customer returns to orbit for another exponential time with rate before returning again. An arrival that finds the server busy and N other customers in orbit will depart and not return. That is, N is the maximum number of customers in orbit. (a) Define states. (b) Give the balance equations. In terms of the solution of the balance equations, find (c) the proportion of all customers that are eventually served.
564
8
Queueing Theory
(d) the average time that a served customer spends waiting in orbit. 23. Consider the M/M/1 system in which customers arrive at rate and the server serves at rate . However, suppose that in any interval of length h in which the server is busy there is a probability h + o(h) that the server will experience a breakdown, which causes the system to shut down. All customers that are in the system depart, and no additional arrivals are allowed to enter until the breakdown is fixed. The time to fix a breakdown is exponentially distributed with rate . (a) Define appropriate states. (b) Give the balance equations. In terms of the longrun probabilities, (c) what is the average amount of time that an entering customer spends in the system? (d) what proportion of entering customers complete their service? (e) what proportion of customers arrive during a breakdown? *24. Reconsider Exercise 23, but this time suppose that a customer that is in the system when a breakdown occurs remains there while the server is being fixed. In addition, suppose that new arrivals during a breakdown period are allowed to enter the system. What is the average time a customer spends in the system? 25. Poisson () arrivals join a queue in front of two parallel servers A and B, having exponential service rates A and B (see Figure 8.4). When the system is empty, arrivals go into server A with probability and into B with probability 1  . Otherwise, the head of the queue takes the first free server. (a) Define states and set up the balance equations. Do not solve. (b) In terms of the probabilities in part (a), what is the average number in the system? Average number of servers idle? (c) In terms of the probabilities in part (a), what is the probability that an arbitrary arrival will get serviced in A? 26. In a queue with unlimited waiting space, arrivals are Poisson (parameter ) and service times are exponentially distributed (parameter ). However, the server waits until K people are present before beginning service on the first customer; thereafter, he services one at a time until all K units, and all subsequent arrivals, are serviced. The server is then "idle" until K new arrivals have occurred. (a) Define an appropriate state space, draw the transition diagram, and set up the balance equations.
Figure 8.4.
Exercises
565
(b) In terms of the limiting probabilities, what is the average time a customer spends in queue? (c) What conditions on and are necessary? 27. Consider a singleserver exponential system in which ordinary customers arrive at a rate and have service rate . In addition, there is a special customer who has a service rate 1 . Whenever this special customer arrives, she goes directly into service (if anyone else is in service, then this person is bumped back into queue). When the special customer is not being serviced, she spends an exponential amount of time (with mean 1/ ) out of the system. (a) What is the average arrival rate of the special customer? (b) Define an appropriate state space and set up balance equations. (c) Find the probability that an ordinary customer is bumped n times. *28. Let D denote the time between successive departures in a stationary M/M/1 queue with < . Show, by conditioning on whether or not a departure has left the system empty, that D is exponential with rate . Hint: By conditioning on whether or not the departure has left the system empty we see that D= Exponential(), Exponential() Exponential(), with probability / with probability 1  /
where Exponential() Exponential() represents the sum of two independent exponential random variables having rates and . Now use momentgenerating functions to show that D has the required distribution. Note that the preceding does not prove that the departure process is Poisson. To prove this we need show not only that the interdeparture times are all exponential with rate , but also that they are independent. 29. Potential customers arrive to a single server hair salon according to a Poisson process with rate . A potential customer who finds the server free enters the system; a potential customer who finds the server busy goes away. Each potential customer is type i with probability pi , where p1 + p2 + p3 = 1. Type 1 customers have their hair washed by the server; type 2 customers have their hair cut by the server; and type 3 customers have their hair first washed and then cut by the server. The time that it takes the server to wash hair is exponentially distributed with rate 1 , and the time that it takes the server to cut hair is exponentially distributed with rate 2 . (a) Explain how this system can be analyzed with four states. (b) Give the equations whose solution yields the proportion of time the system is in each state.
566
8
Queueing Theory
In terms of the solution of the equations of (b), find (c) the proportion of time the server is cutting hair; (d) the average arrival rate of entering customers. 30. For the tandem queue model verify that Pn,m = (/1 )n (1  /1 )(/2 )m (1  /2 ) satisfies the balance equation (8.15). 31. Consider a network of three stations. Customers arrive at stations 1, 2, 3 in accordance with Poisson processes having respective rates, 5, 10, 15. The service times at the three stations are exponential with respective rates 10, 50, 100. A customer completing service at station 1 is equally likely to (i) go to station 2, (ii) go to station 3, or (iii) leave the system. A customer departing service at station 2 always goes to station 3. A departure from service at station 3 is equally likely to either go to station 2 or leave the system. (a) What is the average number of customers in the system (consisting of all three stations)? (b) What is the average time a customer spends in the system? 32. Consider a closed queueing network consisting of two customers moving among two servers, and suppose that after each service completion the customer is equally likely to go to either serverthat is, P1,2 = P2,1 = 1 . Let i denote the 2 exponential service rate at server i, i = 1, 2. (a) Determine the average number of customers at each server. (b) Determine the service completion rate for each server. 33. Explain how a Markov chain Monte Carlo simulation using the Gibbs sampler can be utilized to estimate (a) the distribution of the amount of time spent at server j on a visit. Hint: Use the arrival theorem. (b) the proportion of time a customer is with server j (i.e., either in server j 's queue or in service with j ). 34. For open queueing networks (a) state and prove the equivalent of the arrival theorem; (b) derive an expression for the average amount of time a customer spends waiting in queues. 35. Customers arrive at a singleserver station in accordance with a Poisson process having rate . Each customer has a value. The successive values of customers are independent and come from a uniform distribution on (0, 1). The service time of a customer having value x is a random variable with mean 3 + 4x and variance 5.
Exercises
567
(a) What is the average time a customer spends in the system? (b) What is the average time a customer having value x spends in the system? *36. Compare the M/G/1 system for firstcome, firstserved queue discipline with one of lastcome, firstserved (for instance, in which units for service are taken from the top of a stack). Would you think that the queue size, waiting time, and busyperiod distribution differ? What about their means? What if the queue discipline was always to choose at random among those waiting? Intuitively which discipline would result in the smallest variance in the waiting time distribution? 37. In an M/G/1 queue, (a) what proportion of departures leave behind 0 work? (b) what is the average work in the system as seen by a departure? 38. For the M/G/1 queue, let Xn denote the number in the system left behind by the nth departure. (a) If Xn+1 = what does Yn represent? (b) Rewrite the preceding as Xn+1 = Xn  1 + Yn + n where n = 1, 0, if Xn = 0 if Xn 1 (8.64) Xn  1 + Yn , Yn , if Xn 1 if Xn = 0
Take expectations and let n in Equation (8.64) to obtain E[ ] = 1  E[S] (c) Square both sides of Equation (8.64), take expectations, and then let n to obtain E[X ] = 2 E[S 2 ] + E[S] 2(1  E[S])
(d) Argue that E[X ], the average number as seen by a departure, is equal to L.
568
8
Queueing Theory
*39. Consider an M/G/1 system in which the first customer in a busy period has the service distribution G1 and all others have distribution G2 . Let C denote the number of customers in a busy period, and let S denote the service time of a customer chosen at random. Argue that (a) a0 = P0 = 1  E[S]. (b) E[S] = a0 E[S1 ] + (1  a0 )E[S2 ] where Si has distribution Gi . (c) Use (a) and (b) to show that E[B], the expected length of a busy period, is given by E[B] = (d) Find E[C]. 40. Consider a M/G/1 system with E[S] < 1. (a) Suppose that service is about to begin at a moment when there are n customers in the system. (i) Argue that the additional time until there are only n  1 customers in the system has the same distribution as a busy period. (ii) What is the expected additional time until the system is empty? (b) Suppose that the work in the system at some moment is A. We are interested in the expected additional time until the system is emptycall it E[T ]. Let N denote the number of arrivals during the first A units of time. (i) Compute E[T N]. (ii) Compute E[T ]. 41. Carloads of customers arrive at a singleserver station in accordance with a Poisson process with rate 4 per hour. The service times are exponentially distributed with rate 20 per hour. If each carload contains either 1, 2, or 3 customers with respective probabilities 1 , 1 , 1 compute the average customer delay in queue. 4 2 4 42. In the twoclass priority queueing model of Section 8.6.2, what is WQ ? Show that WQ is less than it would be under FIFO if E[S1 ] < E[S2 ] and greater than under FIFO if E[S1 ] > E[S2 ]. 43. In a twoclass priority queueing model suppose that a cost of Ci per unit time is incurred for each type i customer that waits in queue, i = 1, 2. Show that type 1 customers should be given priority over type 2 (as opposed to the reverse) if E[S1 ] E[S2 ] < C1 C2 E[S1 ] 1  E[S2 ]
Exercises
569
44. Consider the priority queueing model of Section 8.6.2 but now suppose that if a type 2 customer is being served when a type 1 arrives then the type 2 customer is bumped out of service. This is called the preemptive case. Suppose that when a bumped type 2 customer goes back in service his service begins at the point where it left off when he was bumped. (a) Argue that the work in the system at any time is the same as in the nonpreemptive case. 1 (b) Derive WQ . Hint: How do type 2 customers affect type 1s? (c) Why is it not true that
2 2 VQ = 2 E[S2 ]WQ
(d) Argue that the work seen by a type 2 arrival is the same as in the nonpreemptive case, and so
2 2 WQ = WQ (nonpreemptive) + E[extra time]
where the extra time is due to the fact that he may be bumped. (e) Let N denote the number of times a type 2 customer is bumped. Why is E[extra timeN ] = N E[S1 ] 1  1 E[S1 ]
Hint: When a type 2 is bumped, relate the time until he gets back in service to a "busy period." (f) Let S2 denote the service time of a type 2. What is E[N S2 ]? (g) Combine the preceding to obtain
2 2 WQ = WQ (nonpreemptive) +
1 E[S1 ]E[S2 ] 1  1 E[S1 ]
*45. Calculate explicitly (not in terms of limiting probabilities) the average time a customer spends in the system in Exercise 24. 46. In the G/M/1 model if G is exponential with rate show that = /. 47. Verify Erlang's loss formula, Equation (8.60), when k = 1. 48. Verify the formula given for the Pi of the M/M/k. 49. In the Erlang loss system suppose the Poisson arrival rate is = 2, and suppose there are three servers, each of whom has a service distribution that is uniformly distributed over (0, 2). What proportion of potential customers is lost?
570
8
Queueing Theory
50. In the M/M/k system, (a) what is the probability that a customer will have to wait in queue? (b) determine L and W .
51. Verify the formula for the distribution of WQ given for the G/M/k model.
*52. Consider a system where the interarrival times have an arbitrary distribution F , and there is a single server whose service distribution is G. Let Dn denote the amount of time the nth customer spends waiting in queue. Interpret Sn , Tn so that Dn+1 = D n + S n  Tn , 0, if Dn + Sn  Tn 0 if Dn + Sn  Tn < 0
53. Consider a model in which the interarrival times have an arbitrary distribution F , and there are k servers each having service distribution G. What condition on F and G do you think would be necessary for there to exist limiting probabilities?
References
1. J. Cohen, "The Single Server Queue," NorthHolland, Amsterdam, 1969. 2. R. B. Cooper, "Introduction to Queueing Theory," Second Edition, Macmillan, New York, 1984. 3. D. R. Cox and W. L. Smith, "Queues," Wiley, New York, 1961. 4. F. Kelly, "Reversibility and Stochastic Networks," Wiley, New York, 1979. 5. L. Kleinrock, "Queueing Systems," Vol. I, Wiley, New York, 1975. 6. S. Nozaki and S. Ross, "Approximations in Finite Capacity Multiserver Queues with Poisson Arrivals," J. Appl. Prob. 13, 826834 (1978). 7. L. Takacs, "Introduction to the Theory of Queues," Oxford University Press, London and New York, 1962. 8. H. Tijms, "Stochastic Models: An Algorithmic Approach," Wiley, New York, 1994. 9. P. Whittle, "Systems in Stochastic Equilibrium," Wiley, New York, 1986. 10. Wolff, "Stochastic Modeling and the Theory of Queues," Prentice Hall, New Jersey, 1989.
Reliability Theory
9
9.1. Introduction
Reliability theory is concerned with determining the probability that a system, possibly consisting of many components, will function. We shall suppose that whether or not the system functions is determined solely from a knowledge of which components are functioning. For instance, a series system will function if and only if all of its components are functioning, while a parallel system will function if and only if at least one of its components is functioning. In Section 9.2, we explore the possible ways in which the functioning of the system may depend upon the functioning of its components. In Section 9.3, we suppose that each component will function with some known probability (independently of each other) and show how to obtain the probability that the system will function. As this probability often is difficult to explicitly compute, we also present useful upper and lower bounds in Section 9.4. In Section 9.5 we look at a system dynamically over time by supposing that each component initially functions and does so for a random length of time at which it fails. We then discuss the relationship between the distribution of the amount of time that a system functions and the distributions of the component lifetimes. In particular, it turns out that if the amount of time that a component functions has an increasing failure rate on the average (IFRA) distribution, then so does the distribution of system lifetime. In Section 9.6 we consider the problem of obtaining the mean lifetime of a system. In the final section we analyze the system when failed components are subjected to repair.
9.2.
Structure Functions
Consider a system consisting of n components, and suppose that each component is either functioning or has failed. To indicate whether or not the ith component
571
572
9
Reliability Theory
is functioning, we define the indicator variable xi by xi = 1, 0, if the ith component is functioning if the ith component has failed
The vector x = (x1 , . . . , xn ) is called the state vector. It indicates which of the components are functioning and which have failed. We further suppose that whether or not the system as a whole is functioning is completely determined by the state vector x. Specifically, it is supposed that there exists a function (x) such that (x) = 1, 0, if the system is functioning when the state vector is x if the system has failed when the state vector is x
The function (x) is called the structure function of the system.
Example 9.1 (The Series Structure) A series system functions if and only if all of its components are functioning. Hence, its structure function is given by
n
(x) = min(x1 , . . . , xn ) =
i=1
xi
We shall find it useful to represent the structure of a system in terms of a diagram. The relevant diagram for the series structure is shown in Figure 9.1. The idea is that if a signal is initiated at the left end of the diagram then in order for it to successfully reach the right end, it must pass through all of the components; hence, they must all be functioning.
Figure 9.1. A series system.
Example 9.2 (The Parallel Structure) A parallel system functions if and only
if at least one of its components is functioning. Hence its structure function is given by (x) = max(x1 , . . . , xn ) A parallel structure may be pictorially illustrated by Figure 9.2. This follows since a signal at the left end can successfully reach the right end as long as at least one component is functioning.
9.2.
Structure Functions
573
Figure 9.2. A parallel system.
Example 9.3 (The koutofn Structure) The series and parallel systems are
both special cases of a koutofn system. Such a system functions if and only if at least k of the n components are functioning. As n xi equals the number of i=1 functioning components, the structure function of a koutofn system is given by 1, 0,
n
if
i=1 n
xi
k
(x) =
if
i=1
xi < k
Series and parallel systems are respectively noutofn and 1outofn systems. The twooutofthree system may be diagrammed as shown in Figure 9.3.
Figure 9.3. A 2outof3 system.
Example 9.4 (A FourComponent Structure) Consider a system consisting of
four components, and suppose that the system functions if and only if components 1 and 2 both function and at least one of components 3 and 4 function. Its structure function is given by (x) = x1 x2 max(x3 , x4 )
574
9
Reliability Theory
Pictorially, the system is as shown in Figure 9.4. A useful identity, easily checked, is that for binary variables, xi , i = 1, . . . , n,
n
max(x1 , . . . , xn ) = 1 
i=1
(1  xi )
Figure 9.4.
When n = 2, this yields max(x1 , x2 ) = 1  (1  x1 )(1  x2 ) = x1 + x2  x1 x2 Hence, the structure function in the example may be written as (x) = x1 x2 (x3 + x4  x3 x4 ) It is natural to assume that replacing a failed component by a functioning one will never lead to a deterioration of the system. In other words, it is natural to assume that the structure function (x) is an increasing function of x, that is, if xi yi , i = 1, . . . , n, then (x) (y). Such an assumption shall be made in this chapter and the system will be called monotone. 9.2.1. Minimal Path and Minimal Cut Sets In this section we show how any system can be represented both as a series arrangement of parallel structures and as a parallel arrangement of series structures. As a preliminary, we need the following concepts. A state vector x is called a path vector if (x) = 1. If, in addition, (y) = 0 for all y < x, then x is said to be a minimal path vector. If x is a minimal path vector, then the set A = {i : xi = 1} is called a minimal path set. In other words, a minimal path set is a minimal set of components whose functioning ensures the functioning of the system.
A binary variable is one that assumes either the value 0 or 1. We say that y < x if y xi , i = 1, . . . , n, with yi < xi for some i. i
9.2.
Structure Functions
575
Example 9.5 Consider a fivecomponent system whose structure is illustrated
by Figure 9.5. Its structure function equals (x) = max(x1 , x2 ) max(x3 x4 , x5 ) = (x1 + x2  x1 x2 )(x3 x4 + x5  x3 x4 x5 ) There are four minimal path sets, namely, {1, 3, 4}, {2, 3, 4}, {1, 5}, {2, 5}.
Figure 9.5.
Example 9.6 In a koutofn system, there are
all of the sets consisting of exactly k components.
n k
minimal path sets, namely,
Let A1 , . . . , As denote the minimal path sets of a given system. We define j (x), the indicator function of the j th minimal path set, by j (x) = =
iAj
1, 0, xi
if all the components of Ai are functioning otherwise
By definition, it follows that the system will function if all the components of at least one minimal path set are functioning; that is, if j (x) = 1 for some j . On the other hand, if the system functions, then the set of functioning components must include a minimal path set. Therefore, a system will function if and only if all the components of at least one minimal path set are functioning. Hence, (x) = or equivalently (x) = max j (x)
j
1, 0,
if j (x) = 1 for some j if j (x) = 0 for all j
= max
j iAj
xi
(9.1)
576
9
Reliability Theory
Since j (x) is a series structure function of the components of the j th minimal path set, Equation (9.1) expresses an arbitrary system as a parallel arrangement of series systems.
Example 9.7 Consider the system of Example 9.5. Because its minimal path
sets are A1 = {1, 3, 4}, A2 = {2, 3, 4}, A3 = {1, 5}, and A4 = {2, 5}, we have by Equation (9.1) that (x) = max{x1 x3 x4 , x2 x3 x4 , x1 x5 , x2 x5 } = 1  (1  x1 x3 x4 )(1  x2 x3 x4 )(1  x1 x5 )(1  x2 x5 )
Figure 9.6.
You should verify that this equals the value of (x) given in Example 9.5. (Make use of the fact that, since xi equals 0 or 1, xi2 = xi .) This representation may be pictured as shown in Figure 9.6.
Figure 9.7. The bridge system.
Example 9.8 The system whose structure is as pictured in Figure 9.7 is called
the bridge system. Its minimal path sets are {1, 4}, {1, 3, 5}, {2, 5}, and {2, 3, 4}. Hence, by Equation (9.1), its structure function may be expressed as (x) = max{x1 x4 , x1 x3 x5 , x2 x5 , x2 x3 x4 } = 1  (1  x1 x4 )(1  x1 x3 x5 )(1  x2 x5 )(1  x2 x3 x4 ) This representation (x) is diagrammed as shown in Figure 9.8.
9.2.
Structure Functions
577
Figure 9.8.
A state vector x is called a cut vector if (x) = 0. If, in addition, (y) = 1 for all y > x, then x is said to be a minimal cut vector. If x is a minimal cut vector, then the set C = {i : xi = 0} is called a minimal cut set. In other words, a minimal cut set is a minimal set of components whose failure ensures the failure of the system. Let C1 , . . . , Ck denote the minimal cut sets of a given system. We define j (x), the indicator function of the j th minimal cut set, by if at least one component of the j th minimal 1, cut set is functioning j (x) = if all of the components of the j th minimal 0, cut set are not functioning = max xi
iCj
Since a system is not functioning if and only if all the components of at least one minimal cut set are not functioning, it follows that
k k
(x) =
j =1
j (x) =
j =1
max xi
iCj
(9.2)
Since j (x) is a parallel structure function of the components of the j th minimal cut set, Equation (9.2) represents an arbitrary system as a series arrangement of parallel systems.
Example 9.9 The minimal cut sets of the bridge structure shown in Figure 9.9
are {1, 2}, {1, 3, 5}, {2, 3, 4}, and {4, 5}. Hence, from Equation (9.2), we may express (x) by (x) = max(x1 , x2 ) max(x1 , x3 , x5 ) max(x2 , x3 , x4 ) max(x4 , x5 ) = [1  (1  x1 )(1  x2 )][1  (1  x1 )(1  x3 )(1  x5 )] [1  (1  x2 )(1  x3 )(1  x4 )][1  (1  x4 )(1  x5 )] This representation of (x) is pictorially expressed as Figure 9.10.
578
9
Reliability Theory
Figure 9.9.
Figure 9.10. Minimal cut representation of the bridge system.
9.3.
Reliability of Systems of Independent Components
In this section, we suppose that Xi , the state of the ith component, is a random variable such that P {Xi = 1} = pi = 1  P {Xi = 0} The value pi , which equals the probability that the ith component is functioning, is called the reliability of the ith component. If we define r by r = P {(X) = 1}, where X = (X1 , . . . , Xn )
then r is called the reliability of the system. When the components, that is, the random variables Xi , i = 1, . . . , n, are independent, we may express r as a function of the component reliabilities. That is, r = r(p), where p = (p1 , . . . , pn )
The function r(p) is called the reliability function. We shall assume throughout the remainder of this chapter that the components are independent.
9.3.
Reliability of Systems of Independent Components
579
Example 9.10 (The Series System) The reliability function of the series system of n independent components is given by r(p) = P {(X) = 1} = P {Xi = 1 for all i = 1, . . . , n}
n
=
i=1
pi
Example 9.11 (The Parallel System) The reliability function of the parallel
system of n independent components is given by r(p) = P {(X) = 1} = P {Xi = 1 for some i = 1, . . . , n} = 1  P {Xi = 0 for all i = 1, . . . , n}
n
=1
i=1
(1  pi )
Example 9.12 (The koutofn System with Equal Probabilities) Consider a koutofn system. If pi = p for all i = 1, . . . , n, then the reliability function is given by
r(p, . . . , p) = P {(X) = 1}
n
=P
i=1 n
Xi
k
=
i=k
n i p (1  p)ni i
Example 9.13 (The TwooutofThree System) The reliability function of a
twooutofthree system is given by r(p) = P {(X) = 1} = P {X = (1, 1, 1)} + P {X = (1, 1, 0)} + P {X = (1, 0, 1)} + P {X = (0, 1, 1)} = p1 p2 p3 + p1 p2 (1  p3 ) + p1 (1  p2 )p3 + (1  p1 )p2 p3 = p1 p2 + p1 p3 + p2 p3  2p1 p2 p3
580
9
Reliability Theory
Example 9.14 (The ThreeoutofFour System) The reliability function of a
threeoutoffour system is given by r(p) = P {X = (1, 1, 1, 1)} + P {X = (1, 1, 1, 0)} + P {X = (1, 1, 0, 1)} + P {X = (1, 0, 1, 1)} + P {X = (0, 1, 1, 1)} = p1 p2 p3 p4 + p1 p2 p3 (1  p4 ) + p1 p2 (1  p3 )p4 + p1 (1  p2 )p3 p4 + (1  p1 )p2 p3 p4 = p1 p2 p3 + p1 p2 p4 + p1 p3 p4 + p2 p3 p4  3p1 p2 p3 p4
Example 9.15 (A FiveComponent System) Consider a fivecomponent system that functions if and only if component 1, component 2, and at least one of the remaining components function. Its reliability function is given by r(p) = P {X1 = 1, X2 = 1, max(X3 , X4 , X5 ) = 1} = P {X1 = 1}P {X2 = 1}P {max(X3 , X4 , X5 ) = 1} = p1 p2 [1  (1  p3 )(1  p4 )(1  p5 )] Since (X) is a 01 (that is, a Bernoulli) random variable, we may also compute r(p) by taking its expectation. That is, r(p) = P {(X) = 1} = E[(X)]
Example 9.16 (A FourComponent System) A fourcomponent system that
functions when both components 1, 4, and at least one of the other components function has its structure function given by (x) = x1 x4 max(x2 , x3 ) Hence, r(p) = E[(X)] = E[X1 X4 (1  (1  X2 )(1  X3 ))] = p1 p4 [1  (1  p2 )(1  p3 )] An important and intuitive property of the reliability function r(p) is given by the following proposition.
Proposition 9.1 If r(p) is the reliability function of a system of independent
components, then r(p) is an increasing function of p.
9.3.
Reliability of Systems of Independent Components
581
Proof By conditioning on Xi and using the independence of the components,
we obtain r(p) = E[(X)] = pi E[(X)  Xi = 1] + (1  pi )E[(X)  Xi = 0] = pi E[(1i , X)] + (1  pi )E[(0i , X)] where (1i , X) = (X1 , . . . , Xi1 , 1, Xi+1 , . . . , Xn ), (0i , X) = (X1 , . . . , Xi1 , 0, Xi+1 , . . . , Xn ) Thus, r(p) = pi E[(1i , X)  (0i , X)] + E[(0i , X)] However, since is an increasing function, it follows that E[(1i , X)  (0i , X)] 0
and so the preceding is increasing in pi for all i. Hence the result is proven. Let us now consider the following situation: A system consisting of n different components is to be built from a stockpile containing exactly two of each type of component. How should we use the stockpile so as to maximize our probability of attaining a functioning system? In particular, should we build two separate systems, in which case the probability of attaining a functioning one would be P {at least one of the two systems function} = 1  P {neither of the systems function} = 1  [(1  r(p))(1  r(p ))] where pi (pi ) is the probability that the first (second) number i component functions; or should we build a single system whose ith component functions if at least one of the number i components functions? In this latter case, the probability that the system will function equals r[1  (1  p)(1  p )] since 1  (1  pi )(1  pi ) equals the probability that the ith component in the single system will function. We now show that replication at the component level is more effective than replication at the system level.
Notation: If x = (x , . . . , x ), y = (y , . . . , y ), then xy = (x y , . . . , x y ). Also, max(x, y) = n n n n 1 1 1 1 (max(x1 , y1 ), . . . , max(xn , yn )) and min(x, y) = (min(x1 , y1 ), . . . , min(xn , yn )).
582
9
Reliability Theory
Theorem 9.1 For any reliability function r and vectors p, p ,
r[1  (1  p)(1  p )] 1  [1  r(p)][1  r(p )]
Proof Let X1 , . . . , Xn , X1 , . . . , Xn be mutually independent 01 random variables with pi = P {Xi = 1}, pi = P {Xi = 1}
Since P {max(Xi , Xi ) = 1} = 1  (1  pi )(1  pi ), it follows that r[1  (1  p)(1  p )] = E([max(X, X )]) However, by the monotonicity of , we have that [max(X, X )] is greater than or equal to both (X) and (X ) and hence is at least as large as max[(X), (X )]. Hence, from the preceding we have that r[1  (1  p)(1  p )] E[max((X), (X ))] = P {max[(X), (X )] = 1} = 1  P {(X) = 0, (X ) = 0} = 1  [1  r(p)][1  r(p )] where the first equality follows from the fact that max[(X), (X )] is a 01 random variable and hence its expectation equals the probability that it equals 1. As an illustration of the preceding theorem, suppose that we want to build a series system of two different types of components from a stockpile consisting of two of each of the kinds of components. Suppose that the reliability of each component is 1 . If we use the stockpile to build two separate systems, then the 2 probability of attaining a working system is 1
3 2 4
=
7 16
while if we build a single system, replicating components, then the probability of attaining a working system is
3 2 4
=
9 16
Hence, replicating components leads to a higher reliability than replicating systems (as, of course, it must by Theorem 9.1).
9.4.
Bounds on the Reliability Function
583
9.4.
Bounds on the Reliability Function
Consider the bridge system of Example 9.8, which is represented by Figure 9.11. Using the minimal path representation, we have that (x) = 1  (1  x1 x4 )(1  x1 x3 x5 )(1  x2 x5 )(1  x2 x3 x4 ) Hence, r(p) = 1  E[(1  X1 X4 )(1  X1 X3 X5 )(1  X2 X5 )(1  X2 X3 X4 )]
Figure 9.11.
However, since the minimal path sets overlap (that is, they have components in common), the random variables (1  X1 X4 ), (1  X1 X3 X5 ), (1  X2 X5 ), and (1X2 X3 X4 ) are not independent, and thus the expected value of their product is not equal to the product of their expected values. Therefore, in order to compute r(p), we must first multiply the four random variables and then take the expected 2 value. Doing so, using that Xi = Xi , we obtain r(p) = E[X1 X4 + X2 X5 + X1 X3 X5 + X2 X3 X4  X1 X2 X3 X4  X1 X2 X3 X5  X1 X2 X4 X5  X1 X3 X4 X5  X2 X3 X4 X5 + 2X1 X2 X3 X4 X5 ] = p 1 p 4 + p 2 p 5 + p 1 p 3 p 5 + p2 p 3 p 4  p1 p 2 p 3 p 4  p 1 p 2 p 3 p 5  p1 p2 p4 p5  p1 p3 p4 p5  p2 p3 p4 p5 + 2p1 p2 p3 p4 p5 As can be seen by the preceding example, it is often quite tedious to evaluate r(p), and thus it would be useful if we had a simple way of obtaining bounds. We now consider two methods for this.
584
9
Reliability Theory
9.4.1. Method of Inclusion and Exclusion The following is a wellknown formula for the probability of the union of the events E1 , E2 , . . . , En :
n n
P
i=1
Ei
=
i=1
P (Ei ) 
i<j
P (Ei Ej ) +
i<j <k
P (Ei Ej Ek ) (9.3)
 + (1)n+1 P (E1 E2 En ) A result, not as well known, is the following set of inequalities:
n n
P
1 n
Ei
i=1
P (Ei ),
P
1 n
Ei
i
P (Ei ) 
i<j
P (Ei Ej ),
P
1
Ei
i
P (Ei ) 
i<j
P (Ei Ej ) +
i<j <k
P (Ei Ej Ek ),
(9.4)
where the inequality always changes direction as we add an additional term of the expansion of P ( n Ei ). i=1 The equality (9.3) is usually proven by induction on the number of events. However, let us now present another approach that will not only prove Equation (9.3) but also establish the inequalities (9.4). To begin, define the indicator variables Ij , j = 1, . . . , n, by Ij = Letting
n
1, 0,
if Ej occurs otherwise
N=
j =1
Ij j n, that occur. Also, let
then N denotes the number of the Ej , 1 I= 1, 0,
if N > 0 if N = 0
9.4.
Bounds on the Reliability Function
585
Then, as 1  I = (1  1)N we obtain, upon application of the binomial theorem, that
N
1I =
i=0
N (1)i i
or I =N  N N N +  2 3 N (9.5)
We now make use of the following combinatorial identity (which is easily established by induction on i): n n n n1  + = i i +1 n i 1 The preceding thus implies that N N N  + i i +1 N From Equations (9.5) and (9.6) we obtain I I I . . . and so on. Now, since N tion (9.5) as n and
m i
0,
i
n
0
(9.6)
N, N , 2 N N N + , 2 3 N
by letting i = 2 in (9.6) by letting i = 3 in (9.6) (9.7)
= 0 whenever i > m, we can rewrite Equa
n
I=
i=1
N (1)i+1 i
(9.8)
586
9
Reliability Theory
The equality (9.3) and inequalities (9.4) now follow upon taking expectations of (9.7) and (9.8). This is the case since
n
E[I ] = P {N > 0} = P {at least one of the Ej occurs} = P
1 n n
Ej ,
E[N] = E
j =1
Ij =
j =1
P (Ej )
Also, E N 2 = E[number of pairs of the Ej that occur] =E
i<j
Ii Ij P (Ei Ej )
=
i<j
and, in general E N i = E[number of sets of size i that occur] =E
j1 < j2 << ji
I j1 I j2 I ji P (Ej1 Ej2 Eji )
=
j1 < j2 <<ji
The bounds expressed in Equation (9.4) are commonly called the inclusion exclusion bounds. To apply them in order to obtain bounds on the reliability function, let A1 A2 , . . . , As denote the minimal path sets of a given structure , and define the events E1 , E2 , . . . , Es by Ei = {all components in Ai function} Now, since the system functions if and only if at least one of the events Ei occur, we have
s
r(p) = P
1
Ei
9.4.
Bounds on the Reliability Function
587
Applying (9.4) yields the desired bounds on r(p). The terms in the summation are computed thusly: P (Ei ) =
lAi
pl , pl ,
lAi Aj
P (Ei Ej ) = P (Ei Ej Ek ) =
pl
lAi Aj Ak
and so forth for intersections of more than three of the events. (The preceding follows since, for instance, in order for the event Ei Ej to occur, all of the components in Ai and all of them in Aj must function; or, in other words, all components in Ai Aj must function.) When the pi s are small the probabilities of the intersection of many of the events Ei should be quite small and the convergence should be relatively rapid.
Example 9.17 Consider the bridge structure with identical component
probabilities. That is, take pi to equal p for all i. Letting A1 = {1, 4}, A2 = {1, 3, 5}, A3 = {2, 5}, and A4 = {2, 3, 4} denote the minimal path sets, we have that P (E1 ) = P (E3 ) = p 2 , P (E2 ) = P (E4 ) = p 3 Also, because exactly five of the six = 4 unions of Ai and Aj contain four 2 components (the exception being A2 A4 which contains all five components), we have P (E1 E2 ) = P (E1 E3 ) = P (E1 E4 ) = P (E2 E3 ) = P (E3 E4 ) = p 4 , P (E2 E4 ) = p 5 Hence, the first two inclusionexclusion bounds yield 2(p 2 + p 3 )  5p 4  p 5 r(p) 2(p 2 + p 3 )
where r(p) = r(p, p, p, p, p). For instance, when p = 0.2, we have 0.08768 and, when p = 0.01, 0.02149 r(0.1) 0.02200 r(0.2) 0.09600
588
9
Reliability Theory
Just as we can define events in terms of the minimal path sets whose union is the event that the system functions, so can we define events in terms of the minimal cut sets whose union is the event that the system fails. Let C1 , C2 , . . . , Cr denote the minimal cut sets and define the events F1 , . . . , Fr by Fi = {all components in Ci are failed} Now, because the system is failed if and only if all of the components of at least one minimal cut set are failed, we have that
r
1  r(p) = P
1
Fi , P (Fi ),
1  r(p)
i
1  r(p)
i
P (Fi ) 
i<j
P (Fi Fj ), P (Fi Fj ) +
i<j i<j <k
1  r(p)
i
P (Fi ) 
P (Fi Fj Fk ),
and so on. As P (Fi ) =
lCi
(1  pl ), (1  pl ),
lCi Cj
P (Fi Fj ) = P (Fi Fj Fk ) =
(1  pl )
lCi Cj Ck
the convergence should be relatively rapid when the pi s are large.
Example 9.18 (A Random Graph) Let us recall from Section 3.6.2 that a graph consists of a set N of nodes and a set A of pairs of nodes, called arcs. For any two nodes i and j we say that the sequence of arcs (i, i1 )(i1 , i2 ), . . . , (ik , j ) constitutes an ij path. If there is an ij path between all the n pairs of nodes 2 i and j , i = j , then the graph is said to be connected. If we think of the nodes of a graph as representing geographical locations and the arcs as representing direct communication links between the nodes, then the graph will be connected if any two nodes can communicate with each otherif not directly, then at least through the use of intermediary nodes.
9.4.
Bounds on the Reliability Function
589
A graph can always be subdivided into nonoverlapping connected subgraphs called components. For instance, the graph in Figure 9.12 with nodes N = {1, 2, 3, 4, 5, 6} and arcs A = {(1, 2), (1, 3), (2, 3), (4, 5)} consists of three components (a graph consisting of a single node is considered to be connected).
Figure 9.12.
Consider now the random graph having nodes 1, 2, . . . , n which is such that there is an arc from node i to node j with probability Pij . Assume in addition that the occurrences of these arcs constitute independent events. That is, assume that the n random variables Xij , i = j , are independent where 2 Xij = 1, 0, if (i, j ) is an arc otherwise
We are interested in the probability that this graph will be connected. We can think of the preceding as being a reliability system of n components 2 each component corresponding to a potential arc. The component is said to work if the corresponding arc is indeed an arc of the network, and the system is said to work if the corresponding graph is connected. As the addition of an arc to a connected graph cannot disconnect the graph, it follows that the structure so defined is monotone. Let us start by determining the minimal path and minimal cut sets. It is easy to see that a graph will not be connected if and only if the sets of arcs can be partitioned into two nonempty subsets X and X c in such a way that there is no arc connecting a node from X with one from X c . For instance, if there are six nodes and if there are no arcs connecting any of the nodes 1, 2, 3, 4 with either 5 or 6, then clearly the graph will not be connected. Thus, we see that any partition of the nodes into two nonempty subsets X and X c corresponds to the minimal cut set defined by {(i, j ) : i X, j X c } As there are 2n1  1 such partitions (there are 2n  2 ways of choosing a nonempty proper subset X and, as the partition X, X c is the same as X c , X, we must divide by 2) there are therefore this number of minimal cut sets.
590
9
Reliability Theory
To determine the minimal path sets, we must characterize a minimal set of arcs which results in a connected graph. Now the graph in Figure 9.13 is connected but it would remain connected if any one of the arcs from the cycle shown in Figure 9.14 were removed. In fact it is not difficult to see that the minimal path sets are exactly those sets of arcs which result in a graph being connected but not having any cycles (a cycle being a path from a node to itself). Such sets of arcs are called spanning trees (Figure 9.15). It is easily verified that any spanning tree contains exactly n  1 arcs, and it is a famous result in graph theory (due to Cayley) that there are exactly nn2 of these minimal path sets.
Figure 9.13.
Figure 9.14.
Figure 9.15. Two spanning trees (minimal path sets) when n = 4.
Because of the large number of minimal path and minimal cut sets (nn2 and  1, respectively), it is difficult to obtain any useful bounds without making further restrictions. So, let us assume that all the Pij equal the common value p. That is, we suppose that each of the possible arcs exists, independently, with the same probability p. We shall start by deriving a recursive formula for the probability that the graph is connected, which is computationally useful when n is not too large, and then we shall present an asymptotic formula for this probability when n is large. Let us denote by Pn the probability that the random graph having n nodes is connected. To derive a recursive formula for Pn we first concentrate attention on a single nodesay, node 1and try to determine the probability that node 1 will be part of a component of size k in the resultant graph. Now for given set of k  1 other nodes these nodes along with node 1 will form a component if 2n1 (i) there are no arcs connecting any of these k nodes with any of the remaining n  k nodes; (ii) the random graph, restricted to these k nodes [and k potential arcseach 2 independently appearing with probability p] is connected.
9.4.
Bounds on the Reliability Function
591
The probability that (i) and (ii) both occur is q k(nk) Pk where q = 1  p. As there are n1 ways of choosing k  1 other nodes (to form k1 along with node 1 a component of size k) we see that P {node 1 is part of a component of size k} n  1 k(nk) Pk , k = 1, 2, . . . , n = q k1 Now since the sum of the foregoing probabilities as k ranges from 1 through n clearly must equal 1, and as the graph is connected if and only if node 1 is part of a component of size n, we see that
n1
Pn = 1 
k=1
n  1 k(nk) q Pk , k1
n = 2, 3, . . .
(9.9)
Starting with P1 = 1, P2 = p, Equation (9.9) can be used to determine Pn recursively when n is not too large. It is particularly suited for numerical computation. To determine an asymptotic formula for Pn when n is large, first note from Equation (9.9) that since Pk 1, we have
n1
1  Pn
k=1
n  1 k(nk) q k1
As it can be shown that for q < 1 and n sufficiently large
n1 k=1
n  1 k(nk) q k1
(n + 1)q n1
we have that for n large 1  Pn (n + 1)q n1 (9.10)
To obtain a bound in the other direction, we concentrate our attention on a particular type of minimal cut setnamely, those that separate one node from all others
592
9
Reliability Theory
in the graph. Specifically, define the minimal cut set Ci as Ci = {(i, j ) : j = i} and define Fi to be the event that all arcs in Ci are not working (and thus, node i is isolated from the other nodes). Now, 1  Pn = P (graph is not connected) P
i
Fi
since, if any of the events Fi occur, then the graph will be disconnected. By the inclusionexclusion bounds, we have that P
i
Fi
i
P (Fi ) 
i<j
P (Fi Fj )
As P (Fi ) and P (Fi Fj ) are just the respective probabilities that a given set of n1 arcs and that a given set of 2n  3 arcs are not in the graph (why?), it follows that P (Fi ) = q n1 , P (Fi Fj ) = q 2n3 , and so 1  Pn nq n1  n 2n3 q 2 i=j
Combining this with Equation (9.10) yields that for n sufficiently large nq n1  and as n q 2n3 0 2 nq n1 as n , we see that, for large n, 1  Pn nq n1 Thus, for instance, when n = 20 and p = 1 , the probability that the random graph 2 will be connected is approximately given by P20 1  20
1 19 2
n 2n3 q 2
1  Pn
(n + 1)q n1
= 0.99998
9.4.
Bounds on the Reliability Function
593
9.4.2. Second Method for Obtaining Bounds on r(p) Our second approach to obtaining bounds on r(p) is based on expressing the desired probability as the probability of the intersection of events. To do so, let A1 , A2 , . . . , As denote the minimal path sets as before, and define the events, Di , i = 1, . . . by Di = {at least one component in Ai has failed} Now since the system will have failed if and only if at least one component in each of the minimal path sets has failed we have that 1  r(p) = P (D1 D2 Ds ) = P (D1 )P (D2  D1 ) P (Ds  D1 D2 Ds1 ) (9.11)
Now it is quite intuitive that the information that at least one component of A1 is down can only increase the probability that at least one component of A2 is down (or else leave the probability unchanged if A1 and A2 do not overlap). Hence, intuitively P (D2  D1 ) To prove this inequality, we write
c P (D2 ) = P (D2  D1 )P (D1 ) + P (D2  D1 )(1  P (D1 ))
P (D2 )
(9.12)
and note that
c P (D2  D1 ) = P {at least one failed in A2  all functioning in A1 }
=1
j A2 j A1
pj
1
j A2
pj
= P (D2 ) Hence, from Equation (9.12) we see that P (D2 ) or P (D2  D1 ) P (D2 ) P (D2  D1 )P (D1 ) + P (D2 )(1  P (D1 ))
594
9
Reliability Theory
By the same reasoning, it also follows that P (Di  D1 Di1 ) and so from Equation (9.11) we have 1  r(p)
i
P (Di )
P (Di )
or, equivalently, r(p) 1
i
1
j Ai
pj
To obtain a bound in the other direction, let C1 , . . . , Cr denote the minimal cut sets and define the events U1 , . . . , Ur by Ui = {at least one component in Ci is functioning} Then, since the system will function if and only if all of the events Ui occur, we have r(p) = P (U1 U2 Ur ) = P (U1 )P (U2  U1 ) P (Ur  U1 Ur1 ) P (Ui )
i
where the last inequality is established in exactly the same manner as for the Di . Hence, r(p)
i
1
j Ci
(1  pj )
and we thus have the following bounds for the reliability function 1
i j Ci
(1  pj )
r(p)
1
i
1
j Ai
pj
(9.13)
It is to be expected that the upper bound should be close to the actual r(p) if there is not too much overlap in the minimal path sets, and the lower bound to be close if there is not too much overlap in the minimal cut sets.
9.5.
System Life as a Function of Component Lives
595
Example 9.19 For the threeoutoffour system the minimal path sets are
A1 = {1, 2, 3}, A2 = {1, 2, 4}, A3 = {1, 3, 4}, and A4 = {2, 3, 4}; and the minimal cut sets are C1 = {1, 2}, C2 = {1, 3}, C3 = {1, 4}, C4 = {2, 3}, C5 = {2, 4}, and C6 = {3, 4}. Hence, by Equation (9.13) we have (1  q1 q2 )(1  q1 q3 )(1  q1 q4 )(1  q2 q3 )(1  q2 q4 )(1  q3 q4 ) r(p) 1  (1  p1 p2 p3 )(1  p1 p2 p4 )(1  p1 p3 p4 )(1  p2 p3 p4 ) where qi 1  pi . For instance, if pi = 0.18 r
1 2
for all i, then the preceding yields that 0.59
1 1 2,..., 2
The exact value for this structure is easily computed to be r
1 1 2,..., 2
=
5 16
= 0.31
9.5.
System Life as a Function of Component Lives
For a random variable having distribution function G, we define G(a) 1  G(a) to be the probability that the random variable is greater than a. Consider a system in which the ith component functions for a random length of time having distribution Fi and then fails. Once failed it remains in that state forever. Assuming that the individual component lifetimes are independent, how can we express the distribution of system lifetime as a function of the system reliability function r(p) and the individual component lifetime distributions Fi , i = 1, . . . , n? To answer this we first note that the system will function for a length of time t or greater if and only if it is still functioning at time t. That is, letting F denote the distribution of system lifetime, we have F (t) = P {system life > t} = P {system is functioning at time t} But, by the definition of r(p) we have that P {system is functioning at time t } = r(P1 (t), . . . , Pn (t)) where Pi (t) = P {component i is functioning at t} = P {lifetime of i > t} = Fi (t)
596
9
Reliability Theory
Hence we see that F (t) = r(F1 (t), . . . , Fn (t)) (9.14)
Example 9.20 In a series system, r(p) =
F (t) =
n 1
n 1 pi
and so from Equation (9.14)
Fi (t)
which is, of course, quite obvious since for a series system the system life is equal to the minimum of the component lives and so will be greater than t if and only if all component lives are greater than t.
Example 9.21 In a parallel system r(p) = 1 
F (t) = 1 
n
n 1 (1  pi )
and so
Fi (t)
1
The preceding is also easily derived by noting that, in the case of a parallel system, the system life is equal to the maximum of the component lives. For a continuous distribution G, we define (t), the failure rate function of G, by (t) = g(t) G(t)
where g(t) = d/dtG(t). In Section 5.2.2, it is shown that if G is the distribution of the lifetime of an item, then (t) represents the probability intensity that a tyearold item will fail. We say that G is an increasing failure rate (IFR) distribution if (t) is an increasing function of t. Similarly, we say that G is a decreasing failure rate (DFR) distribution if (t) is a decreasing function of t.
Example 9.22 (The Weibull Distribution) A random variable is said to have
the Weibull distribution if its distribution is given, for some > 0, > 0, by G(t) = 1  e(t) ,
t
0
The failure rate function for a Weibull distribution equals e(t) (t)1 (t) = = (t)1 e(t)
Thus, the Weibull distribution is IFR when 1, and DFR when 0 < 1; when = 1, G(t) = 1  et , the exponential distribution, which is both IFR and DFR.
9.5.
System Life as a Function of Component Lives
597
Example 9.23 (The Gamma Distribution) A random variable is said to have a gamma distribution if its density is given, for some > 0, > 0, by
g(t) = where ()
0
et (t)1 ()
for t
0
et t 1 dt
For the gamma distribution, G(t) 1 = = (t) g(t) =
t x (x)1 dx t e et (t)1
e(xt)
x t
1
dx
With the change of variables u = x  t, we obtain 1 = (t) Hence, G is IFR when
0
eu 1 +
u t
1
du 1.
1 and is DFR when 0 <
Suppose that the lifetime distribution of each component in a monotone system is IFR. Does this imply that the system lifetime is also IFR? To answer this, let us at first suppose that each component has the same lifetime distribution, which we denote by G. That is, Fi (t) = G(t), i = 1, . . . , n. To determine whether the system lifetime is IFR, we must compute F (t), the failure rate function of F . Now, by definition, F (t) = = where r(G(t)) r(G(t), . . . , G(t)) (d/dt)F (t) F (t) (d/dt)[1  r(G(t))] r(G(t))
598 Hence,
9
Reliability Theory
F (t) = =
r (G(t)) G (t) r(G(t)) G(t)r (G(t)) G (t) r(G(t)) G(t) pr (p) r(p)
p=G(t)
= G (t)
(9.15)
Since G(t) is a decreasing function of t, it follows from Equation (9.15) that if each component of a coherent system has the same IFR lifetime distribution, then the distribution of system lifetime will be IFR if pr (p)/r(p) is a decreasing function of p.
Example 9.24 (The koutofn System with Identical Components) Consider
the koutofn system which will function if and only if k or more components function. When each component has the same probability p of functioning, the number of functioning components will have a binomial distribution with parameters n and p. Hence,
n
r(p) =
i=k
n i p (1  p)ni i
which, by continual integration by parts, can be shown to be equal to r(p) = n! (k  1)!(n  k)!
p 0
x k1 (1  x)nk dx
Upon differentiation, we obtain r (p) = Therefore, pr (p) r(p) = r(p) pr (p) 1 = p
p 0 1
n! p k1 (1  p)nk (k  1)!(n  k)!
x p
k1
1x 1p
nk
1
dx
9.5.
System Life as a Function of Component Lives
599
Letting y = x/p, yields pr (p) = r(p)
1 0
y k1
1  yp 1p
nk
1
dy
Since (1  yp)/(1  p) is increasing in p, it follows that pr (p)/r(p) is decreasing in p. Thus, if a koutofn system is composed of independent, like components having an increasing failure rate, the system itself has an increasing failure rate. It turns out, however, that for a koutofn system, in which the independent components have different IFR lifetime distributions, the system lifetime need not be IFR. Consider the following example of a twooutoftwo (that is, a parallel) system.
Example 9.25 (A Parallel System That Is Not IFR) The life distribution of a parallel system of two independent components, the ith component having an exponential distribution with mean 1/i, i = 1, 2, is given by
F (t) = 1  (1  et )(1  e2t ) = e2t + et  e3t Therefore, (t) = = f (t) F (t) 2e2t + et  3e3t e2t + et  e3t
It easily follows upon differentiation, that the sign of (t) is determined by e5t  e3t + 3e4t , which is positive for small values and negative for large values of t. Therefore, (t) is initially strictly increasing, and then strictly decreasing. Hence, F is not IFR.
Remark The result of the preceding example is quite surprising at first glance.
To obtain a better feel for it we need the concept of a mixture of distribution functions. The distribution function G is said to be a mixture of the distributions G1 and G2 if for some p, 0 < p < 1, G(x) = pG1 (x) + (1  p)G2 (x) (9.16)
Mixtures occur when we sample from a population made up of two distinct groups. For example, suppose we have a stockpile of items of which the fraction p
600
9
Reliability Theory
are type 1 and the fraction 1  p are type 2. Suppose that the lifetime distribution of type 1 items is G1 and of type 2 items is G2 . If we choose an item at random from the stockpile, then its life distribution is as given by Equation (9.16). Consider now a mixture of two exponential distributions having rates 1 and 2 where 1 < 2 . We are interested in determining whether or not this mixture distribution is IFR. To do so, we note that if the item selected has survived up to time t, then its distribution of remaining life is still a mixture of the two exponential distributions. This is so since its remaining life will still be exponential with rate 1 if it is type 1 or with rate 2 if it is a type 2 item. However, the probability that it is a type 1 item is no longer the (prior) probability p but is now a conditional probability given that it has survived to time t. In fact, its probability of being a type 1 is P {type 1  life > t} = = P {type 1, life > t} P {life > t} pe1 t pe1 t + (1  p)e2 t
As the preceding is increasing in t, it follows that the larger t is, the more likely it is that the item in use is a type 1 (the better one, since 1 < 2 ). Hence, the older the item is, the less likely it is to fail, and thus the mixture of exponentials far from being IFR is, in fact, DFR. Now, let us return to the parallel system of two exponential components having respective rates 1 and 2 . The lifetime of such a system can be expressed as the sum of two independent random variables, namely, 2 1 + 2 system life = Exp(1 + 2 ) + Exp( ) with probability 1 2 1 + 2 The first random variable whose distribution is exponential with rate 1 + 2 represents the time until one of the components fails, and the second, which is a mixture of exponentials, is the additional time until the other component fails. (Why are these two random variables independent?) Now, given that the system has survived a time t, it is very unlikely when t is large that both components are still functioning, but instead it is far more likely that one of the components has failed. Hence, for large t, the distribution of remaining life is basically a mixture of two exponentialsand so as t becomes even larger its failure rate should decrease (as indeed occurs). Exp( ) with probability 1
9.5.
System Life as a Function of Component Lives
601
Recall that the failure rate function of a distribution F (t) having density f (t) = F (t) is defined by (t) = By integrating both sides, we obtain
t 0 t 0
f (t) 1  F (t)
(s) ds =
f (s) ds 1  F (s)
=  log F (t) Hence, F (t) = e where (t) =
0 t (t)
(9.17)
(s) ds
The function
(t) is called the hazard function of the distribution F .
Definition 9.1 A distribution F is said to have increasing failure on the average (IFRA) if (t) = t increases in t for t 0.
t 0
(s) ds t
(9.18)
In other words, Equation (9.18) states that the average failure rate up to time t increases as t increases. It is not difficult to show that if F is IFR, then F is IFRA; but the reverse need not be true. Note that F is IFRA if (s)/s (t)/t whenever 0 s t, which is equivalent to (t) t (t) t for 0 1, all t 0
602
9
Reliability Theory
But by equation (9.17) we see that equivalent to
(t) =  log F (t), and so the preceding is  log F (t)
 log F (t) or equivalently log F (t)
log F (t)
which, since log x is a monotone function of x, shows that F is IFRA if and only if F (t) F (t) for 0 1, all t 0 (9.19)
For a vector p = (p1 , . . . , pn ) we define p = (p1 , . . . , pn ). We shall need the following proposition.
Proposition 9.2 Any reliability function r(p) satisfies
r(p ) [r(p)] , 0 1
Proof We prove this by induction on n, the number of components in the system. If n = 1, then either r(p) 0, r(p) 1, or r(p) p. Hence, the proposition follows in this case. So assume that Proposition 9.2 is valid for all monotone systems of n  1 components and consider a system of n components having structure function . By conditioning upon whether or not the nth component is functioning, we obtain
r(p ) = pn r(1n , p ) + (1  pn )r(0n , p )
(9.20)
Now consider a system of components 1 through n  1 having a structure function 1 (x) = (1n , x). The reliability function for this system is given by r1 (p) = r(1n , p); hence, from the induction assumption (valid for all monotone systems of n  1 components), we have r(1n , p ) [r(1n , p)]
Similarly, by considering the system of components 1 through n  1 and structure function 0 (x) = (0n , x), we obtain r(0n , p ) Thus, from Equation (9.20), we obtain r(p )
pn [r(1n , p)] + (1  pn )[r(0n , p)]
[r(0n , p)]
9.5.
System Life as a Function of Component Lives
603
which, by using the lemma to follow [with = pn , x = r(1n , p), y = r(0n , p)], implies that r(p ) [pn r(1n , p) + (1  pn )r(0n , p)] = [r(p)] which proves the result.
Lemma 9.1 If 0
1, 0
1, then 0
h(y) = x + (1  )y  (x + (1  )y) for all 0 y x.
Proof The proof is left as an exercise.
We are now ready to prove the following important theorem.
Theorem 9.2 For a monotone system of independent components, if each
component has an IFRA lifetime distribution, then the distribution of system lifetime is itself IFRA.
Proof The distribution of system lifetime F is given by
F (t) = r(F1 (t), . . . , Fn (t)) Hence, since r is a monotone function, and since each of the component distribu tions Fi is IFRA, we obtain from Equation (9.19) F (t) r(F1 (t), . . . , Fn (t)) [r(F1 (t), . . . , Fn (t))] = F (t) which by Equation (9.19) proves the theorem. The last inequality followed, of course, from Proposition 9.2.
604
9
Reliability Theory
9.6.
Expected System Lifetime
In this section, we show how the mean lifetime of a system can be determined, at least in theory, from a knowledge of the reliability function r(p) and the component lifetime distributions Fi , i = 1, . . . , n. Since the system's lifetime will be t or larger if and only if the system is still functioning at time t, we have that P {system life > t} = r F(t) where F(t) = (F1 (t), . . . , Fn (t)). Hence, by a wellknown formula that states that for any nonnegative random variable X, E[X] =
0
P {X > x} dx,
we see that E[system life] =
0
r F(t) dt
(9.21)
Example 9.26 (A Series System of Uniformly Distributed Components)
Consider a series system of three independent components each of which functions for an amount of time (in hours) uniformly distributed over (0, 10). Hence, r(p) = p1 p2 p3 and Fi (t) = Therefore, 10  t r F(t) = 10 0,
3
t/10, 1,
0 t 10 t > 10
i = 1, 2, 3
,
0
t
10
t > 10
That E[X] = P {X > x} dx can be shown as follows when X has density f : 0 0
P {X > x} dx =
0 x
f (y) dy dx =
0 0
y
f (y) dx dy =
0
yf (y) dy = E[X]
9.6.
Expected System Lifetime
605
and so from Equation (9.21) we obtain E[system life] =
0 10
10  t 10
1
3
dt
= 10
0
y 3 dy
=
5 2
Example 9.27 (A TwooutofThree System) Consider a twooutofthree
system of independent components, in which each component's lifetime is (in months) uniformly distributed over (0, 1). As was shown in Example 9.13, the reliability of such a system is given by r(p) = p1 p2 + p1 p3 + p2 p3  2p1 p2 p3 Since Fi (t) = we see from Equation (9.21) that E[system life] =
0 1
t, 1,
0 t t >1
1
[3(1  t)2  2(1  t)3 ] dt (3y 2  2y 3 ) dy
1 2
=
0
1
=1 =
1 2
Example 9.28 (A FourComponent System) Consider the fourcomponent
system that functions when components 1 and 2 and at least one of components 3 and 4 functions. Its structure function is given by (x) = x1 x2 (x3 + x4  x3 x4 ) and thus its reliability function equals r(p) = p1 p2 (p3 + p4  p3 p4 )
606
9
Reliability Theory
Let us compute the mean system lifetime when the ith component is uniformly distributed over (0, i), i = 1, 2, 3, 4. Now, 1  t, F1 (t) = 0, 1  t/2, F2 (t) = 0, 1  t/3, F3 (t) = 0, 1  t/4, F4 (t) = 0, Hence, 2t (1  t) r F(t) = 2 0, Therefore, E[system life] = 1 24
1 0
0 t t >1 0 t t >2 0 t t >3 0 t t >4
1 2 3 4
3  t 4  t (3  t)(4  t) +  , 3 4 12
0
t
1
t >1
(1  t)(2  t)(12  t 2 ) dt
593 = (24)(60) 0.41 We end this section by obtaining the mean lifetime of a koutofn system of independent identically distributed exponential components. If is the mean lifetime of each component, then Fi (t) = et/ Hence, since for a koutofn system,
n
r(p, p, . . . , p) =
i=k
n i p (1  p)ni i
we obtain from Equation (9.21) E[system life] =
0 n i=k
n (et/ )i (1  et/ )ni dt i
9.6.
Expected System Lifetime
607
Making the substitution y = et/ , yields
n
1 y dy =  et/ dt =  dt
E[system life] =
i=k
n i
1 0
y i1 (1  y)ni dy
Now, it is not difficult to show that
1 0
y n (1  y)m dy =
m!n! (m + n + 1)!
(9.22)
Thus, the foregoing equals
n
E[system life] =
i=k n
(i  1)!(n  i)! n! (n  i)!i! n! 1 i (9.23)
=
i=k
Remark Equation (9.23) could have been proven directly by making use of
special properties of the exponential distribution. First note that the lifetime of a koutofn system can be written as T1 + + Tnk+1 , where Ti represents the time between the (i  1)st and ith failure. This is true since T1 + + Tnk+1 equals the time at which the (n  k + 1)st component fails, which is also the first time that the number of functioning components is less than k. Now, when all n components are functioning, the rate at which failures occur is n/ . That is, T1 is exponentially distributed with mean /n. Similarly, since Ti represents the time until the next failure when there are n  (i  1) functioning components,
Let
C(n, m) =
1 0
y n (1  y)m dy
Integration by parts yields that C(n, m) = [m/(n + 1)]C(n + 1, m  1). Starting with C(n, 0) = 1/ (n + 1), Equation (9.22) follows by mathematical induction.
608
9
Reliability Theory
it follows that Ti is exponentially distributed with mean /(n  i + 1). Hence, the mean system lifetime equals E[T1 + + Tnk+1 ] = 1 1 + + n k
Note also that it follows, from the lack of memory of the exponential, that the Ti , i = 1, . . . , n  k + 1, are independent random variables. 9.6.1. An Upper Bound on the Expected Life of a Parallel System Consider a parallel system of n components, whose lifetimes are not necessarily independent. The system lifetime can be expressed as system life = max Xi
i
where Xi is the lifetime of component i, i = 1, . . . , n. We can bound the expected system lifetime by making use of the following inequality. Namely, for any constant c
n
max Xi
i
c+
i=1
(Xi  c)+
(9.24)
where x + , the positive part of x, is equal to x if x > 0 and is equal to 0 if x 0. The validity of inequality (9.24) is immediate since if max Xi < c then the left side is equal to max Xi and the right side is equal to c. On the other hand, if X(n) = max Xi > c then the right side is at least as large as c + (X(n)  c) = X(n) . It follows from inequality (9.24), upon taking expectations, that
n
E max Xi
i
c+
i=1
E[(Xi  c)+ ]
(9.25)
Now, (Xi  c)+ is a nonnegative random variable and so E[(Xi  c)+ ] =
0
P {(Xi  c)+ > x} dx P {Xi  c > x} dx P {Xi > y} dy
=
0
=
c
9.6.
Expected System Lifetime
609
Thus, we obtain
n
E max Xi
i
c+
i=1 c
P {Xi > y} dy
(9.26)
Because the preceding is true for all c, it follows that we obtain the best bound by letting c equal the value that minimizes the right side of the preceding. To determine that value, differentiate the right side of the preceding and set the result equal to 0, to obtain:
n
1
i=1
P {Xi > c} = 0
That is, the minimizing value of c is that value c for which
n i=1
P {Xi > c } = 1
Since n P {Xi > c} is a decreasing function of c, the value of c can be easily i=1 approximated and then utilized in inequality (9.26). Also, it is interesting to note that c is such that the expected number of the Xi that exceed c is equal to 1 (see Exercise 32). That the optimal value of c has this property is interesting and somewhat intuitive in as much as inequality 9.24 is an equality when exactly one of the Xi exceeds c.
Example 9.29 Suppose the lifetime of component i is exponentially distributed with rate i , i = 1, . . . , n. Then the minimizing value of c is such that
n
1=
i=1
P {Xi > c } =
n i=1
ei c
and the resulting bound of the mean system life is E max Xi
i
c + = c +
n i=1 n i=1
E[(Xi  c )+ ] E[(Xi  c )+  Xi > c ]P {Xi > c ] c ]P {Xi c ]
+ E[(Xi  c )+  Xi = c +
n i=1
1 i c e i
610
9
Reliability Theory
In the special case where all the rates are equal, say, i = , i = 1, . . . , n, then 1 = nec and the bound is E max Xi
i
or c =
1 log(n)
1 (log(n) + 1)
That is, if X1 , . . . , Xn are identically distributed exponential random variables with rate , then the preceding gives a bound on the expected value of their maximum. In the special case where these random variables are also independent, the following exact expression, given by Equation (9.25), is not much less than the preceding upper bound: E max Xi =
i
1
n
1/i
i=1
1
n 1
1 1 dx log(n) x
9.7.
Systems with Repair
Consider an n component system having reliability function r(p). Suppose that component i functions for an exponentially distributed time with rate i and then fails; once failed it takes an exponential time with rate i to be repaired, i = 1, . . . , n. All components act independently. Let us suppose that all components are initially working, and let A(t) = P {system is working at t} A(t) is called the availability at time t. Since the components act independently, A(t) can be expressed in terms of the reliability function as follows: A(t) = r(A1 (t), . . . , An (t)) where Ai (t) = P {component i is functioning at t} Now the state of component ieither on or offchanges in accordance with a twostate continuous time Markov chain. Hence, from the results of Example 6.12 (9.27)
9.7.
Systems with Repair
611
we have Ai (t) = P00 (t) = Thus, we obtain A(t) = r + e(+)t + + i i + e(i +i )t i + i i + i
If we let t approach , then we obtain the limiting availabilitycall it Awhich is given by A = lim A(t) = r
t
+
Remarks (i) If the on and off distribution for component i are arbitrary continuous distributions with respective means 1/i and 1/i , i = 1, . . . , n, then it follows from the theory of alternating renewal processes (see Section 7.5.1) that Ai (t) 1/i i = 1/i + 1/i i + i
and thus using the continuity of the reliability function, it follows from (9.27) that the limiting availability is A = lim A(t) = r
t
+
Hence, A depends only on the on and off distributions through their means. (ii) It can be shown (using the theory of regenerative processes as presented in Section 7.5) that A will also equal the longrun proportion of time that the system will be functioning.
Example 9.30 For a series system, r(p) =
n
n i=1 pi
and so
A(t) =
i=1
i i + e(i +i )t i + i i + i
and
n
A=
i=1
i i + i
612
9
Reliability Theory
n i=1
Example 9.31 For a parallel system, r(p) = 1 
n
(1  pi ) and thus
A(t) = 1 
i=1
i (1  e(i +i )t ) i + i
and
n
A(t) = 1 
i=1
i i + i
The preceding system will alternate between periods when it is up and periods when it is down. Let us denote by Ui and Di , i 1, the lengths of the ith up and down period respectively. For instance in a twooutofthree system, U1 will be the time until two components are down; D1 , the additional time until two are up; U2 the additional time until two are down, and so on. Let U 1 + + Un , U = lim n n D1 + + Dn D = lim n n denote the average length of an up and down period respectively. To determine U and D, note first that in the first n updown cyclesthat is, in time n (Ui + Di )the system will be up for a time n Ui . Hence, the i=1 i=1 proportion of time the system will be up in the first n updown cycles is U1 + + Un = U 1 + + Un + D 1 + + D n
n i=1 Ui /n n Ui /n + n Di /n i=1 i=1
As n , this must converge to A, the longrun proportion of time the system is up. Hence, U =A=r +D + U (9.28)
However, to solve for U and D we need a second equation. To obtain one consider the rate at which the system fails. As there will be n failures in time
It can be shown using the theory of regenerative processes that, with probability 1, the preceding
limits will exist and will be constants.
9.7.
n i=1 (Ui
Systems with Repair
613
+ Di ), it follows that the rate at which the system fails is
n n i U1
rate at which system fails = lim = lim
n + n
n 1 D1 n 1 Di /n
n
n 1 Ui /n +
=
1 +D U
(9.29)
That is, the foregoing yields the intuitive result that, on average, there is one failure every U + D time units. To utilize this, let us determine the rate at which a failure of component i causes the system to go from up to down. Now, the system will go from up to down when component i fails if the states of the other components x1 , . . . , xi1 , xi1 , . . . , xn are such that (1i , x) = 1, (0i , x) = 0. That is the states of the other components must be such that (1i , x)  (0i , x) = 1 (9.30)
Since component i will, on average, have one failure every 1/i +1/i time units, it follows that the rate at which component i fails is equal to (1/i + 1/i )1 = i i /(i + i ). In addition, the states of the other components will be such that (9.30) holds with probability P {(1i , X())  (0i , X()) = 1} = E[(1i , X())  (0i , X())] = r 1i ,  r 0i , + +
since (1i , X())  (0i , X()) is a Bernoulli random variable
Hence, putting the preceding together we see that i i rate at which component r 1i ,  r 0i , = i causes the system to fail i + i + + Summing this over all components i thus gives rate at which system fails =
i
i i r 1i ,  r 0i , i + i + +
Finally, equating the preceding with (9.29) yields 1 = U +D i i r 1i ,  r 0i , i + i + + (9.31)
i
614
9
Reliability Theory
Solving (9.28) and (9.31), we obtain r
n i=1
U=
+
,
(9.32)
i i r 1i ,  r 0i , i + i + + D= 1r + r + U (9.33)
Also, (9.31) yields the rate at which the system fails. Remark In establishing the formulas for U and D, we did not make use of the assumption of exponential on and off times and in fact, our derivation is valid and Equations (9.32) and (9.33) hold whenever U and D are well defined (a sufficient condition is that all on and off distributions are continuous). The quantities i , i , i = 1, . . . , n, will represent, respectively, the reciprocals of the mean lifetimes and mean repair times.
Example 9.32 For a series system,
U=
i
i i + i
j i i i i + i j =i j + j i 1 i 1 i + i D= i i i i i + i whereas for a parallel system, 1
i i
=
1
i
i
,
U=
i i + i
j =i
1 =
j
i i i + i
i
j j + j
i i + i j j + j
i
1 , i i
i i + i D= U= i 1 i i + i
1 i i
9.7.
Systems with Repair
615
The preceding formulas hold for arbitrary continuous up and down distributions with 1/i and 1/i denoting respectively the mean up and down times of component i, i = 1, . . . , n. 9.7.1. A Series Model with Suspended Animation Consider a series consisting of n components, and suppose that whenever a component (and thus the system) goes down, repair begins on that component and each of the other components enters a state of suspended animation. That is, after the down component is repaired, the other components resume operation in exactly the same condition as when the failure occurred. If two or more components go down simultaneously, one of them is arbitrarily chosen as being the failed component and repair on that component begins; the others that went down at the same time are considered to be in a state of suspended animation, and they will instantaneously go down when the repair is completed. We suppose that (not counting any time in suspended animation) the distribution of time that component i functions is Fi with mean ui , whereas its repair distribution is Gi with mean di , i = 1, . . . , n. To determine the longrun proportion of time this system is working, we reason as follows. To begin, consider the time, call it T , at which the system has been up for a time t. Now, when the system is up, the failure times of component i constitute a renewal process with mean interarrival time ui . Therefore, it follows that number of failures of i in time T t ui
As the average repair time of i is di , the preceding implies that total repair time of i in time T tdi ui
Therefore, in the period of time in which the system has been up for a time t, the total system downtime has approximately been
n
t
i=1
di /ui
Hence, the proportion of time that the system has been up is approximately t t +t
n i=1 di /ui
616
9
Reliability Theory
Because this approximation should become exact as we let t become larger, it follows that proportion of time the system is up = which also shows that proportion of time the system is down = 1  proportion of time the system is up =
i di /ui
1 1+
i di /ui
(9.34)
1+
i di /ui
Moreover, in the time interval from 0 to T , the proportion of the repair time that has been devoted to component i is approximately tdi /ui i tdi /ui Thus, in the long run, proportion of down time that is due to component i = di /ui i di /ui
Multiplying the preceding by the proportion of time the system is down gives proportion of time component i is being repaired = 1+ di /ui i di /ui
Also, since component j will be in suspended animation whenever any of the other components is in repair, we see that proportion of time component j is in suspended animation =
i=j
di /ui
i di /ui
1+
Another quantity of interest is the longrun rate at which the system fails. Since component i fails at rate 1/ui when the system is up, and does not fail when the system is down, it follows that rate at which i fails = = proportion of time system is up ui 1/ui 1 + i di /ui
Exercises
617
Since the system fails when any of its components fail, the preceding yields that rate at which the system fails =
i
1+
1/ui i di /ui
(9.35)
If we partition the time axis into periods when the system is up and those when it is down, we can determine the average length of an up period by noting that if U (t) is the total amount of time that the system is up in the interval [0, t], and if N(t) is the number of failures by time t, then average length of an up period = lim = lim = U (t) N (t) U (t)/t N (t)/t
t
t
1 i 1/ui
where the final equality used Equations (9.34) and (9.35). Also, in a similar manner it can be shown that average length of a down period =
i di /ui i
1/ui
(9.36)
Exercises
1. Prove that, for any structure function, , (x) = xi (1i , x) + (1  xi )(0i , x) where (1i , x) = (x1 , . . . , xi1 , 1, xi+1 , . . . , xn ), (0i , x) = (x1 , . . . , xi1 , 0, xi+1 , . . . , xn ) 2. Show that (a) if (0, 0, . . . , 0) = 0 and (1, 1, . . . , 1) = 1, then min xi (x) max xi
618
9
Reliability Theory
(b) (max(x, y)) (c) (min(x, y)) 3.
max((x), (y)) min((x), (y))
For any structure function, we define the dual structure D by D (x) = 1  (1  x) (a) Show that the dual of a parallel (series) system is a series (parallel) system. (b) Show that the dual of a dual structure is the original structure. (c) What is the dual of a koutofn structure? (d) Show that a minimal path (cut) set of the dual system is a minimal cut (path) set of the original structure.
*4. Write the structure function corresponding to the following: (a)
Figure 9.16.
(b)
Figure 9.17.
(c)
Figure 9.18.
Exercises
619
5.
Find the minimal path and minimal cut sets for: (a)
Figure 9.19.
(b)
Figure 9.20.
*6. The minimal path sets are {1, 2, 4}, {1, 3, 5}, and {5, 6}. Give the minimal cut sets. 7. The minimal cut sets are {1, 2, 3}, {2, 3, 4}, and {3, 5}. What are the minimal path sets? 8. Give the minimal path sets and the minimal cut sets for the structure given by Figure 9.21. 9. Component i is said to be relevant to the system if for some state vector x, (1i , x) = 1, Otherwise, it is said to be irrelevant. (0i , x) = 0
620
9
Reliability Theory
Figure 9.21.
(a) Explain in words what it means for a component to be irrelevant. (b) Let A1 , . . . , As be the minimal path sets of a system, and let S denote the set of components. Show that S = s Ai if and only if all components are i=1 relevant. (c) Let C1 , . . . , Ck denote the minimal cut sets. Show that S = k Ci if and i=1 only if all components are relevant. 10. Let ti denote the time of failure of the ith component; let (t) denote the time to failure of the system as a function of the vector t = (t1 , . . . , tn ). Show that
1 j
max min ti = (t) = min max ti
s iAj 1 j k iCj
where C1 , . . . , Ck are the minimal cut sets, and A1 , . . . , As the minimal path sets. 11. Give the reliability function of the structure of Exercise 8. *12. Give the minimal path sets and the reliability function for the structure in Figure 9.22.
Figure 9.22.
Exercises
621
13. Let r(p) be the reliability function. Show that r(p) = pi r(1i , p) + (1  pi )r(0i , p) 14. Compute the reliability function of the bridge system (see Figure 9.11) by conditioning upon whether or not component 3 is working. 15. Compute upper and lower bounds of the reliability function (using Method 2) for the systems given in Exercise 4, and compare them with the exact values when pi 1 . 2 16. Compute the upper and lower bounds of r(p) using both methods for the (a) twooutofthree system and (b) twooutoffour system. (c) Compare these bounds with the exact reliability when (i) pi 0.5 (ii) pi 0.8 (iii) pi 0.2 *17. Let N be a nonnegative, integervalued random variable. Show that P {N > 0} (E[N ])2 E[N 2 ]
and explain how this inequality can be used to derive additional bounds on a reliability function. Hint: E[N 2 ] = E[N 2  N > 0]P {N > 0} (E[N  N > 0]) P {N > 0}
2
(Why?) (Why?)
Now multiply both sides by P {N > 0}. 18. Consider a structure in which the minimal path sets are {1, 2, 3} and {3, 4, 5}. (a) What are the minimal cut sets? (b) If the component lifetimes are independent uniform (0, 1) random variables, determine the probability that the system life will be less than 1 . 2 19. Let X1 , X2 , . . . , Xn denote independent and identically distributed random variables and define the order statistics X(1) , . . . , X(n) by X(i) ith smallest of X1 , . . . , Xn Show that if the distribution of Xj is IFR, then so is the distribution of X(i) . Hint: Relate this to one of the examples of this chapter.
622
9
Reliability Theory
20. Let F be a continuous distribution function. For some positive , define the distribution function G by G(t) = (F (t)) Find the relationship between G (t) and F (t), the respective failure rate functions of G and F . 21. Consider the following four structures: (i) (ii)
Figure 9.23.
Figure 9.24.
(iii)
(iv)
Figure 9.25.
Figure 9.26.
Let F1 , F2 , and F3 be the corresponding component failure distributions; each of which is assumed to be IFR (increasing failure rate). Let F be the system failure distribution. All components are independent. (a) For which structures is F necessarily IFR if F1 = F2 = F3 ? Give reasons. (b) For which structures is F necessarily IFR if F2 = F3 ? Give reasons. (c) For which structures is F necessarily IFR if F1 = F2 = F3 ? Give reasons. *22. Let X denote the lifetime of an item. Suppose the item has reached the age of t. Let Xt denote its remaining life and define Ft (a) = P {Xt > a} In words, Ft (a) is the probability that a tyear old item survives an additional time a. Show that
Exercises
623
(a) Ft (a) = F (t + a)/F (t) where F is the distribution function of X. (b) Another definition of IFR is to say that F is IFR if Ft (a) decreases in t, for all a. Show that this definition is equivalent to the one given in the text when F has a density. 23. Show that if each (independent) component of a series system has an IFR distribution, then the system lifetime is itself IFR by (a) showing that F (t) =
i
i (t)
where F (t) is the failure rate function of the system; and i (t) the failure rate function of the lifetime of component i. (b) using the definition of IFR given in Exercise 22. 24. Show that if F is IFR, then it is also IFRA, and show by counterexample that the reverse is not true. *25. We say that is a ppercentile of the distribution F if F ( ) = p. Show that if is a ppercentile of the IFRA distribution F , then F (x) (x) F where = 26. Prove Lemma 9.3. Hint: Let x = y + . Note that f (t) = t is a concave function when 0 1, and use the fact that for a concave function f (t +h)f (t) is decreasing in t. 27. Let r(p) = r(p, p, . . . , p). Show that if r(p0 ) = p0 , then r(p) r(p) Hint: Use Proposition 9.2. 28. Find the mean lifetime of a series system of two components when the component lifetimes are respectively uniform on (0, 1) and uniform on (0, 2). Repeat for a parallel system. p p for p for p p0 p0  log(1  p) ex , ex , x x
624
9
Reliability Theory
29. Show that the mean lifetime of a parallel system of two components is 1 1 2 + + 1 + 2 (1 + 2 )2 (1 + 2 )1 when the first component is exponentially distributed with mean 1/1 and the second is exponential with mean 1/2 . *30. Compute the expected system lifetime of a threeoutoffour system when the first two component lifetimes are uniform on (0, 1) and the second two are uniform on (0, 2). 31. Show that the variance of the lifetime of a koutofn system of components, each of whose lifetimes is exponential with mean , is given by
n
2
i=k
1 i2
32. In Section 9.6.1 show that the expected number of Xi that exceed c is equal to 1. 33. Let Xi be an exponential random variable with mean 8 + 2i, for i = 1, 2, 3. Use the results of Section 9.6.1 to obtain an upper bound on E[max Xi ], and then compare this with the exact result when the Xi are independent. 34. For the model of Section 9.7, compute for a koutofn structure (i) the average up time, (ii) the average down time, and (iii) the system failure rate. 35. Prove the combinatorial identity n n n n1 =  + , i 1 i i +1 n i n
(a) by induction on i (b) by a backwards induction argument on ithat is, prove it first for i = n, then assume it for i = k and show that this implies that it is true for i = k  1. 36. Verify Equation (9.36).
References
1. R. E. Barlow and F. Proschan, "Statistical Theory of Reliability and Life Testing," Holt, New York, 1975. 2. H. Frank and I. Frisch, "Communication, Transmission, and Transportation Network," AddisonWesley, Reading, Massachusetts, 1971. 3. I. B. Gertsbakh, "Statistical Reliability Theory," Marcel Dekker, New York and Basel, 1989.
Brownian Motion and Stationary Processes
10
10.1. Brownian Motion
Let us start by considering the symmetric random walk, which in each time unit is equally likely to take a unit step either to the left or to the right. That is, it is a Markov chain with Pi,i+1 = 1 = Pi,i1 , i = 0, 1, . . . . Now suppose that we 2 speed up this process by taking smaller and smaller steps in smaller and smaller time intervals. If we now go to the limit in the right manner what we obtain is Brownian motion. More precisely, suppose that each t time unit we take a step of size x either to the left or the right with equal probabilities. If we let X(t) denote the position at time t then X(t) = where Xi = +1, 1, if the ith step of length if it is to the left x is to the right x(X1 + + X[t/
t] )
(10.1)
and [t/ t] is the largest integer less than or equal to t/ t, and where the Xi are assumed independent with P {Xi = 1} = P {Xi = 1} =
1 2
2 As E[Xi ] = 0, Var(Xi ) = E[Xi ] = 1, we see from Equation (10.1) that
E[X(t)] = 0, Var(X(t)) = ( x)2 t t (10.2)
We shall now let x and t go to 0. However, we must do it in a way such that the resulting limiting process is nontrivial (for instance, if we let x = t and
625
626
10
Brownian Motion and Stationary Processes
let t 0, then from the preceding we see that E[X(t)] and Var(X(t)) would both converge to 0 and thus X(t) would equal 0 with probability 1). If we let t for some positive constant then from Equation (10.2) we see that x= as t 0 E[X(t)] = 0, Var(X(t)) 2 t We now list some intuitive properties of this limiting process obtained by taking t and then letting t 0. From Equation (10.1) and the central limit x= theorem the following seems reasonable: (i) X(t) is normal with mean 0 and variance 2 t. In addition, because the changes of value of the random walk in nonoverlapping time intervals are independent, we have (ii) {X(t), t 0} has independent increments, in that for all t1 < t2 < < tn X(tn )  X(tn1 ), X(tn1 )  X(tn2 ), . . . , X(t2 )  X(t1 ), X(t1 ) are independent. Finally, because the distribution of the change in position of the random walk over any time interval depends only on the length of that interval, it would appear that (iii) {X(t), t 0} has stationary increments, in that the distribution of X(t + s)  X(t) does not depend on t. We are now ready for the following formal definition.
Definition 10.1 A stochastic process {X(t), t
motion process if
0} is said to be a Brownian
(i) X(0) = 0; (ii) {X(t), t 0} has stationary and independent increments; (iii) for every t > 0, X(t) is normally distributed with mean 0 and variance 2 t. The Brownian motion process, sometimes called the Wiener process, is one of the most useful stochastic processes in applied probability theory. It originated in physics as a description of Brownian motion. This phenomenon, named after the English botanist Robert Brown who discovered it, is the motion exhibited by a small particle which is totally immersed in a liquid or gas. Since then, the process has been used beneficially in such areas as statistical testing of goodness of fit, analyzing the price levels on the stock market, and quantum mechanics. The first explanation of the phenomenon of Brownian motion was given by Einstein in 1905. He showed that Brownian motion could be explained by assuming that the immersed particle was continually being subjected to bombardment by
10.1.
Brownian Motion
627
the molecules of the surrounding medium. However, the preceding concise definition of this stochastic process underlying Brownian motion was given by Wiener in a series of papers originating in 1918. When = 1, the process is called standard Brownian motion. Because any Brownian motion can be converted to the standard process by letting B(t) = X(t)/ we shall, unless otherwise stated, suppose throughout this chapter that = 1. The interpretation of Brownian motion as the limit of the random walks [Equation (10.1)] suggests that X(t) should be a continuous function of t. This turns out to be the case, and it may be proven that, with probability 1, X(t) is indeed a continuous function of t. This fact is quite deep, and no proof shall be attempted. As X(t) is normal with mean 0 and variance t, its density function is given by 1 2 ex /2t ft (x) = 2t To obtain the joint density function of X(t1 ), X(t2 ), . . . , X(tn ) for t1 < < tn , note first that the set of equalities X(t1 ) = x1 , X(t2 ) = x2 , . . . X(tn ) = xn is equivalent to X(t1 ) = x1 , X(t2 )  X(t1 ) = x2  x1 , . . . X(tn )  X(tn1 ) = xn  xn1 However, by the independent increment assumption it follows that X(t1 ), X(t2 )  X(t1 ), . . . , X(tn )  X(tn1 ), are independent and, by the stationary increment assumption, that X(tk )  X(tk1 ) is normal with mean 0 and vari
628
10
Brownian Motion and Stationary Processes
ance tk  tk1 . Hence, the joint density of X(t1 ), . . . , X(tn ) is given by f (x1 , x2 , . . . , xn ) = ft1 (x1 )ft2 t1 (x2  x1 ) ftn tn1 (xn  xn1 ) exp  =
2 1 x1 (x2  x1 )2 (xn  xn1 )2 + + + 2 t1 t2  t1 tn  tn1 (2)n/2 [t1 (t2  t1 ) (tn  tn1 )]1/2
(10.3)
From this equation, we can compute in principle any desired probabilities. For instance, suppose we require the conditional distribution of X(s) given that X(t) = B where s < t. The conditional density is fst (xB) = fs (x)fts (B  x) ft (B) 1 1 Bx + + 2s 2(t  s) t s
= K1 exp{x 2 /2s  (B  x)2 /2(t  s)} = K2 exp x 2 = K2 exp  = K3 exp 
t sB x2  2 x 2s(t  s) t (x  Bs/t)2 2s(t  s)/t
where K1 , K2 , and K3 do not depend on x. Hence, we see from the preceding that the conditional distribution of X(s) given that X(t) = B is, for s < t, normal with mean and variance given by s E[X(s)X(t) = B] = B, t s Var[X(s)X(t) = B] = (t  s) t
(10.4)
Example 10.1 In a bicycle race between two competitors, let Y (t) denote the
amount of time (in seconds) by which the racer that started in the inside position is ahead when 100t percent of the race has been completed, and suppose that {Y (t), 0 t 1} can be effectively modeled as a Brownian motion process with variance parameter 2 . (a) If the inside racer is leading by seconds at the midpoint of the race, what is the probability that she is the winner? (b) If the inside racer wins the race by a margin of seconds, what is the probability that she was ahead at the midpoint?
10.2.
Hitting Times, Maximum Variable, and the Gambler's Ruin Problem
629
Solution: (a) P {Y (1) > 0Y (1/2) = } = P {Y (1)  Y (1/2) >  Y (1/2) = } = P {Y (1)  Y (1/2) >  } = P {Y (1/2) >  } Y (1/2) =P > 2 / 2 = ( 2) 0.9213 where (x) = P {N(0, 1) x} is the standard normal distribution function. (b) Because we must compute P {Y (1/2) > 0Y (1) = }, let us first determine the conditional distribution of Y (s) given that Y (t) = C, when s < t. Now, since {X(t), t 0} is standard Brownian motion when X(t) = Y (t)/ , we obtain from Equation (10.4) that the conditional distribution of X(s), given that X(t) = C/ , is normal with mean sC/t and variance s(t  s)/t. Hence, the conditional distribution of Y (s) = X(s) given that Y (t) = C is normal with mean sC/t and variance 2 s(t  s)/t. Hence, P {Y (1/2) > 0Y (1) = } = P {N (/2, 2 /4) > 0} = (1) 0.8413 by independent increments
by stationary increments
10.2.
Hitting Times, Maximum Variable, and the Gambler's Ruin Problem
Let Ta denote the first time the Brownian motion process hits a. When a > 0 we will compute P {Ta t} by considering P {X(t) a} and conditioning on whether or not Ta t. This gives P {X(t) a} = P {X(t) aTa t}P {Ta t} (10.5) +P {X(t) aTa > t}P {Ta > t}
Now if Ta t, then the process hits a at some point in [0, t] and, by symmetry, it is just as likely to be above a or below a at time t. That is P {X(t) aTa t} =
1 2
630
10
Brownian Motion and Stationary Processes
As the second righthand term of Equation (10.5) is clearly equal to 0 (since, by continuity, the process value cannot be greater than a without having yet hit a), we see that P {Ta t} = 2P {X(t) = 2 2t
a a/ t
a} ex
2 /2t
dx dy, a>0 (10.6)
2 = 2
ey
2 /2
For a < 0, the distribution of Ta is, by symmetry, the same as that of Ta . Hence, from Equation (10.6) we obtain P {Ta 2 t} = 2
a/ t
ey
2 /2
dy
(10.7)
Another random variable of interest is the maximum value the process attains in [0, t]. Its distribution is obtained as follows: For a > 0 P max X(s) a = P {Ta t} a}
0 s t
by continuity from (10.6)
2 /2
= 2P {X(t) 2 = 2
a/ t
ey
dy
Let us now consider the probability that Brownian motion hits A before B where A > 0, B > 0. To compute this we shall make use of the interpretation of Brownian motion as being a limit of the symmetric random walk. To start let us recall from the results of the gambler's ruin problem (see Section 4.5.1) that the probability that the symmetric random walk goes up A before going down B when each step is equally likely to be either up or down a distance x is [by Equation (4.14) with N = (A + B)/ x, i = B/ x] equal to B x/(A + B) x = B/(A + B). Hence, upon letting x 0, we see that P {up A before down B} = B A+B
10.3.
Variations on Brownian Motion
631
10.3.
Variations on Brownian Motion
10.3.1. Brownian Motion with Drift We say that {X(t), t 0} is a Brownian motion process with drift coefficient and variance parameter 2 if (i) X(0) = 0; (ii) {X(t), t 0} has stationary and independent increments; (iii) X(t) is normally distributed with mean t and variance t 2 . An equivalent definition is to let {B(t), t and then define 0} be standard Brownian motion
X(t) = B(t) + t 10.3.2. Geometric Brownian Motion If {Y (t), t 0} is a Brownian motion process with drift coefficient and variance parameter 2 , then the process {X(t), t 0} defined by X(t) = eY (t) is called geometric Brownian motion. For a geometric Brownian motion process {X(t)}, let us compute the expected value of the process at time t given the history of the process up to time s. That is, for s < t, consider E[X(t)X(u), 0 u s]. Now, E[X(t)X(u), 0 u s] = E eY (t) Y (u), 0 u s u u s s
= E eY (s)+Y (t)Y (s) Y (u), 0 = eY (s) E eY (t)Y (s) Y (u), 0 = X(s)E eY (t)Y (s)
where the next to last equality follows from the fact that Y (s) is given, and the last equality from the independent increment property of Brownian motion. Now, the moment generating function of a normal random variable W is given by E[eaW ] = eaE[W ]+a
2 Var(W )/2
632
10
Brownian Motion and Stationary Processes
Hence, since Y (t)  Y (s) is normal with mean (t  s) and variance (t  s) 2 , it follows by setting a = 1 that E eY (t)Y (s) = e(ts)+(ts) Thus, we obtain E[X(t)X(u), 0 u s] = X(s)e(ts)(+
2 /2) 2 /2
(10.8)
Geometric Brownian motion is useful in the modeling of stock prices over time when you feel that the percentage changes are independent and identically distributed. For instance, suppose that Xn is the price of some stock at time n. Then, it might be reasonable to suppose that Xn /Xn1 , n 1, are independent and identically distributed. Let Yn = Xn /Xn1 and so Xn = Yn Xn1 Iterating this equality gives Xn = Yn Yn1 Xn2 = Yn Yn1 Yn2 Xn3 . . . = Yn Yn1 Y1 X0 Thus,
n
log(Xn ) =
i=1
log(Yi ) + log(X0 )
Since log(Yi ), i 1 are independent and identically distributed, {log(Xn )} will, when suitably normalized, approximately be Brownian motion with a drift, and so {Xn } will be approximately geometric Brownian motion.
10.4.
Pricing Stock Options
10.4.1. An Example in Options Pricing In situations in which money is to be received or paid out in differing time periods, we must take into account the time value of money. That is, to be given the amount v a time t in the future is not worth as much as being given v immediately. The reason for this is that if we were immediately given v, then it could be loaned out
10.4.
Pricing Stock Options
633
Figure 10.1.
with interest and so be worth more than v at time t. To take this into account, we will suppose that the time 0 value, also called the present value, of the amount v to be earned at time t is vet . The quantity is often called the discount factor. In economic terms, the assumption of the discount function et is equivalent to the assumption that we can earn interest at a continuously compounded rate of 100 percent per unit time. We will now consider a simple model for pricing an option to purchase a stock at a future time at a fixed price. Suppose the present price of a stock is $100 per unit share, and suppose we know that after one time period it will be, in present value dollars, either $200 or $50 (see Figure 10.1). It should be noted that the prices at time 1 are the present value (or time 0) prices. That is, if the discount factor is , then the actual possible prices at time 1 are either 200e or 50e . To keep the notation simple, we will suppose that all prices given are time 0 prices. Suppose that for any y, at a cost of cy, you can purchase at time 0 the option to buy y shares of the stock at time 1 at a (time 0) cost of $150 per share. Thus, for instance, if you do purchase this option and the stock rises to $200, then you would exercise the option at time 1 and realize a gain of $200  150 = $50 for each of the y option units purchased. On the other hand, if the price at time 1 was $50, then the option would be worthless at time 1. In addition, at a cost of 100x you can purchase x units of the stock at time 0, and this will be worth either 200x or 50x at time 1. We will suppose that both x or y can be either positive or negative (or zero). That is, you can either buy or sell both the stock and the option. For instance, if x were negative then you would be selling x shares of the stock, yielding you a return of 100x, and you would then be responsible for buying x shares of the stock at time 1 at a cost of either $200 or $50 per share. We are interested in determining the appropriate value of c, the unit cost of an option. Specifically, we will show that unless c = 50/3 there will be a combination of purchases that will always result in a positive gain. To show this, suppose that at time 0 we buy x units of stock, and buy y units of options
634
10
Brownian Motion and Stationary Processes
where x and y (which can be either positive or negative) are to be determined. The value of our holding at time 1 depends on the price of the stock at that time; and it is given by the following value = 200x + 50y, 50x, if price is 200 if price is 50
The preceding formula follows by noting that if the price is 200 then the x units of the stock are worth 200x, and the y units of the option to buy the stock at a unit price of 150 are worth (200  150)y. On the other hand, if the stock price is 50, then the x units are worth 50x and the y units of the option are worthless. Now, suppose we choose y to be such that the preceding value is the same no matter what the price at time 1. That is, we choose y so that 200x + 50y = 50x or y = 3x (Note that y has the opposite sign of x, and so if x is positive and as a result x units of the stock are purchased at time 0, then 3x units of stock options are also sold at that time. Similarly, if x is negative, then x units of stock are sold and 3x units of stock options are purchased at time 0.) Thus, with y = 3x, the value of our holding at time 1 is value = 50x Since the original cost of purchasing x units of the stock and 3x units of options is original cost = 100x  3xc, we see that our gain on the transaction is gain = 50x  (100x  3xc) = x(3c  50) Thus, if 3c = 50, then the gain is 0; on the other hand if 3c = 50, we can guarantee a positive gain (no matter what the price of the stock at time 1) by letting x be positive when 3c > 50 and letting it be negative when 3c < 50. For instance, if the unit cost per option is c = 20, then purchasing 1 unit of the stock (x = 1) and simultaneously selling 3 units of the option (y = 3) initially costs us 100  60 = 40. However, the value of this holding at time 1 is 50 whether
10.4.
Pricing Stock Options
635
the stock goes up to 200 or down to 50. Thus, a guaranteed profit of 10 is attained. Similarly, if the unit cost per option is c = 15, then selling 1 unit of the stock (x = 1) and buying 3 units of the option (y = 3) leads to an initial gain of 100  45 = 55. On the other hand, the value of this holding at time 1 is 50. Thus, a guaranteed profit of 5 is attained. A sure win betting scheme is called an arbitrage. Thus, as we have just seen, the only option cost c that does not result in an arbitrage is c = 50/3. 10.4.2. The Arbitrage Theorem Consider an experiment whose set of possible outcomes is S = {1, 2, . . . , m}. Suppose that n wagers are available. If the amount x is bet on wager i, then the return xri (j ) is earned if the outcome of the experiment is j . In other words, ri () is the return function for a unit bet on wager i. The amount bet on a wager is allowed to be either positive or negative or zero. A betting scheme is a vector x = (x1 , . . . , xn ) with the interpretation that x1 is bet on wager 1, x2 on wager 2, . . . , and xn on wager n. If the outcome of the experiment is j , then the return from the betting scheme x is
n
return from x =
i=1
xi ri (j )
The following theorem states that either there exists a probability vector p = (p1 , . . . , pm ) on the set of possible outcomes of the experiment under which each of the wagers has expected return 0, or else there is a betting scheme that guarantees a positive win.
Theorem 10.1 (The Arbitrage Theorem) Exactly one of the following is true:
Either (i) there exists a probability vector p = (p1 , . . . , pm ) for which
m
pj ri (j ) = 0,
j =1
for all i = 1, . . . , n
or (ii) there exists a betting scheme x = (x1 , . . . , xn ) for which
n
xi ri (j ) > 0,
i=1
for all j = 1, . . . , m
636
10
Brownian Motion and Stationary Processes
In other words, if X is the outcome of the experiment, then the arbitrage theorem states that either there is a probability vector p for X such that Ep [ri (X)] = 0, for all i = 1, . . . , n
or else there is a betting scheme that leads to a sure win.
Remark This theorem is a consequence of the (linear algebra) theorem of the
separating hyperplane, which is often used as a mechanism to prove the duality theorem of linear programming. The theory of linear programming can be used to determine a betting strategy that guarantees the greatest return. Suppose that the absolute value of the amount bet on each wager must be less than or equal to 1. To determine the vector x that yields the greatest guaranteed wincall this win vwe need to choose x and v so as to maximize v, subject to the constraints
n
xi ri (j )
i=1
v, 1,
for j = 1, . . . , m i = 1, . . . , n
1
xi
This optimization problem is a linear program and can be solved by standard techniques (such as by using the simplex algorithm). The arbitrage theorem yields that the optimal v will be positive unless there is a probability vector p for which m j =1 pj ri (j ) = 0 for all i = 1, . . . , n. choose one of the outcomes i, i = 1, . . . , m, and bet that i is the outcome of the experiment. The return from such a bet is often quoted in terms of "odds." If the odds for outcome i are oi (often written as "oi to 1") then a 1 unit bet will return oi if the outcome of the experiment is i and will return 1 otherwise. That is, ri (j ) = oi , 1 if j = i otherwise
Example 10.2 In some situations, the only types of wagers allowed are to
Suppose the odds o1 , . . . , om are posted. In order for there not t